GNU bug report logs - #31086
[PATCH] xref: Make xref-push-marker-stack interactive

Previous Next

Package: emacs;

Reported by: George Kadianakis <desnacked <at> riseup.net>

Date: Sat, 7 Apr 2018 08:47:02 UTC

Severity: wishlist

Tags: patch, wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: George Kadianakis <desnacked <at> riseup.net>
To: 31086 <at> debbugs.gnu.org
Subject: bug#31086: [PATCH] xref: Make xref-push-marker-stack interactive
Date: Sat, 07 Apr 2018 03:05:45 +0300
Greetings emacs wizards,

here is a small patch that allows xref users to push markers to the
stack without using xref-find-definitions. This allows users to mark
arbitrary positions in the code that they consider interesting
(e.g. documentation) even tho it's not actually an xref definition.

Let me know if you don't like it! :)

Have a good one!

---

From 9ddda3d1724b9a40e7e9a0c413b883abc4aeab33 Mon Sep 17 00:00:00 2001
From: George Kadianakis <desnacked <at> riseup.net>
Date: Fri, 6 Apr 2018 21:42:51 +0300
Subject: [PATCH] Make xref-push-marker-stack interactive

You can now call 'xref-push-marker-stack' interactively to push the
current point to the xref marker stack.  This can be used to mark
interesting places that you want to visit later using
'xref-pop-marker-stack'.

* lisp/progmodes/xref.el (xref-push-marker-stack): Make function interactive.
---
 etc/NEWS               | 6 ++++++
 lisp/progmodes/xref.el | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 02b31ecff4..db6122d901 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -345,6 +345,12 @@ when the PGP keyring contains a public key for every recipient.  To
 achieve this, add 'message-add-encrypt-tag-if-can-encrypt' to
 'message-send-hook'.
 
+** Xref
+++++
+*** You can now call 'xref-push-marker-stack' interactively to push
+the current point to the xref marker stack.  This can be used to mark
+interesting places that you want to visit later using 'xref-pop-marker-stack'.
+
 * New Modes and Packages in Emacs 27.1
 
 +++
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 5a9a7a925a..5c70005d13 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -352,9 +352,14 @@ xref-after-return-hook
 (defvar xref--marker-ring (make-ring xref-marker-ring-length)
   "Ring of markers to implement the marker stack.")
 
+;;;###autoload
 (defun xref-push-marker-stack (&optional m)
   "Add point M (defaults to `point-marker') to the marker stack."
-  (ring-insert xref--marker-ring (or m (point-marker))))
+  (interactive)
+  (ring-insert xref--marker-ring (or m (point-marker)))
+  ; If called interactively, output a message for the user
+  (when (called-interactively-p 'any)
+        (message "xref marker set for current position.")))
 
 ;;;###autoload
 (defun xref-pop-marker-stack ()
-- 
2.16.2






This bug report was last modified 5 years and 337 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.