Discussion:
[mh-e:bugs] #304 Add mh-w3m-push-button to contrib
Bill Wohler
2016-01-18 05:40:00 UTC
Permalink
---

** [bugs:#304] Add mh-w3m-push-button to contrib**

**Status:** unread
**Milestone:** mh-e-7.3
**Labels:** patch
**Created:** Mon Dec 26, 2011 07:08 PM UTC by Bill Wohler
**Last Updated:** Sat Feb 23, 2013 09:17 PM UTC
**Owner:** nobody


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: <***@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



---

Sent from sourceforge.net because mh-e-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/mh-e/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/mh-e/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Bill Wohler
2016-01-18 05:40:23 UTC
Permalink
- **status**: unread --> open



---

** [bugs:#304] Add mh-w3m-push-button to contrib**

**Status:** open
**Milestone:** mh-e-7.3
**Labels:** patch
**Created:** Mon Dec 26, 2011 07:08 PM UTC by Bill Wohler
**Last Updated:** Mon Jan 18, 2016 05:39 AM UTC
**Owner:** nobody


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: <***@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



---

Sent from sourceforge.net because mh-e-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/mh-e/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/mh-e/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Loading...