From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard G Riley Newsgroups: gmane.emacs.help Subject: Re: Open mailto links Date: Fri, 05 Sep 2008 21:57:47 +0200 Organization: A noiseless patient Spider Message-ID: References: <87wshskm7m.fsf@literaturlatenight.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1220647260 4519 80.91.229.12 (5 Sep 2008 20:41:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Sep 2008 20:41:00 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 05 22:41:55 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kbi7g-0007Vc-B1 for geh-help-gnu-emacs@m.gmane.org; Fri, 05 Sep 2008 22:41:40 +0200 Original-Received: from localhost ([127.0.0.1]:33243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kbi6g-0004y5-R4 for geh-help-gnu-emacs@m.gmane.org; Fri, 05 Sep 2008 16:40:38 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!news.motzarella.org!motzarella.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 97 Original-X-Trace: feeder.motzarella.org U2FsdGVkX18M5Y0LGtUea/qBF+QfgoWuifexY8jy0hssnYuD5vyb16YVZImst4iGB2Ep0tVDWPHKCJxeEqBo6Na0i0vUe1oVGhyylPu2NO1ZRZYjjmzqztFQMCpAJlFje5pejZiwYQCdnyB2JjYTiQ== Original-X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers Original-NNTP-Posting-Date: Fri, 5 Sep 2008 19:58:36 +0000 (UTC) X-Auth-Sender: U2FsdGVkX185dHHGme+JfcRLE5V6O5bqhbI0k2uiky/uGqDu0bYxyw== Cancel-Lock: sha1:lQzXfA1zDubi0qyqZcyI0vA2VKM= User-Agent: Emacs 22.2.1/No Gnus v0.11 Original-Xref: news.stanford.edu gnu.emacs.help:161956 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:57298 Archived-At: henry atting writes: > Within iceweasel I open mailto links with this small script: > > > #!/bin/sh > /usr/bin/emacsclient -e "(message-mail \"$1\")" > I use te following in the application path for mailto URLs in Firefox: ,---- | gnus-mailto.sh `---- where gnus-mailto.sh is the following on my path: ,---- | #!/bin/sh | # gnus-mailto.sh | wmctrl -a emacs22 | source ~/bin/emacs.bash | edit --eval "(progn (johnsu01/mailto \"$1\"))" `---- (wmctrl brings emacs into focus on linux/X) and edit is defined in emacs.bash which ships with emacs 22: ,---- | function edit () | { | local windowsys="${WINDOW_PARENT+sun}" | | windowsys="${windowsys:-${DISPLAY+x}}" | | if [ -n "${windowsys:+set}" ]; then | # Do not just test if these files are sockets. On some systems | # ordinary files or fifos are used instead. Just see if they exist. | if [ -e "${HOME}/.emacs_server" -o -e "/tmp/emacs${UID}/server" ]; then | emacsclient "$@" | return $? | else | echo "edit: starting emacs in background..." 1>&2 | fi | | case "${windowsys}" in | x ) (emacs "$@" &) ;; | sun ) (emacstool "$@" &) ;; | esac | else | if jobs %emacs 2> /dev/null ; then | echo "$(pwd)" "$@" >| ${HOME}/.emacs_args && fg %emacs | else | emacs "$@" | fi | fi | } `---- John Sullivans code is the following in my .emacs: ,---- | (defun johnsu01/mailto (url) | "Follow a mailto URL as passed from Iceweasel, prompting for a posting style." | (unless(gnus-alive-p) | (gnus)) | | (message "Url is : %s" url) | | (let ((gnus-newsgroup-name | (completing-read "Use posting style of group: " | gnus-active-hashtb nil | (gnuOBs-read-active-file-p) "rileyrg"))) | (setq url (url-unhex-string url)) | (browse-url-mail url)) | ;; message-mail does not do anything with the body argument, so we have to. | (if (string-match (regexp-quote "?") url) | (let* ((start (match-end 0)) | (args (url-parse-query-string | (substring url start nil))) | (body (cadr (assoc-string "body" args t)))) | (when body | (switch-to-buffer (car (message-buffers))) | (save-excursion | (message-goto-body) | (insert body))))) | ) `---- And this prompts you for which gnus-posting-style to use. Works really well if you have multiple posting styles.