summaryrefslogtreecommitdiff
path: root/lisp/dabbrev.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2001-04-27 15:28:38 +0000
committerMiles Bader <miles@gnu.org>2001-04-27 15:28:38 +0000
commita6a0642945fa6f859ade5e8710ce2f99654b2cdb (patch)
tree6132426e8ec65700a54184fc699d1a7a879b6635 /lisp/dabbrev.el
parentf4976ebceaf62cba09ca84b43f6298e82f102b1e (diff)
downloademacs-a6a0642945fa6f859ade5e8710ce2f99654b2cdb.tar.gz
(dabbrev--ignore-buffer-p): New function.
(dabbrev--find-expansion): Use it. (dabbrev--select-buffers): Don't select ignored buffers.
Diffstat (limited to 'lisp/dabbrev.el')
-rw-r--r--lisp/dabbrev.el24
1 files changed, 14 insertions, 10 deletions
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index 4187d361eb1..297ad595883 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -667,6 +667,7 @@ if it is bound, returns nil. The resulting partial list is returned."
(dabbrev-filter-elements
buffer (buffer-list)
(and (not (eq orig-buffer buffer))
+ (not (dabbrev--ignore-buffer-p buffer))
(boundp 'dabbrev-friend-buffer-function)
(funcall dabbrev-friend-buffer-function buffer))))))
@@ -706,6 +707,17 @@ If IGNORE-CASE is non-nil, accept matches which differ in case."
(defun dabbrev--scanning-message ()
(message "Scanning `%s'" (buffer-name (current-buffer))))
+(defun dabbrev--ignore-buffer-p (buffer)
+ "Return non-nil if BUFFER should be ignored by dabbrev."
+ (let ((bn (buffer-name buffer)))
+ (or (member bn dabbrev-ignored-buffer-names)
+ (let ((tail dabbrev-ignored-buffer-regexps)
+ (match nil))
+ (while (and tail (not match))
+ (setq match (string-match (car tail) bn)
+ tail (cdr tail)))
+ match))))
+
(defun dabbrev--find-expansion (abbrev direction ignore-case)
"Find one occurrence of ABBREV, and return the expansion.
DIRECTION > 0 means look that many times backwards.
@@ -776,16 +788,8 @@ of the start of the occurrence."
(setq non-friend-buffer-list
(dabbrev-filter-elements
buffer (buffer-list)
- (let ((bn (buffer-name buffer)))
- (and (not (member bn dabbrev-ignored-buffer-names))
- (not (memq buffer dabbrev--friend-buffer-list))
- (not
- (let ((tail dabbrev-ignored-buffer-regexps)
- (match nil))
- (while (and tail (not match))
- (setq match (string-match (car tail) bn)
- tail (cdr tail)))
- match)))))
+ (and (not (memq buffer dabbrev--friend-buffer-list))
+ (not (dabbrev--ignore-buffer-p buffer))))
dabbrev--friend-buffer-list
(append dabbrev--friend-buffer-list
non-friend-buffer-list)))))