bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#19556: eww: make URI rewriting fully customizable


From: Ivan Shmakov
Subject: bug#19556: eww: make URI rewriting fully customizable
Date: Sat, 10 Jan 2015 15:59:22 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

>>>>> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]