unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ivan Shmakov <ivan@siamics.net>
To: 19556@debbugs.gnu.org
Subject: bug#19556: eww: make URI rewriting fully customizable
Date: Sat, 10 Jan 2015 15:59:22 +0000	[thread overview]
Message-ID: <87a91q1vad.fsf@violet.siamics.net> (raw)
In-Reply-To: <m3bnm6d6o1.fsf@gnus.org> (Lars Magne Ingebrigtsen's message of "Sat, 10 Jan 2015 15:58:06 +0100")

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

 >> How about allowing for out-of-tree packages to define !whatever
 >> keywords as shortcuts for whatever search engines and what not?

 >> Think of, say, “!wh Example” being rewritten into
 >> https://en.wikipedia.org/wiki/Example?action=history.

 > That does sound nice, but implementing something like that as a list
 > of functions to be called is overly complicated.

	Leaving the obvious customizations aside, it doesn’t seem to be
	anywhere near “complicated” to me.

(defun my-eww-wh-uri (keywords)
  "Return an English Wikipedia history page URI for KEYWORDS.
Return nil if the KEYWORDS string does not begin with \"!wh\"."
  (save-match-data
    (when (string-match "^ *!wh\\> *" keywords)
      (concat "https://en.wikipedia.org/wiki/"
              (substring keywords (match-end 0))
              "?action=history"))))

(add-to-list 'eww-uri-rewrite-hook 'my-eww-wh-uri)

 > Other web browsers allow people to type the abbreviations and their
 > expansions into a handy form.

 > So it sounds like a separate functionality from the `M-x eww' light
 > DWIM code.

	When I /do/ mistype an URI, I /never/ mean for the browser to
	refer to a third-party to correct me.  Lynx never does that, and
	Firefox allows the behavior to be configured via its
	‘keyword.enabled’ option.  Is there any good reason EWW should
	have this functionality nailed down right to its core?

	Otherwise, how do I add my own abbreviation-processing code to
	EWW as currently implemented apart from resorting to defadvice?

 >>> and it sounds like it would be error-prone.

 >> How so?

 > People will send bug reports saying "M-x eww does this, and it's
 > wrong", and what it does depends on what they've customised.

	How’s that different to, say, find-file-hook or auto-mode-alist?

-- 
FSF associate member #7257  np. Because — David Modica  … 3013 B6A0 230E 334A





  reply	other threads:[~2015-01-10 15:59 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-10 13:17 bug#19556: eww: make URI rewriting fully customizable Ivan Shmakov
2015-01-10 14:19 ` Eli Zaretskii
2015-01-10 14:40   ` Ivan Shmakov
2015-01-10 16:01     ` Eli Zaretskii
2015-01-10 17:20       ` Ivan Shmakov
2015-01-10 17:37         ` Eli Zaretskii
2015-01-10 18:05           ` Ivan Shmakov
2015-01-10 14:29 ` Lars Magne Ingebrigtsen
2015-01-10 14:44   ` Ivan Shmakov
2015-01-10 14:58     ` Lars Magne Ingebrigtsen
2015-01-10 15:59       ` Ivan Shmakov [this message]
2015-01-10 16:08         ` Lars Magne Ingebrigtsen
2015-01-10 16:22           ` Lars Magne Ingebrigtsen
2015-01-10 18:24             ` Ivan Shmakov
2015-12-25  7:03   ` Lars Ingebrigtsen
2015-12-26  9:30     ` Ivan Shmakov
2015-01-10 15:02 ` Lars Magne Ingebrigtsen
2015-01-10 18:11   ` Ivan Shmakov
2015-01-11 14:58     ` Lars Magne Ingebrigtsen
2015-01-11 15:06       ` Lars Magne Ingebrigtsen
2015-01-11 18:22         ` Ivan Shmakov
2015-01-11 20:03           ` Eli Zaretskii
2015-01-11 20:17             ` Ivan Shmakov
2015-01-11 20:40               ` Eli Zaretskii
2015-01-11 21:46                 ` Lars Magne Ingebrigtsen
2015-01-11  1:59 ` Stefan Monnier
2015-01-11  6:25   ` Ivan Shmakov

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=87a91q1vad.fsf@violet.siamics.net \
    --to=ivan@siamics.net \
    --cc=19556@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).