Menu

#304 Add mh-w3m-push-button to contrib

mh-e-7.3
open
nobody
patch (25)
5
2016-01-18
2011-12-26
Bill Wohler
No

The following function seems like it would be useful. Since MH-E shouldn't commit to any particular Emacs browser, I think this should probably go in contrib. We'd use a "mh" prefix instead of "my". See Section 5 of the MH-E Developers Guide, Coding Conventions, and Section 6, Bazaar Repository, for a reminder on contrib conventions.

To: "Satyaki Das" <satyakid at stanford.edu>
Cc: Sam Cramer <cramer at netapp.com>, mh-e-users <mh-e-users at lists.sourceforge.net>
From: Win Treese <treese at acm.org>
Subject: Re: customizing the MH-Show buffer -- 2 questions
In-reply-to: Message from "Satyaki Das" of 21 May 2003 22:34:49 PDT
X-Mailer: MH-E 7.2; nmh 1.0.4; GNU Emacs 21.2.1
Message-Id: <20030522191944.C2C764F4028@snoopy.treese.org>
Date: Thu, 22 May 2003 15:19:39 -0400

> IIUC, this requires two clicks -- the first to put point in the
> URL and the next to visit the URL. This can be done with one click
> by using event-* functions. For example mh-push-button does this
> (the function is more complicated than it needs to be since XEmacs
> and Emacs handle mouse events differently).

Yes, you're right, and I hadn't previously bothered to figure out how to
fix that. But, since you gave me the hint, something like this seems to
work:

(defun my-w3m-push-button (event)
"Browse a URL in an mh-show or w3m buffer using an external browser."
(interactive "e")
(save-excursion
(set-buffer (window-buffer (posn-window (event-start event))))
(goto-char (posn-point (event-start event)))
(let ((url (and (fboundp 'w3m-anchor) (w3m-anchor))))
(if url
(browse-url url)
(browse-url-at-point)))))

> Good idea. I like defadvice :-). But sometimes they cause tricky
> debugging problems, when you forget that a function has been
> advised and the function definition you are looking at is not what
> is being used. This has happened to me a couple of times.

In general, I agree. I stared a the w3m code for a while trying to find
a good hook to use, but w3m always smashed the mouse bindings somehow.

Thanks for the hints on making the browsing better!

- Win

Discussion

  • Bill Wohler

    Bill Wohler - 2013-02-23
    • labels: --> patch
     
  • Bill Wohler

    Bill Wohler - 2013-02-23

    Ticket moved from /p/mh-e/patches/22/

     
  • Bill Wohler

    Bill Wohler - 2013-02-23
    • Status: open --> unread
     
  • Bill Wohler

    Bill Wohler - 2016-01-18
     
  • Bill Wohler

    Bill Wohler - 2016-01-18
    • status: unread --> open
     

Log in to post a comment.

MongoDB Logo MongoDB