bug#72866: [PATCH] Add ediff-copy-all-X-to-Y functions

2024-09-02 Thread Robert Pluim
> On Sun, 1 Sep 2024 08:59:53 +0200, Paul Nelson  said:

>> > This patch binds functions in Ediff that copy all changes from one
>> > buffer to another, without having to manually go through each
>> > difference.  Any feedback welcome.
>> 
>> Can you describe situation(s) where these commands will be useful?

Paul> I use Ediff to merge documents outside of git, like when
Paul> working with someone over email or using a computer program to
Paul> refactor code.  Sometimes all changes go one way, say from B to A.
Paul> The standard workflow then involves pressing "n" to review and "b" to
Paul> apply each change.  When the changes turn out to be mundane, this
Paul> leads to repetitive "n b" keystrokes.  The proposed patch allows a
Paul> more efficient process: rapidly review with "n", then apply all at
Paul> once using "C-c C-b".

The functionality seems useful. I wonder if it makes more sense to
have them triggered by the prefix arg, eg "C-u b", "C-u a b",
etc. rather than having to keep Ctrl pressed.

Robert
-- 





bug#69097: [PATCH] Add 'kill-region-or-word' command

2024-09-03 Thread Robert Pluim
> On Tue, 03 Sep 2024 15:21:54 +0300, Eli Zaretskii  said:

>> From: Philip Kaludercic 
>> Cc: Eli Zaretskii ,  Stefan Kangas 
,
>> Andrea Corallo ,  j...@linkov.net,  r...@gnu.org,
>> 69...@debbugs.gnu.org
>> Date: Mon, 02 Sep 2024 21:12:01 +
>> 
>> I had misremembered the last state of this patch.  It is easier to just
>> have a tristate option.  Here is the updated proposal:

Eli> Thanks.

>> +(defcustom kill-word-if-no-region nil

Eli> I would call this 'kill-region-dwim' instead.

>> +  "Behaviour when `kill-region' is invoked without an active region.
>> +If set to nil (default), then an error occurs and nothing is killed.  If
>> +set to `emacs-word', then kill a the last word as defined by the current
>> +major mode.  If set to `unix-word', then kill the last word in the style
>> +of a shell like Bash, disregarding the major mode."
>> +  :type '(choice (const :tag "Kill a word like `backward-kill-word'" 
emacs-word)
>> + (const :tag "Kill a word like Bash would" unix-word)
>> + (const :tag "Do not kill anything" nil))
>> +  :group 'killing)

Eli> :version tag is missing.

Is it worth allowing a user-specified function?

Robert
-- 





bug#69097: [PATCH] Add 'kill-region-or-word' command

2024-09-03 Thread Robert Pluim
> On Tue, 03 Sep 2024 17:27:59 +0300, Eli Zaretskii  said:
>> >> +  "Behaviour when `kill-region' is invoked without an active region.
>> >> +If set to nil (default), then an error occurs and nothing is killed. 
 If
>> >> +set to `emacs-word', then kill a the last word as defined by the 
current
>> >> +major mode.  If set to `unix-word', then kill the last word in the 
style
>> >> +of a shell like Bash, disregarding the major mode."
>> >> +  :type '(choice (const :tag "Kill a word like `backward-kill-word'" 
emacs-word)
>> >> + (const :tag "Kill a word like Bash would" unix-word)
>> >> + (const :tag "Do not kill anything" nil))
>> >> +  :group 'killing)
>> 
Eli> :version tag is missing.
>> 
>> Is it worth allowing a user-specified function?

Eli> I don't understand what you are asking, sorry.  Allow a function where
Eli> and to do what?

The current proposal offers three fixed behaviours. Iʼm wondering if
it makes sense for the user option to be allowed to be a user-defined
function, in case someone wants a different behaviour, ie

+(defcustom kill-word-if-no-region nil
+  "Behaviour when `kill-region' is invoked without an active region.
+If set to nil (default), then an error occurs and nothing is killed.  If
+set to `emacs-word', then kill a the last word as defined by the current
+major mode.  If set to `unix-word', then kill the last word in the style
+of a shell like Bash, disregarding the major mode.  If set to a
+function, call that function."
+  :type '(choice (const :tag "Kill a word like `backward-kill-word'" 
emacs-word)
+ (const :tag "Kill a word like Bash would" unix-word)
+ (const :tag "Do not kill anything" nil)
+ (symbol :tag "User function")
+  :group 'killing)

Robert
-- 





bug#69097: [PATCH] Add 'kill-region-or-word' command

2024-09-03 Thread Robert Pluim
> On Tue, 03 Sep 2024 16:32:46 +, Philip Kaludercic 
>  said:
>> 
>> Is it worth allowing a user-specified function?

Philip> That would be possible as well, but to make it manageable with the
Philip> current approach the function would have to be one that moves the 
point.
Philip> So we could rewrite the patch with two default options 
`backward-word'
Philip> and `unix-backward-word' (which we would have to add), but I am not 
sure
Philip> it would have much use.  Perhaps killing the current word, instead 
of
Philip> just killing to the beginning?

You mean having all the option values be functions? That would work as
well, but was not what I was suggesting.

In any case, I canʼt find a strong justification for such
configurability. We can always add it in later if people ask for it.

Robert
-- 





bug#72866: [PATCH] Add ediff-copy-all-X-to-Y functions

2024-09-04 Thread Robert Pluim
> On Wed, 4 Sep 2024 09:30:58 +0200, Paul Nelson  said:

Paul> Many thanks for your suggestion.  I agree that this is a more elegant
Paul> approach, which also admits a simpler implementation.  I've attached
Paul> my revised patch.  Any further feedback welcome.

Minor comments below

Paul> Thanks, best,

Paul> Paul

Paul> From 91ade3effdbf19b7d8793020a1c31a4ff791a58d Mon Sep 17 00:00:00 2001
Paul> From: Paul Nelson 
Paul> Date: Wed, 4 Sep 2024 09:24:25 +0200
Paul> Subject: [PATCH] Add Ediff feature for copying all differences

Paul> * lisp/vc/ediff-util.el (ediff-diff-to-diff): With universal
Paul> prefix, copy all differences.

Paul> * doc/misc/ediff.texi (Quick Help Commands):
Paul> * etc/NEWS: (Lisp Changes in Emacs 31.1): Document the new
Paul> feature.
Paul> ---
Paul>  doc/misc/ediff.texi   | 26 ++
Paul>  etc/NEWS  | 16 
Paul>  lisp/vc/ediff-util.el | 29 +
Paul>  3 files changed, 47 insertions(+), 24 deletions(-)

Paul> diff --git a/doc/misc/ediff.texi b/doc/misc/ediff.texi
Paul> index 749025c870b..6afb38e3fae 100644
Paul> --- a/doc/misc/ediff.texi
Paul> +++ b/doc/misc/ediff.texi
Paul> @@ -489,15 +489,16 @@ Quick Help Commands
Paul>  @item a
Paul>  @kindex a
Paul>  @emph{In comparison sessions:}
Paul> -Copies the current difference region (or the region specified as the 
prefix
Paul> -to this command) from buffer A to buffer B@.
Paul> -Ediff saves the old contents of buffer B's region; it can
Paul> -be restored via the command @kbd{rb}, which see.
Paul> +Copies the current difference region (or the region specified as the
Paul> +prefix to this command, or @emph{all} regions with @kbd{C-u} prefix)
Paul> +from buffer A to buffer B@.  Ediff saves the old contents of buffer 
B's
Paul> +region; it can be restored via the command @kbd{rb}, which see.

'numerical prefix' maybe? Although that part of the text is not new.

Paul>  @emph{In merge sessions:}
Paul> -Copies the current difference region (or the region specified as the 
prefix
Paul> -to this command) from buffer A to the merge buffer.  The old 
contents of
Paul> -this region in buffer C can be restored via the command @kbd{r}.
Paul> +Copies the current difference region (or the region specified as the
Paul> +prefix to this command, or @emph{all} regions with @kbd{C-u} prefix)
Paul> +from buffer A to the merge buffer.  The old contents of this region 
in
Paul> +buffer C can be restored via the command @kbd{r}.

Similarly here

Paul>  @item b
Paul>  @kindex b
Paul> @@ -511,11 +512,12 @@ Quick Help Commands
 
Paul>  @item ab
Paul>  @kindex ab
Paul> -Copies the current difference region (or the region specified as the 
prefix
Paul> -to this command) from buffer A to buffer B@.  This (and the next 
five)
Paul> -command is enabled only in sessions that compare three files
Paul> -simultaneously.  The old region in buffer B is saved and can be 
restored
Paul> -via the command @kbd{rb}.
Paul> +Copies the current difference region (or the region specified as the
Paul> +prefix to this command, or @emph{all} regions with @kbd{C-u} prefix)
Paul> +from buffer A to buffer B@.  This (and the next five) command is 
enabled
Paul> +only in sessions that compare three files simultaneously.  The old
Paul> +region in buffer B is saved and can be restored via the command
Paul> +@kbd{rb}.

and here.

Paul>  @item ac
Paul>  @kindex ac
Paul>  Copies the difference region from buffer A to buffer C@.
Paul> diff --git a/etc/NEWS b/etc/NEWS
Paul> index f10f9ae4d65..a6db0c96288 100644
Paul> --- a/etc/NEWS
Paul> +++ b/etc/NEWS
Paul> @@ -121,6 +121,22 @@ A new ':authorizable t' parameter has been added 
to 'dbus-call-method'
Paul>  and 'dbus-call-method-asynchronously' to allow the user to 
interactively
Paul>  authorize the invoked D-Bus method (e.g., via polkit).
 
Paul> 
Paul> +** Ediff's copy commands now apply to all changes with 'C-u' prefix.
Paul> +The Ediff copy commands, bound to 'a', 'b', 'ab', etc., now copy all
Paul> +changes when supplied with a universal prefix argument via 'C-u':
Paul> +
Paul> +- 'C-u a' copies all changes from buffer A to buffer B (in 2-way 
diff)
Paul> +  or to buffer C (in 3-way diff or merge).
Paul> +- 'C-u b' copies all changes from buffer B to buffer A (in 2-way 
diff)
Paul> +  or to buffer C (in 3-way diff or merge).
Paul> +- 'C-u a b' copies all changes from buffer A to buffer B.
Paul> +- 'C-u b a' copies all changes from buffer B to buffer A.
Paul> +- 'C-u a c' copies all changes from buffer A to buffer C.
Paul> +- 'C-u b c' copies all changes from buffer B to buffer C.
Paul> +- 'C-u c a' copies all changes from buffer C to buff

bug#72986: Disabling menu-bar-mode changes size of new frames

2024-09-04 Thread Robert Pluim
> On Wed, 04 Sep 2024 20:12:28 +0800, Po Lu via "Bug reports for GNU Emacs, 
> the Swiss army knife of text editors"  said:

Po Lu> If it is this bug that you are trying to isolate, we have already 
heard
Po Lu> reports of its being reproducible all the way to Emacs 26.1, and
Po Lu> concluded that it is a product of a change in the Mutter window 
manager.

As a reference point: I donʼt see this issue here with mutter 43.8

Robert
-- 





bug#72831: [PATCH] gnus-icalendar: Allow comments in event replies

2024-09-11 Thread Robert Pluim
tags 72831 fixed
close 72831 31.1
quit

> On Sat, 07 Sep 2024 17:05:34 +0200, Ferdinand Pieper  
> said:

Ferdinand> Eli Zaretskii  writes:
>> Thanks, I'd like to wait for a few days, to let people comment if they
>> want.

Ferdinand> Sounds good, thanks for handling it.

I wrote a NEWS entry for this and made a few minor style and typo edits.

Sorry about the delay.

Closing.
Committed as 8332b4dd07a

Robert
-- 





bug#72866: [PATCH] Add ediff-copy-all-X-to-Y functions

2024-09-11 Thread Robert Pluim
tags 72866 fixed
close 72866 31.1
quit

> On Wed, 4 Sep 2024 15:20:46 +0200, Paul Nelson  said:

Paul> Thanks Robert, I've implemented your suggestions.
Paul> I hope someone will check that I've used "+++" correctly in NEWS,
Paul> affirming that I updated the documentation -- hopefully I didn't miss
Paul> anything.

Looks fine to me. I slightly adjusted your commit message and added
the bug number to it.

Closing.
Committed as 833158c0b78

Robert
-- 





bug#73175: 30.0.60; toggling emacs-news-view-mode doesn't remove buttons

2024-09-11 Thread Robert Pluim


src/emacs -Q etc/NEWS
C-x C-q ; buttons appear
C-x C-q ; buttons donʼt disappear

(personally I donʼt mind the buttons, but the intent of faf1f037987c
was to make them disappear).

I came up with the following, but I can never remember all the details
of text property removal (maybe we need a `button-debuttonize-region'?)

diff --git a/lisp/textmodes/emacs-news-mode.el 
b/lisp/textmodes/emacs-news-mode.el
index edeb1540feb..2cca63071b5 100644
--- a/lisp/textmodes/emacs-news-mode.el
+++ b/lisp/textmodes/emacs-news-mode.el
@@ -112,10 +112,17 @@ emacs-news--mode-common
 (define-derived-mode emacs-news-mode text-mode "NEWS"
   "Major mode for editing the Emacs NEWS file."
   ;; Disable buttons.
-  (button-mode nil)
+  (button-mode -1)
   ;; And make the buffer writable.  This is used when toggling
   ;; emacs-news-mode.
   (setq buffer-read-only nil)
+  (save-excursion
+(with-silent-modifications
+  (widen)
+  (remove-text-properties (point-min) (point-max)
+(button--properties nil nil nil))
+  (add-face-text-property (point-min) (point-max)
+  'button nil)))
   (setq-local fill-paragraph-function #'emacs-news--fill-paragraph)
   (emacs-news--mode-common))
 



In GNU Emacs 30.0.60 (build 4, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.16.0) of 2024-09-05 built on rltb
Repository revision: fc7581ae2ee9db1e3189b76c66be9cd13f72f004
Repository branch: emacs-30
System Description: Debian GNU/Linux 12 (bookworm)

Robert
-- 





bug#73206: 28.2; xml comment with blank lines to do not indent correctly, nxml-mode.el

2024-09-13 Thread Robert Pluim
> On Thu, 12 Sep 2024 13:53:26 -0400, John Ciolfi via "Bug reports for GNU 
> Emacs, the Swiss army knife of text editors"  said:

John> 1. Create foo.xml containing:

John> 
John>  
John> 

John> Notice that we have a blank line in the xml comment.

John> 2. Put the point on 'bar' and press TAB.

John> Notice that the 'bar' line is not indented correctly.

John> Solution
John> 

John> The problem is that in nxml-compute-indent-in-delimited-token, there
John> is a (forward-line -1) which assumes that the prior line is indented. 
In
John> this case the prior line is a blank line and thus doesn't have
John> indentation. After the (forward-line -1), we need to keep going back
John> until we see a non-blank line:

John>  (forward-line -1)
John> +   (while (looking-at "^[:blank:]*$")
John> +  (forward-line -1))
 
John> Attached is a patch for nxml-mode.el that fixes the issue. 

Your patch does the right thing, but for the wrong reasons. Regexp
character classes only have meaning with a bracket expression, so what
youʼre matching here is actually any lines containing zero or more of
':', 'b', 'l', 'a', 'n', or 'k'. IOW, you should use:

 (looking-at "^[[:blank:]]*$")

Robert
-- 





bug#73217: 30.0.91; etc/ORG-NEWS typo

2024-09-13 Thread Robert Pluim
tags 73217 fixed
close 73217 30.1
quit

> On Thu, 12 Sep 2024 20:51:29 -0700, Mike Kupfer  said:

>> Previously, all the image previews where always left-aligned.
Mike> "where" should be "were".

Mike> mike

Thanks, fixed.

Closing.
Committed as 79f68597aba

Robert
--