From: Ivan Shmakov <ivan@siamics.net>
To: 18550@debbugs.gnu.org
Subject: bug#18550: eww-history-browse may end up calling eww-restore-history in an arbitrary buffer
Date: Wed, 24 Sep 2014 21:19:07 +0000 [thread overview]
Message-ID: <87tx3wn2d0.fsf@violet.siamics.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1542 bytes --]
Package: emacs
Severity: normal
Shortly: go to *eww*, H, C-x 1, C-x b *foo* RET, C-x b RET, RET,
– the EWW history entry will be rendered in *foo*, /not/ *eww*.
As of 0ee10aff098b, eww-history-browse uses quit-window to leave
the history buffer, switching to the “next” buffer – as per
(buffer-list), – and calls eww-restore-history right there.
While the user may generally be expected to use M-x eww-history
(which makes the current *eww* buffer the “next” one), select an
entry, and M-x eww-history-browse it, – it’s also possible for
the user to switch buffers arbitrarily between the calls. This
way, quit-window may select a completely unrelated buffer, and
eww-restore-history will then call (erase-buffer) for it.
(Naturally, that gets much worse if the buffer that the user
choose to take a look at actually has some important data.)
As for #16211, my suggestion would be to employ a separate
buffer-local variable to track the current “browsing” buffer.
In the patch MIMEd, I assume that it’s named eww-current-buffer
(just like in the #16211 patch), although eww-browsing-buffer
seems like a more appropriate name to me now.
As suggested, the code behaves as before when the variable is
nil. It may make sense to raise an error in that case instead,
so to avoid possible corruption of an arbitrary buffer.
PS. Beware of the loose line numbers in the diff.
--
FSF associate member #7257 http://boycottsystemd.org/ … 3013 B6A0 230E 334A
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/diff, Size: 814 bytes --]
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1290,9 +1290,11 @@ defun eww-list-histories ()
(interactive)
(when (null eww-history)
(error "No eww-histories are defined"))
- (let ((eww-history-trans eww-history))
+ (let ((eww-history-trans eww-history)
+ (buffer (current-buffer)))
(set-buffer (get-buffer-create "*eww history*"))
(eww-history-mode)
+ (setq-local eww-current-buffer buffer)
(let ((inhibit-read-only t)
(domain-length 0)
(title-length 0)
@@ -1302,6 +1304,9 @@ defun eww-history-browse ()
(unless history
(error "No history on the current line"))
- (quit-window)
+ (let ((buffer eww-current-buffer))
+ (quit-window)
+ (when buffer
+ (switch-to-buffer buffer)))
(eww-restore-history history)))
(defvar eww-history-mode-map
next reply other threads:[~2014-09-24 21:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-24 21:19 Ivan Shmakov [this message]
2014-11-13 17:03 ` bug#18550: eww-history-browse may end up calling eww-restore-history in an arbitrary buffer Lars Magne Ingebrigtsen
2014-11-13 17:14 ` Lars Magne Ingebrigtsen
2014-11-19 11:30 ` Ivan Shmakov
2014-11-19 17:25 ` Lars Magne Ingebrigtsen
2014-11-25 15:40 ` Ivan Shmakov
2014-12-07 19:38 ` Lars Magne Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tx3wn2d0.fsf@violet.siamics.net \
--to=ivan@siamics.net \
--cc=18550@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).