unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31086: [PATCH] xref: Make xref-push-marker-stack interactive
@ 2018-04-07  0:05 George Kadianakis
  2018-04-11  7:28 ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: George Kadianakis @ 2018-04-07  0:05 UTC (permalink / raw)
  To: 31086

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@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







^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-25 11:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-07  0:05 bug#31086: [PATCH] xref: Make xref-push-marker-stack interactive George Kadianakis
2018-04-11  7:28 ` Dmitry Gutov
2019-06-24 15:25   ` Lars Ingebrigtsen
2019-06-24 23:29     ` Dmitry Gutov
2019-06-25  7:53       ` George Kadianakis
2019-06-25 11:06       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).