GNU bug report logs - #33541
26; Doc string of `align-regexp'

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Wed, 28 Nov 2018 17:27:01 UTC

Severity: wishlist

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33541 in the body.
You can then email your comments to 33541 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#33541; Package emacs. (Wed, 28 Nov 2018 17:27:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 28 Nov 2018 17:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26; Doc string of `align-regexp'
Date: Wed, 28 Nov 2018 09:26:25 -0800 (PST)
These two paragraphs seem to contradict each other:

 There is no predefined rule to handle this, but you could easily do it
 using a REGEXP like "(".  Interactively, all you would have to do is
 to mark the region, call 'align-regexp' and enter that regular expression.

 REGEXP must contain at least one parenthesized subexpression, typically
 whitespace of the form "\\(\\s-*\\)".  In normal interactive use,
 this is automatically added to the start of your regular expression after
 you enter it.  You only need to supply the characters to be lined up, and
 any preceding whitespace is replaced.

It cannot be the case that both (1) all you have to input as regexp is
"(" and (2) the input regexp must contain a group subexpression.

It's also unclear to say that REGEXP must contain... and also say that
something gets added automatically to it.

Yes, it's correct, provided a user interprets "REGEXP" only as the Lisp
argument and not directly as the regexp she enters.  Clearer wording
would be welcome, distinguishing (1) what you have to input (do you need
to include a group subexpression?  even if it is the whitespace prefix
"\\(\\s-*\\)"?) from what is required as the REGEXP argument to the
function.

In particular (minimum fix), it is incorrect to say 'you could easily do
it using a REGEXP like "("'.  There, REGEXP clearly must be the Lisp
argument, not what you type interactively.  REGEXP presumably always
requires a group subexpression.


In GNU Emacs 26.1 (build 1, x86_64-w64-mingw32)
 of 2018-05-30
Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea
Windowing system distributor `Microsoft Corp.', version 10.0.16299
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33541; Package emacs. (Wed, 28 Nov 2018 23:23:01 GMT) Full text and rfc822 format available.

Message #8 received at 33541 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 33541 <at> debbugs.gnu.org
Subject: Re: bug#33541: 26; Doc string of `align-regexp'
Date: Thu, 29 Nov 2018 12:22:18 +1300
I think the docstring is clear, provided that you read all of it; but
it could undoubtedly be improved, especially as this is a slightly
fiddly command to get to grips with.

Perhaps your concern could be addressed by tweaking the paragraph
starting "REGEXP must contain at least one parenthesized subexpression"
so that it says:

"Non-interactively, REGEXP must contain at least one parenthesized...."

(which strictly speaking is perhaps less correct than what it says now,
yet I think in practice would make things slightly clearer.)

I would also change "automatically added" to "automatically prefixed".


-Phil



On 2018-11-29 06:26, Drew Adams wrote:
> These two paragraphs seem to contradict each other:
> 
>  There is no predefined rule to handle this, but you could easily do it
>  using a REGEXP like "(".  Interactively, all you would have to do is
>  to mark the region, call 'align-regexp' and enter that regular 
> expression.
> 
>  REGEXP must contain at least one parenthesized subexpression, 
> typically
>  whitespace of the form "\\(\\s-*\\)".  In normal interactive use,
>  this is automatically added to the start of your regular expression 
> after
>  you enter it.  You only need to supply the characters to be lined up, 
> and
>  any preceding whitespace is replaced.
> 
> It cannot be the case that both (1) all you have to input as regexp is
> "(" and (2) the input regexp must contain a group subexpression.
> 
> It's also unclear to say that REGEXP must contain... and also say that
> something gets added automatically to it.
> 
> Yes, it's correct, provided a user interprets "REGEXP" only as the Lisp
> argument and not directly as the regexp she enters.  Clearer wording
> would be welcome, distinguishing (1) what you have to input (do you 
> need
> to include a group subexpression?  even if it is the whitespace prefix
> "\\(\\s-*\\)"?) from what is required as the REGEXP argument to the
> function.
> 
> In particular (minimum fix), it is incorrect to say 'you could easily 
> do
> it using a REGEXP like "("'.  There, REGEXP clearly must be the Lisp
> argument, not what you type interactively.  REGEXP presumably always
> requires a group subexpression.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33541; Package emacs. (Wed, 28 Nov 2018 23:47:01 GMT) Full text and rfc822 format available.

Message #11 received at 33541 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 33541 <at> debbugs.gnu.org
Subject: RE: bug#33541: 26; Doc string of `align-regexp'
Date: Wed, 28 Nov 2018 15:46:09 -0800 (PST)
> I think the docstring is clear, provided that you read all of it; but
> it could undoubtedly be improved, especially as this is a slightly
> fiddly command to get to grips with.

I don't think so.

> Perhaps your concern could be addressed by tweaking the paragraph
> starting "REGEXP must contain at least one parenthesized subexpression"
> so that it says:
> 
> "Non-interactively, REGEXP must contain at least one parenthesized...."
> 
> (which strictly speaking is perhaps less correct than what it says now,
> yet I think in practice would make things slightly clearer.)

That's in fact worse, as you say.

The argument to the function is REGEXP.  Just what
REGEXP needs to be must be specified accurately.
And what REGEXP needs to be has nothing to do with
whether the function is invoked interactively.

However, in addition to REGEXP needing to be specified
precisely, we need to tell users what they need to
input, to provide arg REGEXP to the function.

Those are two different descriptions.

Usually we describe a command first in terms of
interactive use.  In this case, that means in terms
of describing what you need to input.  Call it a
pattern or whatever, or don't call it anything, but
in any case don't call it REGEXP (the arg name) -
what you input is not arg REGEXP.

We can then say that from your input is constructed
arg REGEXP, which is what is matched against...
And there we can specify both REGEXP and how it is
constructed from your input.

The main problem is conflating arg REGEXP with the
user input, which is a suffix of REGEXP.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33541; Package emacs. (Thu, 29 Nov 2018 07:24:02 GMT) Full text and rfc822 format available.

Message #14 received at 33541 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 33541 <at> debbugs.gnu.org, drew.adams <at> oracle.com
Subject: Re: bug#33541: 26; Doc string of `align-regexp'
Date: Thu, 29 Nov 2018 09:23:36 +0200
> Date: Thu, 29 Nov 2018 12:22:18 +1300
> From: Phil Sainty <psainty <at> orcon.net.nz>
> Cc: 33541 <at> debbugs.gnu.org
> 
> I think the docstring is clear, provided that you read all of it; but
> it could undoubtedly be improved, especially as this is a slightly
> fiddly command to get to grips with.
> 
> Perhaps your concern could be addressed by tweaking the paragraph
> starting "REGEXP must contain at least one parenthesized subexpression"
> so that it says:
> 
> "Non-interactively, REGEXP must contain at least one parenthesized...."
> 
> (which strictly speaking is perhaps less correct than what it says now,
> yet I think in practice would make things slightly clearer.)
> 
> I would also change "automatically added" to "automatically prefixed".

Patches to improve that doc string are welcome.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33541; Package emacs. (Thu, 29 Nov 2018 07:26:02 GMT) Full text and rfc822 format available.

Message #17 received at 33541 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: psainty <at> orcon.net.nz, 33541 <at> debbugs.gnu.org
Subject: Re: bug#33541: 26; Doc string of `align-regexp'
Date: Thu, 29 Nov 2018 09:25:49 +0200
> Date: Wed, 28 Nov 2018 15:46:09 -0800 (PST)
> From: Drew Adams <drew.adams <at> oracle.com>
> Cc: 33541 <at> debbugs.gnu.org
> 
> The argument to the function is REGEXP.  Just what
> REGEXP needs to be must be specified accurately.
> And what REGEXP needs to be has nothing to do with
> whether the function is invoked interactively.
> 
> However, in addition to REGEXP needing to be specified
> precisely, we need to tell users what they need to
> input, to provide arg REGEXP to the function.
> 
> Those are two different descriptions.
> 
> Usually we describe a command first in terms of
> interactive use.  In this case, that means in terms
> of describing what you need to input.  Call it a
> pattern or whatever, or don't call it anything, but
> in any case don't call it REGEXP (the arg name) -
> what you input is not arg REGEXP.
> 
> We can then say that from your input is constructed
> arg REGEXP, which is what is matched against...
> And there we can specify both REGEXP and how it is
> constructed from your input.
> 
> The main problem is conflating arg REGEXP with the
> user input, which is a suffix of REGEXP.

I don't see how this doc string could be improved by just discussing
it.  Someone who understands well enough what the feature does should
sit down and prepare more clear and coherent text, and then submit a
patch.  FWIW, I tried and didn't succeed too well.  (Which should not
discourage others from trying, of course.)

TIA




Severity set to 'wishlist' from 'minor' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 03 Oct 2019 00:18:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33541; Package emacs. (Wed, 22 Sep 2021 22:20:01 GMT) Full text and rfc822 format available.

Message #22 received at 33541 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: psainty <at> orcon.net.nz, 33541 <at> debbugs.gnu.org,
 Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#33541: 26; Doc string of `align-regexp'
Date: Thu, 23 Sep 2021 00:19:06 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> I don't see how this doc string could be improved by just discussing
> it.  Someone who understands well enough what the feature does should
> sit down and prepare more clear and coherent text, and then submit a
> patch. 

I've now tried to make the doc string more coherent by emphasising
what's being added interactively, and what REGEXP has to actually
contain in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 33541 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 22 Sep 2021 22:20:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 21 Oct 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 188 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.