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

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

bug#66670: [PATCH] Use buffer-local comment-continue in comment-indent-n


From: Stefan Monnier
Subject: bug#66670: [PATCH] Use buffer-local comment-continue in comment-indent-new-line
Date: Sun, 22 Oct 2023 00:11:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

>>>                       ;; Recreate comment-continue from comment-start.
>>> -                     ;; FIXME: wrong if comment-continue was set 
>>> explicitly!
>>>                       ;; FIXME: use prev line's continuation if available.
>>> -                     (comment-continue nil))
>>> +                     (comment-continue (if (local-variable-p 
>>> 'comment-continue)
>>> +                                           comment-continue
>>> +                                         nil)))
>>
>> Are you sure?  `comment-continue` is very rarely set globally.
>> Usually it's set buffer-locally by `comment-normalize-vars`.
>
> Or by the major-mode!  But yes, I see your point, this patch is
> effectively removing the (comment-continue nil) definition.

Yup.

> I guess that the (comment-continue nil) definition is there in the first
> place so that comment-normalize-vars recalculates it based on
> comment-start,

Indeed, that's what the comment tries to say.

> which is the comment prefix from the previous line?

Something like that, yes.

> So we therefore copy the prefix from the previous line?

Not necessarily.  If the previous line was the beginning of the comment
with "/*" we should use " *".

> Should we just recalculate comment-continue directly in
> comment-indent-new-line instead, if necessary?

We could.  But we still need to decide whether to do that or to just
trust the `comment-continue` value set by those major modes which set
it by hand :-(


        Stefan






reply via email to

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