]> git.eshelyaron.com Git - emacs.git/commitdiff
dabbrev: also filter visible buffers.
authorEshel Yaron <me@eshelyaron.com>
Mon, 14 Apr 2025 15:43:04 +0000 (17:43 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 14 Apr 2025 15:43:04 +0000 (17:43 +0200)
lisp/dabbrev.el

index 9d75150b08492d46e2c020f3ce6a6a608ad11ab7..a0f8134f8cbafcd5edcae8732aa7604f32832b0f 100644 (file)
@@ -40,7 +40,7 @@ addition to the current buffer and the visible buffers.")
   (let* ((abbrev (or abbrev (thing-at-point 'symbol)))
          (anchor (or anchor (car (bounds-of-thing-at-point 'symbol))))
          (scanned 0) pos expansions more
-         (search
+         (srch
           (lambda (buffer)
             (when (< scanned dabbrev-maximum-characters)
               (with-current-buffer buffer
@@ -79,11 +79,16 @@ addition to the current buffer and the visible buffers.")
             scanned (- (point-max) (point-min)))
       ;; Then all visible buffers.
       (when (< scanned dabbrev-maximum-characters)
-        (walk-windows (compf [search] window-buffer) nil 'visible)
+        (walk-windows
+         (lambda (win)
+           (let ((buf (window-buffer win)))
+             (when (buffer-match-p dabbrev-buffer-search-condition buf)
+               (funcall srch buf))))
+         nil 'visible)
         (setq expansions (nconc expansions more) more nil))
       ;; Then try other buffers.
       (when (< scanned dabbrev-maximum-characters)
-        (mapc search (match-buffers dabbrev-buffer-search-condition))
+        (mapc srch (match-buffers dabbrev-buffer-search-condition))
         (setq expansions (nconc expansions more)))
       expansions)))