[emacs-w3m:13566] Re: [emacs-w3m/emacs-w3m] w3m-next/previous-anchor no more working in buffers formatted with w3m-region (#71)
Thierry Volpiatto <[email protected]>
| Newsgroups | gmane.emacs.w3m |
|---|---|
| Message-ID | <emacs-w3m/emacs-w3m/issues/71/[email protected]> |
Thanks for your answer. yamaoka <[email protected]> writes: > I vaguely guess you are running w3m-next-anchor or w3m-previous-anchor > in a buffer in which formatted web contents are copied from a temp > buffer where w3m-region runs to format an html source. Not exactly, here what I use: (setq mu4e-html2text-command (cond ((fboundp 'w3m) ;; Use emacs-w3m (lambda () (w3m-region (point-min) (point-max)))) ((executable-find "w3m") ;; Use w3m shell-command "w3m -T text/html") (t 'html2text))) Then mu4e funcall this function. I then use a command that use w3m-next-anchor: (defun tv/mu4e-next-anchor () (interactive) (require 'w3m) (or (stringp (w3m-next-anchor)) (let ((pos (point))) (when (eq (get-text-property (point) 'face) 'mu4e-link-face) (setq pos (next-single-property-change (point) 'face))) (let ((next-url (and pos (or (text-property-any pos (point-max) 'face 'mu4e-link-face) (text-property-any (point-min) (point-max) 'face 'mu4e-link-face))))) (and next-url (goto-char next-url)))))) Setting w3m-max-anchor-sequence at beginning of this function works. > If so, at least the local variable w3m-max-anchor-sequence should > also be copied, for example: > > (let (formatted-contents max-anchor) > (set-buffer mu4e-buffer) > (with-temp-buffer > (insert an-html-contents) > (w3m-region (point-min) (point-max)) > (setq formatted-contents (buffer-string) > max-anchor w3m-max-anchor-sequence)) > (insert formatted-contents) > (setq w3m-max-anchor-sequence max-anchor)) Hmm, I hardly see how this could work properly, w3m-max-anchor-sequence would still remain to nil. Why don't you use make-local-variable instead of make-variable-buffer-local? This would be much simpler, you could give at beginning a reasonable default value and set it directly in each w3m buffer when needed. Thanks. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/emacs-w3m/emacs-w3m/issues/71#issuecomment-536897463