[emacs-w3m:13448] Re: position of tabs not working?

Boruch Baum <[email protected]>
Newsgroups gmane.emacs.w3m
Message-ID <[email protected]>
On 2019-06-07 11:15, Katsumi Yamaoka wrote:
> In [emacs-w3m:13441]
> On Thu, 06 Jun 2019 04:25:46 -0400, 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,
>
> Oh, that's a long standing bug.  Fixed.  Thanks.

I think the commit is buggy. After evaluating the patched function, I
selected w3m buffer #12 out of 28 tabs open, and opened a link in a new
buffer. The new buffer name became "*w3m*<12><2>", and it causes the
original tab #12 to jump in the w3m-select-buffer pop-up to position 2.
It may have also corrupted some data structure somewhere because I'm now
having other problems with moving tabs. What I had before, which seemed
to be working for me was:

(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."
  (when next
    (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)))
    (with-current-buffer new
      (w3m-mode)
      (setq w3m-previous-session-buffer prev))
    new))

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.