unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
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: Tue, 25 Nov 2014 15:40:06 +0000	[thread overview]
Message-ID: <87a93fs2zt.fsf@violet.siamics.net> (raw)
In-Reply-To: <m34mtvp0ey.fsf@stories.gnus.org> (Lars Magne Ingebrigtsen's message of "Wed, 19 Nov 2014 18:25:57 +0100")

>>>>> Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
>>>>> Ivan Shmakov <ivan@siamics.net> writes:

 >> I see no reason to abuse quit-window for what’s essentially
 >> switching to a buffer to edit one.  That is: the eww-restore-history
 >> call right after quit-window edits the /current/ buffer.  Thus, it
 >> indeed makes sense to explicitly use set-buffer before that.  (Or to
 >> wrap the call in with-current-buffer, anyway.)

 >> Moreover, vc.el already uses a dedicated buffer-local variable for a
 >> similar purpose, and so does rcirc.el, and perhaps a few more modes
 >> out there.

 > I think you're arguing against yourself here.

	Not in the least.

 > If this is such a common thing to do, then something in this setup
 > should provide this functionality, so that all these modes don't have
 > to implement it again and again.

	The vc-parent-buffer variable is /not/ used just to get back to
	the controlled file’s buffer; instead, it allows for the VC
	commands to be used in the associated buffers /as if/ they were
	invoked in the file’s own one.  As in: the user does C-x v = to
	see the diff; finds something of interest, and – whoa! – the VC
	log is only C-x v l away.

	In the case of eww-history-browse, (quit-window) is part of the
	user interface, and I’m perfectly fine with it.  (Although I
	/do/ imagine a use case which would require eww-history-browse
	to leave the history window in place.)

	On the contrary, the requirement to be invoked in the right
	buffer is part of the eww-restore-history calling convention.
	Even though the users may have different opinions regarding
	which buffer or window (if any) to select upon finishing with
	the history, the necessity to call eww-restore-history from the
	right one remains entirely the same.

	There is indeed some freedom with respect to the location the
	EWW buffer proper gets referenced from, – it could be a variable
	(as I’ve suggested before), a text property, or some arcane
	location quit-window would use.  However, I’d like to note that
	I currently also use EWW to render previews of the buffer’s
	MediaWiki markup [1], and that already benefits from having the
	target EWW buffer linked via a buffer-local variable.  (Contrary
	to, say, M-x mml-preview, it /is/ reasonable to direct the
	output into a single buffer for all the repeated uses of the
	command in the same “source” buffer, thanks to this very
	“history” feature EWW provides.)

[1] http://am-1.org/~ivan/archives/git/gitweb.cgi?p=mw-el-2014.git;a=blob;f=mw-eww.el

	I presume that such an approach will hold for the other cases
	where a given buffer’s contents needs to be rendered with EWW,
	possibly after passing through a specific local (say,
	$ markdown) or remote software.  It’s even possible to provide
	an M-x eww-preview command of some kind for that very purpose.
	The command will either use the (live) buffer pointed to by this
	new buffer-local variable; or will search for one, or create one
	anew, possibly by running a user-specified function or hook.

	(The command would employ one another hook to perform the
	conversion of the source data into HTML.)

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A





  reply	other threads:[~2014-11-25 15:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24 21:19 bug#18550: eww-history-browse may end up calling eww-restore-history in an arbitrary buffer Ivan Shmakov
2014-11-13 17:03 ` 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 [this message]
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=87a93fs2zt.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).