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

w3m-view-this-url-new-session in background



Ok,

I post here instead of with M-x report-emacs-w3m-bug since it is broken
for me (see my last message).

What I want to have is what S-RET (w3m-view-this-url-new-session) does
but in the background - a feature that is known from other web browsers.
That doesn't exist in w3m yet (at this level), correct?

If not, I would suggest to add it.  Or better use the currently unused
prefix arg of `w3m-view-this-url-new-session' to control the behavior.
I think ideally the default should be user configurable, and the prefix
arg would should the default behavior.

Seems w3m has all capabilities to do what I want, but it's not simple to
get it as a user.  Currently I use this hack:

#+begin_src emacs-lisp
(advice-add 'w3m-view-this-url-new-session :around
            (defun my-w3m-view-this-url-new-session-in-backgound (f &rest args)
              (cl-letf* ((w3m-goto-url-new-session--orig
                          (indirect-function 'w3m-goto-url-new-session))
                         ((symbol-function 'w3m-goto-url-new-session)
                          (lambda (&rest args)
                            (apply w3m-goto-url-new-session--orig
                                   (if current-prefix-arg args
                                     (mapcar
                                      (lambda (i)
                                        (if (< i 5) (nth i args) (not (nth i args))))
                                      (number-sequence 0 5)))))))
                (apply f args))))
#+end_src

Of course this obviously is really just a hack, I guess a BACKGROUND
flag should somehow be passed by the code up to the place where
`w3m-goto-url-new-session' gets called.

TIA,

Michael.