From 1fc4bb1fead205e425f69fa803a71f4e446d48a8 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 9 Aug 2025 14:21:23 +0200 Subject: [PATCH] Rename variables *-in-progress-p to *-in-progress * doc/lispref/backups.texi (Reverting): Fix variable names revert-buffer-in-progress and auto-revert-buffer-in-progress. * etc/NEWS: Fix variable names revert-buffer-in-progress and auto-revert-buffer-in-progress. Presentational fixes and improvements. * lisp/autorevert.el (auto-revert-buffer-in-progress): Rename. (auto-revert-handler, auto-revert-buffer): Use renamed variables. * lisp/dired-x.el (dired-omit-expunge): Use `auto-revert-buffer-in-progress'. * lisp/files.el (revert-buffer-in-progress): Rename. (revert-buffer-in-progress-p): Declare obsolete. (after-find-file, revert-buffer): * lisp/saveplace.el (save-place-find-file-hook) (save-place-dired-hook): * lisp/vc/vc-git.el (vc-git-command, vc-git--out-ok): * lisp/vc/vc.el (vc-diff-internal): Use `revert-buffer-in-progress'. * lisp/net/tramp-sh.el (tramp-sh-handle-vc-registered): Suppress warning. --- doc/lispref/backups.texi | 4 ++-- etc/NEWS | 14 ++++++++++++-- lisp/autorevert.el | 6 +++--- lisp/dired-x.el | 2 +- lisp/files.el | 11 ++++++----- lisp/net/tramp-sh.el | 4 +++- lisp/saveplace.el | 4 ++-- lisp/vc/vc-git.el | 4 ++-- lisp/vc/vc.el | 2 +- 9 files changed, 32 insertions(+), 19 deletions(-) diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi index a1df26230aa..9e262346edb 100644 --- a/doc/lispref/backups.texi +++ b/doc/lispref/backups.texi @@ -719,7 +719,7 @@ preserved, but this is up to the specific @code{revert-buffer-function} implementation. @end deffn -@defvar revert-buffer-in-progress-p +@defvar revert-buffer-in-progress @code{revert-buffer} binds this variable to a non-@code{nil} value while it is working. @end defvar @@ -852,7 +852,7 @@ It is important to assure that point does not continuously jump around as a consequence of auto-reverting. Of course, moving point might be inevitable if the buffer radically changes. -@defvar auto-revert-buffer-in-progress-p +@defvar auto-revert-buffer-in-progress @code{auto-revert-buffer} binds this variable to a non-@code{nil} value while it is working. This can be used by major mode @code{revert-buffer-function} implementations to suppress messages in diff --git a/etc/NEWS b/etc/NEWS index 1600e1ce943..f4fdf3d4eec 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -966,7 +966,7 @@ characters in CJK texts. For example, 'A' is converted to 'A', '1' is converted to '1', etc. Companion commands 'halfwidth-region' and 'halfwidth-word' perform the opposite conversion. -** Texinfo Mode +** Texinfo mode --- *** texinfo-mode now can auto-close the ``'' pairs. @@ -2212,6 +2212,16 @@ destination window is chosen using 'display-buffer-alist'. Example: display-buffer-use-some-window) (some-window . mru)))) +** Revert + ++++ +*** Variable 'revert-buffer-in-progress' has been renamed. +The old name, 'revert-buffer-in-progress-p', is kept as obsolete +variable alias. + +Symbol names with a trailing '-p' are reserved for predicates. Calling +a variable like this was a mistake. + ** Autorevert +++ @@ -2226,7 +2236,7 @@ runs its body, and removes the current buffer from 'inhibit-auto-revert-buffers' afterwards. +++ -*** New variable 'auto-revert-buffer-in-progress-p'. +*** New variable 'auto-revert-buffer-in-progress'. 'auto-revert-buffer' binds this variable to a non-nil value while it is working. This can be used by major mode 'revert-buffer-function' implementations to suppress messages in Auto Revert modes, for example. diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 63c7d2928c7..ccedaa759cb 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -330,7 +330,7 @@ seconds, in addition to using notification for those files." ;; Internal variables: ;;;###autoload -(defvar auto-revert-buffer-in-progress-p nil "\ +(defvar auto-revert-buffer-in-progress nil "\ Non-nil if a `auto-revert-buffer' operation is in progress, nil otherwise.") (defvar auto-revert-buffer-list () @@ -875,7 +875,7 @@ This is an internal function used by Auto-Revert Mode." ;; `preserve-modes' avoids changing the (minor) modes. But we do ;; want to reset the mode for VC, so we do it manually. (when (and (not auto-revert-tail-mode) (or revert auto-revert-check-vc-info)) - (let ((revert-buffer-in-progress-p t)) + (let ((revert-buffer-in-progress t)) (vc-refresh-state))))) (defun auto-revert-tail-handler (size) @@ -936,7 +936,7 @@ buffers not reverted last time due to user interruption." This is performed as specified by Auto-Revert and Global Auto-Revert Modes." - (let ((auto-revert-buffer-in-progress-p t)) + (let ((auto-revert-buffer-in-progress t)) (if (not (buffer-live-p buf)) (auto-revert-remove-current-buffer buf) (with-current-buffer buf diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 016b97d34a2..ad602b00a3e 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -477,7 +477,7 @@ status message." (old-modified-p (buffer-modified-p)) (count (or init-count 0)) (dired-omit-verbose - (and dired-omit-verbose (not auto-revert-buffer-in-progress-p)))) + (and dired-omit-verbose (not auto-revert-buffer-in-progress)))) (unless (string= omit-re "") (let ((dired-marker-char dired-omit-marker-char)) (when dired-omit-verbose (message "Omitting...")) diff --git a/lisp/files.el b/lisp/files.el index 4567f91bc8e..5bcfa24e930 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2887,7 +2887,7 @@ error in reading the file. WARN non-nil means warn if there exists an auto-save file more recent than the visited file. NOAUTO means don't mess with auto-save mode. Fourth arg AFTER-FIND-FILE-FROM-REVERT-BUFFER is ignored -\(see `revert-buffer-in-progress-p' for similar functionality). +\(see `revert-buffer-in-progress' for similar functionality). Fifth arg NOMODES non-nil means don't alter the file's modes. Finishes by calling the functions in `find-file-hook' unless NOMODES is non-nil." @@ -7107,9 +7107,10 @@ hook functions. The function `revert-buffer--default' runs this. A customized `revert-buffer-function' need not run this hook.") -(defvar revert-buffer-in-progress-p nil +(defvar revert-buffer-in-progress nil "Non-nil if a `revert-buffer' operation is in progress, nil otherwise.") - +(define-obsolete-variable-alias + 'revert-buffer-in-progress-p 'revert-buffer-in-progress "31.1") (defvar revert-buffer-internal-hook) ;; `revert-buffer-function' was defined long ago to be a function of only @@ -7168,7 +7169,7 @@ revert buffers without querying for confirmation.) Optional third argument PRESERVE-MODES non-nil means don't alter the files modes. Normally we reinitialize them using `normal-mode'. -This function binds `revert-buffer-in-progress-p' non-nil while it operates. +This function binds `revert-buffer-in-progress' non-nil while it operates. This function calls the function that `revert-buffer-function' specifies to do the work, with arguments IGNORE-AUTO and NOCONFIRM. @@ -7189,7 +7190,7 @@ preserve markers and overlays, at the price of being slower." ;; reversal of the argument sense. So I'm just changing the user ;; interface, but leaving the programmatic interface the same. (interactive (list (not current-prefix-arg))) - (let ((revert-buffer-in-progress-p t) + (let ((revert-buffer-in-progress t) (revert-buffer-preserve-modes preserve-modes) restore-functions) (run-hook-wrapped 'revert-buffer-restore-functions diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 576f09b764b..51633f686eb 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3669,6 +3669,8 @@ are \"file-exists-p\", \"file-readable-p\", \"file-directory-p\" and (defun tramp-sh-handle-vc-registered (file) "Like `vc-registered' for Tramp files." (when vc-handled-backends + ;; Starting with Emacs 31, use `revert-buffer-in-progress'. + (with-suppressed-warnings ((obsolete revert-buffer-in-progress-p)) (let ((inhibit-message (or revert-buffer-in-progress-p inhibit-message)) (temp-message (unless revert-buffer-in-progress-p ""))) (with-temp-message temp-message @@ -3728,7 +3730,7 @@ are \"file-exists-p\", \"file-readable-p\", \"file-directory-p\" and ;; Run. (tramp-with-demoted-errors v "Error in 2nd pass of `vc-registered': %s" - (tramp-run-real-handler #'vc-registered (list file)))))))))) + (tramp-run-real-handler #'vc-registered (list file))))))))))) ;;;###tramp-autoload (defun tramp-sh-file-name-handler (operation &rest args) diff --git a/lisp/saveplace.el b/lisp/saveplace.el index 8b8d9a445d7..1f36196408a 100644 --- a/lisp/saveplace.el +++ b/lisp/saveplace.el @@ -444,7 +444,7 @@ It runs the hook `save-place-after-find-file-hook'." save-place-alist)))) (if cell (progn - (or revert-buffer-in-progress-p + (or revert-buffer-in-progress (and (integerp (cdr cell)) (goto-char (cdr cell)))) ;; and make sure it will be saved again for later @@ -467,7 +467,7 @@ This is run via `dired-initial-position-hook', which see." (cell (assoc (if save-place-abbreviate-file-names (abbreviate-file-name item) item) save-place-alist))) - (or revert-buffer-in-progress-p + (or revert-buffer-in-progress (cond ((integerp (cdr cell)) (goto-char (cdr cell))) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 1f5ac7bd289..ab47ef6dadd 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -2488,7 +2488,7 @@ The difference to `vc-do-command' is that this function always invokes '("GIT_LITERAL_PATHSPECS=1")) ;; Avoid repository locking during background operations ;; (bug#21559). - ,@(when revert-buffer-in-progress-p + ,@(when revert-buffer-in-progress '("GIT_OPTIONAL_LOCKS=0"))) process-environment))) (apply #'vc-do-command (or buffer "*vc*") okstatus vc-git-program @@ -2527,7 +2527,7 @@ The difference to `vc-do-command' is that this function always invokes '("GIT_LITERAL_PATHSPECS=1")) ;; Avoid repository locking during background operations ;; (bug#21559). - ,@(when revert-buffer-in-progress-p + ,@(when revert-buffer-in-progress '("GIT_OPTIONAL_LOCKS=0"))) process-environment))) (apply #'process-file vc-git-program nil buffer nil "--no-pager" command args))) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 9383788a0c3..74f25403017 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2286,7 +2286,7 @@ Return t if the buffer had changes, nil otherwise." (if files (vc-coding-system-for-diff (car files)) 'undecided) 'unix)) (orig-diff-buffer-clone - (if revert-buffer-in-progress-p + (if revert-buffer-in-progress (clone-buffer (generate-new-buffer-name " *vc-diff-clone*") nil)))) ;; On MS-Windows and MS-DOS, Diff is likely to produce DOS-style