summaryrefslogtreecommitdiff
path: root/lisp/hexl.el
diff options
context:
space:
mode:
authorDan Nicolaescu <dann@ics.uci.edu>2010-10-10 16:12:30 -0700
committerDan Nicolaescu <dann@ics.uci.edu>2010-10-10 16:12:30 -0700
commita0310a6c2226b23bc25c2dd66c8dd9664fdeb022 (patch)
tree31c8181c70d9f9a3d0532f128b38a0fcb62f9d8c /lisp/hexl.el
parentdab0271f8dfd284e0ecd5022745a67c182410b81 (diff)
downloademacs-a0310a6c2226b23bc25c2dd66c8dd9664fdeb022.tar.gz
Declare and define in one step various mode maps.
* lisp/shell.el (shell-mode-map): * lisp/progmodes/modula2.el (m2-mode-map): * lisp/progmodes/inf-lisp.el (inferior-lisp-mode-map): * lisp/play/mpuz.el (mpuz-mode-map): * lisp/play/landmark.el (lm-mode-map): * lisp/play/decipher.el (decipher-mode-map): * lisp/play/5x5.el (5x5-mode-map): * lisp/net/telnet.el (telnet-mode-map): * lisp/net/quickurl.el (quickurl-list-mode-map): * lisp/net/mairix.el (mairix-searches-mode-map): * lisp/net/eudc-hotlist.el (eudc-hotlist-mode-map): * lisp/net/dig.el (dig-mode-map): * lisp/mail/mspools.el (mspools-mode-map): * lisp/hexl.el (hexl-mode-map): * lisp/emulation/ws-mode.el (wordstar-C-k-map, wordstar-mode-map) (wordstar-C-o-map, wordstar-C-q-map): * lisp/emacs-lisp/edebug.el (edebug-eval-mode-map): * lisp/emacs-lisp/chart.el (chart-map): * lisp/edmacro.el (edmacro-mode-map): * lisp/array.el (array-mode-map): Declare and define in one step. * lisp/erc/erc-list.el (erc-list-menu-mode-map): Declare and define in one step.
Diffstat (limited to 'lisp/hexl.el')
-rw-r--r--lisp/hexl.el188
1 files changed, 93 insertions, 95 deletions
diff --git a/lisp/hexl.el b/lisp/hexl.el
index 7edf5ec10ac..ebc43e43d25 100644
--- a/lisp/hexl.el
+++ b/lisp/hexl.el
@@ -97,7 +97,99 @@ Quoting cannot be used, so the arguments cannot themselves contain spaces."
(defvar hexl-max-address 0
"Maximum offset into hexl buffer.")
-(defvar hexl-mode-map nil)
+(defvar hexl-mode-map
+ (let ((map (make-keymap)))
+ ;; Make all self-inserting keys go through hexl-self-insert-command,
+ ;; because we need to convert them to unibyte characters before
+ ;; inserting them into the buffer.
+ (define-key map [remap self-insert-command] 'hexl-self-insert-command)
+
+ (define-key map "\C-m" 'hexl-self-insert-command)
+ (define-key map [left] 'hexl-backward-char)
+ (define-key map [right] 'hexl-forward-char)
+ (define-key map [up] 'hexl-previous-line)
+ (define-key map [down] 'hexl-next-line)
+ (define-key map [M-left] 'hexl-backward-short)
+ (define-key map [?\e left] 'hexl-backward-short)
+ (define-key map [M-right] 'hexl-forward-short)
+ (define-key map [?\e right] 'hexl-forward-short)
+ (define-key map [next] 'hexl-scroll-up)
+ (define-key map [prior] 'hexl-scroll-down)
+ (define-key map [home] 'hexl-beginning-of-line)
+ (define-key map [end] 'hexl-end-of-line)
+ (define-key map [C-home] 'hexl-beginning-of-buffer)
+ (define-key map [C-end] 'hexl-end-of-buffer)
+ (define-key map [deletechar] 'undefined)
+ (define-key map [deleteline] 'undefined)
+ (define-key map [insertline] 'undefined)
+ (define-key map [S-delete] 'undefined)
+ (define-key map "\177" 'undefined)
+
+ (define-key map "\C-a" 'hexl-beginning-of-line)
+ (define-key map "\C-b" 'hexl-backward-char)
+ (define-key map "\C-d" 'undefined)
+ (define-key map "\C-e" 'hexl-end-of-line)
+ (define-key map "\C-f" 'hexl-forward-char)
+
+ (if (not (memq (key-binding (char-to-string help-char))
+ '(help-command ehelp-command)))
+ (define-key map (char-to-string help-char) 'undefined))
+
+ (define-key map "\C-k" 'undefined)
+ (define-key map "\C-n" 'hexl-next-line)
+ (define-key map "\C-o" 'undefined)
+ (define-key map "\C-p" 'hexl-previous-line)
+ (define-key map "\C-q" 'hexl-quoted-insert)
+ (define-key map "\C-t" 'undefined)
+ (define-key map "\C-v" 'hexl-scroll-up)
+ (define-key map "\C-w" 'undefined)
+ (define-key map "\C-y" 'undefined)
+
+ (fset 'hexl-ESC-prefix (copy-keymap 'ESC-prefix))
+ (define-key map "\e" 'hexl-ESC-prefix)
+ (define-key map "\e\C-a" 'hexl-beginning-of-512b-page)
+ (define-key map "\e\C-b" 'hexl-backward-short)
+ (define-key map "\e\C-d" 'hexl-insert-decimal-char)
+ (define-key map "\e\C-e" 'hexl-end-of-512b-page)
+ (define-key map "\e\C-f" 'hexl-forward-short)
+ (define-key map "\e\C-i" 'undefined)
+ (define-key map "\e\C-j" 'undefined)
+ (define-key map "\e\C-k" 'undefined)
+ (define-key map "\e\C-o" 'hexl-insert-octal-char)
+ (define-key map "\e\C-q" 'undefined)
+ (define-key map "\e\C-t" 'undefined)
+ (define-key map "\e\C-x" 'hexl-insert-hex-char)
+ (define-key map "\eb" 'hexl-backward-word)
+ (define-key map "\ec" 'undefined)
+ (define-key map "\ed" 'undefined)
+ (define-key map "\ef" 'hexl-forward-word)
+ (define-key map "\eg" 'hexl-goto-hex-address)
+ (define-key map "\ei" 'undefined)
+ (define-key map "\ej" 'hexl-goto-address)
+ (define-key map "\ek" 'undefined)
+ (define-key map "\el" 'undefined)
+ (define-key map "\eq" 'undefined)
+ (define-key map "\es" 'undefined)
+ (define-key map "\et" 'undefined)
+ (define-key map "\eu" 'undefined)
+ (define-key map "\ev" 'hexl-scroll-down)
+ (define-key map "\ey" 'undefined)
+ (define-key map "\ez" 'undefined)
+ (define-key map "\e<" 'hexl-beginning-of-buffer)
+ (define-key map "\e>" 'hexl-end-of-buffer)
+
+ (fset 'hexl-C-c-prefix (copy-keymap mode-specific-map))
+ (define-key map "\C-c" 'hexl-C-c-prefix)
+ (define-key map "\C-c\C-c" 'hexl-mode-exit)
+
+ (fset 'hexl-C-x-prefix (copy-keymap 'Control-X-prefix))
+ (define-key map "\C-x" 'hexl-C-x-prefix)
+ (define-key map "\C-x[" 'hexl-beginning-of-1k-page)
+ (define-key map "\C-x]" 'hexl-end-of-1k-page)
+ (define-key map "\C-x\C-p" 'undefined)
+ (define-key map "\C-x\C-s" 'hexl-save-buffer)
+ (define-key map "\C-x\C-t" 'undefined)
+ map))
;; Variable declarations for suppressing warnings from the byte-compiler.
(defvar ruler-mode)
@@ -1017,100 +1109,6 @@ This function is assumed to be used as callback function for `hl-line-mode'."
;; startup stuff.
-(if hexl-mode-map
- nil
- (setq hexl-mode-map (make-keymap))
- ;; Make all self-inserting keys go through hexl-self-insert-command,
- ;; because we need to convert them to unibyte characters before
- ;; inserting them into the buffer.
- (define-key hexl-mode-map [remap self-insert-command] 'hexl-self-insert-command)
-
- (define-key hexl-mode-map "\C-m" 'hexl-self-insert-command)
- (define-key hexl-mode-map [left] 'hexl-backward-char)
- (define-key hexl-mode-map [right] 'hexl-forward-char)
- (define-key hexl-mode-map [up] 'hexl-previous-line)
- (define-key hexl-mode-map [down] 'hexl-next-line)
- (define-key hexl-mode-map [M-left] 'hexl-backward-short)
- (define-key hexl-mode-map [?\e left] 'hexl-backward-short)
- (define-key hexl-mode-map [M-right] 'hexl-forward-short)
- (define-key hexl-mode-map [?\e right] 'hexl-forward-short)
- (define-key hexl-mode-map [next] 'hexl-scroll-up)
- (define-key hexl-mode-map [prior] 'hexl-scroll-down)
- (define-key hexl-mode-map [home] 'hexl-beginning-of-line)
- (define-key hexl-mode-map [end] 'hexl-end-of-line)
- (define-key hexl-mode-map [C-home] 'hexl-beginning-of-buffer)
- (define-key hexl-mode-map [C-end] 'hexl-end-of-buffer)
- (define-key hexl-mode-map [deletechar] 'undefined)
- (define-key hexl-mode-map [deleteline] 'undefined)
- (define-key hexl-mode-map [insertline] 'undefined)
- (define-key hexl-mode-map [S-delete] 'undefined)
- (define-key hexl-mode-map "\177" 'undefined)
-
- (define-key hexl-mode-map "\C-a" 'hexl-beginning-of-line)
- (define-key hexl-mode-map "\C-b" 'hexl-backward-char)
- (define-key hexl-mode-map "\C-d" 'undefined)
- (define-key hexl-mode-map "\C-e" 'hexl-end-of-line)
- (define-key hexl-mode-map "\C-f" 'hexl-forward-char)
-
- (if (not (memq (key-binding (char-to-string help-char))
- '(help-command ehelp-command)))
- (define-key hexl-mode-map (char-to-string help-char) 'undefined))
-
- (define-key hexl-mode-map "\C-k" 'undefined)
- (define-key hexl-mode-map "\C-n" 'hexl-next-line)
- (define-key hexl-mode-map "\C-o" 'undefined)
- (define-key hexl-mode-map "\C-p" 'hexl-previous-line)
- (define-key hexl-mode-map "\C-q" 'hexl-quoted-insert)
- (define-key hexl-mode-map "\C-t" 'undefined)
- (define-key hexl-mode-map "\C-v" 'hexl-scroll-up)
- (define-key hexl-mode-map "\C-w" 'undefined)
- (define-key hexl-mode-map "\C-y" 'undefined)
-
- (fset 'hexl-ESC-prefix (copy-keymap 'ESC-prefix))
- (define-key hexl-mode-map "\e" 'hexl-ESC-prefix)
- (define-key hexl-mode-map "\e\C-a" 'hexl-beginning-of-512b-page)
- (define-key hexl-mode-map "\e\C-b" 'hexl-backward-short)
- (define-key hexl-mode-map "\e\C-d" 'hexl-insert-decimal-char)
- (define-key hexl-mode-map "\e\C-e" 'hexl-end-of-512b-page)
- (define-key hexl-mode-map "\e\C-f" 'hexl-forward-short)
- (define-key hexl-mode-map "\e\C-i" 'undefined)
- (define-key hexl-mode-map "\e\C-j" 'undefined)
- (define-key hexl-mode-map "\e\C-k" 'undefined)
- (define-key hexl-mode-map "\e\C-o" 'hexl-insert-octal-char)
- (define-key hexl-mode-map "\e\C-q" 'undefined)
- (define-key hexl-mode-map "\e\C-t" 'undefined)
- (define-key hexl-mode-map "\e\C-x" 'hexl-insert-hex-char)
- (define-key hexl-mode-map "\eb" 'hexl-backward-word)
- (define-key hexl-mode-map "\ec" 'undefined)
- (define-key hexl-mode-map "\ed" 'undefined)
- (define-key hexl-mode-map "\ef" 'hexl-forward-word)
- (define-key hexl-mode-map "\eg" 'hexl-goto-hex-address)
- (define-key hexl-mode-map "\ei" 'undefined)
- (define-key hexl-mode-map "\ej" 'hexl-goto-address)
- (define-key hexl-mode-map "\ek" 'undefined)
- (define-key hexl-mode-map "\el" 'undefined)
- (define-key hexl-mode-map "\eq" 'undefined)
- (define-key hexl-mode-map "\es" 'undefined)
- (define-key hexl-mode-map "\et" 'undefined)
- (define-key hexl-mode-map "\eu" 'undefined)
- (define-key hexl-mode-map "\ev" 'hexl-scroll-down)
- (define-key hexl-mode-map "\ey" 'undefined)
- (define-key hexl-mode-map "\ez" 'undefined)
- (define-key hexl-mode-map "\e<" 'hexl-beginning-of-buffer)
- (define-key hexl-mode-map "\e>" 'hexl-end-of-buffer)
-
- (fset 'hexl-C-c-prefix (copy-keymap mode-specific-map))
- (define-key hexl-mode-map "\C-c" 'hexl-C-c-prefix)
- (define-key hexl-mode-map "\C-c\C-c" 'hexl-mode-exit)
-
- (fset 'hexl-C-x-prefix (copy-keymap 'Control-X-prefix))
- (define-key hexl-mode-map "\C-x" 'hexl-C-x-prefix)
- (define-key hexl-mode-map "\C-x[" 'hexl-beginning-of-1k-page)
- (define-key hexl-mode-map "\C-x]" 'hexl-end-of-1k-page)
- (define-key hexl-mode-map "\C-x\C-p" 'undefined)
- (define-key hexl-mode-map "\C-x\C-s" 'hexl-save-buffer)
- (define-key hexl-mode-map "\C-x\C-t" 'undefined))
-
(easy-menu-define hexl-menu hexl-mode-map "Hexl Mode menu"
`("Hexl"
:help "Hexl-specific Features"