bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#47566: 28.0.50; diff-hl should use `repeat-mode' ... and not `smartr


From: Ramesh Nedunchezian
Subject: bug#47566: 28.0.50; diff-hl should use `repeat-mode' ... and not `smartrep'
Date: Sun, 11 Apr 2021 12:18:43 +0530
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 11/04/21 4:29 am, Juri Linkov wrote:
>> It seems to me that repeat-mode is essentially a poor man's hydra.
> 
> It is.  It provides only the basic functionality.
> Don't expect many fancy things from repeat-mode.

The code below is pulled out from the existing code i.e., it doesn't
add any additional layer of complexity or does anything fanciful.  But
it does add a bit of extensibility.

This is what I was suggesting:

    (defvar repeat-mode-helper
      (defun repeat-mode-helper (map)
        (let (keys)
          (message "Coming here")
          (map-keymap (lambda (key _) (push key keys)) map)
          (let ((mess (format-message
                       "Repeat with %s%s"
                       (mapconcat (lambda (key)
                                    (key-description (vector key)))
                                  keys ", ")
                       (if repeat-exit-key
                           (format ", or exit with %s"
                                   (key-description repeat-exit-key))
                         ""))))
            (if (current-message)
                (message "%s [%s]" (current-message) mess)
              (message mess))))))


And in `repeat-post-hook', do something like

    ;; Messaging
    (unless prefix-arg
      (funcall (or (get rep-sym 'help) repeat-mode-helper) rep-map))


For those who don't want hints, they can use

    (setq repeat-mode-helper #'ignore)

For those who want hints, but do /not/ want the hints hogging the echo
area, they could have their own custom helper like the one above,
after replacing

        (message mess)

with

        (tooltip-show mess)

--------------------------------

I would also appreciate if you could assess adding the exit key as a
property to the repeat mode symbol.







reply via email to

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