From: Stefan Kangas Date: Mon, 27 May 2024 08:51:54 +0000 (+0200) Subject: Make `idle-update-delay` obsolete X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=04ea351c6141b85469a85dc9195b58cea40807b8;p=emacs.git Make `idle-update-delay` obsolete 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) --- diff --git a/etc/NEWS b/etc/NEWS index 920d7c516cf..c3ba376d822 100644 --- 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 +++ diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index bd68672f905..e2aab1cc1af 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -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) diff --git a/lisp/simple.el b/lisp/simple.el index 6757ecce801..764f809c012 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -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