unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] New function to send a mail to the recipient at point
@ 2008-02-23  0:25 Xavier Maillard
  2008-02-24  9:05 ` Reiner Steib
  0 siblings, 1 reply; 10+ messages in thread
From: Xavier Maillard @ 2008-02-23  0:25 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1727 bytes --]


here is a very small function I find very convenient. If it can
be of any help/interest to the project, fell free to install it.


Signed-off-by: Xavier Maillard <xma@gnu.org>

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7d3ba62..4fd162a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-23  Xavier Maillard  <xma@gnu.org>
+
+	* mail/rmail.el (rmail-send-mail-at-point): New function. Send an email
+	to the recipient address at point.
+
 2008-02-22  Juanma Barranquero  <lekktu@gmail.com>
 
 	* faces.el (font-weight-table): Fix value of `semi-light'.
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index e36b988..679ee56 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -775,7 +775,7 @@ isn't provided."
 by setting `rmail-enable-mime' to non-nil, the required feature
 `%s' (the value of `rmail-mime-feature')
 is not available in the current session.
-So, the MIME support is turned off for the moment." 
+So, the MIME support is turned off for the moment."
 		rmail-mime-feature))
        (setq rmail-enable-mime nil)))))
 
@@ -4022,6 +4022,15 @@ specifying headers which should not be copied into the new message."
 		    (insert "BCC: " (user-login-name) "\n"))))
 	    (goto-char (point-min))
 	    (mail-position-on-field (if resending "Resent-To" "To") t))))))
+
+(defun rmail-send-mail-at-point ()
+  "Edit a mail message to the recipient found at point."
+  (interactive)
+  (require 'thingatpt)
+  (let ((to (thing-at-point 'email)))
+    (if to
+	(mail nil to)
+      (error "No email found at point"))))
 \f
 (defun rmail-summary-exists ()
   "Non-nil if in an RMAIL buffer and an associated summary buffer exists.

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] New function to send a mail to the recipient at point
  2008-02-23  0:25 [PATCH] New function to send a mail to the recipient at point Xavier Maillard
@ 2008-02-24  9:05 ` Reiner Steib
  2008-02-24  9:56   ` Leo
  2008-02-26  2:00   ` [PATCH] New function to send a mail to the recipient at point Xavier Maillard
  0 siblings, 2 replies; 10+ messages in thread
From: Reiner Steib @ 2008-02-24  9:05 UTC (permalink / raw)
  To: Xavier Maillard; +Cc: emacs-devel

On Sat, Feb 23 2008, Xavier Maillard wrote:

> +2008-02-23  Xavier Maillard  <xma@gnu.org>
> +
> +	* mail/rmail.el (rmail-send-mail-at-point): New function. Send an email
> +	to the recipient address at point.
[...]

> -So, the MIME support is turned off for the moment." 
> +So, the MIME support is turned off for the moment."

[Unrelated whitespace change.]

> +(defun rmail-send-mail-at-point ()
> +  "Edit a mail message to the recipient found at point."
> +  (interactive)
> +  (require 'thingatpt)
> +  (let ((to (thing-at-point 'email)))
> +    (if to
> +	(mail nil to)
> +      (error "No email found at point"))))

`M-x browse-url-at-point RET' already does this for me (in every mode).
I have `("^mailto:" . browse-url-mail)' in `browse-url-browser-function'.

[BTW, your User-Agent header is not confirming to RFC 2616 or the
usefor drafts.]

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] New function to send a mail to the recipient at point
  2008-02-24  9:05 ` Reiner Steib
@ 2008-02-24  9:56   ` Leo
  2008-02-24 12:33     ` User-Agent header (was: [PATCH] New function to send a mail to the recipient at point) Reiner Steib
  2008-02-26  2:00   ` [PATCH] New function to send a mail to the recipient at point Xavier Maillard
  1 sibling, 1 reply; 10+ messages in thread
From: Leo @ 2008-02-24  9:56 UTC (permalink / raw)
  To: emacs-devel

On 2008-02-24 09:05 +0000, Reiner Steib wrote:
> [BTW, your User-Agent header is not confirming to RFC 2616 or the
> usefor drafts.]

How to test if it is conforming to RFC2616?

,----[ C-h v gnus-user-agent RET ]
| gnus-user-agent is a variable defined in `gnus.el'.
| Its value is 
| "Gnus/5.130000 Emacs/23.0.60 (20080222) Fedora 8 (gnu/linux)"
| 
| Documentation:
| Which information should be exposed in the User-Agent header.
| 
| Can be a list of symbols or a string.  Valid symbols are `gnus'
| (show Gnus version) and `emacs' (show Emacs version).  In
| addition to the Emacs version, you can add `codename' (show
| (S)XEmacs codename) or either `config' (show system
| configuration) or `type' (show system type).  If you set it to
| a string, be sure to use a valid format, see RFC 2616.
| 
| You can customize this variable.
| 
| This variable was introduced, or its default value was changed, in
| version 22.1 of Emacs.
| 
| [back]
`----

Thanks,
-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .:  [ GPG Key: 9283AA3F ]  :.

          Use the best OS -- http://www.fedoraproject.org/




^ permalink raw reply	[flat|nested] 10+ messages in thread

* User-Agent header (was: [PATCH] New function to send a mail to the recipient at point)
  2008-02-24  9:56   ` Leo
@ 2008-02-24 12:33     ` Reiner Steib
  2008-02-24 17:49       ` User-Agent header Leo
  2008-02-24 18:21       ` User-Agent header (was: [PATCH] New function to send a mail to the recipient at point) Stephen J. Turnbull
  0 siblings, 2 replies; 10+ messages in thread
From: Reiner Steib @ 2008-02-24 12:33 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

On Sun, Feb 24 2008, Leo wrote:

> On 2008-02-24 09:05 +0000, Reiner Steib wrote:
>> [BTW, your User-Agent header is not confirming to RFC 2616 or the
>> usefor drafts.]
>
> How to test if it is conforming to RFC2616?

Leave it to Gnus (e.g. use the list of predefined symbols in
`gnus-user-agent', see below) or read RFC 2616. ;-)

> ,----[ C-h v gnus-user-agent RET ]
> | gnus-user-agent is a variable defined in `gnus.el'.
> | Its value is 
> | "Gnus/5.130000 Emacs/23.0.60 (20080222) Fedora 8 (gnu/linux)"

IIRC, "Fedora 8" isn't allowed.  Probably "Fedora/8 (Fedora 8,
gnu/linux)" is correct.
 
> | Documentation:
> | Which information should be exposed in the User-Agent header.
> | 
> | Can be a list of symbols or a string.  Valid symbols are `gnus'
> | (show Gnus version) and `emacs' (show Emacs version).  In
> | addition to the Emacs version, you can add `codename' (show
> | (S)XEmacs codename) or either `config' (show system
> | configuration) or `type' (show system type).  If you set it to
> | a string, be sure to use a valid format, see RFC 2616.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: User-Agent header
  2008-02-24 12:33     ` User-Agent header (was: [PATCH] New function to send a mail to the recipient at point) Reiner Steib
@ 2008-02-24 17:49       ` Leo
  2008-02-24 18:21       ` User-Agent header (was: [PATCH] New function to send a mail to the recipient at point) Stephen J. Turnbull
  1 sibling, 0 replies; 10+ messages in thread
From: Leo @ 2008-02-24 17:49 UTC (permalink / raw)
  To: emacs-devel

On 2008-02-24 12:33 +0000, Reiner Steib wrote:
> IIRC, "Fedora 8" isn't allowed.  Probably "Fedora/8 (Fedora 8,
> gnu/linux)" is correct.

Thanks, I've changed it to:

,----[ C-h v gnus-user-agent RET ]
| gnus-user-agent is a variable defined in `gnus.el'.
| Its value is 
| "Gnus/5.13 Emacs/23.0.60 (20080222) Fedora/8 (gnu/linux)"
`----

Bye,
-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .:  [ GPG Key: 9283AA3F ]  :.

          Use the best OS -- http://www.fedoraproject.org/




^ permalink raw reply	[flat|nested] 10+ messages in thread

* User-Agent header (was: [PATCH] New function to send a mail to the recipient at point)
  2008-02-24 12:33     ` User-Agent header (was: [PATCH] New function to send a mail to the recipient at point) Reiner Steib
  2008-02-24 17:49       ` User-Agent header Leo
@ 2008-02-24 18:21       ` Stephen J. Turnbull
  2008-02-24 18:41         ` User-Agent header Bill Wohler
  1 sibling, 1 reply; 10+ messages in thread
From: Stephen J. Turnbull @ 2008-02-24 18:21 UTC (permalink / raw)
  To: Reiner Steib; +Cc: Leo, emacs-devel

Reiner Steib writes:
 > On Sun, Feb 24 2008, Leo wrote:
 > 
 > > On 2008-02-24 09:05 +0000, Reiner Steib wrote:
 > >> [BTW, your User-Agent header is not confirming to RFC 2616 or the
 > >> usefor drafts.]

Of course it's conforming to RFC 2616; RFC 2616 defines HTTP headers,
not mail headers.  The drafts may define the same format (including by
reference to RFC 2616), but that's not the same as RFC 2616
conformance.

In particular, the "usefor drafts" may impose additional syntactic
restrictions or permit extensions (both unlikely) or add semantic
interpretations.  (In a trivial sense they do the latter two by
extending use of the header to mail.)

 > > How to test if it is conforming to RFC2616?

token           = 1*<any CHAR except CTLs or separators>
product         = token ["/" product-version]
product-version = token
User-Agent      = "User-Agent" ":" 1*( product | comment )

 > > ,----[ C-h v gnus-user-agent RET ]
 > > | gnus-user-agent is a variable defined in `gnus.el'.
 > > | Its value is 
 > > | "Gnus/5.130000 Emacs/23.0.60 (20080222) Fedora 8 (gnu/linux)"
 > 
 > IIRC, "Fedora 8" isn't allowed.  Probably "Fedora/8 (Fedora 8,
 > gnu/linux)" is correct.

The field value above is conformant to the RFC, although it doesn't
have the expected semantics.  It makes "Fedora" and "8" separate
products, where you would expect Fedora to be a product and 8 to be a
version.  (Consider "9" as a product token.)

I think the suggested change is simply to change the space in "Fedora
8" to a slash:

    "Gnus/5.130000 Emacs/23.0.60 (20080222) Fedora/8 (gnu/linux)"





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: User-Agent header
  2008-02-24 18:21       ` User-Agent header (was: [PATCH] New function to send a mail to the recipient at point) Stephen J. Turnbull
@ 2008-02-24 18:41         ` Bill Wohler
  2008-02-24 22:44           ` Stephen J. Turnbull
  0 siblings, 1 reply; 10+ messages in thread
From: Bill Wohler @ 2008-02-24 18:41 UTC (permalink / raw)
  To: emacs-devel

"Stephen J. Turnbull" <turnbull@sk.tsukuba.ac.jp> writes:

> Reiner Steib writes:
>  > On Sun, Feb 24 2008, Leo wrote:
>  > 
>  > > On 2008-02-24 09:05 +0000, Reiner Steib wrote:
>  > >> [BTW, your User-Agent header is not confirming to RFC 2616 or the
>  > >> usefor drafts.]
>
> Of course it's conforming to RFC 2616; RFC 2616 defines HTTP headers,
> not mail headers.  The drafts may define the same format (including by
> reference to RFC 2616), but that's not the same as RFC 2616
> conformance.

I was thinking the same thing :-).

> In particular, the "usefor drafts" may impose additional syntactic
> restrictions or permit extensions (both unlikely) or add semantic
> interpretations.  (In a trivial sense they do the latter two by
> extending use of the header to mail.)

And until this draft is promoted to RFC status, MH-E is still using
X-Mailer (although we could update the format of the header field to
conform with this draft).

Assuming this draft applies to mail header fields.

The draft refers to Usenet header fields in the "context" of RFCs 2822
and 2045; does that imply that this document "extends" RFCs 2822 and
2045?

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: User-Agent header
  2008-02-24 18:41         ` User-Agent header Bill Wohler
@ 2008-02-24 22:44           ` Stephen J. Turnbull
  2008-02-26  2:00             ` Xavier Maillard
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen J. Turnbull @ 2008-02-24 22:44 UTC (permalink / raw)
  To: Bill Wohler; +Cc: emacs-devel

Bill Wohler writes:

 > And until this draft is promoted to RFC status,

Never gonna happen.  It would be sacrilege.<wink>  I note that the
draft expired 7 months ago, although it's still in the editor's queue.

 > MH-E is still using X-Mailer (although we could update the format
 > of the header field to conform with this draft).

That's the right thing to do for a mail-only MUA, IMO.

 > Assuming this draft applies to mail header fields.

It doesn't.  It applies to netnews.  It is the devout wish of the
newsies that mail agents adopt their practices too, but they've often
failed in that (cf mail-followup-to).

And the spec of User-Agent is mildly broken in any case, as it permits
characters that RFC 2616 doesn't (the braces "{" and "}").

 > The draft refers to Usenet header fields in the "context" of RFCs 2822
 > and 2045; does that imply that this document "extends" RFCs 2822 and
 > 2045?

Not in the sense that it would impose or imply new practices for
mail-only agents, nor justify Gnus users' practice of inserting
news-only headers in mail messages and expecting them to operate as
they do in news.  It means that it is a conforming implementation of
those RFCs (and in fact is a substantial restriction of them in
several ways).





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] New function to send a mail to the recipient at point
  2008-02-24  9:05 ` Reiner Steib
  2008-02-24  9:56   ` Leo
@ 2008-02-26  2:00   ` Xavier Maillard
  1 sibling, 0 replies; 10+ messages in thread
From: Xavier Maillard @ 2008-02-26  2:00 UTC (permalink / raw)
  To: Reiner Steib; +Cc: emacs-devel


   On Sat, Feb 23 2008, Xavier Maillard wrote:

   > +2008-02-23  Xavier Maillard  <xma@gnu.org>
   > +
   > +	* mail/rmail.el (rmail-send-mail-at-point): New function. Send an email
   > +	to the recipient address at point.
   [...]

   > -So, the MIME support is turned off for the moment." 
   > +So, the MIME support is turned off for the moment."

   [Unrelated whitespace change.]

Yes, I did not change anything there. Git has added this for me,
I guess.

   > +(defun rmail-send-mail-at-point ()
   > +  "Edit a mail message to the recipient found at point."

   `M-x browse-url-at-point RET' already does this for me (in
   every mode).

Hum, it seems it does not for me using emacs -Q :

Debugger entered--Lisp error: (wrong-type-argument stringp browse-url-text-browser)
  start-process("lynxmailto:foo@bar.com" nil "xterm" "-e" browse-url-text-browser "mailto:foo@bar.com")
  apply(start-process ("lynxmailto:foo@bar.com" nil "xterm" "-e" browse-url-text-browser "mailto:foo@bar.com"))
  browse-url-text-xterm("mailto:foo@bar.com" nil)
  apply(browse-url-text-xterm "mailto:foo@bar.com" nil)
  browse-url-default-browser("mailto:foo@bar.com" nil)
  apply(browse-url-default-browser "mailto:foo@bar.com" nil)
  browse-url("mailto:foo@bar.com" nil)
  browse-url-at-point(nil)
  call-interactively(browse-url-at-point t nil)
  execute-extended-command(nil)
  call-interactively(execute-extended-command nil nil)

   I have `("^mailto:" . browse-url-mail)' in `browse-url-browser-function'.

With my patch, there is no need to customize anything. Maybe we
should change the default value of `browse-url-browser-function' ?

   [BTW, your User-Agent header is not confirming to RFC 2616 or the
   usefor drafts.]

Thank you for the notice. I will check in what I should conform
to by reading the RFC.

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: User-Agent header
  2008-02-24 22:44           ` Stephen J. Turnbull
@ 2008-02-26  2:00             ` Xavier Maillard
  0 siblings, 0 replies; 10+ messages in thread
From: Xavier Maillard @ 2008-02-26  2:00 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: wohler, emacs-devel


    > MH-E is still using X-Mailer (although we could update the format
    > of the header field to conform with this draft).

   That's the right thing to do for a mail-only MUA, IMO.

I read all the RFC 2616 and I think this what I'll do but I will
try to conform to the RFC 2616 even with a X-Mailer header (Note:
this is not the case yet).

Thank you all for your clarifications.

By the way, what do people think about either the patch or my
proposition to change the behaviour of b-u-b-f variable ?

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-02-26  2:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-23  0:25 [PATCH] New function to send a mail to the recipient at point Xavier Maillard
2008-02-24  9:05 ` Reiner Steib
2008-02-24  9:56   ` Leo
2008-02-24 12:33     ` User-Agent header (was: [PATCH] New function to send a mail to the recipient at point) Reiner Steib
2008-02-24 17:49       ` User-Agent header Leo
2008-02-24 18:21       ` User-Agent header (was: [PATCH] New function to send a mail to the recipient at point) Stephen J. Turnbull
2008-02-24 18:41         ` User-Agent header Bill Wohler
2008-02-24 22:44           ` Stephen J. Turnbull
2008-02-26  2:00             ` Xavier Maillard
2008-02-26  2:00   ` [PATCH] New function to send a mail to the recipient at point Xavier Maillard

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).