emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master fe939b3 1/2: Fix reference to `tags-loop-continue' in doc str


From: Robert Pluim
Subject: Re: master fe939b3 1/2: Fix reference to `tags-loop-continue' in doc string
Date: Fri, 02 Aug 2019 14:23:15 +0200

>>>>> On Fri, 02 Aug 2019 12:49:19 +0200, Lars Ingebrigtsen <address@hidden> 
>>>>> said:

    Lars> Robert Pluim <address@hidden> writes:
    Lars> Fix reference to `tags-loop-continue' in doc string
    >> 
    Lars> * lisp/dired-aux.el (dired-do-search): Refer to
    Lars> `fileloop-continue' instead of the obsolete `tags-loop-continue'
    Lars> (bug#21475).
    >> 
    >> Hmm, in the interests of backwards compatibility, could
    >> 'xref-pop-marker-stack' not check 'last-command'?

    Lars> Hm...  would that help?  The UI previously here was that you could 
just
    Lars> hit `M-,' (or was it `M-.'?) and go to the next hit -- no matter what
    Lars> the previous command was?  I think?

I think youʼre right. Unfortunately fileloop has no "fileloop is in
progress" flag, nor would it help, because sometimes you do want the
xref behaviour.

    Lars> But `xref-pop-marker-stack' could perhaps possibly check whether
    Lars> `fileloop-continue' has something to offer instead of erroring out?

Ah, you mean like this? I hope I have the eval-when-compile stuff
right. And if you do 'dired-do-search' followed by
'xref-find-definitions' it would be easy to confuse yourself.

We could find a new binding for fileloop-continue, which also breaks
backwards compatibility, but then at least thereʼs a default binding.

diff --git i/lisp/progmodes/xref.el w/lisp/progmodes/xref.el
index 8dc4f3c471..d9245e2822 100644
--- i/lisp/progmodes/xref.el
+++ w/lisp/progmodes/xref.el
@@ -70,6 +70,7 @@
 (require 'eieio)
 (require 'ring)
 (require 'project)
+(eval-when-compile (declare-function fileloop-continue "fileloop" ()))
 
 (defgroup xref nil "Cross-referencing commands"
   :version "25.1"
@@ -380,14 +381,15 @@ xref-pop-marker-stack
   "Pop back to where \\[xref-find-definitions] was last invoked."
   (interactive)
   (let ((ring xref--marker-ring))
-    (when (ring-empty-p ring)
-      (user-error "Marker stack is empty"))
-    (let ((marker (ring-remove ring 0)))
-      (switch-to-buffer (or (marker-buffer marker)
-                            (user-error "The marked buffer has been deleted")))
-      (goto-char (marker-position marker))
-      (set-marker marker nil nil)
-      (run-hooks 'xref-after-return-hook))))
+    (if (ring-empty-p ring)
+        ;; Just in case we were in a fileloop sequence
+        (fileloop-continue)
+      (let ((marker (ring-remove ring 0)))
+        (switch-to-buffer (or (marker-buffer marker)
+                              (user-error "The marked buffer has been 
deleted")))
+        (goto-char (marker-position marker))
+        (set-marker marker nil nil)
+        (run-hooks 'xref-after-return-hook)))))
 
 (defvar xref--current-item nil)
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]