]> git.eshelyaron.com Git - emacs.git/commitdiff
(custom-tool-bar-map): Move initialization of this
authorMartin Rudalics <rudalics@gmx.at>
Sun, 6 Jan 2008 09:49:16 +0000 (09:49 +0000)
committerMartin Rudalics <rudalics@gmx.at>
Sun, 6 Jan 2008 09:49:16 +0000 (09:49 +0000)
keymap from here ...
(custom-mode): ... to here.

lisp/ChangeLog
lisp/cus-edit.el

index 9665c6cd561bfc67bda9a67d20083f2d4d030668..caa9c0f71f15514e2922793db1a578bdb77f1198 100644 (file)
@@ -1,3 +1,9 @@
+2008-01-06  Martin Rudalics  <rudalics@gmx.at>
+
+       * cus-edit.el (custom-tool-bar-map): Move initialization of this
+       keymap from here ...
+       (custom-mode): ... to here.  Reported by Reiner Steib.
+
 2008-01-06  Dan Nicolaescu  <dann@ics.uci.edu>
 
        * obsolete/x-apollo.el: Remove file for unsupported system.
index b46981f137b611dd4cd739f6ef7db2f1b36d141d..c1071f3b3efffb5c8d4af793a234de48ee63a90d 100644 (file)
@@ -1,7 +1,7 @@
 ;;; cus-edit.el --- tools for customizing Emacs and Lisp packages
 ;;
 ;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Maintainer: FSF
@@ -4465,15 +4465,12 @@ The format is suitable for use with `easy-menu-define'."
                 custom-commands)))
 
 (defvar tool-bar-map)
-(defvar custom-tool-bar-map
-  (if (display-graphic-p)
-      (let ((map (make-sparse-keymap)))
-       (mapc
-        (lambda (arg)
-          (tool-bar-local-item-from-menu
-           (nth 1 arg) (nth 4 arg) map custom-mode-map))
-        custom-commands)
-       map)))
+
+;;; `custom-tool-bar-map' used to be set up here.  This will fail to
+;;; DTRT when `display-graphic-p' returns nil during compilation.  Hence
+;;; we set this up lazily in `custom-mode'.
+(defvar custom-tool-bar-map nil
+  "Keymap for toolbar in Custom mode.")
 
 ;;; The Custom Mode.
 
@@ -4534,7 +4531,17 @@ Entry to this mode calls the value of `custom-mode-hook'
 if that value is non-nil."
   (use-local-map custom-mode-map)
   (easy-menu-add Custom-mode-menu)
-  (set (make-local-variable 'tool-bar-map) custom-tool-bar-map)
+  (when (display-graphic-p)
+    (set (make-local-variable 'tool-bar-map)
+        (or custom-tool-bar-map
+            ;; Set up `custom-tool-bar-map'.
+            (let ((map (make-sparse-keymap)))
+              (mapc
+               (lambda (arg)
+                 (tool-bar-local-item-from-menu
+                  (nth 1 arg) (nth 4 arg) map custom-mode-map))
+               custom-commands)
+              (setq custom-tool-bar-map map)))))
   (make-local-variable 'custom-options)
   (make-local-variable 'custom-local-buffer)
   (make-local-variable 'widget-documentation-face)