# HG changeset patch # User Chong Yidong # Date 1223819173 0 # Node ID 90b078ed2dc4a271f5e96a4044afba7e61ba0864 # Parent f19f5a4863df1f463fef413b62f484ebd1400387 (grep-mode-tool-bar-map): Check if tool-bar-map has been initialized before setting it up. diff -r f19f5a4863df -r 90b078ed2dc4 lisp/progmodes/grep.el --- a/lisp/progmodes/grep.el Sun Oct 12 13:45:58 2008 +0000 +++ b/lisp/progmodes/grep.el Sun Oct 12 13:46:13 2008 +0000 @@ -228,25 +228,28 @@ `compilation-minor-mode-map' is a cdr of this.") (defvar grep-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 match") - (tool-bar-local-item - "right-arrow" 'next-error-no-select 'next-error-no-select map - :rtl "left-arrow" - :help "Goto next match") - (tool-bar-local-item - "cancel" 'kill-compilation 'kill-compilation map - :enable '(let ((buffer (compilation-find-buffer))) - (get-buffer-process buffer)) - :help "Stop grep") - (tool-bar-local-item - "refresh" 'recompile 'recompile map - :help "Restart grep") - (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 match") + (tool-bar-local-item + "right-arrow" 'next-error-no-select 'next-error-no-select map + :rtl "left-arrow" + :help "Goto next match") + (tool-bar-local-item + "cancel" 'kill-compilation 'kill-compilation map + :enable '(let ((buffer (compilation-find-buffer))) + (get-buffer-process buffer)) + :help "Stop grep") + (tool-bar-local-item + "refresh" 'recompile 'recompile map + :help "Restart grep") + (append map help)))) (defalias 'kill-grep 'kill-compilation)