all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: dalanicolai@gmail.com
Cc: 43617@debbugs.gnu.org
Subject: bug#43617: 27.1; Define-minor-mode keybindings not get precedence over global  keymap
Date: Sat, 26 Sep 2020 16:04:56 +0200	[thread overview]
Message-ID: <87eemoljlj.fsf@gnus.org> (raw)
In-Reply-To: <53faa17bc88194ba2a67440eb1ddd139ea1188c3.camel@gmail.com> (dalanicolai@gmail.com's message of "Fri, 25 Sep 2020 20:10:40 +0200")

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	other threads:[~2020-09-26 14:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25 18:10 bug#43617: 27.1; Define-minor-mode keybindings not get precedence over global keymap dalanicolai
2020-09-26 14:04 ` Lars Ingebrigtsen [this message]
2020-09-26 14:09   ` Lars Ingebrigtsen
2020-09-26 15:25     ` Drew Adams
2020-09-26 15:32       ` Andreas Schwab
2020-09-26 16:04         ` Drew Adams
2020-09-27 11:00           ` dalanicolai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eemoljlj.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=43617@debbugs.gnu.org \
    --cc=dalanicolai@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.