[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Redefining the TAB key in a custom major mode:
From: |
Davin Pearson |
Subject: |
Redefining the TAB key in a custom major mode: |
Date: |
Sat, 9 Jan 2016 18:22:01 -0800 (PST) |
User-agent: |
G2/1.0 |
(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)
)
With the previous function defined C-h v TAB returns the following
information:
<tab> runs the command indent-for-tab-command
None of the previous four lines seem to redefine the TAB key to my
custom function d-indent-line.
- Redefining the TAB key in a custom major mode:,
Davin Pearson <=