bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68235: 29.1.90; Switching tabs stops following process output in sel


From: Juri Linkov
Subject: bug#68235: 29.1.90; Switching tabs stops following process output in selected window
Date: Sun, 21 Apr 2024 09:59:28 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>> Thanks, I confirm this completely fixes the original test case.
>
> Should be installed now.  Please have a look.

I noticed that now 'find-alternate-file' has such a problem
that it updates the modification timestamp of the directory.

This is because 'find-alternate-file' calls 'rename-buffer'
before setting back the value of 'buffer-file-name'.
So this code in 'rename-buffer' is fired and changes
the directory modification timestamp:

  if (NILP (BVAR (current_buffer, filename))
      && !NILP (BVAR (current_buffer, auto_save_file_name)))
    call0 (intern ("rename-auto-save-file"));

A possible fix would be to swap the order of
setting of 'buffer-file-name' and 'rename-buffer':

diff --git a/lisp/files.el b/lisp/files.el
index 1e11dd44bad..5ef1160ab18 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2113,15 +2113,15 @@ find-alternate-file
        (rename-buffer oname)))
     (unless (eq (current-buffer) obuf)
       (with-current-buffer obuf
+       ;; Restore original buffer's file names so they can be still
+       ;; used when referencing the now defunct buffer (Bug#68235).
+       (setq buffer-file-name ofile)
+       (setq buffer-file-number onum)
+       (setq buffer-file-truename otrue)
        (unless (get-buffer oname)
          ;; Restore original's buffer name so 'kill-buffer' can use it
          ;; to assign its last name (Bug#68235).
          (rename-buffer oname))
-       ;; Restore original buffer's file names so they can be still
-       ;; used when referencing the now defunct buffer (Bug#68235).
-       (setq buffer-file-name ofile)
-       (setq buffer-file-number onum)
-       (setq buffer-file-truename otrue)
        ;; We already ran these; don't run them again.
        (let (kill-buffer-query-functions kill-buffer-hook)
          (kill-buffer obuf))))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]