[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: position of tabs not working?
On 2019-06-06 04:25, Boruch Baum wrote:
> There exists a feature for w3m-copy-buffer to select whether to position
> a new tab at the end of the list or next to the current one. That
> feature isn't working for me, in that it is always putting new tabs at
> the end of the list. Looking at the code, function w3m-copy-buffer
> passes an arg NEXT to w3m-generate-new-buffer, but that function seems
> to use the arg only partially, and seems to determine where to place a
> new tab based upon the unrelated variable w3m-use-title-buffer-name.
> Can someone confirm this?
Following is my current working patched version which seems to fix the
issue and also addresses another problem that when NEXT was non-nil,
buffers would be renamed in the form "*w3m*<n><m>" instead of "*w3m*<n>".
This second issue was solved by reversing the order of the dolist. There
was a third issue in sequencing that I think I solved by changing the
way the new buffer number is calculated.
(defun w3m-generate-new-buffer (name &optional next)
"Create and return a buffer with a name based on NAME.
Make the new buffer the next of the current buffer if NEXT is non-nil."
(let* ((tailbufs (let ((w3m-fb-mode nil))
(let ((all-w3m-buffers (w3m-list-buffers)))
(memq (current-buffer) all-w3m-buffers))))
(new-buffer-number (w3m-buffer-number (car tailbufs))))
(when (string-match "\\*w3m\\*\\(<\\([0-9]+\\)>\\)?\\'" name)
(setq name "*w3m*"))
(when (and tailbufs new-buffer-number)
(dolist (buf (reverse (cdr tailbufs)))
(w3m-buffer-set-number buf (1+ (w3m-buffer-number buf))))
(setq name (format "%s<%d>" name (1+ new-buffer-number))))))
(let ((prev (and (eq major-mode 'w3m-mode) (current-buffer)))
(new (generate-new-buffer name)))
(setq w3m-previous-session-buffer prev))
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0