bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59662: 29.0.50; [PATCH] Add treesit--indent-defun


From: Theodor Thornhill
Subject: bug#59662: 29.0.50; [PATCH] Add treesit--indent-defun
Date: Sat, 10 Dec 2022 21:21:53 +0100

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Theodor Thornhill <theo@thornhill.no>
>> Cc: dgutov@yandex.ru, larsi@gnus.org, 59662@debbugs.gnu.org,
>>  casouri@gmail.com, monnier@iro.umontreal.ca
>> Date: Fri, 09 Dec 2022 22:09:10 +0100
>> 
>> Something like the patch below?  Forgive me, but my texinfo-fu is
>> limited.
>
> You have nothing to worry in that department.
>
>> I'm a little unsure if I xrefed to the correct nodes.  Maybe
>> it is better to just mention 'beginning-of-defun' rather than the
>> variable 'beginning-of-defun-function'?
>
> I meant a reference to where beginning-of-defun-function is mentioned,
> and that is in the ELisp manual.  You can see examples of how to
> reference another manual in many places in doc/emacs/*.texi; seartch
> for "elisp".
>

Ok, thanks!

>> >> +(defun prog-fill-reindent-defun (&optional argument)
>> >> +  "Refill paragraph or reindent the definition that the point is on.
>> >> +
>> >> +If the point is in a string, or in a comment, or there is a
>> >> +comment on the current line, fill the paragraph that the point is
>> >> +in or is on the same line.
>> >
>> > I don't understand the difference between "point is in a string, or in
>> > a comment" and "there is a comment on the current line".  
>> >
>> >> +Otherwise, reindent the definition around or below point."
>> >
>> > Likewise this one is confusing.
>> 
>> I'm not sure how to word this differently, but I agree it's a mouthful.
>
> If you explain to me in plain English what you meant, I can suggest a
> better wording.
>

I made another attempt - I think it's a little clearer.  What I want to
say is something like this (| denotes point):

1. If point is inside a comment, refill the paragraph:
  // foo bar | baz

2. If point is before a comment, refill the paragraph:
 |  // foo bar baz

3. If point is inside code, reindent the defun:
int
main(void)
{
             int i;          // <-- This will be reindented
  /* Some very long comment that will _not_ be refilled in this case.  */
  for(;;)
    {
  |   int x;
    }
}

Anyway, see attached patch:

Theo

Attachment: 0001-Add-prog-fill-reindent-defun-bug-59664.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]