aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVaino Kauppila <vaino@vke.fi>2026-09-10 16:18:54 +0300
committerVaino Kauppila <vaino@vke.fi>2026-09-10 16:18:54 +0300
commitc53ead9f2f30a6d64907e06472d43d447588b4b2 (patch)
tree54b5c97fcc10942f6fb22bd4a56ce068d5d04ceb
parent74b9de6292b8638348a7595b843a7f22a6064890 (diff)
downloademacs_setup-c53ead9f2f30a6d64907e06472d43d447588b4b2.tar.gz
emacs_setup-c53ead9f2f30a6d64907e06472d43d447588b4b2.zip
Stub org-clock-kill-emacs-query before requiring org-clockHEADmain
Quitting Emacs (C-x C-c / frame close) during startup could randomly fail with 'void-function org-clock-kill-emacs-query'. Cause: Org 9.8's defcustom org-clock-ask-before-exiting has a :set that hooks the function onto kill-emacs-query-functions while (require 'org-clock) is still mid-file -- ~2800 lines before its defun. A quit landing in that window calls the not-yet-defined function. Fix: pre-define a permissive stub (returns t) before the require; the real definition overwrites it when the require completes. Traced via advice on add-hook during config load.
-rw-r--r--emacs.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/emacs.el b/emacs.el
index e13833b..7deabba 100644
--- a/emacs.el
+++ b/emacs.el
@@ -405,6 +405,14 @@
;; Custom org-dblock for weekly time tracking
(require 'cl-lib)
+;; QUIRK (Org 9.8 / Emacs 31): while (require 'org-clock) evaluates its
+;; defcustoms, the :set of org-clock-ask-before-exiting adds
+;; org-clock-kill-emacs-query to kill-emacs-query-functions ~2800 lines
+;; BEFORE the defun that defines it. Quitting inside that window
+;; (e.g. C-x C-c during startup) hits a void-function error. Pre-define
+;; a permissive stub; Org's real definition replaces it once loaded.
+(unless (fboundp 'org-clock-kill-emacs-query)
+ (defun org-clock-kill-emacs-query () t))
(require 'org-clock)
(defun org-dblock-write:weekly (params)