[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65905: 30.0.50; Consider changing info buffer names to info<(org)> r
From: |
Vladimir Nikishkin |
Subject: |
bug#65905: 30.0.50; Consider changing info buffer names to info<(org)> rather than info<3> |
Date: |
Wed, 13 Sep 2023 22:04:31 +0800 |
User-agent: |
mu4e 1.10.7; emacs 30.0.50 |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Vladimir Nikishkin <lockywolf@gmail.com>
>> Date: Wed, 13 Sep 2023 12:09:48 +0800
>>
>>
>> Dear Emacs Developers,
>>
>> I would like to ask for a small usability improvement to Emacs. Could we
>> name info buffers as "info<(manual)>" (or, maybe, just
>> "info<org.info>"), not as "info<3>"? I do not always remember in which
>> order I open info manuals, and having a file name in the buffer name
>> should be nice an easily readable.
>
> Did you try using "C-h R"? It will find the existing Info buffer
> without your need to remember any numbers. Just type
>
> C-h R org RET
>
> I have dozens of Info manuals in my Emacs sessions, and I always use
> "C-h R" to get to those whose numbers I don't remember (which is all
> but the 2 Emacs manuals).
But it's not the same thing, is it?
If I open some manual recently and then forget its name, how do I switch
back _to that manual which I have been reading in the past hour but
which name I do not remember_?
At the moment I have installed an advice:
#+begin_src
(advice-add 'info-display-manual :after
(lambda (x)
(rename-buffer (seq-concatenate 'string "info<"
(file-name-nondirectory Info-current-file) ">"))))
#+end_src
I also have a hack to show buffer names in window titles, and seeing
there info<org> is nicer than info<3>.
(But that snippet is a little suboptimal, so I am a little hesitant to
show it.)
#+begin_src elisp
(defvar-local lockywolf/org-buffer-memoized-title nil)
(defun lockywolf/generate-frame-title ()
"Generated frame title from all buffers."
(interactive)
(let* ((retval "")
(nwin (let ((nwin 0))
(walk-window-tree
(lambda (x) (setf nwin (+ 1 nwin))))
nwin))
(maxlen (if (= nwin 1) 999 11)))
;; (message "lwf:debug:nwin=%s" nwin)
(walk-window-tree
(lambda (x)
;; (message "mode=%s" major-mode)
(defun truncate-title (title)
(seq-subseq
title
0
(min maxlen (seq-length title))))
(setf retval
(seq-concatenate
'string
retval
" "
(let ((wb (window-buffer x)))
(with-current-buffer wb
(truncate-title
(if (not (equalp major-mode 'org-mode))
(buffer-name wb)
;;;;; org-get-title is super slow
;; (progn
;; (if (buffer-modified-p)
;; (setf lockywolf/org-buffer-memoized-title
(org-get-title)))
;; (if (equalp nil
lockywolf/org-buffer-memoized-title)
;; (setf lockywolf/org-buffer-memoized-title
(buffer-name wb)))
;; lockywolf/org-buffer-memoized-title)
(seq-concatenate 'string "TMP:" (buffer-name wb))
))
))))))
(setf (frame-parameter nil 'name) retval)
retval))
(setq-default frame-title-format '(:eval (lockywolf/generate-frame-title)))
#+end_src
--
Your sincerely,
Vladimir Nikishkin (MiEr, lockywolf)
(Laptop)