emacs-devel
[Top][All Lists]
Advanced

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

Re: [ELPA] Add 'pulsar' package


From: Philip Kaludercic
Subject: Re: [ELPA] Add 'pulsar' package
Date: Sun, 20 Mar 2022 11:29:35 +0000

Protesilaos Stavrou <info@protesilaos.com> writes:

> On 2022-03-16, 16:05 +0000, Philip Kaludercic <philipk@posteo.net> wrote:
>
>>>> I have no real opinion on this, I just wanted to bring it up in case you
>>>> hadn't considered it before (and also because in this case, at least from
>>>> what I understand the package does, it should be rather easy).
>>>
>>> I think a standalone package and a patch for 'master' are not mutually
>>> exclusive.  As I wrote before, we can deprecate pulsar when Emacs 29 is
>>> the new stable and has this functionality built-in.
>>>
>>> As for whether such a patch would be easy, I admit that I do not know
>>> how best to implement it.  If you or anyone else can write such a patch,
>>> please do it.
>>
>> I guess it might depend on how many features you want to re-implement in
>> the core. Please don't misinterpret this, but I think that the core
>> functionality, pulsing a line after certain commands, could be done by
>> providing a single user option, with a custom setter.
>
> As I wrote before, I do not know how best to do this in core.  This is
> not me faking ignorance to support a different opinion: I genuinely do
> not know how to do this with a single option.  Please do it if you
> can---it will also help me learn something new.

This is a quick sketch:

diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el
index f7af10887c..97803d08c1 100644
--- a/lisp/cedet/pulse.el
+++ b/lisp/cedet/pulse.el
@@ -102,6 +102,22 @@ pulse-delay
   :group 'pulse
   :type 'number)
 
+;;;###autoload
+(defcustom pulse-after-commands '()
+  "List of commands to pulse the current line after invocation."
+  :set (lambda (sym val)
+         (funcall (if val #'add-hook #'remove-hook)
+                  'post-command-hook
+                  #'pulse--after-command)
+         (set-default sym val))
+  :group 'pulse
+  :type '(repeat symbol))
+
+(defun pulse--after-command ()
+  "Pulse if the current command is in `pulse-after-commands'."
+  (when (memq this-command pulse-after-commands)
+    (pulse-momentary-highlight-one-line)))
+
 ;;; Convenience Functions
 ;;
 (defvar pulse-momentary-overlay nil
This can be extended by allowing regular expressions to match sets of
commands, or cons-cells to configure additional details (color,
duration, multiple pulses, ...) for specific case.

> At any rate, this is not what this thread is about.  I think pulsar
> belongs in the archive.  I post on emacs-devel to give others a chance
> to point out any obvious flaws with the package.  If there are none, the
> patch must be installed in elpa.git (I have write access and can do that
> myself, if needed).
>
> There are people who are already using pulsar and I believe there is no
> technical reason why it should not be in GNU ELPA.

In any case, I don't want to object, especially if others find the
package useful.  I just wanted to be sure that the alternative was
mentioned.

Unless anyone objects, there shouldn't be any problem if you push your
patch to elpa.git.

> To your point though about patching the core, I repeat what I already
> stated in unequivocal terms: I will deprecate pulsar when the Emacs
> version that includes its functionality becomes the stable version of
> Emacs.  Until then, the package has a good reason to exist and be
> readily available.

I don't even think this is necessary.  IMO there is nothing wrong with
having a package on ELPA that extends or improves on a core feature.

-- 
        Philip Kaludercic

reply via email to

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