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

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

bug#43617: 27.1; Define-minor-mode keybindings not get precedence over g


From: Lars Ingebrigtsen
Subject: bug#43617: 27.1; Define-minor-mode keybindings not get precedence over global keymap
Date: Sat, 26 Sep 2020 16:04:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

dalanicolai@gmail.com writes:

> Start emacs with the -Q flag, use the following code to create
> keybindings with define-minor-mode:
>
> (define-minor-mode pdf-continuous-scroll-mode
>   "Emulate continuous scroll with two synchronized buffers"
>   nil
>   " Continuous"
>   '(((kbd "j") . (lambda () (interactive) (print "pushed j")))
>     ((kbd "C-n") . (lambda () (interactive)(print "pushed C-n"))))
>   (print "toggled minor mode"))
>
> Now activate the just defined pdf-continuous-scroll-mode.
> The "C-n" keybinding does not work correctly while the "j"
> keybinding does (i.e. prints "pushed j").

Hm.  It seems like there's a difference between \C-n and (kbd "C-n")
here for some reason.  With this definition:

(define-minor-mode pdf-continuous-scroll-mode-3
  "Emulate continuous scroll with two synchronized buffers"
  nil
  " Continuous"
  '(((kbd "j") . (lambda () (interactive) (print "pushed j")))
    ("\C-n" . (lambda () (interactive)(print "pushed C-n"))))
  (print "toggled minor mode"))

we get the keymap:

(keymap
 (14 lambda nil
     (interactive)
     (print "pushed C-n"))
 (106 lambda nil
      (interactive)
      (print "pushed j")))

With `kbd', we get the following keymap, which surely has to be wrong:

(keymap
 (67 keymap
     (45 keymap
         (110 lambda nil
              (interactive)
              (print "pushed C-n"))))
 (106 lambda nil
      (interactive)
      (print "pushed j")))


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





reply via email to

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