all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#74027: [PATCH] ; Insert "Stealing lock" at the beginning of a message
@ 2024-10-26  7:41 Philip Kaludercic
  2024-11-02 11:27 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Philip Kaludercic @ 2024-10-26  7:41 UTC (permalink / raw)
  To: 74027

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

It appears "vc-steal-lock" is not compatible with automatic signatures,
as the "I stole the lock on ..." is inserted at the end of the message,
which can appear behind the signature.  This should fix it:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] ; Insert "Stealing lock" at the beginning of a message --]
[-- Type: text/x-patch, Size: 1171 bytes --]

From b5539a1924bbcbb1ee68fcbb21310856fcd437a9 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Sat, 26 Oct 2024 09:39:00 +0200
Subject: [PATCH] ; Insert "Stealing lock" at the beginning of a message

* lisp/vc/vc.el (vc-steal-lock): Use 'mail-text' instead of
jumping to 'point-max', to avoid inserting the message after
signatures.
---
 lisp/vc/vc.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index a30ba06aec3..0d72b169e41 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1661,6 +1661,7 @@ vc-mark-resolved
 	 (format "%d files" (length files))
        "this file"))))
 
+(declare-function mail-text "sendmail" ())
 (defun vc-steal-lock (file rev owner)
   "Steal the lock on FILE."
   (let (file-description)
@@ -1681,7 +1682,7 @@ vc-steal-lock
     ;; goes wrong, we don't want to send any mail.
     (compose-mail owner (format "Stolen lock on %s" file-description))
     (setq default-directory (expand-file-name "~/"))
-    (goto-char (point-max))
+    (mail-text)
     (insert
      (format "I stole the lock on %s, " file-description)
      (current-time-string)
-- 
2.45.2


[-- Attachment #3: Type: text/plain, Size: 34 bytes --]


-- 
	Philip Kaludercic on siskin

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

* bug#74027: [PATCH] ; Insert "Stealing lock" at the beginning of a message
  2024-10-26  7:41 bug#74027: [PATCH] ; Insert "Stealing lock" at the beginning of a message Philip Kaludercic
@ 2024-11-02 11:27 ` Eli Zaretskii
  2024-11-08 14:15   ` Philip Kaludercic
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-11-02 11:27 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 74027

> From: Philip Kaludercic <philipk@posteo.net>
> Date: Sat, 26 Oct 2024 07:41:49 +0000
> 
> It appears "vc-steal-lock" is not compatible with automatic signatures,
> as the "I stole the lock on ..." is inserted at the end of the message,
> which can appear behind the signature.  This should fix it:
> 
> >From b5539a1924bbcbb1ee68fcbb21310856fcd437a9 Mon Sep 17 00:00:00 2001
> From: Philip Kaludercic <philipk@posteo.net>
> Date: Sat, 26 Oct 2024 09:39:00 +0200
> Subject: [PATCH] ; Insert "Stealing lock" at the beginning of a message
> 
> * lisp/vc/vc.el (vc-steal-lock): Use 'mail-text' instead of
> jumping to 'point-max', to avoid inserting the message after
> signatures.
> ---
>  lisp/vc/vc.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
> index a30ba06aec3..0d72b169e41 100644
> --- a/lisp/vc/vc.el
> +++ b/lisp/vc/vc.el
> @@ -1661,6 +1661,7 @@ vc-mark-resolved
>  	 (format "%d files" (length files))
>         "this file"))))
>  
> +(declare-function mail-text "sendmail" ())
>  (defun vc-steal-lock (file rev owner)
>    "Steal the lock on FILE."
>    (let (file-description)
> @@ -1681,7 +1682,7 @@ vc-steal-lock
>      ;; goes wrong, we don't want to send any mail.
>      (compose-mail owner (format "Stolen lock on %s" file-description))
>      (setq default-directory (expand-file-name "~/"))
> -    (goto-char (point-max))
> +    (mail-text)

I guess you are using sendmail.el as your mail-user-agent?  But the
default is message.el, so I think we should either use
message-goto-body here, or perhaps dispatch to either to message.el or
sendmail.el based on the value of mail-user-agent.





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

* bug#74027: [PATCH] ; Insert "Stealing lock" at the beginning of a message
  2024-11-02 11:27 ` Eli Zaretskii
@ 2024-11-08 14:15   ` Philip Kaludercic
  2024-11-08 15:22     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Philip Kaludercic @ 2024-11-08 14:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74027

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Philip Kaludercic <philipk@posteo.net>
>> Date: Sat, 26 Oct 2024 07:41:49 +0000
>> 
>> It appears "vc-steal-lock" is not compatible with automatic signatures,
>> as the "I stole the lock on ..." is inserted at the end of the message,
>> which can appear behind the signature.  This should fix it:
>> 
>> >From b5539a1924bbcbb1ee68fcbb21310856fcd437a9 Mon Sep 17 00:00:00 2001
>> From: Philip Kaludercic <philipk@posteo.net>
>> Date: Sat, 26 Oct 2024 09:39:00 +0200
>> Subject: [PATCH] ; Insert "Stealing lock" at the beginning of a message
>> 
>> * lisp/vc/vc.el (vc-steal-lock): Use 'mail-text' instead of
>> jumping to 'point-max', to avoid inserting the message after
>> signatures.
>> ---
>>  lisp/vc/vc.el | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
>> index a30ba06aec3..0d72b169e41 100644
>> --- a/lisp/vc/vc.el
>> +++ b/lisp/vc/vc.el
>> @@ -1661,6 +1661,7 @@ vc-mark-resolved
>>  	 (format "%d files" (length files))
>>         "this file"))))
>>  
>> +(declare-function mail-text "sendmail" ())
>>  (defun vc-steal-lock (file rev owner)
>>    "Steal the lock on FILE."
>>    (let (file-description)
>> @@ -1681,7 +1682,7 @@ vc-steal-lock
>>      ;; goes wrong, we don't want to send any mail.
>>      (compose-mail owner (format "Stolen lock on %s" file-description))
>>      (setq default-directory (expand-file-name "~/"))
>> -    (goto-char (point-max))
>> +    (mail-text)
>
> I guess you are using sendmail.el as your mail-user-agent?  But the
> default is message.el, so I think we should either use
> message-goto-body here, 

Ok, I falsely assumed that using 'mail-text' would be more compatible.

>                         
>                         or perhaps dispatch to either to message.el or
> sendmail.el based on the value of mail-user-agent.

So a `cond' expression checking mail-user-agent and then invoking the
right function, or is there some more generic way to do that?

-- 
	Philip Kaludercic on siskin





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

* bug#74027: [PATCH] ; Insert "Stealing lock" at the beginning of a message
  2024-11-08 14:15   ` Philip Kaludercic
@ 2024-11-08 15:22     ` Eli Zaretskii
  2024-11-08 15:26       ` Philip Kaludercic
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-11-08 15:22 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 74027

> From: Philip Kaludercic <philipk@posteo.net>
> Cc: 74027@debbugs.gnu.org
> Date: Fri, 08 Nov 2024 14:15:53 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> -    (goto-char (point-max))
> >> +    (mail-text)
> >
> > I guess you are using sendmail.el as your mail-user-agent?  But the
> > default is message.el, so I think we should either use
> > message-goto-body here, 
> 
> Ok, I falsely assumed that using 'mail-text' would be more compatible.
> 
> >                         
> >                         or perhaps dispatch to either to message.el or
> > sendmail.el based on the value of mail-user-agent.
> 
> So a `cond' expression checking mail-user-agent and then invoking the
> right function, or is there some more generic way to do that?

The former, I think.





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

* bug#74027: [PATCH] ; Insert "Stealing lock" at the beginning of a message
  2024-11-08 15:22     ` Eli Zaretskii
@ 2024-11-08 15:26       ` Philip Kaludercic
  2024-11-08 15:50         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Philip Kaludercic @ 2024-11-08 15:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74027

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Philip Kaludercic <philipk@posteo.net>
>> Cc: 74027@debbugs.gnu.org
>> Date: Fri, 08 Nov 2024 14:15:53 +0000
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> -    (goto-char (point-max))
>> >> +    (mail-text)
>> >
>> > I guess you are using sendmail.el as your mail-user-agent?  But the
>> > default is message.el, so I think we should either use
>> > message-goto-body here, 
>> 
>> Ok, I falsely assumed that using 'mail-text' would be more compatible.
>> 
>> >                         
>> >                         or perhaps dispatch to either to message.el or
>> > sendmail.el based on the value of mail-user-agent.
>> 
>> So a `cond' expression checking mail-user-agent and then invoking the
>> right function, or is there some more generic way to do that?
>
> The former, I think.

In that case it seems better/simpler to just use 'message-goto-body'.

-- 
	Philip Kaludercic on siskin





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

* bug#74027: [PATCH] ; Insert "Stealing lock" at the beginning of a message
  2024-11-08 15:26       ` Philip Kaludercic
@ 2024-11-08 15:50         ` Eli Zaretskii
  2024-11-08 16:10           ` Philip Kaludercic
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-11-08 15:50 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 74027

> From: Philip Kaludercic <philipk@posteo.net>
> Cc: 74027@debbugs.gnu.org
> Date: Fri, 08 Nov 2024 15:26:40 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Philip Kaludercic <philipk@posteo.net>
> >> Cc: 74027@debbugs.gnu.org
> >> Date: Fri, 08 Nov 2024 14:15:53 +0000
> >> 
> >> Eli Zaretskii <eliz@gnu.org> writes:
> >> 
> >> >> -    (goto-char (point-max))
> >> >> +    (mail-text)
> >> >
> >> > I guess you are using sendmail.el as your mail-user-agent?  But the
> >> > default is message.el, so I think we should either use
> >> > message-goto-body here, 
> >> 
> >> Ok, I falsely assumed that using 'mail-text' would be more compatible.
> >> 
> >> >                         
> >> >                         or perhaps dispatch to either to message.el or
> >> > sendmail.el based on the value of mail-user-agent.
> >> 
> >> So a `cond' expression checking mail-user-agent and then invoking the
> >> right function, or is there some more generic way to do that?
> >
> > The former, I think.
> 
> In that case it seems better/simpler to just use 'message-goto-body'.

I'm not sure.  I use sendmail, and I don't really like the idea of
having message.el loaded into my sessions.

It shouldn't be hard to dispatch, is it?





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

* bug#74027: [PATCH] ; Insert "Stealing lock" at the beginning of a message
  2024-11-08 15:50         ` Eli Zaretskii
@ 2024-11-08 16:10           ` Philip Kaludercic
  2024-11-08 16:25             ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Philip Kaludercic @ 2024-11-08 16:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74027

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

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Philip Kaludercic <philipk@posteo.net>
>> Cc: 74027@debbugs.gnu.org
>> Date: Fri, 08 Nov 2024 15:26:40 +0000
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> From: Philip Kaludercic <philipk@posteo.net>
>> >> Cc: 74027@debbugs.gnu.org
>> >> Date: Fri, 08 Nov 2024 14:15:53 +0000
>> >> 
>> >> Eli Zaretskii <eliz@gnu.org> writes:
>> >> 
>> >> >> -    (goto-char (point-max))
>> >> >> +    (mail-text)
>> >> >
>> >> > I guess you are using sendmail.el as your mail-user-agent?  But the
>> >> > default is message.el, so I think we should either use
>> >> > message-goto-body here, 
>> >> 
>> >> Ok, I falsely assumed that using 'mail-text' would be more compatible.
>> >> 
>> >> >                         
>> >> >                         or perhaps dispatch to either to message.el or
>> >> > sendmail.el based on the value of mail-user-agent.
>> >> 
>> >> So a `cond' expression checking mail-user-agent and then invoking the
>> >> right function, or is there some more generic way to do that?
>> >
>> > The former, I think.
>> 
>> In that case it seems better/simpler to just use 'message-goto-body'.
>
> I'm not sure.  I use sendmail, and I don't really like the idea of
> having message.el loaded into my sessions.
>
> It shouldn't be hard to dispatch, is it?

Technically no, just if we want to be exhaustive then I don't have a
good overview of all clients.  Or should we just fall-back onto message:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Insert-Stealing-lock-at-the-beginning-of-a-message.patch --]
[-- Type: text/x-diff, Size: 1340 bytes --]

From 728f6e64b4c11099a0b70c748dbae2183e28f918 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Sat, 26 Oct 2024 09:39:00 +0200
Subject: [PATCH] ; Insert "Stealing lock" at the beginning of a message

* lisp/vc/vc.el (vc-steal-lock): Use 'mail-text' instead of
jumping to 'point-max', to avoid inserting the message after
signatures.
---
 lisp/vc/vc.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 194b181f3e9..dd6079d22ab 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1738,6 +1738,8 @@ vc-mark-resolved
 	 (format "%d files" (length files))
        "this file"))))
 
+(declare-function mail-text "sendmail" ())
+(declare-function message-goto-body "message" (&optional interactive))
 (defun vc-steal-lock (file rev owner)
   "Steal the lock on FILE."
   (let (file-description)
@@ -1758,7 +1760,10 @@ vc-steal-lock
     ;; goes wrong, we don't want to send any mail.
     (compose-mail owner (format "Stolen lock on %s" file-description))
     (setq default-directory (expand-file-name "~/"))
-    (goto-char (point-max))
+    (cond
+     ((eq mail-user-agent 'sendmail-user-agent)
+      (mail-text))
+     ((message-goto-body)))
     (insert
      (format "I stole the lock on %s, " file-description)
      (current-time-string)
-- 
2.45.2


[-- Attachment #3: Type: text/plain, Size: 34 bytes --]


-- 
	Philip Kaludercic on siskin

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

* bug#74027: [PATCH] ; Insert "Stealing lock" at the beginning of a message
  2024-11-08 16:10           ` Philip Kaludercic
@ 2024-11-08 16:25             ` Eli Zaretskii
  2024-11-08 16:30               ` Philip Kaludercic
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-11-08 16:25 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 74027

> From: Philip Kaludercic <philipk@posteo.net>
> Cc: 74027@debbugs.gnu.org
> Date: Fri, 08 Nov 2024 16:10:22 +0000
> 
> >> In that case it seems better/simpler to just use 'message-goto-body'.
> >
> > I'm not sure.  I use sendmail, and I don't really like the idea of
> > having message.el loaded into my sessions.
> >
> > It shouldn't be hard to dispatch, is it?
> 
> Technically no, just if we want to be exhaustive then I don't have a
> good overview of all clients.  Or should we just fall-back onto message:

Yes, falling back to message should be okay, IMO.

Thanks.





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

* bug#74027: [PATCH] ; Insert "Stealing lock" at the beginning of a message
  2024-11-08 16:25             ` Eli Zaretskii
@ 2024-11-08 16:30               ` Philip Kaludercic
  0 siblings, 0 replies; 9+ messages in thread
From: Philip Kaludercic @ 2024-11-08 16:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74027-done

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Philip Kaludercic <philipk@posteo.net>
>> Cc: 74027@debbugs.gnu.org
>> Date: Fri, 08 Nov 2024 16:10:22 +0000
>> 
>> >> In that case it seems better/simpler to just use 'message-goto-body'.
>> >
>> > I'm not sure.  I use sendmail, and I don't really like the idea of
>> > having message.el loaded into my sessions.
>> >
>> > It shouldn't be hard to dispatch, is it?
>> 
>> Technically no, just if we want to be exhaustive then I don't have a
>> good overview of all clients.  Or should we just fall-back onto message:
>
> Yes, falling back to message should be okay, IMO.
>
> Thanks.

OK, I have pushed the change to master!  Closing the report.

-- 
	Philip Kaludercic on siskin





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

end of thread, other threads:[~2024-11-08 16:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-26  7:41 bug#74027: [PATCH] ; Insert "Stealing lock" at the beginning of a message Philip Kaludercic
2024-11-02 11:27 ` Eli Zaretskii
2024-11-08 14:15   ` Philip Kaludercic
2024-11-08 15:22     ` Eli Zaretskii
2024-11-08 15:26       ` Philip Kaludercic
2024-11-08 15:50         ` Eli Zaretskii
2024-11-08 16:10           ` Philip Kaludercic
2024-11-08 16:25             ` Eli Zaretskii
2024-11-08 16:30               ` Philip Kaludercic

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.