Bind keys in dwarf-mode-map definition
[deliverable/binutils-gdb.git] / binutils / dwarf-mode.el
index f95319ded5cfcd7bd2152d2a9ff553dd921035fd..c2c01ee745b520cb04428560709889a5c47068f2 100644 (file)
@@ -1,6 +1,8 @@
 ;;; dwarf-mode.el --- Browser for DWARF information.
 
-;; Version: 1.0
+;; Version: 1.3
+
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
 
 ;; This file is not part of GNU Emacs, but is distributed under the
 ;; same terms:
@@ -56,7 +58,7 @@
   (beginning-of-line)
   (unless (looking-at "^ <\\([0-9]+\\)>")
     (error "Unrecognized line."))
-  (let ((new-depth (1+ (string-to-int (match-string 1)))))
+  (let ((new-depth (1+ (string-to-number (match-string 1)))))
     (dwarf-do-insert-substructure new-depth die)))
 
 (defun dwarf-insert-substructure (arg)
@@ -96,7 +98,7 @@ A prefix argument means expand all children."
   'action #'dwarf-die-button-action)
 
 ;; Helper regexp to match a DIE reference.
-(defconst dwarf-die-reference ": \\(<0x\\([0-9a-f]+\\)>\\)\\s *$")
+(defconst dwarf-die-reference "\\(<0x\\([0-9a-f]+\\)>\\)")
 
 ;; Helper regexp to match a `...' indicating that there are hidden
 ;; children.
@@ -139,7 +141,13 @@ A prefix argument means expand all children."
                    (expand-file-name dwarf-file)))
     (set-buffer-modified-p nil)))
 
-;;;###autoload
+(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.
 
@@ -150,9 +158,7 @@ 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
+;;;###autoload
 (defun dwarf-browse (file)
   "Invoke `objdump' and put output into a `dwarf-mode' buffer.
 This is the main interface to `dwarf-mode'."
@@ -161,7 +167,10 @@ This is the main interface to `dwarf-mode'."
         (buffer (generate-new-buffer (concat "*DWARF for " base-name "*"))))
     (pop-to-buffer buffer)
     (dwarf-mode)
+    (setq default-directory (file-name-directory file))
     (set (make-local-variable 'dwarf-file) file)
     (dwarf-do-refresh)))
 
 (provide 'dwarf-mode)
+
+;;; dwarf-mode.el ends here
This page took 0.024689 seconds and 4 git commands to generate.