unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Richard G Riley <rileyrgdev@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Open mailto links
Date: Fri, 05 Sep 2008 21:57:47 +0200	[thread overview]
Message-ID: <g9s31c$13a$1@registered.motzarella.org> (raw)
In-Reply-To: 87wshskm7m.fsf@literaturlatenight.de


henry atting <nospam@literaturlatenight.de> 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.




      parent reply	other threads:[~2008-09-05 19:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-04 14:41 Open mailto links henry atting
2008-09-04 15:25 ` Vyazovoi Pavel
2008-09-04 15:41 ` Tassilo Horn
2008-09-04 15:59 ` Thierry Volpiatto
     [not found] ` <mailman.18423.1220544200.18990.help-gnu-emacs@gnu.org>
2008-09-05  5:21   ` henry atting
2008-09-05 19:57 ` Richard G Riley [this message]

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='g9s31c$13a$1@registered.motzarella.org' \
    --to=rileyrgdev@gmail.com \
    --cc=help-gnu-emacs@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.
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).