unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50642: 27.2; autoload xref-pulse-momentarily
@ 2021-09-17 14:43 Howard Melman
  2021-09-18  0:14 ` Dmitry Gutov
  0 siblings, 1 reply; 4+ messages in thread
From: Howard Melman @ 2021-09-17 14:43 UTC (permalink / raw)
  To: 50642

I'm not sure about this but can xref-pulse-momentarily be
autoloaded?

I'm using consult and it has a consult-after-jump-hook which
recommends xref-pulse-momentarily as something you may want
to use in it. I set it and xref-after-jump-hook to:
'(reposition-window xref-pulse-momentarily).

It works great, but if I use consult before xref I get the error:
run-hooks: Symbol's function definition is void: xref-pulse-momentarily
If I add an autoload call myself it does not error.

I looked but didn't find a more suitable function to use.
It seems like pulse.el should define a function suitable for
use in a hook, but in its absense xref-pulse-momentarily
does seem like the best option (though I couldn't follow its
implementation). 


In GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0, Carbon Version 158 AppKit 1671.6)
of 2021-03-27 built on Traviss-Mac.local

-- 

Howard





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

* bug#50642: 27.2; autoload xref-pulse-momentarily
  2021-09-17 14:43 bug#50642: 27.2; autoload xref-pulse-momentarily Howard Melman
@ 2021-09-18  0:14 ` Dmitry Gutov
  2021-09-18  1:48   ` Howard Melman
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Gutov @ 2021-09-18  0:14 UTC (permalink / raw)
  To: Howard Melman, 50642

On 17.09.2021 17:43, Howard Melman wrote:
> I'm not sure about this but can xref-pulse-momentarily be
> autoloaded?
> 
> I'm using consult and it has a consult-after-jump-hook which
> recommends xref-pulse-momentarily as something you may want
> to use in it. I set it and xref-after-jump-hook to:
> '(reposition-window xref-pulse-momentarily).
> 
> It works great, but if I use consult before xref I get the error:
> run-hooks: Symbol's function definition is void: xref-pulse-momentarily
> If I add an autoload call myself it does not error.
> 
> I looked but didn't find a more suitable function to use.
> It seems like pulse.el should define a function suitable for
> use in a hook, but in its absense xref-pulse-momentarily
> does seem like the best option (though I couldn't follow its
> implementation).

Well, um. I don't really mind but xref-pulse-momentarily was designed to 
pulse after a jump to an xref location. That's why it refers to 
xref--current-item in its implementation.

It does fall back to pulsing the whole line, so I suppose it can be 
useful in other cases too.

But maybe Counsel wants to provide its own version of this function? It 
can call xref-pulse-momentarily after xref navigations, but maybe do 
some more useful fallbacks for other commands? I'm not sure which other 
kinds of jumps consult-after-jump-hook also handles.





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

* bug#50642: 27.2; autoload xref-pulse-momentarily
  2021-09-18  0:14 ` Dmitry Gutov
@ 2021-09-18  1:48   ` Howard Melman
  2021-09-18 14:14     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Howard Melman @ 2021-09-18  1:48 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 50642

On Sep 17, 2021, at 8:14 PM, Dmitry Gutov <dgutov@yandex.ru> wrote:
> 
> Well, um. I don't really mind but xref-pulse-momentarily was designed to pulse after a jump to an xref location. That's why it refers to xref--current-item in its implementation.
> 
> It does fall back to pulsing the whole line, so I suppose it can be useful in other cases too.
> 
> But maybe Counsel wants to provide its own version of this function? It can call xref-pulse-momentarily after xref navigations, but maybe do some more useful fallbacks for other commands? I'm not sure which other kinds of jumps consult-after-jump-hook also handles.

I'm not the consult author, but given that it doesn't actually use a pulse function, it just suggests one possible one, I doubt it will.

It looked to me in some cases consult wasn't pulsing the whole line but rather just a symbol, but perhaps I'm mistaken (I can't seem to get it to do so now).  It uses this hook in various grep/imenu/outline/etc. navigation commands.

I do still think it would be nice for pulse.el to define a function suitable for use in a jump-like hook that take no arguments and pulses the current line or maybe symbol.  The former is trival, but if pulse-momentary-highlight-one-line allowed it's POINT argument to be optional, emacs could provide it for everyone.  It seems like in Emacs 27 all the callers of it just pass (point) anyway.

Or maybe pulse-line-hook-function is supposed to be this?  In which case it should be autoloaded and pulse-command-advice-flag should be a defcustom and have a docstring?

Howard




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

* bug#50642: 27.2; autoload xref-pulse-momentarily
  2021-09-18  1:48   ` Howard Melman
@ 2021-09-18 14:14     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-18 14:14 UTC (permalink / raw)
  To: Howard Melman; +Cc: 50642, Dmitry Gutov

Howard Melman <hmelman@gmail.com> writes:

>> Well, um. I don't really mind but xref-pulse-momentarily was
>> designed to pulse after a jump to an xref location. That's why it
>> refers to xref--current-item in its implementation.

Yeah, that's the wrong function to use here, so the Consult
documentation should be altered.

> I do still think it would be nice for pulse.el to define a function
> suitable for use in a jump-like hook that take no arguments and pulses
> the current line or maybe symbol.  The former is trival, but if
> pulse-momentary-highlight-one-line allowed it's POINT argument to be
> optional, emacs could provide it for everyone.  It seems like in Emacs
> 27 all the callers of it just pass (point) anyway.

I've now made POINT optional in Emacs 28.

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





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

end of thread, other threads:[~2021-09-18 14:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 14:43 bug#50642: 27.2; autoload xref-pulse-momentarily Howard Melman
2021-09-18  0:14 ` Dmitry Gutov
2021-09-18  1:48   ` Howard Melman
2021-09-18 14:14     ` 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).