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

* bug#31086: [PATCH] xref: Make xref-push-marker-stack interactive
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2018-04-11  7:28 UTC (permalink / raw)
  To: George Kadianakis, 31086

Hey!

On 4/7/18 3:05 AM, George Kadianakis wrote:

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

Thank you for the patch, but I'm not quite sure we want this behavior, 
at least not until we have a common marker stack for many different 
operations. But let's hear what others think.

In the meantime, it should be easy for you to use advice, or define a 
command in your init file that would call xref-push-marker-stack.





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

* bug#31086: [PATCH] xref: Make xref-push-marker-stack interactive
  2018-04-11  7:28 ` Dmitry Gutov
@ 2019-06-24 15:25   ` Lars Ingebrigtsen
  2019-06-24 23:29     ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-24 15:25 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: George Kadianakis, 31086

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 4/7/18 3:05 AM, George Kadianakis wrote:
>
>> 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.
>
> Thank you for the patch, but I'm not quite sure we want this behavior,
> at least not until we have a common marker stack for many different
> operations. But let's hear what others think.

It didn't sound like anybody else had an opinion here...  Dmitry, do you
still think that this is probably something we don't want?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#31086: [PATCH] xref: Make xref-push-marker-stack interactive
  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
  0 siblings, 2 replies; 6+ messages in thread
From: Dmitry Gutov @ 2019-06-24 23:29 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: George Kadianakis, 31086

Hi Lars,

On 24.06.2019 18:25, Lars Ingebrigtsen wrote:

> It didn't sound like anybody else had an opinion here...  Dmitry, do you
> still think that this is probably something we don't want?

Still not convinced, no. It's a customization that is easy to set up in 
a personal init script, so unless we see similar requests, I'd rather 
hold off installing it in the core.

It's not a strong opinion, though.





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

* bug#31086: [PATCH] xref: Make xref-push-marker-stack interactive
  2019-06-24 23:29     ` Dmitry Gutov
@ 2019-06-25  7:53       ` George Kadianakis
  2019-06-25 11:06       ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: George Kadianakis @ 2019-06-25  7:53 UTC (permalink / raw)
  To: Dmitry Gutov, Lars Ingebrigtsen; +Cc: 31086

Dmitry Gutov <dgutov@yandex.ru> writes:

> Hi Lars,
>
> On 24.06.2019 18:25, Lars Ingebrigtsen wrote:
>
>> It didn't sound like anybody else had an opinion here...  Dmitry, do you
>> still think that this is probably something we don't want?
>
> Still not convinced, no. It's a customization that is easy to set up in 
> a personal init script, so unless we see similar requests, I'd rather 
> hold off installing it in the core.
>
> It's not a strong opinion, though.

Makes sense to me. For me, this was just an ugly hack and perhaps the
xref subsystem is not meant to do this sort of interactive stuff.





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

* bug#31086: [PATCH] xref: Make xref-push-marker-stack interactive
  2019-06-24 23:29     ` Dmitry Gutov
  2019-06-25  7:53       ` George Kadianakis
@ 2019-06-25 11:06       ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-25 11:06 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: George Kadianakis, 31086

Dmitry Gutov <dgutov@yandex.ru> writes:

> Hi Lars,
>
> On 24.06.2019 18:25, Lars Ingebrigtsen wrote:
>
>> It didn't sound like anybody else had an opinion here...  Dmitry, do you
>> still think that this is probably something we don't want?
>
> Still not convinced, no. It's a customization that is easy to set up
> in a personal init script, so unless we see similar requests, I'd
> rather hold off installing it in the core.

OK; closing the bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[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).