From de9cd85ad0c897436589b805e8fdc9aba7526603 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 20 Feb 2025 20:36:47 +0800 Subject: [PATCH] Fix signal when first enabling Custom-mode on non-GUI builds * 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 3d2b8092942..16985fb44d7 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -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'. -- 2.39.5