GNU bug report logs -
#21555
25.0.50; per-project *vc-change-log* buffers
Previous Next
Reported by: Tom Tromey <tom <at> tromey.com>
Date: Thu, 24 Sep 2015 21:50:02 UTC
Severity: wishlist
Tags: moreinfo
Found in version 25.0.50
Done: Sean Whitton <spwhitton <at> spwhitton.name>
Full log
View this message in rfc822 format
>>> You can already do something similar by using C-x x u to rename the
>>> *vc-change-log* buffer, and then 'g' inside it works to regenerate it.
>> Or (add-hook 'log-view-mode-hook 'rename-uniquely)
>
> Could we have a function that would do such a renaming, but only when
> project differs? E.g. it would take the base buffer name and add the
> abbreviated project root to it.
>
> We could call it 'rename-prefixed-with-project' or something like that.
I tried it, and this works nicely:
#+begin_src emacs-lisp
(defun project-rename-uniquely ()
(interactive)
(if-let* ((project (project-current)))
(let ((base-name (replace-regexp-in-string
"\\`\\*\\(.*\\)\\*\\(?:<[0-9]+>\\)?\\'" "\\1"
(buffer-name))))
(rename-buffer (generate-new-buffer-name
(project-prefixed-buffer-name base-name)))
(force-mode-line-update))
(rename-uniquely)))
(add-hook 'log-view-mode-hook 'project-rename-uniquely)
(add-hook 'diff-mode-hook 'project-rename-uniquely)
#+end_src
> This way one would only have as many log-view buffers as they have projects
> open.
Ah, you meant one buffer per project? Then maybe add another
similar function without 'generate-new-buffer-name'?
But then it fails with the error "Buffer name is in use".
This means that for one buffer per project the changes should be
in vc and project like in the patch provided by Matthias.
> Might even fix the revert-buffer issue?
The revert-buffer issue can't be fixed with 'generate-new-buffer-name'.
This bug report was last modified 14 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.