unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Strange behavior with major mode specific key bindings
@ 2020-04-24 22:20 Tim Johnson
  2020-04-24 22:36 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 6+ messages in thread
From: Tim Johnson @ 2020-04-24 22:20 UTC (permalink / raw)
  To: MLEmacs

I have customized a key binding for jinja2 mode.

;; In my init.el I have the following
(require 'jinja2-mode)
(require 'tj-mode-custom)
(add-to-list 'auto-mode-alist '("\\.html$" . jinja2-mode))
(add-hook 'jinja2-mode-hook 'tj-jinja2-mode-keys)

;; In  tj-mode-custom the following

(defun tj-jinja2-mode-keys ()
   "Bindings and for jinja2"
   (define-prefix-command 'jinja2-mode-map)
   (local-set-key (kbd "C-c") 'jinja2-mode-map)
   (define-key jinja2-mode-map "a" 'jinja2-close-tag))

If an .html file is loaded at emacs startup, the following key sequence:

C-c a

invokes jinja2-close-tag

BUT if I open an .html file that is on disk but not preloaded at 
startup, OR if I create a new .html file, the single character "a" will 
execute the same function.

In other words, now both "C-c a" and "a" are bound to 'jinja2-close-tag, 
clobbering 'insert-char

I can observe that the newly opened files are in jinja2 mode.

I do not have similar issues with elpy mode

I am using GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
2.24.30)

On ubuntu 16.04

thanks


-- 
Tim
tj49.com




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-24 23:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-24 22:20 Strange behavior with major mode specific key bindings Tim Johnson
2020-04-24 22:36 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-04-24 22:57   ` Tim Johnson
2020-04-24 23:07     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-04-24 23:46       ` Tim Johnson
2020-04-24 23:48         ` Emanuel Berg via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).