From c53ead9f2f30a6d64907e06472d43d447588b4b2 Mon Sep 17 00:00:00 2001 From: Vaino Kauppila Date: Thu, 10 Sep 2026 16:18:54 +0300 Subject: Stub org-clock-kill-emacs-query before requiring org-clock 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. --- emacs.el | 8 ++++++++ 1 file changed, 8 insertions(+) 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) -- cgit v1.3