[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: bugs related to tabs

On 2019-05-22 09:22, Boruch Baum wrote:
> On 2019-05-22 07:59, Boruch Baum wrote:
> > On 2019-05-22 15:54, Katsumi Yamaoka wrote:
> > > ...
> > > 1.
> > >   In the emacs-w3m home page <http://emacs-w3m.namazu.org/>,
> > > when I type <S-return> (`w3m-view-this-url-new-session') on
> > > the name link `Features', the new tab appears and it shows
> > > the Features section of the page.  That's ok.  However, if I
> > > switch the tab to the original one, I can see the Features
> > > section shown also there.  But what the original tab displays
> > > should not be changed of course.
> >
> > I can reproduce this bug by performing "M-x
> > w3m-view-this-url-new-session" and "C-u C-u M-x w3m-view-this-url", but
> > it does seem to function correctly when performing "M-x
> > w3m-goto-url-new-session".
> Does the following fix the situation for you?
> (defun w3m-view-this-url-new-session ()
>   "Display the page of the link under point in a new session.
> If the region is active, use the `w3m-open-all-links-in-new-session'
> command instead."
>   (interactive)
>   (if (w3m-region-active-p)
>       (call-interactively 'w3m-open-all-links-in-new-session)
>     (let ((url (w3m-url-valid (w3m-anchor))))
>       (if url
>         (w3m-goto-url-new-session url)
> ;      (w3m--message t 'w3m-error "No URL at point")))))
>        (w3m-message "No URL at point")))))
> There is much duplication between the code of w3m-goto... and
> w3m-view..., the only difference I can see from the user's perspective
> is that w3m-view... doesn't prompt the user. If that's correct, then
> much more of the code could be combined, and that would make maintenance
> that much easier.

Following should be a better fix, instead of the above patch, ie. keep
`w3m-view-this-url-new-session' in its original orm.

(defun w3m-view-this-url (&optional reload new-session)
  "Display the page pointed to by the link under point.
If ARG is the number 2 or the list of the number 16 (you may produce
this by typing `C-u' twice) or NEW-SESSION is non-nil and the link is
an anchor, this function makes a copy of the current buffer in advance.
Otherwise, if RELOAD is non-nil, it forces to reload the url at point."
  (interactive (if (member current-prefix-arg '(2 (16)))
		   (list nil t)
		 (list current-prefix-arg nil)))
  ;; Store the current position in the history structure.
  (let ((w3m-prefer-cache
	 (or w3m-prefer-cache
	     (and (stringp w3m-current-url)
		  (string-match "\\`about://\\(?:db-\\)?history/"
	act url)
     ((setq act (w3m-action))
      (let ((w3m-form-new-session new-session)
	    (w3m-form-download nil))
	(eval act)))
     ((setq url (w3m-url-valid (w3m-anchor)))
;     (w3m-view-this-url-1 url reload new-session))
      (if new-session
        (w3m-goto-url-new-session url reload)
       (w3m-goto-url url reload)))
     ((w3m-url-valid (w3m-image))
      (if (w3m-display-graphic-p)
     ((setq url (w3m-active-region-or-url-at-point 'never))
      (unless (eq 'quit (setq url (w3m-input-url nil url 'quit nil
						 'feeling-searchy 'no-initial)))
;	(w3m-view-this-url-1 url reload new-session)))
      (if new-session
        (w3m-goto-url-new-session url reload)
       (w3m-goto-url url reload))))
;    (t (w3m--message t 'w3m-error "No URL at point"))))
     (t (w3m-message "No URL at point")))))

CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0