]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix signal when first enabling Custom-mode on non-GUI builds
authorPo Lu <luangruo@yahoo.com>
Thu, 20 Feb 2025 12:36:47 +0000 (20:36 +0800)
committerEshel Yaron <me@eshelyaron.com>
Thu, 20 Feb 2025 21:43:58 +0000 (22:43 +0100)
* lisp/cus-edit.el (Custom-mode): Define tool-bar-map if not
bound and elaborate why this must be arranged.

(cherry picked from commit afd088bd608c0c27f676bbc34a5d596df3db14a1)

lisp/cus-edit.el

index 3d2b80929426c5ad52476c4b367288410a4e2745..16985fb44d7a1a73cebca417c7480bda8b8bd330 100644 (file)
@@ -5468,6 +5468,13 @@ Erase customizations; set options
 Entry to this mode calls the value of `Custom-mode-hook'
 if that value is non-nil."
   (use-local-map custom-mode-map)
+  (when (not (boundp 'tool-bar-map))
+    ;; setq-local will render tool-bar-map buffer local before the form
+    ;; is evaluated, but if tool-bar.el remains unloaded this blv will
+    ;; be unbound and consequently once tool-bar-local-item-from-menu is
+    ;; called and autoloads tool-bar.el, no binding will be created,
+    ;; causing it to signal.
+    (setq tool-bar-map (make-sparse-keymap)))
   (setq-local tool-bar-map
              (or custom-tool-bar-map
                  ;; Set up `custom-tool-bar-map'.