Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] message-goto-body after <#secure
@ 2010-11-23 20:55 Łukasz Stelmach
  2010-11-24 17:28 ` Julien Danjou
  2010-11-24 20:53 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 6+ messages in thread
From: Łukasz Stelmach @ 2010-11-23 20:55 UTC (permalink / raw)
  To: ding

Hi.

The following patch makes message-goto-body function put cursor after
possible "<#secure" tag. This hits two birds with one stone: pressing
C-c C-b moves me where I can start typing and any citations that get
inserted into a new message buffer when replying (I have not tested
resending or forwarding yet but I suppose it works the same way) leave
the tag at the very begining of a message.

Why I wrote this? I've set up mml-secure-message-sign-pgpmime as a part
of message-setup-hook. I prefere this to putting it in message-send-hook
because I can decide whether to sign a message or not. And it works well
for a new message. However, it fails for replies because just before
citations are inserted message-goto-body sets point *brefore*
the <#secure tag that is there since message-setup-hook gets fired
before citations.

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/message.el b/lisp/message.el
index bff11b2..b3660c6 100644
--- a/lisp/message.el
+++ b/lisp/message.el
@@ -3099,7 +3099,8 @@ M-RET    `message-newline-and-reformat' (break the line and reformat)."
     (expand-abbrev))
   (goto-char (point-min))
   (or (search-forward (concat "\n" mail-header-separator "\n") nil t)
-      (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t)))
+      (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t))
+  (while (looking-at "^<#secure") (forward-line 1)))
 
 (defun message-in-body-p ()
   "Return t if point is in the message body."
--8<---------------cut here---------------end--------------->8---

-- 
Miłego dnia,
Łukasz Stelmach




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

* Re: [PATCH] message-goto-body after <#secure
  2010-11-23 20:55 [PATCH] message-goto-body after <#secure Łukasz Stelmach
@ 2010-11-24 17:28 ` Julien Danjou
  2010-11-24 20:53 ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Julien Danjou @ 2010-11-24 17:28 UTC (permalink / raw)
  To: Łukasz Stelmach; +Cc: ding

On Tue, Nov 23 2010, Łukasz Stelmach wrote:

> The following patch makes message-goto-body function put cursor after
> possible "<#secure" tag. This hits two birds with one stone: pressing
> C-c C-b moves me where I can start typing and any citations that get
> inserted into a new message buffer when replying (I have not tested
> resending or forwarding yet but I suppose it works the same way) leave
> the tag at the very begining of a message.
>
> Why I wrote this? I've set up mml-secure-message-sign-pgpmime as a part
> of message-setup-hook. I prefere this to putting it in message-send-hook
> because I can decide whether to sign a message or not. And it works well
> for a new message. However, it fails for replies because just before
> citations are inserted message-goto-body sets point *brefore*
> the <#secure tag that is there since message-setup-hook gets fired
> before citations.

Thanks, pushed.

Cheers,
-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info



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

* Re: [PATCH] message-goto-body after <#secure
  2010-11-23 20:55 [PATCH] message-goto-body after <#secure Łukasz Stelmach
  2010-11-24 17:28 ` Julien Danjou
@ 2010-11-24 20:53 ` Lars Magne Ingebrigtsen
  2010-11-24 21:20   ` Julien Danjou
  1 sibling, 1 reply; 6+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-11-24 20:53 UTC (permalink / raw)
  To: ding

Łukasz Stelmach <lukasz.stelmach@iem.pw.edu.pl> writes:

> Why I wrote this? I've set up mml-secure-message-sign-pgpmime as a part
> of message-setup-hook. I prefere this to putting it in message-send-hook
> because I can decide whether to sign a message or not. And it works well
> for a new message. However, it fails for replies because just before
> citations are inserted message-goto-body sets point *brefore*
> the <#secure tag that is there since message-setup-hook gets fired
> before citations.

Actually, I think this is probably the wrong way to do it.  If you want
to insert <#secure automatically in all your message buffers, you should
do it after everything is inserted, and not before yanking.

I'm not sure such a late hook exists, but if not, I can add it to
message.el.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: [PATCH] message-goto-body after <#secure
  2010-11-24 20:53 ` Lars Magne Ingebrigtsen
@ 2010-11-24 21:20   ` Julien Danjou
  2010-11-24 23:16     ` Łukasz Stelmach
  0 siblings, 1 reply; 6+ messages in thread
From: Julien Danjou @ 2010-11-24 21:20 UTC (permalink / raw)
  To: ding

<#secure method=pgpmime mode=sign>
On Wed, Nov 24 2010, Lars Magne Ingebrigtsen wrote:

> Actually, I think this is probably the wrong way to do it.  If you want
> to insert <#secure automatically in all your message buffers, you should
> do it after everything is inserted, and not before yanking.

I use this with success:

(defun jd:gnus-secure-message-sign ()
  (when (or (equal gnus-newsgroup-name "")
            (equal gnus-newsgroup-name nil)
            (not (string-match-p "Somestuff" gnus-newsgroup-name)))
    (mml-secure-message-sign-pgpmime)))
;; plug this into message-setup-hook
(add-hook 'gnus-message-setup-hook 'jd:gnus-secure-message-sign)

FWIW.

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info



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

* Re: [PATCH] message-goto-body after <#secure
  2010-11-24 21:20   ` Julien Danjou
@ 2010-11-24 23:16     ` Łukasz Stelmach
  2010-11-24 23:19       ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Łukasz Stelmach @ 2010-11-24 23:16 UTC (permalink / raw)
  To: ding

Julien Danjou <julien@danjou.info> writes:

> <#secure method=pgpmime mode=sign>
> On Wed, Nov 24 2010, Lars Magne Ingebrigtsen wrote:
>
>> Actually, I think this is probably the wrong way to do it.  If you want
>> to insert <#secure automatically in all your message buffers, you should
>> do it after everything is inserted, and not before yanking.
[...]
> ;; plug this into message-setup-hook
> (add-hook 'gnus-message-setup-hook 'jd:gnus-secure-message-sign)

Every day I learn something new: message-setup-hook and
gnus-message-setup-hook are quite different ones. And there is no
base64 citation problem if I put mml-secure-message-sign-pgpmime in the
latter one. However, I still think C-c C-b should place cursor after
the <#secure tag. What I did wrong is that I forgot to return the
current position from the message-goto-body.

[Here was a patch that does not work either]

It seems that the it won't work one way or the other. Even If I return
(point) from the message-goto-body and "base64 citation" works ok then
mml decoding breaks (hence the unused <#secure > tag in
<87vd3mba16.fsf@kotik.lan>).

I give up (but I still would like C-c C-b to beam me up to the right
point)

-- 
Miłego dnia,
Łukasz Stelmach




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

* Re: [PATCH] message-goto-body after <#secure
  2010-11-24 23:16     ` Łukasz Stelmach
@ 2010-11-24 23:19       ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-11-24 23:19 UTC (permalink / raw)
  To: ding

Łukasz Stelmach <lukasz.stelmach@iem.pw.edu.pl> writes:

> I give up (but I still would like C-c C-b to beam me up to the right
> point)

But what the right point is depends on what you're doing.  If, for
instance, you have a multipart/alternative message, you may want it to
go to the beginning of the first part.  Or not.  Or you may want it to
go to after the "writes:" line.  So you should just bind `C-c C-b' to go
to where you want it to go...

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

end of thread, other threads:[~2010-11-24 23:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-23 20:55 [PATCH] message-goto-body after <#secure Łukasz Stelmach
2010-11-24 17:28 ` Julien Danjou
2010-11-24 20:53 ` Lars Magne Ingebrigtsen
2010-11-24 21:20   ` Julien Danjou
2010-11-24 23:16     ` Łukasz Stelmach
2010-11-24 23:19       ` Lars Magne Ingebrigtsen

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 NNTP newsgroup(s).