]> git.eshelyaron.com Git - emacs.git/commitdiff
Make `idle-update-delay` obsolete
authorStefan Kangas <stefankangas@gmail.com>
Mon, 27 May 2024 08:51:54 +0000 (10:51 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 27 May 2024 20:27:21 +0000 (22:27 +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'.

(cherry picked from commit a212687e24fb6a7492db28e62070b03b43784660)

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

index 920d7c516cf49c43667308dd4e6fdb321b85c107..c3ba376d822fd43e40de80897afc5ef0293b1c38 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1163,6 +1163,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 bd68672f9058cd1c5fefb36336b528a6b0257302..e2aab1cc1af45b155779a5914c1fb8508f21490d 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 6757ecce8013743c39ba23768854becb44101594..764f809c01212ef890acbf0e979ec2524cbc54f2 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