Make `idle-update-delay` obsolete
authorStefan Kangas <stefankangas@gmail.com>
Mon, 27 May 2024 08:51:54 +0000 (10:51 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Mon, 27 May 2024 08:51:54 +0000 (10:51 +0200)
This user option was introduced in 2003, and was advertised as a general
variable for a "delay before updating various things on the screen".
But this has never been true: it was only used by 'which-function-mode',
and, to make matters worse, users of that mode would basically never
know that this user option existed without reading the code.

Conversely, users that did find the user option would be surprised to
see that it only took effect in 'which-func-mode'.

The lack of other users of 'idle-update-delay' reveals that it has not
been considered generally useful.  Thus, it makes more sense to
introduce a new mode specific user option `which-func-update-delay`, and
to mark the old one obsolete.

* lisp/simple.el (idle-update-delay): Make obsolete.
* lisp/progmodes/which-func.el (which-func-update-delay): New defcustom.
(which-function-mode): Use above new defcustom instead of
'idle-update-delay'.

etc/NEWS
lisp/progmodes/which-func.el
lisp/simple.el

index d058acc35723c67ca1edc60bca2f7da90a6ef2f3..ea8729f39391ad50faab560d1e5276d84b20fae5 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1071,6 +1071,13 @@ function name is displayed.  The default is 'mode' to display in the
 mode line.  'header' will display in the header line;
 'mode-and-header' displays in both the header line and mode line.
 
++++
+*** New user option 'which-func-update-delay'.
+This replaces the user option 'idle-update-delay', which was previously
+used to control the delay before `which-function-mode` updated its
+display.  The user option 'idle-update-delay', which was only used by
+Which Function mode, is now obsolete.
+
 ** Tramp
 
 +++
index b36e13104e3533b55d7efd368894b636a494acb1..e928999ab5eec81ec76aba7594e3cad66052629b 100644 (file)
@@ -107,6 +107,17 @@ long time to send the information, you can use this option to delay
 activation of Which Function until Imenu is used for the first time."
   :type 'integer)
 
+(defcustom which-func-update-delay
+  ;; Backwards-compatibility: if users had changed this before
+  ;; `idle-update-delay' was declared obsolete, let's respect that.
+  (if (/= idle-update-delay 0.5) idle-update-delay 0.5)
+  "Idle time delay before `which-function-mode` updates its display.
+When point moves, wait this many seconds after Emacs becomes idle before
+doing an update."
+  :type 'number
+  :group 'display
+  :version "30.1")
+
 (defvar which-func-keymap
   (let ((map (make-sparse-keymap)))
     (define-key map [mode-line mouse-1] 'beginning-of-defun)
@@ -293,9 +304,9 @@ in certain major modes."
     (cancel-timer which-func-update-timer))
   (setq which-func-update-timer nil)
   (when which-function-mode
-    ;;Turn it on.
+    ;; Turn it on.
     (setq which-func-update-timer
-          (run-with-idle-timer idle-update-delay t #'which-func-update)))
+          (run-with-idle-timer which-func-update-delay t #'which-func-update)))
   (dolist (buf (buffer-list))
     (with-current-buffer buf
       (which-func--header-line-remove)
index ae8a824cb54380c9810764d1a7390bdf1c3af4d5..88a4a388518f22072baea51f573c9af4c17ac106 100644 (file)
@@ -37,6 +37,7 @@
 (defvar compilation-current-error)
 (defvar compilation-context-lines)
 
+(make-obsolete-variable 'idle-update-delay 'which-func-update-delay "30.1")
 (defcustom idle-update-delay 0.5
   "Idle time delay before updating various things on the screen.
 Various Emacs features that update auxiliary information when point moves