GNU bug report logs - #70331
[PATCH] Call custom folding functions with consistent point

Previous Next

Package: auctex;

Reported by: Paul Nelson <ultrono <at> gmail.com>

Date: Thu, 11 Apr 2024 05:49:03 UTC

Severity: normal

Tags: patch

Done: Arash Esbati <arash <at> gnu.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 70331 in the body.
You can then email your comments to 70331 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-auctex <at> gnu.org:
bug#70331; Package auctex. (Thu, 11 Apr 2024 05:49:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Nelson <ultrono <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Thu, 11 Apr 2024 05:49:04 GMT) Full text and rfc822 format available.

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

From: Paul Nelson <ultrono <at> gmail.com>
To: bug-auctex <at> gnu.org
Subject: [PATCH] Call custom folding functions with consistent point
Date: Thu, 11 Apr 2024 07:47:33 +0200
[Message part 1 (text/plain, inline)]
Hello,

As you know, one way to customize TeX-fold-mode is to supply functions
to the variables TeX-fold-*-spec-list, which are then called by
TeX-fold-hide-item.  This patch introduces the convention that such
functions are called with point positioned at the beginning of the
item to be folded.  This already happens "by accident" when the
folding occurs via TeX-fold-region, but not via TeX-fold-post-command,
for instance.

The motivation for having a consistent convention is that it makes it
possible (or at least simpler) to introduce more advanced folding
specs that depend on more than just the provided argument list.  For
example, in https://github.com/ultronozm/czm-tex-fold.el, I have used
similar functionality, implemented via :override advice, to fold
\begin{theorem} as "Theorem 1.1", with the correct equation number.
The patch would allow me to excise the advice.

Thanks, best,

Paul
[0001-Call-custom-folding-functions-with-consistent-point.patch (application/octet-stream, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#70331; Package auctex. (Sat, 13 Apr 2024 21:26:12 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Paul Nelson <ultrono <at> gmail.com>
Cc: 70331 <at> debbugs.gnu.org
Subject: Re: bug#70331: [PATCH] Call custom folding functions with
 consistent point
Date: Sat, 13 Apr 2024 23:25:28 +0200
Hi Paul,

Paul Nelson <ultrono <at> gmail.com> writes:

> From 594ff7ad7454d42dbab37e213714f9827e1061b1 Mon Sep 17 00:00:00 2001
> From: Paul Nelson <ultrono <at> gmail.com>
> Date: Thu, 11 Apr 2024 07:33:21 +0200
> Subject: [PATCH] Call custom folding functions with consistent point

Thanks for patch, I installed it (5f40b686b4).  I have one question
though:

> * tex-fold.el (TeX-fold-hide-item): Call folding spec with point at
> beginning of item.
> * doc/auctex.texi (Folding): Mention the new convention.

How do you generate the changelog above?  When I paste the entry in my
ChangeLog inside my local repo and re-fill, it looks like this:

  * tex-fold.el (TeX-fold-hide-item): Call folding spec with point
  at beginning of item.
  * doc/auctex.texi (Folding): Mention the new convention.

Note the different line break after "point".  In value of `fill-column'
should be set to 74 when editing the ChangeLog.  Which value do you see?

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#70331; Package auctex. (Sat, 13 Apr 2024 21:50:04 GMT) Full text and rfc822 format available.

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

From: Paul Nelson <ultrono <at> gmail.com>
To: Arash Esbati <arash <at> gnu.org>
Cc: 70331 <at> debbugs.gnu.org
Subject: Re: bug#70331: [PATCH] Call custom folding functions with consistent
 point
Date: Sat, 13 Apr 2024 23:48:35 +0200
Hi Arash,

> How do you generate the changelog above?  When I paste the entry in my
> ChangeLog inside my local repo and re-fill, it looks like this:
>
>   * tex-fold.el (TeX-fold-hide-item): Call folding spec with point
>   at beginning of item.
>   * doc/auctex.texi (Folding): Mention the new convention.
>
> Note the different line break after "point".  In value of `fill-column'
> should be set to 74 when editing the ChangeLog.  Which value do you see?

I've generally been trying to remember to set fill-column to 63
(following my interpretation of
https://git.savannah.gnu.org/cgit/emacs.git/tree/CONTRIBUTE#n243), but
guess I forgot here -- I suspect I used 70, which seems to be the
default for me via magit or vc.el.  I suspect you meant to write 64
rather than 74?  Happy to hardcode mine to that (or whatever) so I
won't forget.

Thanks,b est,

Paul




Information forwarded to bug-auctex <at> gnu.org:
bug#70331; Package auctex. (Sun, 14 Apr 2024 13:43:03 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Paul Nelson <ultrono <at> gmail.com>
Cc: 70331 <at> debbugs.gnu.org
Subject: Re: bug#70331: [PATCH] Call custom folding functions with
 consistent point
Date: Sun, 14 Apr 2024 15:42:12 +0200
Hi Paul,

Paul Nelson <ultrono <at> gmail.com> writes:

> I've generally been trying to remember to set fill-column to 63
> (following my interpretation of
> https://git.savannah.gnu.org/cgit/emacs.git/tree/CONTRIBUTE#n243), but
> guess I forgot here -- I suspect I used 70, which seems to be the
> default for me via magit or vc.el.  I suspect you meant to write 64
> rather than 74?

No, I meant 74 since I manually edit a ChangeLog file and then copy my
entries when commiting.  But in general, yes, the fill-column in Git
messages should be 64.

> Happy to hardcode mine to that (or whatever) so I won't forget.

We have a .dir-locals.el in our repo for this purpose.  I just updated
it with some entries from Emacs .dir-locals.el.  Do you want to update
your local repo and see if that gives you better results?  TIA.

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#70331; Package auctex. (Sun, 14 Apr 2024 14:06:02 GMT) Full text and rfc822 format available.

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

From: Paul Nelson <ultrono <at> gmail.com>
To: Arash Esbati <arash <at> gnu.org>
Cc: 70331 <at> debbugs.gnu.org
Subject: Re: bug#70331: [PATCH] Call custom folding functions with consistent
 point
Date: Sun, 14 Apr 2024 16:04:54 +0200
Hi Arash,

OK, I think I understand.  Just to be sure: your workflow is to edit a
"dummy" ChangeLog file while preparing a commit (in the auctex folder,
so that the .dir-locals.el are in effect), then copy this into the
actual commit message (in vc.el or magit) and delete the leading tabs?

Thanks, best,

Paul

On Sun, Apr 14, 2024 at 3:42 PM Arash Esbati <arash <at> gnu.org> wrote:
>
> Hi Paul,
>
> Paul Nelson <ultrono <at> gmail.com> writes:
>
> > I've generally been trying to remember to set fill-column to 63
> > (following my interpretation of
> > https://git.savannah.gnu.org/cgit/emacs.git/tree/CONTRIBUTE#n243), but
> > guess I forgot here -- I suspect I used 70, which seems to be the
> > default for me via magit or vc.el.  I suspect you meant to write 64
> > rather than 74?
>
> No, I meant 74 since I manually edit a ChangeLog file and then copy my
> entries when commiting.  But in general, yes, the fill-column in Git
> messages should be 64.
>
> > Happy to hardcode mine to that (or whatever) so I won't forget.
>
> We have a .dir-locals.el in our repo for this purpose.  I just updated
> it with some entries from Emacs .dir-locals.el.  Do you want to update
> your local repo and see if that gives you better results?  TIA.
>
> Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#70331; Package auctex. (Sun, 14 Apr 2024 14:32:03 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Paul Nelson <ultrono <at> gmail.com>
Cc: 70331 <at> debbugs.gnu.org
Subject: Re: bug#70331: [PATCH] Call custom folding functions with
 consistent point
Date: Sun, 14 Apr 2024 16:30:48 +0200
Paul Nelson <ultrono <at> gmail.com> writes:

> OK, I think I understand.  Just to be sure: your workflow is to edit a
> "dummy" ChangeLog file while preparing a commit (in the auctex folder,
> so that the .dir-locals.el are in effect), then copy this into the
> actual commit message (in vc.el or magit) and delete the leading tabs?

Yes, exactly.  But I don't use vc.el or magit, I do "git commit" from
the command line and Git opens Emacs via emacsclient.

That's why I can't tell if commit 5970fbf499 improves the situation for
you by setting `fill-column' in `log-edit-mode'.

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#70331; Package auctex. (Sun, 14 Apr 2024 15:33:03 GMT) Full text and rfc822 format available.

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

From: Paul Nelson <ultrono <at> gmail.com>
To: Arash Esbati <arash <at> gnu.org>
Cc: 70331 <at> debbugs.gnu.org
Subject: Re: bug#70331: [PATCH] Call custom folding functions with consistent
 point
Date: Sun, 14 Apr 2024 17:32:08 +0200
[Message part 1 (text/plain, inline)]
Hi Arash,

OK, I see.  The commit that you shared improves the situation for
vc.el, except that I think 64 should be 66 (= 74 - 8).  I attach what
I'm using, which also tells magit how long the summary should be.
Unfortunately, I don't see a way to set the fill-column in magit via
directory local variables (without eval).  I've added the following
hack to my config:

(defvar git-fill-column-alist '(("auctex" . 66)))

(defun set-git-commit-fill-column ()
  (when-let ((project (project-current))
             (root (project-root project))
             (name (file-name-nondirectory (directory-file-name root)))
             (assn (assoc name git-fill-column-alist)))
    (setq fill-column (cdr assn))))

(add-hook 'git-commit-mode-hook 'set-git-commit-fill-column)


Paul
[0001-Tweak-.dir-locals.el.patch (application/x-patch, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#70331; Package auctex. (Mon, 15 Apr 2024 06:49:04 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Paul Nelson <ultrono <at> gmail.com>
Cc: 70331 <at> debbugs.gnu.org
Subject: Re: bug#70331: [PATCH] Call custom folding functions with
 consistent point
Date: Mon, 15 Apr 2024 08:48:09 +0200
Paul Nelson <ultrono <at> gmail.com> writes:

> OK, I see.  The commit that you shared improves the situation for
> vc.el, except that I think 64 should be 66 (= 74 - 8).  I attach what
> I'm using, which also tells magit how long the summary should be.

Hi Paul,

I can't tell why Emacs sets `fill-column' to 64 in `log-edit-mode', but
I'd like to follow this convention until Emacs changes it.  So I'd be
grateful if you could stick to 64 in your config as well.

Do you want to raise this issue and your change for Magit on Emacs bug
list?  I presume there are Magit users contributing to Emacs, so fixing
this there might be useful.

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#70331; Package auctex. (Mon, 15 Apr 2024 07:03:04 GMT) Full text and rfc822 format available.

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

From: Paul Nelson <ultrono <at> gmail.com>
To: Arash Esbati <arash <at> gnu.org>
Cc: 70331 <at> debbugs.gnu.org
Subject: Re: bug#70331: [PATCH] Call custom folding functions with consistent
 point
Date: Mon, 15 Apr 2024 09:02:23 +0200
> I can't tell why Emacs sets `fill-column' to 64 in `log-edit-mode', but
> I'd like to follow this convention until Emacs changes it.  So I'd be
> grateful if you could stick to 64 in your config as well.

Will do - I guess my point is then that if you want your own edits in
ChangeLog to behave in the same way, then I think you should use
fill-column 72.

> Do you want to raise this issue and your change for Magit on Emacs bug
> list?  I presume there are Magit users contributing to Emacs, so fixing
> this there might be useful.

Just to be clear: bug or devel?

There's some discussion on the magit repo at
https://github.com/magit/magit/issues/2848 (but no solution there,
from what I can tell).




Reply sent to Arash Esbati <arash <at> gnu.org>:
You have taken responsibility. (Mon, 15 Apr 2024 08:15:03 GMT) Full text and rfc822 format available.

Notification sent to Paul Nelson <ultrono <at> gmail.com>:
bug acknowledged by developer. (Mon, 15 Apr 2024 08:15:03 GMT) Full text and rfc822 format available.

Message #34 received at 70331-done <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Paul Nelson <ultrono <at> gmail.com>
Cc: 70331-done <at> debbugs.gnu.org
Subject: Re: bug#70331: [PATCH] Call custom folding functions with
 consistent point
Date: Mon, 15 Apr 2024 10:13:56 +0200
Paul Nelson <ultrono <at> gmail.com> writes:

> Just to be clear: bug or devel?

If you want to send a patch, then bug, if you want to discuss the point,
devel, I'd say.

> There's some discussion on the magit repo at
> https://github.com/magit/magit/issues/2848 (but no solution there,
> from what I can tell).

I can hardly imagine that Magit doesn't cater for `fill-column' when
composing commit messages, but again, I don't use Magit.

I think we're done with this report, so I'm closing this.

Best, Arash




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 13 May 2024 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 days ago.

Previous Next


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