]> git.eshelyaron.com Git - emacs.git/commitdiff
Update default-directory in occur buffer (bug#39608)
authorStéphane Boucher <Stephane.Boucher@acceo.com>
Wed, 4 Mar 2020 00:05:55 +0000 (02:05 +0200)
committerJuri Linkov <juri@linkov.net>
Wed, 4 Mar 2020 00:05:55 +0000 (02:05 +0200)
* lisp/replace.el (occur-1): Update default-directory in occur buffer.

Copyright-paperwork-exempt: yes

lisp/replace.el

index a0b050637e1e44bf0af2a1b88344a8b089f4b3b5..168ccf2f72a34ac8918bcfc432a4f44e0e4dc234 100644 (file)
@@ -1576,7 +1576,8 @@ See also `multi-occur'."
                                          (and (overlayp boo)
                                               (overlay-buffer boo)))
                                  boo))
-                          bufs))))
+                           bufs)))
+        (source-buffer-default-directory default-directory))
     ;; Handle the case where one of the buffers we're searching is the
     ;; output buffer.  Just rename it.
     (when (member buf-name
@@ -1593,6 +1594,9 @@ See also `multi-occur'."
     (setq occur-buf (get-buffer-create buf-name))
 
     (with-current-buffer occur-buf
+      ;; Make the default-directory of the *Occur* buffer match that of
+      ;; the buffer where the occurences come from
+      (setq default-directory source-buffer-default-directory)
       (if (stringp nlines)
          (fundamental-mode) ;; This is for collect operation.
        (occur-mode))