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 #8 received at 47566 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Ramesh Nedunchezian <rameshnedunchezian <at> outlook.com>,
 47566 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#47566: 28.0.50; diff-hl should use `repeat-mode' ... and not
 `smartrep'
Date: Sun, 4 Apr 2021 01:08:55 +0300
Hi!

On 02.04.2021 08:40, Ramesh Nedunchezian wrote:
> FWIW, `smartrep' is not part of GNU Emacs or GNU ELPA but available
> elsewhere.  (I install it via MELPA)
> 
> Now, that `repeat-mode' is part of GNU Emacs, I think this dependency
> on `smartrep' can be removed.

I'd be happy to migrate away from smartrep, as soon as the functionality 
is equal, and all supported Emacs versions have repeat-mode.

> FWIW, this is what I have in my `.emacs'.
> 
>      (progn
>        (defvar diff-hl--repeat-map
> 	(let
> 	    ((map
> 	      (make-sparse-keymap)))
> 	  map))
>        (message "Installed %s" 'diff-hl--repeat-map)
>        (cl-loop for
> 	       (cmd . key)
> 	       in
> 	       '((diff-hl-diff-goto-hunk . "=")
> 		 (diff-hl-revert-hunk . "n")
> 		 (diff-hl-previous-hunk . "[")
> 		 (diff-hl-next-hunk . "]"))
> 	       do
> 	       (define-key diff-hl--repeat-map key cmd)
> 	       (put cmd 'repeat-map 'diff-hl--repeat-map)))

Try this alternative too, seems shorter:

(map-keymap
 (lambda (_key cmd)
   (put cmd 'repeat-map 'diff-hl-command-map))
 diff-hl-command-map)

But either version (together with enabling repeat-mode) seems to break 
diff-hl-revert-hunk: as soon as it reaches the the y-or-n prompt, and I 
try to answer 'n', it enters the repeat loop again, instead of sending 
the result to the command.




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

Previous Next


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