diff options
author | Tom Tromey <tom@tromey.com> | 2017-10-06 13:18:31 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-10-10 13:01:42 -0600 |
commit | 22b63797983f485041a2a424e6cd7732f4318885 (patch) | |
tree | d3bd132ac6efadad41ec0182309d4948a031c37f | |
parent | 65630365f7d073430e62b4fe65f34dcdc0a4b05e (diff) | |
download | gdb-22b63797983f485041a2a424e6cd7732f4318885.zip gdb-22b63797983f485041a2a424e6cd7732f4318885.tar.gz gdb-22b63797983f485041a2a424e6cd7732f4318885.tar.bz2 |
Bind keys in dwarf-mode-map definition
It's bad Emacs style to define keys from a top-level form. Instead, one
should define a mode map separately and binding keys in the definition.
This lets users completely override the map by defining it before
loading the mode.
2017-10-10 Tom Tromey <tom@tromey.com>
* dwarf-mode.el (dwarf-mode-map): New defvar.
-rw-r--r-- | binutils/ChangeLog | 4 | ||||
-rw-r--r-- | binutils/dwarf-mode.el | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 9f2e5f0..7a7edab 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2017-10-10 Tom Tromey <tom@tromey.com> + + * dwarf-mode.el (dwarf-mode-map): New defvar. + 2017-10-10 Tom Tromey <tromey@sourceware.org> PR 22249 diff --git a/binutils/dwarf-mode.el b/binutils/dwarf-mode.el index a944a77..c2c01ee 100644 --- a/binutils/dwarf-mode.el +++ b/binutils/dwarf-mode.el @@ -141,6 +141,13 @@ A prefix argument means expand all children." (expand-file-name dwarf-file))) (set-buffer-modified-p nil))) +(defvar dwarf-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map special-mode-map) + (define-key map [(control ?m)] #'dwarf-insert-substructure) + map) + "Keymap for dwarf-mode buffers.") + (define-derived-mode dwarf-mode special-mode "DWARF" "Major mode for browsing DWARF output. @@ -151,8 +158,6 @@ A prefix argument means expand all children." (set (make-local-variable 'revert-buffer-function) #'dwarf-do-refresh) (jit-lock-register #'dwarf-fontify-region)) -(define-key dwarf-mode-map [(control ?m)] #'dwarf-insert-substructure) - ;;;###autoload (defun dwarf-browse (file) "Invoke `objdump' and put output into a `dwarf-mode' buffer. |