]> git.eshelyaron.com Git - emacs.git/commitdiff
(compilation-mode-tool-bar-map): Check if tool-bar-map has been
authorChong Yidong <cyd@stupidchicken.com>
Sun, 12 Oct 2008 13:46:28 +0000 (13:46 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sun, 12 Oct 2008 13:46:28 +0000 (13:46 +0000)
initialized before setting it up.

lisp/progmodes/compile.el

index f6e15d0ba4e8c9a4691455479aa95ad1bf8bf3b3..2405efb2ba33a0cf63dc2a81c177fefb7b114c38 100644 (file)
@@ -1471,25 +1471,28 @@ Returns the compilation buffer created."
 `compilation-minor-mode-map' is a parent of this.")
 
 (defvar compilation-mode-tool-bar-map
-  (let ((map (butlast (copy-keymap tool-bar-map)))
-       (help (last tool-bar-map))) ;; Keep Help last in tool bar
-    (tool-bar-local-item
-     "left-arrow" 'previous-error-no-select 'previous-error-no-select map
-     :rtl "right-arrow"
-     :help "Goto previous error")
-    (tool-bar-local-item
-     "right-arrow" 'next-error-no-select 'next-error-no-select map
-     :rtl "left-arrow"
-     :help "Goto next error")
-    (tool-bar-local-item
-     "cancel" 'kill-compilation 'kill-compilation map
-     :enable '(let ((buffer (compilation-find-buffer)))
-               (get-buffer-process buffer))
-     :help "Stop compilation")
-    (tool-bar-local-item
-     "refresh" 'recompile 'recompile map
-     :help "Restart compilation")
-    (append map help)))
+  ;; When bootstrapping, tool-bar-map is not properly initialized yet,
+  ;; so don't do anything.
+  (when (keymapp (butlast tool-bar-map))
+    (let ((map (butlast (copy-keymap tool-bar-map)))
+         (help (last tool-bar-map))) ;; Keep Help last in tool bar
+      (tool-bar-local-item
+       "left-arrow" 'previous-error-no-select 'previous-error-no-select map
+       :rtl "right-arrow"
+       :help "Goto previous error")
+      (tool-bar-local-item
+       "right-arrow" 'next-error-no-select 'next-error-no-select map
+       :rtl "left-arrow"
+       :help "Goto next error")
+      (tool-bar-local-item
+       "cancel" 'kill-compilation 'kill-compilation map
+       :enable '(let ((buffer (compilation-find-buffer)))
+                 (get-buffer-process buffer))
+       :help "Stop compilation")
+      (tool-bar-local-item
+       "refresh" 'recompile 'recompile map
+       :help "Restart compilation")
+      (append map help))))
 
 (put 'compilation-mode 'mode-class 'special)