* Open mailto links
@ 2008-09-04 14:41 henry atting
2008-09-04 15:25 ` Vyazovoi Pavel
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: henry atting @ 2008-09-04 14:41 UTC (permalink / raw
To: help-gnu-emacs
Within iceweasel I open mailto links with this small script:
--8<---------------cut here---------------end--------------->8---
#!/bin/sh
/usr/bin/emacsclient -e "(message-mail \"$1\")"
--8<---------------cut here---------------end--------------->8---
It works but the address is filled in with `mailto` preceeded, like
this:
mailto: a@address.fl
It's same when I click on a mailto within emacs-w3m.
Any hints?
Cheers
henry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Open mailto links
2008-09-04 14:41 Open mailto links henry atting
@ 2008-09-04 15:25 ` Vyazovoi Pavel
2008-09-04 15:41 ` Tassilo Horn
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Vyazovoi Pavel @ 2008-09-04 15:25 UTC (permalink / raw
To: help-gnu-emacs
At Thu, 04 Sep 2008 16:41:17 +0200,
henry atting wrote:
Something like this:
(defun my-message-mail (mail)
"my message-mail alternative"
(if (< (length (split-string mail "subject=")) 2)
(message-mail (nth 1 (split-string mail ":")))
(message-mail (nth 1 (split-string mail "[:?]")) (nth 1 (split-string mail "subject=")))))
>
> Within iceweasel I open mailto links with this small script:
>
> --8<---------------cut here---------------end--------------->8---
>
> #!/bin/sh
> /usr/bin/emacsclient -e "(message-mail \"$1\")"
>
> --8<---------------cut here---------------end--------------->8---
>
> It works but the address is filled in with `mailto` preceeded, like
> this:
> mailto: a@address.fl
>
> It's same when I click on a mailto within emacs-w3m.
>
> Any hints?
>
> Cheers
> henry
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Open mailto links
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
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tassilo Horn @ 2008-09-04 15:41 UTC (permalink / raw
To: help-gnu-emacs
henry atting <nospam@literaturlatenight.de> writes:
Hi Henry,
> #!/bin/sh
> /usr/bin/emacsclient -e "(message-mail \"$1\")"
I use a similar script but with `th-message-mail'. Its definition is:
--8<---------------cut here---------------start------------->8---
(defun th-message-mail (mailto-url)
"Parse MAILTO-URL and invoke `message-mail'."
(let (to subject cc bcc)
(dolist (header (split-string mailto-url "[?&]"))
(cond
((string-match "mailto:" header)
(setq to (substring header (match-end 0))))
((string-match "Cc=" header)
(setq cc (substring header (match-end 0))))
((string-match "Bcc=" header)
(setq bcc (substring header (match-end 0))))
((string-match "Subject=" header)
(setq subject (substring header (match-end 0))))))
(message-mail to subject (list (cons "Cc" cc) (cons "Bcc" bcc)))))
--8<---------------cut here---------------end--------------->8---
Hope that helps,
Tassilo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Open mailto links
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 19:57 ` Richard G Riley
4 siblings, 0 replies; 6+ messages in thread
From: Thierry Volpiatto @ 2008-09-04 15:59 UTC (permalink / raw
To: help-gnu-emacs
Hi,
I use that:
,----
| /usr/bin/emacsclient -e "(message-mail (substring \"$1\" 7))"
`----
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\")"
>
>
> It works but the address is filled in with `mailto` preceeded, like
> this:
> mailto: a@address.fl
>
> It's same when I click on a mailto within emacs-w3m.
>
> Any hints?
>
> Cheers
> henry
>
--
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <mailman.18423.1220544200.18990.help-gnu-emacs@gnu.org>]
* Re: Open mailto links
2008-09-04 14:41 Open mailto links henry atting
` (3 preceding siblings ...)
[not found] ` <mailman.18423.1220544200.18990.help-gnu-emacs@gnu.org>
@ 2008-09-05 19:57 ` Richard G Riley
4 siblings, 0 replies; 6+ messages in thread
From: Richard G Riley @ 2008-09-05 19:57 UTC (permalink / raw
To: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-09-05 19:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).