mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2026-09-10 07:46:51 -04:00
shadowfile.el uses eqhemeral buffer names now
* etc/NEWS: shadowfile.el uses eqhemeral buffer names now. * lisp/shadowfile.el (shadow-find-file-noselect): New function. (shadow-read-files, shadow-write-info-file) (shadow-write-todo-file): Use it.
This commit is contained in:
parent
073455ccb8
commit
d7fd87b403
5
etc/NEWS
5
etc/NEWS
|
|
@ -3339,6 +3339,11 @@ If an active region exists, the commands 'hi-lock-line-face-buffer' and
|
||||||
'hi-lock-face-phrase-buffer' now use its contents as their default
|
'hi-lock-face-phrase-buffer' now use its contents as their default
|
||||||
value. Previously, only 'hi-lock-face-buffer' supported this.
|
value. Previously, only 'hi-lock-face-buffer' supported this.
|
||||||
|
|
||||||
|
** Shadowfile
|
||||||
|
|
||||||
|
*** 'shadow-info-buffer' and 'shadow-todo-buffer' use eqhemeral buffer names now.
|
||||||
|
This excludes the buffers from save buffer predicates.
|
||||||
|
|
||||||
|
|
||||||
* New Modes and Packages in Emacs 31.1
|
* New Modes and Packages in Emacs 31.1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -667,6 +667,12 @@ PAIR must be `eq' to one of the elements of that list."
|
||||||
(setq shadow-files-to-copy
|
(setq shadow-files-to-copy
|
||||||
(cl-remove-if (lambda (s) (eq s pair)) shadow-files-to-copy)))
|
(cl-remove-if (lambda (s) (eq s pair)) shadow-files-to-copy)))
|
||||||
|
|
||||||
|
(defun shadow-find-file-noselect (filename &optional nowarn)
|
||||||
|
"Like `find-file-noselect', but make buffer name ephemeral."
|
||||||
|
(with-current-buffer (find-file-noselect filename nowarn)
|
||||||
|
(rename-buffer (format " *%s*" (buffer-name)))
|
||||||
|
(current-buffer)))
|
||||||
|
|
||||||
(defun shadow-read-files ()
|
(defun shadow-read-files ()
|
||||||
"Visit and load `shadow-info-file' and `shadow-todo-file'.
|
"Visit and load `shadow-info-file' and `shadow-todo-file'.
|
||||||
Thus restores shadowfile's state from your last Emacs session.
|
Thus restores shadowfile's state from your last Emacs session.
|
||||||
|
|
@ -682,7 +688,7 @@ Return t unless files were locked; then return nil."
|
||||||
(save-current-buffer
|
(save-current-buffer
|
||||||
(when shadow-info-file
|
(when shadow-info-file
|
||||||
(set-buffer (setq shadow-info-buffer
|
(set-buffer (setq shadow-info-buffer
|
||||||
(find-file-noselect shadow-info-file 'nowarn)))
|
(shadow-find-file-noselect shadow-info-file 'nowarn)))
|
||||||
(lisp-data-mode)
|
(lisp-data-mode)
|
||||||
(setq-local lexical-binding t)
|
(setq-local lexical-binding t)
|
||||||
(when (and (not (buffer-modified-p))
|
(when (and (not (buffer-modified-p))
|
||||||
|
|
@ -695,7 +701,7 @@ Return t unless files were locked; then return nil."
|
||||||
(eval-buffer))
|
(eval-buffer))
|
||||||
(when shadow-todo-file
|
(when shadow-todo-file
|
||||||
(set-buffer (setq shadow-todo-buffer
|
(set-buffer (setq shadow-todo-buffer
|
||||||
(find-file-noselect shadow-todo-file 'nowarn)))
|
(shadow-find-file-noselect shadow-todo-file 'nowarn)))
|
||||||
(lisp-data-mode)
|
(lisp-data-mode)
|
||||||
(setq-local lexical-binding t)
|
(setq-local lexical-binding t)
|
||||||
(when (and (not (buffer-modified-p))
|
(when (and (not (buffer-modified-p))
|
||||||
|
|
@ -717,7 +723,8 @@ defined, the old hashtable info is invalid."
|
||||||
(if shadow-info-file
|
(if shadow-info-file
|
||||||
(save-current-buffer
|
(save-current-buffer
|
||||||
(if (not shadow-info-buffer)
|
(if (not shadow-info-buffer)
|
||||||
(setq shadow-info-buffer (find-file-noselect shadow-info-file)))
|
(setq shadow-info-buffer
|
||||||
|
(shadow-find-file-noselect shadow-info-file)))
|
||||||
(set-buffer shadow-info-buffer)
|
(set-buffer shadow-info-buffer)
|
||||||
(setq buffer-read-only nil)
|
(setq buffer-read-only nil)
|
||||||
(delete-region (point-min) (point-max))
|
(delete-region (point-min) (point-max))
|
||||||
|
|
@ -730,7 +737,8 @@ defined, the old hashtable info is invalid."
|
||||||
With non-nil argument also saves the buffer."
|
With non-nil argument also saves the buffer."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(if (not shadow-todo-buffer)
|
(if (not shadow-todo-buffer)
|
||||||
(setq shadow-todo-buffer (find-file-noselect shadow-todo-file)))
|
(setq shadow-todo-buffer
|
||||||
|
(shadow-find-file-noselect shadow-todo-file)))
|
||||||
(set-buffer shadow-todo-buffer)
|
(set-buffer shadow-todo-buffer)
|
||||||
(setq buffer-read-only nil)
|
(setq buffer-read-only nil)
|
||||||
(delete-region (point-min) (point-max))
|
(delete-region (point-min) (point-max))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue