GNU bug report logs - #63444
folding mode for Texinfo doesn't work reliably

Previous Next

Package: auctex;

Reported by: Werner LEMBERG <wl <at> gnu.org>

Date: Thu, 11 May 2023 12:00:02 UTC

Severity: normal

To reply to this bug, email your comments to 63444 AT debbugs.gnu.org.

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#63444; Package auctex. (Thu, 11 May 2023 12:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Werner LEMBERG <wl <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Thu, 11 May 2023 12:00:02 GMT) Full text and rfc822 format available.

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

From: Werner LEMBERG <wl <at> gnu.org>
To: bug-auctex <at> gnu.org
Subject: folding mode for Texinfo doesn't work reliably
Date: Thu, 11 May 2023 11:59:17 +0000 (UTC)
[commit 0cb158fd96ff8c1c7f0bf8c0dd152a301e82f562]


Consider this quite complicated Texinfo macro file from LilyPond's
documentation:

  https://gitlab.com/lilypond/lilypond/-/blob/master/Documentation/ca/macros.itexi

If I call `TeX-fold-buffer`, some macros like `rnotation` are
properly folded, but many others like `snippets` or `englishref` are
not.

It seems that the presence of a `@xxx` command within a macro causes
hiccups, but as `englishref` shows, other factors seem to play a role,
too.


Finally, I have a wish: It would be extremely helpful to have two more
commands for folding

* conditional blocks like `@iffoo ... @end iffoo`, and

* format-specific blocks like `@html ... @end html` or `@tex ... @end
  tex`.


     Werner




Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Thu, 11 May 2023 12:41:02 GMT) Full text and rfc822 format available.

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

From: Werner LEMBERG <wl <at> gnu.org>
To: 63444 <at> debbugs.gnu.org
Subject: Re: bug#63444: Acknowledgement (folding mode for Texinfo doesn't
 work reliably)
Date: Thu, 11 May 2023 12:40:18 +0000 (UTC)
> If I call `TeX-fold-buffer`, some macros like `rnotation` are
> properly folded, but many others like `snippets` or `englishref` are
> not.

Ah, maybe it is not working for `@macro ... @end macro` either – the
`[r]` seems to be a reference, not the contents of a macro.


    Werner

Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Fri, 12 May 2023 08:24:02 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Werner LEMBERG <wl <at> gnu.org>
Cc: 63444 <at> debbugs.gnu.org
Subject: Re: bug#63444: folding mode for Texinfo doesn't work reliably
Date: Fri, 12 May 2023 10:22:50 +0200
Werner LEMBERG <wl <at> gnu.org> writes:

> Consider this quite complicated Texinfo macro file from LilyPond's
> documentation:
>
>   https://gitlab.com/lilypond/lilypond/-/blob/master/Documentation/ca/macros.itexi
>
> If I call `TeX-fold-buffer`, some macros like `rnotation` are
> properly folded, but many others like `snippets` or `englishref` are
> not.
>
> It seems that the presence of a `@xxx` command within a macro causes
> hiccups, but as `englishref` shows, other factors seem to play a role,
> too.

I'm not sure if I understand this part.  Can you please give me a hint
where to look in that file and what to do in order to understand this
issue better?

> Finally, I have a wish: It would be extremely helpful to have two more
> commands for folding
>
> * conditional blocks like `@iffoo ... @end iffoo`, and
>
> * format-specific blocks like `@html ... @end html` or `@tex ... @end
>   tex`.

You can put this in your init file (and adjust it accordingly):

(setq Texinfo-fold-env-spec-list
      '(("[html]"  ("html"))
        ("[TeX]"   ("tex"))))

and then load your .texi file and activate folding.  Maybe that helps
already.

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Sat, 13 May 2023 07:31:01 GMT) Full text and rfc822 format available.

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

From: Werner LEMBERG <wl <at> gnu.org>
To: 63444 <at> debbugs.gnu.org
Subject: Re: bug#63444: folding mode for Texinfo doesn't work reliably
Date: Sat, 13 May 2023 07:30:37 +0000 (UTC)
>> It seems that the presence of a `@xxx` command within a macro
>> causes hiccups, but as `englishref` shows, other factors seem to
>> play a role, too.
> 
> I'm not sure if I understand this part.  Can you please give me a hint
> where to look in that file and what to do in order to understand this
> issue better?

I was confused.  Having never tried folding mode for Texinfo before, I
interpreted `[r]` as the contents of a macro.  However, this is the
visual indicator for a reference.

>> Finally, I have a wish: It would be extremely helpful to have two
>> more commands for folding
>>
>> * conditional blocks like `@iffoo ... @end iffoo`, and
>>
>> * format-specific blocks like `@html ... @end html` or `@tex
>>   ... @end tex`.
> 
> You can put this in your init file (and adjust it accordingly):
> 
> (setq Texinfo-fold-env-spec-list
>       '(("[html]"  ("html"))
>         ("[TeX]"   ("tex"))))
> 
> and then load your .texi file and activate folding.  Maybe that helps
> already.

Aaah, completely undocumented :-) This helps, thanks.  However, there
are some issues.

* I tried to set 

  ```
  (setq Texinfo-fold-env-spec-list
        '(("[macro]"  ("macro"))
          ...
  ```

  This converts

  ```
  @macro foo {bar, baz}
    ...
  @end macro
  ```

  into

  ```
  [macro]
  ```

  which is not very helpful.  Is there a way to get

  ```
  [macro foo]
  ```

  instead?

* There is no example for

    If the first element is a function symbol, the function will be
    called with all mandatory arguments of the macro and the result of
    the function call will be used as a replacement for the macro.

  Additionally, this documentation paragraph confuses me: Are the
  'mandatory arguments' passed as plain strings arguments?  Or a list
  of strings?  Or something else?

* `Texinfo-fold-type-list` is missing – or not documented.

* In combination with the last item, it seems that there are no
  folding defaults for Texinfo mode.  Maybe it makes sense to have the
  same default as with other TeX modes, i.e., folding macros and
  environments.


    Werner

Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Sat, 13 May 2023 19:04:02 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Werner LEMBERG <wl <at> gnu.org>, Ralf Angeli <angeli <at> caeruleus.net>
Cc: 63444 <at> debbugs.gnu.org
Subject: Re: bug#63444: folding mode for Texinfo doesn't work reliably
Date: Sat, 13 May 2023 21:02:37 +0200
Werner LEMBERG <wl <at> gnu.org> writes:

> I was confused.  Having never tried folding mode for Texinfo before, I
> interpreted `[r]` as the contents of a macro.  However, this is the
> visual indicator for a reference.

Ok, got it, thanks.

> Aaah, completely undocumented :-)

We expect users to be fluent in elisp and read the code instead of
wasting their time and read the manual ;-)  I agree, the part in the
manual is sparse, but if you look here[1], you'll see:

  The variables TeX-fold-macro-spec-list, TeX-fold-env-spec-list, and
  TeX-fold-math-spec-list apply to any AUCTeX mode.  If you want to make
  settings which are only applied to LaTeX mode, you can use the
  mode-specific variables LaTeX-fold-macro-spec-list,
  LaTeX-fold-env-spec-list, and LaTeX-fold-math-spec-list

So users should deduce from this that there is also
`Texinfo-fold-env-spec-list', which is, optimistic.  But before fixing
the manual, I wonder what the idea behind the implementation is: The
variables are not custom variables, so in order to make
`Texinfo-fold-env-spec-list' for example to work, one has to setq it.
I'm CC'ing Ralf who wrote the code, maybe he can remember the idea
behind it.

@Ralf: The code was introduced with commit ae2fcc1685.  Do you still
remember the idea behind the part:

+		       (let ((symbol (intern (format "%s-fold-%s-spec-list"
+						     (TeX-mode-prefix) elt))))
+			 (when (boundp symbol)
+			   (symbol-value symbol)))))))

If I get it right, things like `Texinfo-fold-env-spec-list' should be
custom variables; otherwise I'd use `intern-soft' above and slightly
adjust the test.

> This helps, thanks.  However, there are some issues.
>
> * I tried to set 
>
>   ```
>   (setq Texinfo-fold-env-spec-list
>         '(("[macro]"  ("macro"))
>           ...
>   ```
>
>   This converts
>
>   ```
>   @macro foo {bar, baz}
>     ...
>   @end macro
>   ```
>
>   into
>
>   ```
>   [macro]
>   ```
>
>   which is not very helpful.  Is there a way to get
>
>   ```
>   [macro foo]
>   ```
>
>   instead?

Does something like

   (setq Texinfo-fold-env-spec-list
         '((1  ("macro"))
           ...

helps (which I didn't test)?

> * There is no example for
>
>     If the first element is a function symbol, the function will be
>     called with all mandatory arguments of the macro and the result of
>     the function call will be used as a replacement for the macro.
>
>   Additionally, this documentation paragraph confuses me: Are the
>   'mandatory arguments' passed as plain strings arguments?  Or a list
>   of strings?  Or something else?

I'd like to pass this question to Ralf as well; otherwise I have to read
and understand the code (which I've never used for any mode in my life).

> * `Texinfo-fold-type-list` is missing – or not documented.
>
> * In combination with the last item, it seems that there are no
>   folding defaults for Texinfo mode.  Maybe it makes sense to have the
>   same default as with other TeX modes, i.e., folding macros and
>   environments.

See above.  I think we can change/expand this once we have a course of
action, i.e., introduce a custom variable `Texinfo-fold-type-list' and
preset it with whatever you think is appropriate.

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Sun, 14 May 2023 04:52:01 GMT) Full text and rfc822 format available.

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

From: Werner LEMBERG <wl <at> gnu.org>
To: arash <at> gnu.org
Cc: angeli <at> caeruleus.net, 63444 <at> debbugs.gnu.org
Subject: Re: bug#63444: folding mode for Texinfo doesn't work reliably
Date: Sun, 14 May 2023 04:51:02 +0000 (UTC)
> [...] if you look here[1], you'll see:
>
>   The variables TeX-fold-macro-spec-list, TeX-fold-env-spec-list,
>   and TeX-fold-math-spec-list apply to any AUCTeX mode.  If you want
>   to make settings which are only applied to LaTeX mode, you can use
>   the mode-specific variables LaTeX-fold-macro-spec-list,
>   LaTeX-fold-env-spec-list, and LaTeX-fold-math-spec-list
>
> So users should deduce from this that there is also
> `Texinfo-fold-env-spec-list', which is, optimistic.

Pfft.  Reading a manual?  Really?  I directly went to the 'Texinfo
mode' node in the appendix :-)

> Does something like
>
>    (setq Texinfo-fold-env-spec-list
>          '((1  ("macro"))
>            ...
>
> helps (which I didn't test)?

No – as expected:  For macros without arguments you get

```
[Error: No content found]
```

and for a macro with arguments like

```
@macro foo {bar, baz}
  ...
@end macro
```

you get

```
[bar, baz]
```

BTW, there is also a bug in the argument parser: In Texinfo mode,
arguments *must* be on the same (logical) line as `@macro`, contrary
to TeX's or LaTeX's macro definition.  However, a macro like

```
@macro logoLegalMacOSX
La @qq{imatge de la X} no és una marca registrada.
@end macro
```

gets shown as

```
[imatge de la X]
```

if I have

```
  '((1  ("macro"))
```

as the setting in `Texinfo-fold-env-spec-list`, which is wrong.
Assuming that this `1` is correct (which is not) it should show `[]`
instead, i.e., no arguments.


    Werner

Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Sun, 14 May 2023 10:37:02 GMT) Full text and rfc822 format available.

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

From: Ralf Angeli <dev.null <at> caeruleus.net>
To: bug-auctex <at> gnu.org
Cc: 63444 <at> debbugs.gnu.org
Subject: Re: bug#63444: folding mode for Texinfo doesn't work reliably
Date: Sun, 14 May 2023 11:44:57 +0200
On 13/05/2023 21.02, Arash Esbati wrote:

>    The variables TeX-fold-macro-spec-list, TeX-fold-env-spec-list, and
>    TeX-fold-math-spec-list apply to any AUCTeX mode.  If you want to make
>    settings which are only applied to LaTeX mode, you can use the
>    mode-specific variables LaTeX-fold-macro-spec-list,
>    LaTeX-fold-env-spec-list, and LaTeX-fold-math-spec-list
> 
> So users should deduce from this that there is also
> `Texinfo-fold-env-spec-list', which is, optimistic. But before fixing
> the manual, I wonder what the idea behind the implementation is: The
> variables are not custom variables, so in order to make
> `Texinfo-fold-env-spec-list' for example to work, one has to setq it.
> I'm CC'ing Ralf who wrote the code, maybe he can remember the idea
> behind it.
> 
> @Ralf: The code was introduced with commit ae2fcc1685.  Do you still
> remember the idea behind the part:
> 
> +		       (let ((symbol (intern (format "%s-fold-%s-spec-list"
> +						     (TeX-mode-prefix) elt))))
> +			 (when (boundp symbol)
> +			   (symbol-value symbol)))))))
> 
> If I get it right, things like `Texinfo-fold-env-spec-list' should be
> custom variables; otherwise I'd use `intern-soft' above and slightly
> adjust the test.
> 
>> This helps, thanks.  However, there are some issues.
>>
>> * I tried to set
>>
>>    ```
>>    (setq Texinfo-fold-env-spec-list
>>          '(("[macro]"  ("macro"))
>>            ...
>>    ```
>>
>>    This converts
>>
>>    ```
>>    @macro foo {bar, baz}
>>      ...
>>    @end macro
>>    ```
>>
>>    into
>>
>>    ```
>>    [macro]
>>    ```
>>
>>    which is not very helpful.  Is there a way to get
>>
>>    ```
>>    [macro foo]
>>    ```
>>
>>    instead?
> 
> Does something like
> 
>     (setq Texinfo-fold-env-spec-list
>           '((1  ("macro"))
>             ...
> 
> helps (which I didn't test)?
> 
>> * There is no example for
>>
>>      If the first element is a function symbol, the function will be
>>      called with all mandatory arguments of the macro and the result of
>>      the function call will be used as a replacement for the macro.
>>
>>    Additionally, this documentation paragraph confuses me: Are the
>>    'mandatory arguments' passed as plain strings arguments?  Or a list
>>    of strings?  Or something else?
> 
> I'd like to pass this question to Ralf as well; otherwise I have to read
> and understand the code (which I've never used for any mode in my life).
> 
>> * `Texinfo-fold-type-list` is missing – or not documented.
>>
>> * In combination with the last item, it seems that there are no
>>    folding defaults for Texinfo mode.  Maybe it makes sense to have the
>>    same default as with other TeX modes, i.e., folding macros and
>>    environments.
> 
> See above.  I think we can change/expand this once we have a course of
> action, i.e., introduce a custom variable `Texinfo-fold-type-list' and
> preset it with whatever you think is appropriate.
> 
> Best, Arash
> 
> 
> 
> _______________________________________________
> bug-auctex mailing list
> bug-auctex <at> gnu.org
> https://lists.gnu.org/mailman/listinfo/bug-auctex






Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Sun, 14 May 2023 10:37:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Sun, 14 May 2023 11:39:02 GMT) Full text and rfc822 format available.

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

From: Ralf Angeli <angeli <at> caeruleus.net>
To: Arash Esbati <arash <at> gnu.org>, Werner LEMBERG <wl <at> gnu.org>
Cc: 63444 <at> debbugs.gnu.org
Subject: Re: bug#63444: folding mode for Texinfo doesn't work reliably
Date: Sun, 14 May 2023 13:38:07 +0200
[Sorry for the last mail which was unfinished. Now I know that C-RET 
does not insert a linebreak with quoting in Thunderbird. Duh. %-)]

On 13/05/2023 21.02, Arash Esbati wrote:

>    The variables TeX-fold-macro-spec-list, TeX-fold-env-spec-list, and
>    TeX-fold-math-spec-list apply to any AUCTeX mode.  If you want to make
>    settings which are only applied to LaTeX mode, you can use the
>    mode-specific variables LaTeX-fold-macro-spec-list,
>    LaTeX-fold-env-spec-list, and LaTeX-fold-math-spec-list
> 
> So users should deduce from this that there is also
> `Texinfo-fold-env-spec-list', which is, optimistic.

I don't tend to add riddles to manuals. ;-) I guess I only mentioned the 
LaTeX-mode-specific variables because those are the only ones 
implemented as custom variables. Why the other ones are not, 
unfortunately I don't remember. It's not just the ones for Texinfo mode 
but also for ConTeXt, docTeX and so on. Perhaps I didn't have enough 
trust in the folding support for other modes than LaTeX. The latter is 
the only one which received much testing and usage.

> But before fixing
> the manual, I wonder what the idea behind the implementation is: The
> variables are not custom variables, so in order to make
> `Texinfo-fold-env-spec-list' for example to work, one has to setq it.
> I'm CC'ing Ralf who wrote the code, maybe he can remember the idea
> behind it.

As hinted at above, it could be that this was a way to let people in the 
knowing test a feature that was still experimental. They could setq the 
variables and assess the results whereas regular users would not 
directly see them.

>> This helps, thanks.  However, there are some issues.
>>
>> * I tried to set
>>
>>    ```
>>    (setq Texinfo-fold-env-spec-list
>>          '(("[macro]"  ("macro"))
>>            ...
>>    ```
>>
>>    This converts
>>
>>    ```
>>    @macro foo {bar, baz}
>>      ...
>>    @end macro
>>    ```
>>
>>    into
>>
>>    ```
>>    [macro]
>>    ```
>>
>>    which is not very helpful.  Is there a way to get
>>
>>    ```
>>    [macro foo]
>>    ```
>>
>>    instead?
> 
> Does something like
> 
>     (setq Texinfo-fold-env-spec-list
>           '((1  ("macro"))
>             ...
> 
> helps (which I didn't test)?

I just tested it and you just get an ellipsis (...) when a macro is 
folded. Without looking at the code, it seems that it does not consider 
the first thing behind @macro to be an argument. This could be a missing 
feature. As mentioned above, Texinfo mode was not the focus of 
development and usage, which is the likely reason for this.

>> * There is no example for
>>
>>      If the first element is a function symbol, the function will be
>>      called with all mandatory arguments of the macro and the result of
>>      the function call will be used as a replacement for the macro.
>>
>>    Additionally, this documentation paragraph confuses me: Are the
>>    'mandatory arguments' passed as plain strings arguments?  Or a list
>>    of strings?  Or something else?
> 
> I'd like to pass this question to Ralf as well; otherwise I have to read
> and understand the code (which I've never used for any mode in my life).
It's a list of strings, see `TeX-fold-hide-item'. Inside of ((functionp 
spec)...) you can see the list `arg-list' being built and then used to 
call the function behind `spec'.

-- 
Ralf





Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Mon, 15 May 2023 05:11:02 GMT) Full text and rfc822 format available.

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

From: Werner LEMBERG <wl <at> gnu.org>
To: angeli <at> caeruleus.net
Cc: 63444 <at> debbugs.gnu.org, arash <at> gnu.org
Subject: Re: bug#63444: folding mode for Texinfo doesn't work reliably
Date: Mon, 15 May 2023 05:10:34 +0000 (UTC)
> Without looking at the code, it seems that it does not consider the
> first thing behind @macro to be an argument.

Thanks for the reply; I got this impression, too.

Given that I have no idea about the internals of AUCTeX I can't help
with coding; however, I'm willing to test any new Texinfo
functionality.


    Werner




Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Fri, 19 May 2023 12:02:02 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Ralf Angeli <angeli <at> caeruleus.net>
Cc: 63444 <at> debbugs.gnu.org, Werner LEMBERG <wl <at> gnu.org>
Subject: Re: bug#63444: folding mode for Texinfo doesn't work reliably
Date: Fri, 19 May 2023 13:54:15 +0200
Ralf Angeli <angeli <at> caeruleus.net> writes:

> I don't tend to add riddles to manuals. ;-)

:-)

> I guess I only mentioned the LaTeX-mode-specific variables because
> those are the only ones implemented as custom variables. Why the other
> ones are not, unfortunately I don't remember. It's not just the ones
> for Texinfo mode but also for ConTeXt, docTeX and so on. Perhaps I
> didn't have enough trust in the folding support for other modes than
> LaTeX. The latter is the only one which received much testing and
> usage.

Thanks for your response.  Maybe we should mention those variables in
the manual saying that their are still experimental and therefore not
provided as defcustom's?

> It's a list of strings, see `TeX-fold-hide-item'. Inside of
> ((functionp spec)...) you can see the list `arg-list' being built and
> then used to call the function behind `spec'.

Thanks for the clarification.

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Fri, 19 May 2023 12:02:02 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Werner LEMBERG <wl <at> gnu.org>
Cc: angeli <at> caeruleus.net, 63444 <at> debbugs.gnu.org
Subject: Re: bug#63444: folding mode for Texinfo doesn't work reliably
Date: Fri, 19 May 2023 14:00:41 +0200
Werner LEMBERG <wl <at> gnu.org> writes:

> Given that I have no idea about the internals of AUCTeX I can't help
> with coding; however, I'm willing to test any new Texinfo
> functionality.

Given what Ralf said about the experimental nature of folding in Texinfo
mode, maybe you can add this to your init file and see if works for you
as expected:

--8<---------------cut here---------------start------------->8---
(defun wl/Texinfo-fold-env-macro (&rest _ignore)
  (save-excursion
    (if (looking-at-p "@macro")
        (forward-sexp)
      (Texinfo-find-env-start)
      (forward-char)
      (skip-chars-forward "a-zA-Z"))
    (skip-chars-forward "^a-zA-Z")
    (concat "macro " (thing-at-point 'symbol t))))

(setq Texinfo-fold-env-spec-list
      '((wl/Texinfo-fold-env-macro ("macro"))))
--8<---------------cut here---------------end--------------->8---

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Mon, 17 Jul 2023 20:44:01 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Werner LEMBERG <wl <at> gnu.org>
Cc: angeli <at> caeruleus.net, 63444 <at> debbugs.gnu.org
Subject: Re: bug#63444: folding mode for Texinfo doesn't work reliably
Date: Mon, 17 Jul 2023 22:39:26 +0200
Arash Esbati <arash <at> gnu.org> writes:

> Werner LEMBERG <wl <at> gnu.org> writes:
>
>> Given that I have no idea about the internals of AUCTeX I can't help
>> with coding; however, I'm willing to test any new Texinfo
>> functionality.
>
> Given what Ralf said about the experimental nature of folding in Texinfo
> mode, maybe you can add this to your init file and see if works for you
> as expected:
>
> (defun wl/Texinfo-fold-env-macro (&rest _ignore)
>   (save-excursion
>     (if (looking-at-p "@macro")
>         (forward-sexp)
>       (Texinfo-find-env-start)
>       (forward-char)
>       (skip-chars-forward "a-zA-Z"))
>     (skip-chars-forward "^a-zA-Z")
>     (concat "macro " (thing-at-point 'symbol t))))
>
> (setq Texinfo-fold-env-spec-list
>       '((wl/Texinfo-fold-env-macro ("macro"))))

Ping!

Is there anything else we can do about this report?  Otherwise I'd
update the manual and close this report.

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Wed, 19 Jul 2023 06:00:02 GMT) Full text and rfc822 format available.

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

From: Werner LEMBERG <wl <at> gnu.org>
To: arash <at> gnu.org
Cc: angeli <at> caeruleus.net, 63444 <at> debbugs.gnu.org
Subject: Re: bug#63444: folding mode for Texinfo doesn't work reliably
Date: Wed, 19 Jul 2023 05:58:56 +0000 (UTC)
[Message part 1 (text/plain, inline)]
>> (defun wl/Texinfo-fold-env-macro (&rest _ignore)
>>   (save-excursion
>>     (if (looking-at-p "@macro")
>>         (forward-sexp)
>>       (Texinfo-find-env-start)
>>       (forward-char)
>>       (skip-chars-forward "a-zA-Z"))
>>     (skip-chars-forward "^a-zA-Z")
>>     (concat "macro " (thing-at-point 'symbol t))))
>>
>> (setq Texinfo-fold-env-spec-list
>>       '((wl/Texinfo-fold-env-macro ("macro"))))
> 
> Ping!

Sorry for not answering earlier, I was procrastinating due to many
other tasks.

Thanks, your solution works, sort-of: It properly hides Texinfo macros
(see images 1 and 2); however, if I click on a hidden macro, then
clicking somewhere else, I get a warning message

```
[Error: No content or function found]
```


    Werner
[emacs-1.png (image/png, inline)]
[emacs-2.png (image/png, inline)]
[emacs-3.png (image/png, inline)]
[emacs-4.png (image/png, inline)]

Information forwarded to bug-auctex <at> gnu.org:
bug#63444; Package auctex. (Sun, 06 Aug 2023 16:21:02 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Werner LEMBERG <wl <at> gnu.org>
Cc: angeli <at> caeruleus.net, 63444 <at> debbugs.gnu.org
Subject: Re: bug#63444: folding mode for Texinfo doesn't work reliably
Date: Sun, 06 Aug 2023 18:19:50 +0200
Werner LEMBERG <wl <at> gnu.org> writes:

>>> (defun wl/Texinfo-fold-env-macro (&rest _ignore)
>>>   (save-excursion
>>>     (if (looking-at-p "@macro")
>>>         (forward-sexp)
>>>       (Texinfo-find-env-start)
>>>       (forward-char)
>>>       (skip-chars-forward "a-zA-Z"))
>>>     (skip-chars-forward "^a-zA-Z")
>>>     (concat "macro " (thing-at-point 'symbol t))))
>>>
>>> (setq Texinfo-fold-env-spec-list
>>>       '((wl/Texinfo-fold-env-macro ("macro"))))
>> 
>> Ping!
>
> Sorry for not answering earlier, I was procrastinating due to many
> other tasks.
>
> Thanks, your solution works, sort-of: It properly hides Texinfo macros
> (see images 1 and 2); however, if I click on a hidden macro, then
> clicking somewhere else, I get a warning message
>
> ```
> [Error: No content or function found]
> ```

Thanks for your response and now sorry from my side for being late.  I
can reproduce what you describe.  Unfortunately, I don't understand the
code in tex-fold.el enough to come up with a better solution.  So I'd
say this is not an AUCTeX bug, but me not being able to come up with a
working solution.  Maybe Ralf or others have an idea.

Sorry.  Best, Arash




This bug report was last modified 1 year and 313 days ago.

Previous Next


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