* outline-heading-alist for elisp using ";; * "
@ 2021-05-10 14:21 Christopher Dimech
2021-05-10 21:08 ` Philip Kaludercic
2021-05-11 20:54 ` Jeremie Juste
0 siblings, 2 replies; 46+ messages in thread
From: Christopher Dimech @ 2021-05-10 14:21 UTC (permalink / raw)
To: Help Gnu Emacs
I want to use ";; * " and so forth for subheadings but using the following code had
no effect.
(setq hstar
'( (";; * " . 1)
(";; ** " . 2)
(";; *** " . 3)
(";; **** " . 4)
(";; ***** " . 5)
(";; ****** " . 6)
(";; ******* " . 7)
(";; ******** " . 8) ))
( (emacs-lisp-mode . (
(outline-heading-alist . hstar) )))
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-10 14:21 outline-heading-alist for elisp using ";; * " Christopher Dimech
@ 2021-05-10 21:08 ` Philip Kaludercic
2021-05-11 1:55 ` Christopher Dimech
` (2 more replies)
2021-05-11 20:54 ` Jeremie Juste
1 sibling, 3 replies; 46+ messages in thread
From: Philip Kaludercic @ 2021-05-10 21:08 UTC (permalink / raw)
To: Christopher Dimech; +Cc: Help Gnu Emacs
Christopher Dimech <dimech@gmx.com> writes:
> I want to use ";; * " and so forth for subheadings but using the following code had
> no effect.
>
>
> (setq hstar
> '( (";; * " . 1)
> (";; ** " . 2)
> (";; *** " . 3)
> (";; **** " . 4)
> (";; ***** " . 5)
> (";; ****** " . 6)
> (";; ******* " . 7)
> (";; ******** " . 8) ))
Why not use outline-regexp? ";; \\*+" should do the same job, if I'm not
mistaken.
> ( (emacs-lisp-mode . (
> (outline-heading-alist . hstar) )))
>
Where are you evaluating this? In .dir-locals.el? If so, what is the
local value of outline-heading-alist in an emacs-lisp buffer?
--
Philip K.
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-10 21:08 ` Philip Kaludercic
@ 2021-05-11 1:55 ` Christopher Dimech
2021-05-11 3:00 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-11 2:52 ` outline-heading-alist for elisp using ";; * " Christopher Dimech
2021-05-11 4:50 ` Jean Louis
2 siblings, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-11 1:55 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: Help Gnu Emacs
> Sent: Tuesday, May 11, 2021 at 9:08 AM
> From: "Philip Kaludercic" <philipk@posteo.net>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> Christopher Dimech <dimech@gmx.com> writes:
>
> > I want to use ";; * " and so forth for subheadings but using the following code had
> > no effect.
> >
> >
> > (setq hstar
> > '( (";; * " . 1)
> > (";; ** " . 2)
> > (";; *** " . 3)
> > (";; **** " . 4)
> > (";; ***** " . 5)
> > (";; ****** " . 6)
> > (";; ******* " . 7)
> > (";; ******** " . 8) ))
>
> Why not use outline-regexp? ";; \\*+" should do the same job, if I'm not
> mistaken.
Will use outline-regexp. I need the different heading levels to follow
org-mode *, **, *** etc. Would you have an example for that, because
";; \\*+" considers
> > ( (emacs-lisp-mode . (
> > (outline-heading-alist . hstar) )))
> >
>
> Where are you evaluating this? In .dir-locals.el? If so, what is the
> local value of outline-heading-alist in an emacs-lisp buffer?
Am using my own ".el" file. As for finding the local "outline-heading-alist",
how do you find out what it is exactly? Have tried the defaults, for elisp
the default seems to be ";;;;;".
> --
> Philip K.
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-10 21:08 ` Philip Kaludercic
2021-05-11 1:55 ` Christopher Dimech
@ 2021-05-11 2:52 ` Christopher Dimech
2021-05-11 4:50 ` Jean Louis
2 siblings, 0 replies; 46+ messages in thread
From: Christopher Dimech @ 2021-05-11 2:52 UTC (permalink / raw)
To: Philip Kaludercic, Jean Louis; +Cc: Help Gnu Emacs
Have done this way, which works. But I want more that what the code produces.
Currently, the number af * do not determine heading levels as in org-mode.
(add-hook 'emacs-lisp-mode-hook #'outline-minor-mode)
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(set (make-local-variable 'outline-regexp) "*+")))
> Sent: Tuesday, May 11, 2021 at 9:08 AM
> From: "Philip Kaludercic" <philipk@posteo.net>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> Christopher Dimech <dimech@gmx.com> writes:
>
> > I want to use ";; * " and so forth for subheadings but using the following code had
> > no effect.
> >
> >
> > (setq hstar
> > '( (";; * " . 1)
> > (";; ** " . 2)
> > (";; *** " . 3)
> > (";; **** " . 4)
> > (";; ***** " . 5)
> > (";; ****** " . 6)
> > (";; ******* " . 7)
> > (";; ******** " . 8) ))
>
> Why not use outline-regexp? ";; \\*+" should do the same job, if I'm not
> mistaken.
>
> > ( (emacs-lisp-mode . (
> > (outline-heading-alist . hstar) )))
> >
>
> Where are you evaluating this? In .dir-locals.el? If so, what is the
> local value of outline-heading-alist in an emacs-lisp buffer?
>
>
>
>
> --
> Philip K.
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-11 1:55 ` Christopher Dimech
@ 2021-05-11 3:00 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-11 5:05 ` Christopher Dimech
2021-05-12 1:53 ` Christopher Dimech
0 siblings, 2 replies; 46+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-05-11 3:00 UTC (permalink / raw)
To: help-gnu-emacs
> Am using my own ".el" file. As for finding the local "outline-heading-alist",
> how do you find out what it is exactly?
In the vast majority of modes, the default is nil and it is
lazily auto-populated based on `outline-regexp` and `outline-level`.
Stefan
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-10 21:08 ` Philip Kaludercic
2021-05-11 1:55 ` Christopher Dimech
2021-05-11 2:52 ` outline-heading-alist for elisp using ";; * " Christopher Dimech
@ 2021-05-11 4:50 ` Jean Louis
2021-05-11 5:17 ` Christopher Dimech
2 siblings, 1 reply; 46+ messages in thread
From: Jean Louis @ 2021-05-11 4:50 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: Christopher Dimech, Help Gnu Emacs
* Philip Kaludercic <philipk@posteo.net> [2021-05-11 00:09]:
> Why not use outline-regexp? ";; \\*+" should do the same job, if I'm not
> mistaken.
It works here, great.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
^ permalink raw reply [flat|nested] 46+ messages in thread
* outline-heading-alist for elisp using ";; * "
2021-05-11 3:00 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-05-11 5:05 ` Christopher Dimech
2021-05-11 12:06 ` Jean Louis
2021-05-12 1:53 ` Christopher Dimech
1 sibling, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-11 5:05 UTC (permalink / raw)
To: monnier; +Cc: help-gnu-emacs
> Sent: Tuesday, May 11, 2021 at 3:00 PM
> From: "Stefan Monnier via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> > Am using my own ".el" file. As for finding the local "outline-heading-alist",
> > how do you find out what it is exactly?
>
> In the vast majority of modes, the default is nil and it is
> lazily auto-populated based on `outline-regexp` and `outline-level`.
I am working on some ideas and recommend that emacs beefs up outline-minor-mode
for the different programming languages. Outline structures would then be available
for use. And if users want to change they can do that as well. We would need some
docementation with real examples on how to set things up. Better still, if the
information is provided in the outline.el code.
Regards
Christopher
> Stefan
>
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* outline-heading-alist for elisp using ";; * "
2021-05-11 4:50 ` Jean Louis
@ 2021-05-11 5:17 ` Christopher Dimech
0 siblings, 0 replies; 46+ messages in thread
From: Christopher Dimech @ 2021-05-11 5:17 UTC (permalink / raw)
To: Jean Louis; +Cc: Philip Kaludercic, Help Gnu Emacs
This is what I have done
(add-hook 'emacs-lisp-mode-hook #'outline-minor-mode)
;; set regularity condition
;;(setq rgc ";;; \\*+ ")
(setq rgc ";;; \\([A-Za-z]\\|[IVXLCDMivxlcdm0-9]+\\) | ")
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(set (make-local-variable 'outline-regexp) rgc)))
Now starts the task of setting a keybinding that if I continue to press it
will cycle the folding/unfolding of headlines only. And a different keybinding
that cycles the folding/unfolding of code.
Regards
Christopher
> Sent: Tuesday, May 11, 2021 at 4:50 PM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Philip Kaludercic" <philipk@posteo.net>
> Cc: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> * Philip Kaludercic <philipk@posteo.net> [2021-05-11 00:09]:
> > Why not use outline-regexp? ";; \\*+" should do the same job, if I'm not
> > mistaken.
>
> It works here, great.
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-11 5:05 ` Christopher Dimech
@ 2021-05-11 12:06 ` Jean Louis
2021-05-11 12:40 ` Christopher Dimech
` (2 more replies)
0 siblings, 3 replies; 46+ messages in thread
From: Jean Louis @ 2021-05-11 12:06 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs, monnier
* Christopher Dimech <dimech@gmx.com> [2021-05-11 08:06]:
> I am working on some ideas and recommend that emacs beefs up
> outline-minor-mode for the different programming languages. Outline
> structures would then be available for use. And if users want to
> change they can do that as well. We would need some docementation
> with real examples on how to set things up. Better still, if the
> information is provided in the outline.el code.
I have found enough information to make it working, it was in the
variables. And much is already documented: (info "(emacs) Outline
Mode")
Now if somebody wish to customize any variable, well... where to find
the variables?
What I do is:
C-h v outline-TAB TAB or
C-h v outline-minorTAB TAB and I look then in descriptions of those
variables.
Emacs is in general stable editor and it is already advanced.
Customizing variables and modes is on a level more than advanced. Thus
documentation on those variables is already there, as when person is
level more than what Emacs Manual provides, that person has to know to
find descriptions in docstrings of variables or in the source of the
mode.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
^ permalink raw reply [flat|nested] 46+ messages in thread
* outline-heading-alist for elisp using ";; * "
2021-05-11 12:06 ` Jean Louis
@ 2021-05-11 12:40 ` Christopher Dimech
2021-05-11 14:17 ` Jean Louis
2021-05-11 12:56 ` Christopher Dimech
2021-05-11 13:15 ` Christopher Dimech
2 siblings, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-11 12:40 UTC (permalink / raw)
To: Jean Louis; +Cc: help-gnu-emacs, monnier
Have you found any information to cycle the folding/unfolding of headings
only using a keybinding?
> Sent: Wednesday, May 12, 2021 at 12:06 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: monnier@iro.umontreal.ca, help-gnu-emacs@gnu.org
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-11 08:06]:
> > I am working on some ideas and recommend that emacs beefs up
> > outline-minor-mode for the different programming languages. Outline
> > structures would then be available for use. And if users want to
> > change they can do that as well. We would need some docementation
> > with real examples on how to set things up. Better still, if the
> > information is provided in the outline.el code.
>
> I have found enough information to make it working, it was in the
> variables. And much is already documented: (info "(emacs) Outline
> Mode")
>
> Now if somebody wish to customize any variable, well... where to find
> the variables?
>
> What I do is:
>
> C-h v outline-TAB TAB or
>
> C-h v outline-minorTAB TAB and I look then in descriptions of those
> variables.
>
> Emacs is in general stable editor and it is already advanced.
>
> Customizing variables and modes is on a level more than advanced. Thus
> documentation on those variables is already there, as when person is
> level more than what Emacs Manual provides, that person has to know to
> find descriptions in docstrings of variables or in the source of the
> mode.
>
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* outline-heading-alist for elisp using ";; * "
2021-05-11 12:06 ` Jean Louis
2021-05-11 12:40 ` Christopher Dimech
@ 2021-05-11 12:56 ` Christopher Dimech
2021-05-11 14:20 ` Jean Louis
2021-05-11 13:15 ` Christopher Dimech
2 siblings, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-11 12:56 UTC (permalink / raw)
To: Jean Louis; +Cc: help-gnu-emacs, monnier
> Sent: Wednesday, May 12, 2021 at 12:06 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: monnier@iro.umontreal.ca, help-gnu-emacs@gnu.org
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-11 08:06]:
> > I am working on some ideas and recommend that emacs beefs up
> > outline-minor-mode for the different programming languages. Outline
> > structures would then be available for use. And if users want to
> > change they can do that as well. We would need some docementation
> > with real examples on how to set things up. Better still, if the
> > information is provided in the outline.el code.
>
> I have found enough information to make it working, it was in the
> variables. And much is already documented: (info "(emacs) Outline
> Mode")
>
> Now if somebody wish to customize any variable, well... where to find
> the variables?
>
> What I do is:
>
> C-h v outline-TAB TAB or
>
> C-h v outline-minorTAB TAB and I look then in descriptions of those
> variables.
>
> Emacs is in general stable editor and it is already advanced.
>
> Customizing variables and modes is on a level more than advanced. Thus
> documentation on those variables is already there, as when person is
> level more than what Emacs Manual provides, that person has to know to
> find descriptions in docstrings of variables or in the source of the
> mode.
Maybe, but beefing up would also mean more functionality available by default.
For instance the capability to cycle folding/unfolding of headings only
by continuing to simply press a single key sequence, not a compound one.
And another keybinding to fold/unfold code only, also by default.
And by default allow subheading levels.
Can the aforementioned capabilities turned on by default at this moment?
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* outline-heading-alist for elisp using ";; * "
2021-05-11 12:06 ` Jean Louis
2021-05-11 12:40 ` Christopher Dimech
2021-05-11 12:56 ` Christopher Dimech
@ 2021-05-11 13:15 ` Christopher Dimech
2021-05-11 14:22 ` Jean Louis
2 siblings, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-11 13:15 UTC (permalink / raw)
To: Jean Louis; +Cc: help-gnu-emacs, monnier
Have made the following function. I alse want to be able to select the
defalt headings for elisp which I think is ";;; Heading"
Having difficulties on what modifications I need to do.
(defun headline-elisp (hdl)
"todo"
(pcase hdl
(1
(defvar rgc ";;; \\*+ "))
(_
(defvar rgc ";;; \\([A-Za-z]\\|[IVXLCDMivxlcdm0-9]+\\) | ")) )
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(set (make-local-variable 'outline-regexp) rgc))) )
> Sent: Wednesday, May 12, 2021 at 12:06 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: monnier@iro.umontreal.ca, help-gnu-emacs@gnu.org
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-11 08:06]:
> > I am working on some ideas and recommend that emacs beefs up
> > outline-minor-mode for the different programming languages. Outline
> > structures would then be available for use. And if users want to
> > change they can do that as well. We would need some docementation
> > with real examples on how to set things up. Better still, if the
> > information is provided in the outline.el code.
>
> I have found enough information to make it working, it was in the
> variables. And much is already documented: (info "(emacs) Outline
> Mode")
>
> Now if somebody wish to customize any variable, well... where to find
> the variables?
>
> What I do is:
>
> C-h v outline-TAB TAB or
>
> C-h v outline-minorTAB TAB and I look then in descriptions of those
> variables.
>
> Emacs is in general stable editor and it is already advanced.
>
> Customizing variables and modes is on a level more than advanced. Thus
> documentation on those variables is already there, as when person is
> level more than what Emacs Manual provides, that person has to know to
> find descriptions in docstrings of variables or in the source of the
> mode.
>
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-11 12:40 ` Christopher Dimech
@ 2021-05-11 14:17 ` Jean Louis
0 siblings, 0 replies; 46+ messages in thread
From: Jean Louis @ 2021-05-11 14:17 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs, monnier
* Christopher Dimech <dimech@gmx.com> [2021-05-11 15:40]:
> Have you found any information to cycle the folding/unfolding of headings
> only using a keybinding?
Of course. I have also demonstrated how it works on video. And I have
used just TAB for folding unfolding after the settings in the group
`outlines', {M-x customize-group RET outlines RET}
Maybe you wanted to tell something else with that question.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-11 12:56 ` Christopher Dimech
@ 2021-05-11 14:20 ` Jean Louis
2021-05-11 15:32 ` Christopher Dimech
0 siblings, 1 reply; 46+ messages in thread
From: Jean Louis @ 2021-05-11 14:20 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs, monnier
* Christopher Dimech <dimech@gmx.com> [2021-05-11 15:56]:
> > Customizing variables and modes is on a level more than advanced. Thus
> > documentation on those variables is already there, as when person is
> > level more than what Emacs Manual provides, that person has to know to
> > find descriptions in docstrings of variables or in the source of the
> > mode.
>
> Maybe, but beefing up would also mean more functionality available by default.
> For instance the capability to cycle folding/unfolding of headings only
> by continuing to simply press a single key sequence, not a compound
> one.
By default it disturbs the indentation. It definitely does not work
well with identation:
M-x emacs-lisp-mode
M-x outline-minor-mode
(defun fun ()
(let ((something else)
■(more here))))
If I press C-o at the position ■ to enter new line this is what happens:
(defun fun ()
(let ((something else)
(more here))))
and now I cannot any more indent (more here)))) by using TAB,
neither by marking region and using TAB, to which I am more
used. I have to use SPACE TAB to indent it.
Of course, one key press more is costly.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-11 13:15 ` Christopher Dimech
@ 2021-05-11 14:22 ` Jean Louis
2021-05-11 15:22 ` Christopher Dimech
0 siblings, 1 reply; 46+ messages in thread
From: Jean Louis @ 2021-05-11 14:22 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs, monnier
* Christopher Dimech <dimech@gmx.com> [2021-05-11 16:16]:
> Have made the following function. I alse want to be able to select the
> defalt headings for elisp which I think is ";;; Heading"
>
> Having difficulties on what modifications I need to do.
>
> (defun headline-elisp (hdl)
> "todo"
>
> (pcase hdl
> (1
> (defvar rgc ";;; \\*+ "))
> (_
> (defvar rgc ";;; \\([A-Za-z]\\|[IVXLCDMivxlcdm0-9]+\\) | ")) )
It does not look right. The headline regexp looks only for beginning
stuff, it is not all inclusive.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
^ permalink raw reply [flat|nested] 46+ messages in thread
* outline-heading-alist for elisp using ";; * "
2021-05-11 14:22 ` Jean Louis
@ 2021-05-11 15:22 ` Christopher Dimech
0 siblings, 0 replies; 46+ messages in thread
From: Christopher Dimech @ 2021-05-11 15:22 UTC (permalink / raw)
To: Jean Louis; +Cc: help-gnu-emacs, monnier
The first one is org-like, the second option is roman-numeral-like. You are correct,
not all inclusive. They are just primary headings for now.
For subheadings I would want to use
;;; * Heading
;;; ** Subheading
;;; *** SubSubHeading
For the roman-like, it uses only headings
;;; I | Heading
;;; II | Heading
;;; III | Heading
;;; IV | Heading
> Sent: Wednesday, May 12, 2021 at 2:22 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: monnier@iro.umontreal.ca, help-gnu-emacs@gnu.org
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-11 16:16]:
> > Have made the following function. I alse want to be able to select the
> > defalt headings for elisp which I think is ";;; Heading"
> >
> > Having difficulties on what modifications I need to do.
> >
> > (defun headline-elisp (hdl)
> > "todo"
> >
> > (pcase hdl
> > (1
> > (defvar rgc ";;; \\*+ "))
> > (_
> > (defvar rgc ";;; \\([A-Za-z]\\|[IVXLCDMivxlcdm0-9]+\\) | ")) )
>
> It does not look right. The headline regexp looks only for beginning
> stuff, it is not all inclusive.
What do you mean by "beginning stuff"?
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* outline-heading-alist for elisp using ";; * "
2021-05-11 14:20 ` Jean Louis
@ 2021-05-11 15:32 ` Christopher Dimech
2021-05-11 18:09 ` Jean Louis
0 siblings, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-11 15:32 UTC (permalink / raw)
To: Jean Louis; +Cc: help-gnu-emacs, monnier
> Sent: Wednesday, May 12, 2021 at 2:20 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: monnier@iro.umontreal.ca, help-gnu-emacs@gnu.org
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-11 15:56]:
> > > Customizing variables and modes is on a level more than advanced. Thus
> > > documentation on those variables is already there, as when person is
> > > level more than what Emacs Manual provides, that person has to know to
> > > find descriptions in docstrings of variables or in the source of the
> > > mode.
> >
> > Maybe, but beefing up would also mean more functionality available by default.
> > For instance the capability to cycle folding/unfolding of headings only
> > by continuing to simply press a single key sequence, not a compound
> > one.
>
> By default it disturbs the indentation. It definitely does not work
> well with identation:
>
> M-x emacs-lisp-mode
> M-x outline-minor-mode
>
> (defun fun ()
> (let ((something else)
> ■(more here))))
>
> If I press C-o at the position ■ to enter new line this is what happens:
>
> (defun fun ()
> (let ((something else)
>
> (more here))))
>
> and now I cannot any more indent (more here)))) by using TAB,
> neither by marking region and using TAB, to which I am more
> used. I have to use SPACE TAB to indent it.
>
> Of course, one key press more is costly.
I customarily hit enter at the end of the previous line and indentation works.
Pressing <tab> after using "C-o" works for me.
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-11 15:32 ` Christopher Dimech
@ 2021-05-11 18:09 ` Jean Louis
2021-05-12 1:46 ` Christopher Dimech
0 siblings, 1 reply; 46+ messages in thread
From: Jean Louis @ 2021-05-11 18:09 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs, monnier
* Christopher Dimech <dimech@gmx.com> [2021-05-11 18:32]:
(defun fun ()
(let ((something else)
(more here))))
> > If I press C-o at the position ■ to enter new line this is what happens:
> I customarily hit enter at the end of the previous line and indentation works.
> Pressing <tab> after using "C-o" works for me.
Not in outline-minor-mode within emacs-lisp-mode as if
parenthesis is on the new line, then it becomes a header, as each
parenthesis on new line is then header for something.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-10 14:21 outline-heading-alist for elisp using ";; * " Christopher Dimech
2021-05-10 21:08 ` Philip Kaludercic
@ 2021-05-11 20:54 ` Jeremie Juste
1 sibling, 0 replies; 46+ messages in thread
From: Jeremie Juste @ 2021-05-11 20:54 UTC (permalink / raw)
To: Christopher Dimech; +Cc: Help Gnu Emacs
Hello,
On Monday, 10 May 2021 at 16:21, Christopher Dimech wrote:
> I want to use ";; * " and so forth for subheadings but using the following code had
> no effect.
For me the following works out of the box.
I install outshine-mode from melpa and in my init file I have
;; * outshine-mode folding
(eval-after-load "outshine-mode"
(progn (require 'outshine)
(define-key outshine-mode-map (kbd "M-I") 'outshine-imenu)
(define-key outshine-mode-map (kbd "<backtab>") 'outshine-cycle-buffer)))
(add-hook 'emacs-lisp-mode-hook 'outshine-mode)
Hope this helps,
Jeremie
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-11 18:09 ` Jean Louis
@ 2021-05-12 1:46 ` Christopher Dimech
2021-05-12 4:00 ` Jean Louis
0 siblings, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-12 1:46 UTC (permalink / raw)
To: Jean Louis; +Cc: help-gnu-emacs, monnier
> Sent: Wednesday, May 12, 2021 at 6:09 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: monnier@iro.umontreal.ca, help-gnu-emacs@gnu.org
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-11 18:32]:
> (defun fun ()
> (let ((something else)
>
> (more here))))
>
> > > If I press C-o at the position ■ to enter new line this is what happens:
>
> > I customarily hit enter at the end of the previous line and indentation works.
> > Pressing <tab> after using "C-o" works for me.
>
> Not in outline-minor-mode within emacs-lisp-mode as if
> parenthesis is on the new line, then it becomes a header, as each
> parenthesis on new line is then header for something.
I fully understand now. outline-minor-more must be revamped. For instance, it should
actually look for "(defun ", rather than for the simplistic "(" on a new line.
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-11 3:00 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-11 5:05 ` Christopher Dimech
@ 2021-05-12 1:53 ` Christopher Dimech
2021-05-12 12:31 ` Stefan Monnier
1 sibling, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-12 1:53 UTC (permalink / raw)
To: monnier; +Cc: help-gnu-emacs
> Sent: Tuesday, May 11, 2021 at 3:00 PM
> From: "Stefan Monnier via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> > Am using my own ".el" file. As for finding the local "outline-heading-alist",
> > how do you find out what it is exactly?
>
> In the vast majority of modes, the default is nil and it is
> lazily auto-populated based on `outline-regexp` and `outline-level`.
Could this be resolved by updating outline-mode. It could do with some more work.
> Stefan
>
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-12 1:46 ` Christopher Dimech
@ 2021-05-12 4:00 ` Jean Louis
2021-05-13 3:33 ` Christopher Dimech
0 siblings, 1 reply; 46+ messages in thread
From: Jean Louis @ 2021-05-12 4:00 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs, monnier
* Christopher Dimech <dimech@gmx.com> [2021-05-12 04:46]:
> I fully understand now. outline-minor-more must be revamped. For instance, it should
> actually look for "(defun ", rather than for the simplistic "(" on a
> new line.
If it would be just `defun' but it is not.
I think simplistic approach is good as anything could be there in
parenthesis in the first column. Lisp has multiple paradigms and lines
of a high level program could as well consist of functions which do no
call defun directly, as functions could be already defined.
There is no possible simple definition for what you mean. People use
function aliases, I was recently handling `defil' alias from GNU
Hyperbole development version. There can be unlimited number of
aliases and macros that will written on the first column.
(defalias 'definiere 'defun)
(definiere meine-sache ()
"Nichts für Dich")
(meine-sache) ⇒ "Nichts für Dich"
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-12 1:53 ` Christopher Dimech
@ 2021-05-12 12:31 ` Stefan Monnier
2021-05-12 12:43 ` Christopher Dimech
0 siblings, 1 reply; 46+ messages in thread
From: Stefan Monnier @ 2021-05-12 12:31 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs
>> > Am using my own ".el" file. As for finding the local "outline-heading-alist",
>> > how do you find out what it is exactly?
>>
>> In the vast majority of modes, the default is nil and it is
>> lazily auto-populated based on `outline-regexp` and `outline-level`.
>
> Could this be resolved by updating outline-mode.
I have no idea what "this" is, so I can't really answer.
Stefan
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-12 12:31 ` Stefan Monnier
@ 2021-05-12 12:43 ` Christopher Dimech
2021-05-12 14:35 ` Yuri Khan
0 siblings, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-12 12:43 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
Some have been trying to set outline-heading-alist fol/lowing the code in "texinfo.el".
I have also tried to set it up but have not been successful.
;; Outline settings.
(setq-local outline-heading-alist
;; We should merge `outline-heading-alist' and
;; `texinfo-section-list'. But in the mean time, let's
;; just generate one from the other.
(mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
texinfo-section-list))
(setq-local outline-regexp
(concat (regexp-opt (mapcar 'car outline-heading-alist) t)
"\\>"))
> Sent: Thursday, May 13, 2021 at 12:31 AM
> From: "Stefan Monnier" <monnier@iro.umontreal.ca>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> >> > Am using my own ".el" file. As for finding the local "outline-heading-alist",
> >> > how do you find out what it is exactly?
> >>
> >> In the vast majority of modes, the default is nil and it is
> >> lazily auto-populated based on `outline-regexp` and `outline-level`.
> >
> > Could this be resolved by updating outline-mode.
>
> I have no idea what "this" is, so I can't really answer.
>
>
> Stefan
>
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-12 12:43 ` Christopher Dimech
@ 2021-05-12 14:35 ` Yuri Khan
2021-05-12 14:52 ` Christopher Dimech
2021-05-13 12:29 ` Setting up user defined texinfo headlines using outline-heading-alist Christopher Dimech
0 siblings, 2 replies; 46+ messages in thread
From: Yuri Khan @ 2021-05-12 14:35 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs
On Wed, 12 May 2021 at 19:43, Christopher Dimech <dimech@gmx.com> wrote:
> Some have been trying to set outline-heading-alist fol/lowing the code in "texinfo.el".
> I have also tried to set it up but have not been successful.
There is a group of people on this list, including you,
michael-franzese, pietru, steve-humphreys, and wael-zwaiter, who seem
to be working on a common project, have various difficulties, and post
requests for assistance that are hard to follow through.
You state an approach (“I have tried this…”), followed by something
general like “I have not been successful” or “I encountered
difficulties” or “I need assistance”, but it is not readily clear how
to assist you. So you get unhelpful answers or no answers at all.
The standard assistance request form includes:
* Your software version(s) and operating system (if you feel it might
be relevant). This is important because if you are using older
software, you won’t be able to use some solutions, or people will say
it just works on newer versions.
* What high-level problem you are trying to solve. This is important
because sometimes people will say your approach is wrong and point you
at a better way to solve it.
* How you are trying to solve it.
* What concrete result you expected.
* What concrete result you observe instead.
Your above request could look like:
===
I am on GNU/Linux, running Emacs 27.1.
I have a variable ‘texinfo-section-list’ whose value is:
((chapter 2) (section 3) (subsection 4) (subsubsection 5)
(unnumbered 2) (unnumberedsec 3) (unnumberedsubsec 4)
(unnumberedsubsubsec 5)
(mychapter 2) (mysection 3) (mysubsection 4))
(note my custom section macros).
I want to set up Emacs so that, when I open a texinfo file,
outline-minor-mode is enabled and configured to recognize section
macros listed in ‘texinfo-section-list’ as headings.
To that end, I’m trying this:
(defun my-texinfo-outline ()
(setq-local outline-heading-alist
(mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
texinfo-section-list))
(setq-local outline-regexp
(concat (regexp-opt (mapcar 'car outline-heading-alist) t)
"\\>")))
(add-hook 'texinfo-mode-hook #'my-texinfo-outline)
When I open the attached texinfo file, put point on line 42 and press
C-c @ C-d (outline-hide-subtree), I expect the whole section up to
line 68 to be hidden but not further lines, because line 69 has a
custom section header; but Emacs hides everything up to line 86.
===
(and don’t forget to actually attach a sample file, as short as
possible to demonstrate the problem).
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-12 14:35 ` Yuri Khan
@ 2021-05-12 14:52 ` Christopher Dimech
2021-05-13 12:29 ` Setting up user defined texinfo headlines using outline-heading-alist Christopher Dimech
1 sibling, 0 replies; 46+ messages in thread
From: Christopher Dimech @ 2021-05-12 14:52 UTC (permalink / raw)
To: Yuri Khan; +Cc: help-gnu-emacs
Have been picking up on programming mode headings. Basically we are trying to set up
outline-heading-alist to specify headings in outer-minor-mode. Had started
with emacs-lisp-mode, but now also to texinfo-mode.
You wrote a good description there.
> Sent: Thursday, May 13, 2021 at 2:35 AM
> From: "Yuri Khan" <yuri.v.khan@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "help-gnu-emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> On Wed, 12 May 2021 at 19:43, Christopher Dimech <dimech@gmx.com> wrote:
>
> > Some have been trying to set outline-heading-alist fol/lowing the code in "texinfo.el".
> > I have also tried to set it up but have not been successful.
>
> There is a group of people on this list, including you,
> michael-franzese, pietru, steve-humphreys, and wael-zwaiter, who seem
> to be working on a common project, have various difficulties, and post
> requests for assistance that are hard to follow through.
>
> You state an approach (“I have tried this…”), followed by something
> general like “I have not been successful” or “I encountered
> difficulties” or “I need assistance”, but it is not readily clear how
> to assist you. So you get unhelpful answers or no answers at all.
>
> The standard assistance request form includes:
>
> * Your software version(s) and operating system (if you feel it might
> be relevant). This is important because if you are using older
> software, you won’t be able to use some solutions, or people will say
> it just works on newer versions.
> * What high-level problem you are trying to solve. This is important
> because sometimes people will say your approach is wrong and point you
> at a better way to solve it.
> * How you are trying to solve it.
> * What concrete result you expected.
> * What concrete result you observe instead.
>
> Your above request could look like:
>
> ===
> I am on GNU/Linux, running Emacs 27.1.
>
> I have a variable ‘texinfo-section-list’ whose value is:
>
> ((chapter 2) (section 3) (subsection 4) (subsubsection 5)
> (unnumbered 2) (unnumberedsec 3) (unnumberedsubsec 4)
> (unnumberedsubsubsec 5)
> (mychapter 2) (mysection 3) (mysubsection 4))
>
> (note my custom section macros).
>
> I want to set up Emacs so that, when I open a texinfo file,
> outline-minor-mode is enabled and configured to recognize section
> macros listed in ‘texinfo-section-list’ as headings.
>
> To that end, I’m trying this:
>
> (defun my-texinfo-outline ()
> (setq-local outline-heading-alist
> (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
> texinfo-section-list))
> (setq-local outline-regexp
> (concat (regexp-opt (mapcar 'car outline-heading-alist) t)
> "\\>")))
>
> (add-hook 'texinfo-mode-hook #'my-texinfo-outline)
>
> When I open the attached texinfo file, put point on line 42 and press
> C-c @ C-d (outline-hide-subtree), I expect the whole section up to
> line 68 to be hidden but not further lines, because line 69 has a
> custom section header; but Emacs hides everything up to line 86.
> ===
>
> (and don’t forget to actually attach a sample file, as short as
> possible to demonstrate the problem).
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-12 4:00 ` Jean Louis
@ 2021-05-13 3:33 ` Christopher Dimech
2021-05-13 7:22 ` Jean Louis
0 siblings, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-13 3:33 UTC (permalink / raw)
To: Jean Louis; +Cc: help-gnu-emacs, monnier
> Sent: Wednesday, May 12, 2021 at 4:00 PM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: monnier@iro.umontreal.ca, help-gnu-emacs@gnu.org
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-12 04:46]:
> > I fully understand now. outline-minor-more must be revamped. For instance, it should
> > actually look for "(defun ", rather than for the simplistic "(" on a
> > new line.
>
> If it would be just `defun' but it is not.
>
> I think simplistic approach is good as anything could be there in
> parenthesis in the first column. Lisp has multiple paradigms and lines
> of a high level program could as well consist of functions which do no
> call defun directly, as functions could be already defined.
Correct , but we could start with a defun for folding, the others would not fold.
It improves the current implementation nevertheless. From what I see, there will
not be many working on it, and we can start improving it some more. I could then
look at it again to see what I can do.
There certainly exists the capability of user defined code blocks, something I am
currently trying to do, particularly since there are others that would find it
valuable to use.
> There is no possible simple definition for what you mean. People use
> function aliases, I was recently handling `defil' alias from GNU
> Hyperbole development version. There can be unlimited number of
> aliases and macros that will written on the first column.
>
> (defalias 'definiere 'defun)
>
> (definiere meine-sache ()
> "Nichts für Dich")
>
> (meine-sache) ⇒ "Nichts für Dich"
The plan would be for users to adapt the folding to their needs. Many don't usually
use an unlimited number of aliases in the code they work on.
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-13 3:33 ` Christopher Dimech
@ 2021-05-13 7:22 ` Jean Louis
2021-05-13 7:41 ` Christopher Dimech
0 siblings, 1 reply; 46+ messages in thread
From: Jean Louis @ 2021-05-13 7:22 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs, monnier
* Christopher Dimech <dimech@gmx.com> [2021-05-13 06:33]:
> Correct , but we could start with a defun for folding, the others would not fold.
> It improves the current implementation nevertheless. From what I see, there will
> not be many working on it, and we can start improving it some more. I could then
> look at it again to see what I can do.
Anything is folded that begins with ( in the first column. Not just
`defun'.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-13 7:22 ` Jean Louis
@ 2021-05-13 7:41 ` Christopher Dimech
2021-05-13 10:03 ` Jean Louis
0 siblings, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-13 7:41 UTC (permalink / raw)
To: Jean Louis; +Cc: help-gnu-emacs, monnier
> Sent: Thursday, May 13, 2021 at 7:22 PM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org, monnier@iro.umontreal.ca
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-13 06:33]:
> > Correct , but we could start with a defun for folding, the others would not fold.
> > It improves the current implementation nevertheless. From what I see, there will
> > not be many working on it, and we can start improving it some more. I could then
> > look at it again to see what I can do.
>
> Anything is folded that begins with ( in the first column. Not just
> `defun'.
One of your criticisms has been that simply using "(" in the first column
generates problems whilst working. Is that correct?
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-13 7:41 ` Christopher Dimech
@ 2021-05-13 10:03 ` Jean Louis
2021-05-13 10:22 ` Christopher Dimech
0 siblings, 1 reply; 46+ messages in thread
From: Jean Louis @ 2021-05-13 10:03 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs, monnier
* Christopher Dimech <dimech@gmx.com> [2021-05-13 10:42]:
> > Anything is folded that begins with ( in the first column. Not just
> > `defun'.
>
> One of your criticisms has been that simply using "(" in the first column
> generates problems whilst working. Is that correct?
It collides with TAB indentation. Remedy for those lines is SPC TAB.
I Step:
(defun my-fun (a)
(let ((var 1)
(var 3)
(var 4))))
II Step:
(defun my-fun (a)
(let ((var 1)
<--- C-o brings it down to new line
(var 3)
(var 4))))
III Step:
(defun my-fun (a)
(let ((var 1)
(var 2)
(var 3) <--- TAB in first column will not work to indent it back
(var 4))))
IV Step:
(defun my-fun (a)
(let ((var 1)
(var 2)
(var 3) <--- insert SPC, THEN TAB
(var 4))))
IV Step:
(defun my-fun (a)
(let ((var 1)
(var 2)
(var 3)
(var 4))))
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-13 10:03 ` Jean Louis
@ 2021-05-13 10:22 ` Christopher Dimech
2021-05-13 10:33 ` Jean Louis
0 siblings, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-13 10:22 UTC (permalink / raw)
To: Jean Louis; +Cc: help-gnu-emacs, monnier
> Sent: Thursday, May 13, 2021 at 10:03 PM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org, monnier@iro.umontreal.ca
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-13 10:42]:
> > > Anything is folded that begins with ( in the first column. Not just
> > > `defun'.
> >
> > One of your criticisms has been that simply using "(" in the first column
> > generates problems whilst working. Is that correct?
>
> It collides with TAB indentation. Remedy for those lines is SPC TAB.
Are you happy with "SPC TAB" or do you consider the solution as just a workaround?
What would you think about having "C-o" bringing the cursor point to the indentation
point appropriate for that section of code?
> I Step:
>
> (defun my-fun (a)
> (let ((var 1)
> (var 3)
> (var 4))))
>
> II Step:
>
> (defun my-fun (a)
> (let ((var 1)
> <--- C-o brings it down to new line
> (var 3)
> (var 4))))
>
> III Step:
>
> (defun my-fun (a)
> (let ((var 1)
> (var 2)
> (var 3) <--- TAB in first column will not work to indent it back
> (var 4))))
>
> IV Step:
>
> (defun my-fun (a)
> (let ((var 1)
> (var 2)
> (var 3) <--- insert SPC, THEN TAB
> (var 4))))
>
> IV Step:
>
> (defun my-fun (a)
> (let ((var 1)
> (var 2)
> (var 3)
> (var 4))))
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-13 10:22 ` Christopher Dimech
@ 2021-05-13 10:33 ` Jean Louis
2021-05-13 11:37 ` Christopher Dimech
0 siblings, 1 reply; 46+ messages in thread
From: Jean Louis @ 2021-05-13 10:33 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs, monnier
* Christopher Dimech <dimech@gmx.com> [2021-05-13 13:23]:
> > It collides with TAB indentation. Remedy for those lines is SPC TAB.
>
> Are you happy with "SPC TAB" or do you consider the solution as just
> a workaround?
I am happy with SPC TAB, it is such a minor collision, and I got used
to it.
> What would you think about having "C-o" bringing the cursor point to the indentation
> point appropriate for that section of code?
I am strong opponent of changing C-o, if you mention it to me, I start
burning trash cans on street and block the traffic. ;-)
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: outline-heading-alist for elisp using ";; * "
2021-05-13 10:33 ` Jean Louis
@ 2021-05-13 11:37 ` Christopher Dimech
0 siblings, 0 replies; 46+ messages in thread
From: Christopher Dimech @ 2021-05-13 11:37 UTC (permalink / raw)
To: Jean Louis; +Cc: help-gnu-emacs, monnier
> Sent: Thursday, May 13, 2021 at 10:33 PM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org, monnier@iro.umontreal.ca
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-13 13:23]:
> > > It collides with TAB indentation. Remedy for those lines is SPC TAB.
> >
> > Are you happy with "SPC TAB" or do you consider the solution as just
> > a workaround?
>
> I am happy with SPC TAB, it is such a minor collision, and I got used
> to it.
>
> > What would you think about having "C-o" bringing the cursor point to the indentation
> > point appropriate for that section of code?
>
> I am strong opponent of changing C-o, if you mention it to me, I start
> burning trash cans on street and block the traffic. ;-)
Sounds serious and entertaining. :)
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Setting up user defined texinfo headlines using outline-heading-alist
2021-05-12 14:35 ` Yuri Khan
2021-05-12 14:52 ` Christopher Dimech
@ 2021-05-13 12:29 ` Christopher Dimech
2021-05-13 13:26 ` Yuri Khan
1 sibling, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-13 12:29 UTC (permalink / raw)
To: Help Gnu Emacs; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 5600 bytes --]
I am running GNU Emacs 27.1 build as x86_64-pc-linux-gnu with GTK+ Version 3.22.30
and cairo version 1.15.10.
I have a texinfo file (test.texi attached) where I defined some additional sectioning
commands (e.g. @usec, @usebsec). I customarily switch on outline-minor-mode to see the
headings. outline-minor-mode gives the possibility to define my own set of headings
(e.g. @usec, @usebsec) by setting up "outline-heading-alist".
With the default settings I get
@node uchapter-amcoh
@unnumbered 6 @ Ameliorating Waveform Coherency...
Have modified my init file with the following code that resets "outline-heading-alist"
to include @usec, @usebsec as headings in addition to @unnumbered
(defvar texinfo-hdlevels
'( ("@chapter" . 2)
("@section" . 3)
("@subsection" . 4)
("@subsubsection" . 5)
;; --------------------------------------------------
("@unnumbered" . 2)
("@unnumberedsec" . 3)
("@unnumberedsubsec" . 4)
("@unnumberedsubsubsec" . 5)
;; --------------------------------------------------
("@appendix" . 2)
("@appendixsec" . 3)
("@appendixsubsec" . 4)
("@appendixsubsubsec" . 5)
;; --------------------------------------------------
("@majorheading" 2)
;; --------------------------------------------------
("@chapheading" 2)
("@heading" 3)
("@subheading" 4)
("@subsubheading" 5)
;; --------------------------------------------------
("@uchap" . 2)
("@usec" . 2)
("@usubsec" . 3)
("@usubsubsec" . 4) ))
(setq-local outline-heading-alist texinfo-hdlevels)
I was expecting to see the following
@node uchapter-amcoh
@unnumbered 6 @ Ameliorating Waveform Coherency
@usec @value{seclb} Abductive Reasoning...
@usec @value{seclb} Parsimony over Complexity...
@usubsec @value{seclb} The Claerbout Conjecture...
@usec @value{seclb} Correlograms in Helioseismology...
@usubsec @value{seclb} Solar Magnetic Cycle and the Interface Dynamo...
But I am only seeing
@node uchapter-amcoh
@unnumbered 6 @ Ameliorating Waveform Coherency...
>
> I have a variable ‘texinfo-section-list’ whose value is:
---------------------
Christopher Dimech
General Administrator - Naiad Informatics - GNU Project (Geocomputation)
- Geophysical Simulation
- Geological Subsurface Mapping
- Disaster Preparedness and Mitigation
- Natural Resource Exploration and Production
- Free Software Advocacy
> Sent: Thursday, May 13, 2021 at 2:35 AM
> From: "Yuri Khan" <yuri.v.khan@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "help-gnu-emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: outline-heading-alist for elisp using ";; * "
>
> On Wed, 12 May 2021 at 19:43, Christopher Dimech <dimech@gmx.com> wrote:
>
> > Some have been trying to set outline-heading-alist fol/lowing the code in "texinfo.el".
> > I have also tried to set it up but have not been successful.
>
> There is a group of people on this list, including you,
> michael-franzese, pietru, steve-humphreys, and wael-zwaiter, who seem
> to be working on a common project, have various difficulties, and post
> requests for assistance that are hard to follow through.
>
> You state an approach (“I have tried this…”), followed by something
> general like “I have not been successful” or “I encountered
> difficulties” or “I need assistance”, but it is not readily clear how
> to assist you. So you get unhelpful answers or no answers at all.
>
> The standard assistance request form includes:
>
> * Your software version(s) and operating system (if you feel it might
> be relevant). This is important because if you are using older
> software, you won’t be able to use some solutions, or people will say
> it just works on newer versions.
> * What high-level problem you are trying to solve. This is important
> because sometimes people will say your approach is wrong and point you
> at a better way to solve it.
> * How you are trying to solve it.
> * What concrete result you expected.
> * What concrete result you observe instead.
>
> Your above request could look like:
>
> ===
> I am on GNU/Linux, running Emacs 27.1.
>
> I have a variable ‘texinfo-section-list’ whose value is:
>
> ((chapter 2) (section 3) (subsection 4) (subsubsection 5)
> (unnumbered 2) (unnumberedsec 3) (unnumberedsubsec 4)
> (unnumberedsubsubsec 5)
> (mychapter 2) (mysection 3) (mysubsection 4))
>
> (note my custom section macros).
>
> I want to set up Emacs so that, when I open a texinfo file,
> outline-minor-mode is enabled and configured to recognize section
> macros listed in ‘texinfo-section-list’ as headings.
>
> To that end, I’m trying this:
>
> (defun my-texinfo-outline ()
> (setq-local outline-heading-alist
> (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
> texinfo-section-list))
> (setq-local outline-regexp
> (concat (regexp-opt (mapcar 'car outline-heading-alist) t)
> "\\>")))
>
> (add-hook 'texinfo-mode-hook #'my-texinfo-outline)
>
> When I open the attached texinfo file, put point on line 42 and press
> C-c @ C-d (outline-hide-subtree), I expect the whole section up to
> line 68 to be hidden but not further lines, because line 69 has a
> custom section header; but Emacs hides everything up to line 86.
> ===
>
> (and don’t forget to actually attach a sample file, as short as
> possible to demonstrate the problem).
>
[-- Attachment #2: test.texi --]
[-- Type: application/x-texinfo, Size: 4822 bytes --]
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Setting up user defined texinfo headlines using outline-heading-alist
2021-05-13 12:29 ` Setting up user defined texinfo headlines using outline-heading-alist Christopher Dimech
@ 2021-05-13 13:26 ` Yuri Khan
2021-05-13 15:10 ` Christopher Dimech
2021-05-13 15:34 ` Jean Louis
0 siblings, 2 replies; 46+ messages in thread
From: Yuri Khan @ 2021-05-13 13:26 UTC (permalink / raw)
To: Christopher Dimech; +Cc: Help Gnu Emacs
On Thu, 13 May 2021 at 19:46, Christopher Dimech <dimech@gmx.com> wrote:
[…]
Ha! Much better.
> Have modified my init file with the following code that resets "outline-heading-alist"
> to include @usec, @usebsec as headings in addition to @unnumbered
>
> (defvar texinfo-hdlevels […])
>
> (setq-local outline-heading-alist texinfo-hdlevels)
If that’s all that you have in your init file, then the setq-local
acts on the wrong buffer. It sets the local value of the variable
‘outline-heading-alist’ in whichever buffer that is current at the
time your init file is executed, maybe *scratch* or something. But you
actually want it to act on the buffer that visits your test.texi file.
To that end, put that setq-local in a hook that runs when you visit a
.texi file:
(defun my-texinfo-outline ()
(setq-local outline-heading-alist texinfo-hdlevels))
(add-hook 'texinfo-mode-hook #'my-texinfo-outline)
This is a recurring pattern in Emacs configuration: If you have a
general facility that works in various buffers regardless of their
major mode, and you want it to behave differently depending on the
major mode, you put configuration in a hook that is run by that major
mode.
^ permalink raw reply [flat|nested] 46+ messages in thread
* Setting up user defined texinfo headlines using outline-heading-alist
2021-05-13 13:26 ` Yuri Khan
@ 2021-05-13 15:10 ` Christopher Dimech
2021-05-13 16:05 ` Yuri Khan
2021-05-13 15:34 ` Jean Louis
1 sibling, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-13 15:10 UTC (permalink / raw)
To: Yuri Khan; +Cc: Help Gnu Emacs
I have followed your suggestion of using a function that sets outline-heading-alist
using texinfo-mode-hook.
Have included the following setup (see code section), yet I am still getting
@node uchapter-amcoh
@unnumbered 6 @ Ameliorating Waveform Coherency...
whenever I hit "C-C @ C-t" (Hide Body). Should I not get @usec and @usubsec
showing up as well?
-------- code --------
(defvar texinfo-hdlevels
'( ("@chapter" . 2)
("@section" . 3)
("@subsection" . 4)
("@subsubsection" . 5)
;; --------------------------------------------------
("@unnumbered" . 2)
("@unnumberedsec" . 3)
("@unnumberedsubsec" . 4)
("@unnumberedsubsubsec" . 5)
;; --------------------------------------------------
("@appendix" . 2)
("@appendixsec" . 3)
("@appendixsubsec" . 4)
("@appendixsubsubsec" . 5)
;; --------------------------------------------------
("@majorheading" 2)
;; --------------------------------------------------
("@chapheading" 2)
("@heading" 3)
("@subheading" 4)
("@subsubheading" 5)
;; --------------------------------------------------
("@uchap" . 2)
("@usec" . 2)
("@usubsec" . 3)
("@usubsubsec" . 4) ))
(defun instate-texinfo-hdlevels ()
(setq-local outline-heading-alist texinfo-hdlevels))
(defun texinfo-hdlevels-hook ()
"todo"
(add-hook 'texinfo-mode-hook #'instate-texinfo-hdlevels))
(defun outline-hooks ()
"todo"
(add-hook 'emacs-lisp-mode-hook #'outline-minor-mode)
(add-hook 'texinfo-mode-hook #'outline-minor-mode) )
(outline-hooks)
(texinfo-hdlevels-hook)
Regards
Christopher
> Sent: Friday, May 14, 2021 at 1:26 AM
> From: "Yuri Khan" <yuri.v.khan@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Setting up user defined texinfo headlines using outline-heading-alist
>
> On Thu, 13 May 2021 at 19:46, Christopher Dimech <dimech@gmx.com> wrote:
>
> […]
>
> Ha! Much better.
>
> > Have modified my init file with the following code that resets "outline-heading-alist"
> > to include @usec, @usebsec as headings in addition to @unnumbered
> >
> > (defvar texinfo-hdlevels […])
> >
> > (setq-local outline-heading-alist texinfo-hdlevels)
>
> If that’s all that you have in your init file, then the setq-local
> acts on the wrong buffer. It sets the local value of the variable
> ‘outline-heading-alist’ in whichever buffer that is current at the
> time your init file is executed, maybe *scratch* or something. But you
> actually want it to act on the buffer that visits your test.texi file.
>
> To that end, put that setq-local in a hook that runs when you visit a
> .texi file:
>
> (defun my-texinfo-outline ()
> (setq-local outline-heading-alist texinfo-hdlevels))
>
> (add-hook 'texinfo-mode-hook #'my-texinfo-outline)
>
> This is a recurring pattern in Emacs configuration: If you have a
> general facility that works in various buffers regardless of their
> major mode, and you want it to behave differently depending on the
> major mode, you put configuration in a hook that is run by that major
> mode.
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Setting up user defined texinfo headlines using outline-heading-alist
2021-05-13 13:26 ` Yuri Khan
2021-05-13 15:10 ` Christopher Dimech
@ 2021-05-13 15:34 ` Jean Louis
1 sibling, 0 replies; 46+ messages in thread
From: Jean Louis @ 2021-05-13 15:34 UTC (permalink / raw)
To: Yuri Khan; +Cc: Christopher Dimech, Help Gnu Emacs
* Yuri Khan <yuri.v.khan@gmail.com> [2021-05-13 16:27]:
> On Thu, 13 May 2021 at 19:46, Christopher Dimech <dimech@gmx.com> wrote:
>
> […]
>
> Ha! Much better.
>
> > Have modified my init file with the following code that resets "outline-heading-alist"
> > to include @usec, @usebsec as headings in addition to @unnumbered
> >
> > (defvar texinfo-hdlevels […])
> >
> > (setq-local outline-heading-alist texinfo-hdlevels)
>
> If that’s all that you have in your init file, then the setq-local
> acts on the wrong buffer. It sets the local value of the variable
> ‘outline-heading-alist’ in whichever buffer that is current at the
> time your init file is executed, maybe *scratch* or something. But you
> actually want it to act on the buffer that visits your test.texi file.
>
> To that end, put that setq-local in a hook that runs when you visit a
> .texi file:
>
> (defun my-texinfo-outline ()
> (setq-local outline-heading-alist texinfo-hdlevels))
I don't think there is any need for `setq-local' as
`outline-heading-alist' becomes automatically buffer local variable.
Just using `setq' is enough, in the right buffer.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Setting up user defined texinfo headlines using outline-heading-alist
2021-05-13 15:10 ` Christopher Dimech
@ 2021-05-13 16:05 ` Yuri Khan
2021-05-13 18:29 ` Jean Louis
2021-05-13 18:35 ` Christopher Dimech
0 siblings, 2 replies; 46+ messages in thread
From: Yuri Khan @ 2021-05-13 16:05 UTC (permalink / raw)
To: Christopher Dimech; +Cc: Help Gnu Emacs
On Thu, 13 May 2021 at 22:10, Christopher Dimech <dimech@gmx.com> wrote:
> I have followed your suggestion of using a function that sets outline-heading-alist
> using texinfo-mode-hook.
>
> Have included the following setup (see code section), yet I am still getting
>
> @node uchapter-amcoh
> @unnumbered 6 @ Ameliorating Waveform Coherency...
>
> whenever I hit "C-C @ C-t" (Hide Body). Should I not get @usec and @usubsec
> showing up as well?
Now that you gave a recipe, I was able to reproduce it. I saved your
test.texi and put your code into /tmp/20210513/.emacs and started
Emacs as “HOME=. emacs test.texi”. This way, my own config does not
affect the reproduction.
I pressed C-c @ C-t, and, yes, everything after the first heading got
collapsed. So next I pressed C-c @ C-h to see what other commands are
available. I spotted C-c @ C-a (outline-show-all) as the way to expand
it all back, and C-c @ C-n (outline-next-visible-heading) as a
reasonable way to check what Emacs thinks are your headings. And,
predictably, starting at the top, it stopped on @unnumbered, and then
at the bottom of the buffer. Which means it does not detect @usec as a
heading.
Next, I went to read the docstring on outline-next-visible-heading. And it says:
A heading line is one that starts with a ‘*’ (or that
‘outline-regexp’ matches).
So next let’s see what outline-regexp is:
outline-regexp is a variable defined in ‘outline.el’.
Its value is "[*^L]+"
[…]
Regular expression to match the beginning of a heading.
Any line whose beginning matches this regexp is considered to
start a heading.
Note that Outline mode only checks this regexp at the start of a line,
so the regexp need not (and usually does not) start with ‘^’.
So let’s change your hook function to set that:
(defun instate-texinfo-hdlevels ()
(setq-local outline-heading-alist texinfo-hdlevels)
(setq-local outline-regexp
(concat (regexp-opt (mapcar 'car texinfo-hdlevels)) "\\>")))
Now I press C-M-x within the above source to update the function
definition, switch to test.texi, and press M-x normal-mode RET to
reapply the major mode, which reruns all its hooks, which sets the
variables as needed. Now, C-c @ C-n from the top goes through
@unnumbered, @usec, @usec, @usubsec, @usec, @usubsec, bottom; and C-c
@ C-t leaves all custom headings visible:
@node uchapter-amcoh
@unnumbered 6 @ Ameliorating Waveform Coherency...
@usec{@value{seclb}, Abductive Reasoning}...
@usec{@value{seclb}, Parsimony over Complexity}...
@usubsec{@value{seclb}, The Claerbout Conjecture}...
@usec{@value{seclb}, Correlograms in Helioseismology}...
@usubsec{@value{seclb}, Solar Magnetic Cycle and the Interface Dynamo}...
Now I save the modified .emacs and restart this Emacs instance to see
if my solution works when applied from the init file. It does, so I am
confident enough to post it.
Next you might want to read the full docstring for outline-regexp, as
it tells you the recommended way to set it so that it travels with
your file rather than lives in your personal configuration. You might
also see if setting outline-heading alist the same way works.
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Setting up user defined texinfo headlines using outline-heading-alist
2021-05-13 16:05 ` Yuri Khan
@ 2021-05-13 18:29 ` Jean Louis
2021-05-13 18:48 ` Christopher Dimech
2021-05-13 19:01 ` Yuri Khan
2021-05-13 18:35 ` Christopher Dimech
1 sibling, 2 replies; 46+ messages in thread
From: Jean Louis @ 2021-05-13 18:29 UTC (permalink / raw)
To: Yuri Khan; +Cc: Christopher Dimech, Help Gnu Emacs
Hello Yuri,
Thank you for insightful explanation.
* Yuri Khan <yuri.v.khan@gmail.com> [2021-05-13 19:12]:
> outline-regexp is a variable defined in ‘outline.el’.
> Its value is (regexp-op "[*^L]+"
Here, not quite sure, but how I see the above regular expression
it will fold on the new line where there is character ^L, is it?
> So let’s change your hook function to set that:
>
> (defun instate-texinfo-hdlevels ()
> (setq-local outline-heading-alist texinfo-hdlevels)
> (setq-local outline-regexp
> (concat (regexp-opt (mapcar 'car texinfo-hdlevels)) "\\>")))
Interesting, I did not know the `regexp-opt' function, that is
very handy. It finds the regular expression that will match the
given list of strings and I find your application smart.
(regexp-opt '("something" "anything")) ⇒ "\\(?:\\(?:any\\|some\\)thing\\)"
(regexp-opt '("TODO" "DONE" "DELEGATED")) ⇒ "\\(?:D\\(?:ELEGATED\\|ONE\\)\\|TODO\\)"
and that may be reused with certainty to work:
(highlight-regexp "\\(?:D\\(?:ELEGATED\\|ONE\\)\\|TODO\\)")
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Setting up user defined texinfo headlines using outline-heading-alist
2021-05-13 16:05 ` Yuri Khan
2021-05-13 18:29 ` Jean Louis
@ 2021-05-13 18:35 ` Christopher Dimech
2021-05-13 19:13 ` Yuri Khan
1 sibling, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-13 18:35 UTC (permalink / raw)
To: Yuri Khan; +Cc: Help Gnu Emacs
> Sent: Friday, May 14, 2021 at 4:05 AM
> From: "Yuri Khan" <yuri.v.khan@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Setting up user defined texinfo headlines using outline-heading-alist
>
> On Thu, 13 May 2021 at 22:10, Christopher Dimech <dimech@gmx.com> wrote:
>
> > I have followed your suggestion of using a function that sets outline-heading-alist
> > using texinfo-mode-hook.
> >
> > Have included the following setup (see code section), yet I am still getting
> >
> > @node uchapter-amcoh
> > @unnumbered 6 @ Ameliorating Waveform Coherency...
> >
> > whenever I hit "C-C @ C-t" (Hide Body). Should I not get @usec and @usubsec
> > showing up as well?
>
> Now that you gave a recipe, I was able to reproduce it. I saved your
> test.texi and put your code into /tmp/20210513/.emacs and started
> Emacs as “HOME=. emacs test.texi”. This way, my own config does not
> affect the reproduction.
>
> I pressed C-c @ C-t, and, yes, everything after the first heading got
> collapsed. So next I pressed C-c @ C-h to see what other commands are
> available. I spotted C-c @ C-a (outline-show-all) as the way to expand
> it all back, and C-c @ C-n (outline-next-visible-heading) as a
> reasonable way to check what Emacs thinks are your headings. And,
> predictably, starting at the top, it stopped on @unnumbered, and then
> at the bottom of the buffer. Which means it does not detect @usec as a
> heading.
>
> Next, I went to read the docstring on outline-next-visible-heading. And it says:
>
> A heading line is one that starts with a ‘*’ (or that
> ‘outline-regexp’ matches).
>
> So next let’s see what outline-regexp is:
>
> outline-regexp is a variable defined in ‘outline.el’.
> Its value is "[*^L]+"
> […]
> Regular expression to match the beginning of a heading.
> Any line whose beginning matches this regexp is considered to
> start a heading.
> Note that Outline mode only checks this regexp at the start of a line,
> so the regexp need not (and usually does not) start with ‘^’.
>
> So let’s change your hook function to set that:
>
> (defun instate-texinfo-hdlevels ()
> (setq-local outline-heading-alist texinfo-hdlevels)
> (setq-local outline-regexp
> (concat (regexp-opt (mapcar 'car texinfo-hdlevels)) "\\>")))
>
> Now I press C-M-x within the above source to update the function
> definition, switch to test.texi, and press M-x normal-mode RET to
> reapply the major mode, which reruns all its hooks, which sets the
> variables as needed. Now, C-c @ C-n from the top goes through
> @unnumbered, @usec, @usec, @usubsec, @usec, @usubsec, bottom; and C-c
> @ C-t leaves all custom headings visible:
>
> @node uchapter-amcoh
> @unnumbered 6 @ Ameliorating Waveform Coherency...
> @usec{@value{seclb}, Abductive Reasoning}...
> @usec{@value{seclb}, Parsimony over Complexity}...
> @usubsec{@value{seclb}, The Claerbout Conjecture}...
> @usec{@value{seclb}, Correlograms in Helioseismology}...
> @usubsec{@value{seclb}, Solar Magnetic Cycle and the Interface Dynamo}...
>
> Now I save the modified .emacs and restart this Emacs instance to see
> if my solution works when applied from the init file. It does, so I am
> confident enough to post it.
Yes, your code works. Nevertheless, I find all this extremely confusing.
For instance:
1. outline.el does not state how to set a user defined outline-regexp or guide
you to a particular implementation such as texinfo.el
2. texinfo.el uses a convoluted way to set outline-heading-alist and outline-regexp.
2a. Firstly texinfo.el tries to play around with texinfo-section-list, excluding the
initial "@" fog texinfo-commands. The implementation certainly does not watch the
example on how to set up outline-heading-alist as described in the docstring of
outline-heading-alist in "outline.el".
2b. outline-heading-alist provides the following example:
(setq outline-heading-alist
\\='((\"@chapter\" . 2) (\"@section\" . 3) (\"@subsection\" . 4)
(\"@subsubsection\" . 5)
(\"@unnumbered\" . 2) (\"@unnumberedsec\" . 3)
(\"@unnumberedsubsec\" . 4) (\"@unnumberedsubsubsec\" . 5)
(\"@appendix\" . 2) (\"@appendixsec\" . 3)...
(\"@appendixsubsec\" . 4) (\"@appendixsubsubsec\" . 5) ..))
This is not a real working example because of the additional "..." and ".." in
the declaration.
Consequently, the code rather than helping others see how to set things up, confuses
them because of the inconsistencies described.
So again, I do not understand how to set outline-heading-alist for a user who wants
to define his own headers.
I also fail to understand how to visualise any differences between different heading
levels.
It is then very easy to tell a user to learn more elisp, rather than convince a
developer to be consistent and write in ways that assist in the reuse of their
code.
> Next you might want to read the full docstring for outline-regexp, as
> it tells you the recommended way to set it so that it travels with
> your file rather than lives in your personal configuration. You might
> also see if setting outline-heading alist the same way works.
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Setting up user defined texinfo headlines using outline-heading-alist
2021-05-13 18:29 ` Jean Louis
@ 2021-05-13 18:48 ` Christopher Dimech
2021-05-13 19:01 ` Yuri Khan
1 sibling, 0 replies; 46+ messages in thread
From: Christopher Dimech @ 2021-05-13 18:48 UTC (permalink / raw)
To: Jean Louis; +Cc: Help Gnu Emacs, Yuri Khan
> Sent: Friday, May 14, 2021 at 6:29 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Yuri Khan" <yuri.v.khan@gmail.com>
> Cc: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Setting up user defined texinfo headlines using outline-heading-alist
>
> Hello Yuri,
>
> Thank you for insightful explanation.
>
> * Yuri Khan <yuri.v.khan@gmail.com> [2021-05-13 19:12]:
> > outline-regexp is a variable defined in ‘outline.el’.
> > Its value is (regexp-op "[*^L]+"
>
> Here, not quite sure, but how I see the above regular expression
> it will fold on the new line where there is character ^L, is it?
I can see a number of ^L in texinfo.el
> > So let’s change your hook function to set that:
> >
> > (defun instate-texinfo-hdlevels ()
> > (setq-local outline-heading-alist texinfo-hdlevels)
> > (setq-local outline-regexp
> > (concat (regexp-opt (mapcar 'car texinfo-hdlevels)) "\\>")))
>
> Interesting, I did not know the `regexp-opt' function, that is
> very handy. It finds the regular expression that will match the
> given list of strings and I find your application smart.
>
> (regexp-opt '("something" "anything")) ⇒ "\\(?:\\(?:any\\|some\\)thing\\)"
>
> (regexp-opt '("TODO" "DONE" "DELEGATED")) ⇒ "\\(?:D\\(?:ELEGATED\\|ONE\\)\\|TODO\\)"
>
> and that may be reused with certainty to work:
>
> (highlight-regexp "\\(?:D\\(?:ELEGATED\\|ONE\\)\\|TODO\\)")
>
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Setting up user defined texinfo headlines using outline-heading-alist
2021-05-13 18:29 ` Jean Louis
2021-05-13 18:48 ` Christopher Dimech
@ 2021-05-13 19:01 ` Yuri Khan
1 sibling, 0 replies; 46+ messages in thread
From: Yuri Khan @ 2021-05-13 19:01 UTC (permalink / raw)
To: Yuri Khan, Christopher Dimech, Help Gnu Emacs
On Fri, 14 May 2021 at 01:35, Jean Louis <bugs@gnu.support> wrote:
> > Its value is (regexp-op "[*^L]+"
>
> Here, not quite sure, but how I see the above regular expression
> it will fold on the new line where there is character ^L, is it?
Not new line, new page.
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Setting up user defined texinfo headlines using outline-heading-alist
2021-05-13 18:35 ` Christopher Dimech
@ 2021-05-13 19:13 ` Yuri Khan
2021-05-14 3:49 ` Christopher Dimech
0 siblings, 1 reply; 46+ messages in thread
From: Yuri Khan @ 2021-05-13 19:13 UTC (permalink / raw)
To: Christopher Dimech; +Cc: Help Gnu Emacs
On Fri, 14 May 2021 at 01:35, Christopher Dimech <dimech@gmx.com> wrote:
> It is then very easy to tell a user to learn more elisp, rather than convince a
> developer to be consistent and write in ways that assist in the reuse of their
> code.
Yeah, much of the code in and around Emacs assumes the user can read,
and often also write, Elisp.
If you find outline-regexp in a docstring and you want to know where
it’s defined and how it’s used, your best bet is to invoke
xref-find-references on it and skim through the code.
If you want to know how to have headings fontified, M-x find-library
RET outline RET, then search for “face”, eventually find a variable
‘outline-font-lock-keywords’ and its use in ‘outline-mode’ but not in
outline-minor-mode (probably because with outline-minor-mode you
already have some fontification by the major mode). Maybe find a way
to add ‘outline-font-lock-keywords’ to the major mode’s
‘font-lock-defaults’, but that definitely requires some programming.
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Setting up user defined texinfo headlines using outline-heading-alist
2021-05-13 19:13 ` Yuri Khan
@ 2021-05-14 3:49 ` Christopher Dimech
2021-05-14 3:56 ` Stefan Monnier via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 46+ messages in thread
From: Christopher Dimech @ 2021-05-14 3:49 UTC (permalink / raw)
To: Yuri Khan; +Cc: Help Gnu Emacs
I would be grateful for some explanation of variables "outline-regexp" and
"outline-heading-alist".
texinfo.el sets both "outline-heading-alist" and "outline-regexp", the latter from the
other using the same variable "texinfo-section-list".
Do we really need to have both outline-heading-alist and texinfo-section-list, because
as far as I can see we are using the same definition of headings and levels with the
variable "texinfo-section-list".
> Sent: Friday, May 14, 2021 at 7:13 AM
> From: "Yuri Khan" <yuri.v.khan@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Setting up user defined texinfo headlines using outline-heading-alist
>
> On Fri, 14 May 2021 at 01:35, Christopher Dimech <dimech@gmx.com> wrote:
>
> > It is then very easy to tell a user to learn more elisp, rather than convince a
> > developer to be consistent and write in ways that assist in the reuse of their
> > code.
>
> Yeah, much of the code in and around Emacs assumes the user can read,
> and often also write, Elisp.
>
> If you find outline-regexp in a docstring and you want to know where
> it’s defined and how it’s used, your best bet is to invoke
> xref-find-references on it and skim through the code.
>
> If you want to know how to have headings fontified, M-x find-library
> RET outline RET, then search for “face”, eventually find a variable
> ‘outline-font-lock-keywords’ and its use in ‘outline-mode’ but not in
> outline-minor-mode (probably because with outline-minor-mode you
> already have some fontification by the major mode). Maybe find a way
> to add ‘outline-font-lock-keywords’ to the major mode’s
> ‘font-lock-defaults’, but that definitely requires some programming.
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Setting up user defined texinfo headlines using outline-heading-alist
2021-05-14 3:49 ` Christopher Dimech
@ 2021-05-14 3:56 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-14 5:25 ` Christopher Dimech
0 siblings, 1 reply; 46+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-05-14 3:56 UTC (permalink / raw)
To: help-gnu-emacs
> I would be grateful for some explanation of variables "outline-regexp" and
> "outline-heading-alist".
`outline-regexp` is the most important setting for outline.el since it
defines which lines are considered headings.
`outline-heading-alist` is a relatively late addition to `outline.el`,
very rarely used. Basically it's just there for `outline-promote` and
`outline-demote`.
> Do we really need to have both outline-heading-alist and texinfo-section-list,
Of course: `texinfo-section-list` is the variable that defines for
`texinfo.el` the sectioning commands that are in use. It can be set by
the user to adapt to their own Texinfo needs.
`outline-heading-alist` is used as the way for `texinfo.el` to tell
`outline.el` which heading promotes/demotes to which.
Stefan
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Setting up user defined texinfo headlines using outline-heading-alist
2021-05-14 3:56 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-05-14 5:25 ` Christopher Dimech
0 siblings, 0 replies; 46+ messages in thread
From: Christopher Dimech @ 2021-05-14 5:25 UTC (permalink / raw)
To: monnier; +Cc: help-gnu-emacs
> Sent: Friday, May 14, 2021 at 3:56 PM
> From: "Stefan Monnier via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Setting up user defined texinfo headlines using outline-heading-alist
>
> > I would be grateful for some explanation of variables "outline-regexp" and
> > "outline-heading-alist".
>
> `outline-regexp` is the most important setting for outline.el since it
> defines which lines are considered headings.
>
> `outline-heading-alist` is a relatively late addition to `outline.el`,
> very rarely used. Basically it's just there for `outline-promote` and
> `outline-demote`.
Is it usual that we use the same heading name and level declaration
(texinfo-section-list in our case) for both "outline-regexp" and for
"outline-heading-alist"?
> > Do we really need to have both outline-heading-alist and texinfo-section-list,
>
> Of course: `texinfo-section-list` is the variable that defines for
> `texinfo.el` the sectioning commands that are in use. It can be set by
> the user to adapt to their own Texinfo needs.
>
> `outline-heading-alist` is used as the way for `texinfo.el` to tell
> `outline.el` which heading promotes/demotes to which.
If "outline-regexp" is the most important setting, whilst "outline-heading-alist"
is rarely used, we can just set "texinfo-section-list" and "outline-regexp" and
introduce the "promotes/demotes" capability automatically from "texinfo-section-list".
Then users could simply set just "outline-regexp" only. Then again, we could
set outline-regexp directly without using "texinfo-section-list".
The texinfo.el states that
;; We should merge `outline-heading-alist' and
;; `texinfo-section-list'. But in the mean time, let's
;; just generate one from the other.
We should look at texinfo.el as it does need some cleaning up and simplification.
Regards
Christopher
> Stefan
>
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
end of thread, other threads:[~2021-05-14 5:25 UTC | newest]
Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-10 14:21 outline-heading-alist for elisp using ";; * " Christopher Dimech
2021-05-10 21:08 ` Philip Kaludercic
2021-05-11 1:55 ` Christopher Dimech
2021-05-11 3:00 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-11 5:05 ` Christopher Dimech
2021-05-11 12:06 ` Jean Louis
2021-05-11 12:40 ` Christopher Dimech
2021-05-11 14:17 ` Jean Louis
2021-05-11 12:56 ` Christopher Dimech
2021-05-11 14:20 ` Jean Louis
2021-05-11 15:32 ` Christopher Dimech
2021-05-11 18:09 ` Jean Louis
2021-05-12 1:46 ` Christopher Dimech
2021-05-12 4:00 ` Jean Louis
2021-05-13 3:33 ` Christopher Dimech
2021-05-13 7:22 ` Jean Louis
2021-05-13 7:41 ` Christopher Dimech
2021-05-13 10:03 ` Jean Louis
2021-05-13 10:22 ` Christopher Dimech
2021-05-13 10:33 ` Jean Louis
2021-05-13 11:37 ` Christopher Dimech
2021-05-11 13:15 ` Christopher Dimech
2021-05-11 14:22 ` Jean Louis
2021-05-11 15:22 ` Christopher Dimech
2021-05-12 1:53 ` Christopher Dimech
2021-05-12 12:31 ` Stefan Monnier
2021-05-12 12:43 ` Christopher Dimech
2021-05-12 14:35 ` Yuri Khan
2021-05-12 14:52 ` Christopher Dimech
2021-05-13 12:29 ` Setting up user defined texinfo headlines using outline-heading-alist Christopher Dimech
2021-05-13 13:26 ` Yuri Khan
2021-05-13 15:10 ` Christopher Dimech
2021-05-13 16:05 ` Yuri Khan
2021-05-13 18:29 ` Jean Louis
2021-05-13 18:48 ` Christopher Dimech
2021-05-13 19:01 ` Yuri Khan
2021-05-13 18:35 ` Christopher Dimech
2021-05-13 19:13 ` Yuri Khan
2021-05-14 3:49 ` Christopher Dimech
2021-05-14 3:56 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-14 5:25 ` Christopher Dimech
2021-05-13 15:34 ` Jean Louis
2021-05-11 2:52 ` outline-heading-alist for elisp using ";; * " Christopher Dimech
2021-05-11 4:50 ` Jean Louis
2021-05-11 5:17 ` Christopher Dimech
2021-05-11 20:54 ` Jeremie Juste
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).