GNU bug report logs - #47566
28.0.50; diff-hl should use `repeat-mode' ... and not `smartrep'

Previous Next

Package: emacs;

Reported by: Ramesh Nedunchezian <rameshnedunchezian <at> outlook.com>

Date: Fri, 2 Apr 2021 14:51:02 UTC

Severity: normal

Found in version 28.0.50

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #37 received at 47566-done <at> debbugs.gnu.org (full text, mbox):

From: Ramesh Nedunchezian <rameshnedunchezian <at> outlook.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 47566-done <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#47566: 28.0.50; diff-hl should use `repeat-mode' ... and not
 `smartrep'
Date: Sun, 11 Apr 2021 12:18:43 +0530
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.






This bug report was last modified 3 years and 185 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.