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

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

Re: Redefining the TAB key in a custom major mode:


From: Dmitry Gutov
Subject: Re: Redefining the TAB key in a custom major mode:
Date: Sun, 10 Jan 2016 05:27:38 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Thunderbird/43.0

On 01/10/2016 05:22 AM, Davin Pearson wrote:

(defun c2j-mode ()
   (interactive)
   (java-mode)
   (setq major-mode 'c2j-mode)
   (setq mode-name "C2J Mode")
   (setq c2j-mode-map (copy-keymap java-mode-map))
   (assert (fboundp 'd-indent-line))
   (setcdr (assq 9 c2j-mode-map) 'd-indent-line) ;; won't work under XEmacs
   (define-key c2j-mode-map [tab] 'd-indent-line)
   (define-key c2j-mode-map [(tab)] 'd-indent-line)
   (define-key c2j-mode-map "\t" 'd-indent-line)
   )

You seem to be missing the line that would make cj2-mode-map the current keymap. Call use-local-map?

But you probably should use the handly macro called define-derived-mode, instead of setting this stuff up manually.



reply via email to

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