mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Persist Log View mode marks across buffer revert
* lisp/vc/log-view.el (vc-exec-after): Autoload. (log-view--restore-marks): New function. (log-view-mode): Add it to revert-buffer-restore-functions.
This commit is contained in:
parent
e233513d28
commit
4cc42911ed
1 changed files with 18 additions and 0 deletions
|
|
@ -117,6 +117,8 @@
|
|||
(autoload 'vc--pick-or-revert "vc")
|
||||
(autoload 'vc--remove-revisions-from-end "vc")
|
||||
(autoload 'vc--prompt-other-working-tree "vc")
|
||||
(autoload 'vc-exec-after "vc-dispatcher")
|
||||
(eval-when-compile (require 'vc-dispatcher))
|
||||
|
||||
(defvar cvs-minor-wrap-function)
|
||||
(defvar cvs-force-command)
|
||||
|
|
@ -276,6 +278,8 @@ The match group number 1 should match the revision number itself.")
|
|||
(setq-local cvs-minor-wrap-function #'log-view-minor-wrap)
|
||||
(setq-local project-find-matching-buffer-function
|
||||
#'project-change-to-matching-directory)
|
||||
(add-hook 'revert-buffer-restore-functions #'log-view--restore-marks
|
||||
nil t)
|
||||
(hack-dir-local-variables-non-file-buffer))
|
||||
|
||||
;;;;
|
||||
|
|
@ -471,6 +475,20 @@ See `log-view-mark-entry'."
|
|||
(setq pos (overlay-end ov))))
|
||||
marked-list)))
|
||||
|
||||
(defun log-view--restore-marks ()
|
||||
"Return a function to restore log entry marks after `revert-buffer'.
|
||||
Added to `revert-buffer-restore-functions' by Log View mode."
|
||||
(let ((table (make-hash-table :test #'equal)))
|
||||
(dolist (mark (log-view-get-marked))
|
||||
(puthash mark t table))
|
||||
(lambda ()
|
||||
(vc-run-delayed
|
||||
(log-view--mark-unmark (lambda ()
|
||||
(if (gethash (log-view-current-tag) table)
|
||||
(log-view--mark-entry)
|
||||
(log-view-msg-next 1)))
|
||||
nil (point-min) (point-max))))))
|
||||
|
||||
(defun log-view-toggle-entry-display ()
|
||||
"If possible, expand the current Log View entry.
|
||||
This calls `log-view-expanded-log-entry-function' to do the work."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue