unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Cycling first N heading levels in outline
@ 2021-05-22 16:16 Christopher Dimech
  2021-05-23  4:48 ` Ihor Radchenko
  0 siblings, 1 reply; 26+ messages in thread
From: Christopher Dimech @ 2021-05-22 16:16 UTC (permalink / raw)
  To: emacs-devel

It would be helpful to have outline show the first N heading levels using
a keybinding that changes N after every hit (from N to N+1), then reversing
when it reaches the last heading (from N to N-1).




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-22 16:16 Cycling first N heading levels in outline Christopher Dimech
@ 2021-05-23  4:48 ` Ihor Radchenko
  2021-05-23  8:58   ` Christopher Dimech
  0 siblings, 1 reply; 26+ messages in thread
From: Ihor Radchenko @ 2021-05-23  4:48 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: emacs-devel

> It would be helpful to have outline show the first N heading levels using
> a keybinding that changes N after every hit (from N to N+1), then reversing
> when it reaches the last heading (from N to N-1).

Could you provide an example use-case? It does not sound very useful for
me.

Best,
Ihor



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Cycling first N heading levels in outline
  2021-05-23  4:48 ` Ihor Radchenko
@ 2021-05-23  8:58   ` Christopher Dimech
  2021-05-23  9:46     ` Ihor Radchenko
  2021-05-23 14:12     ` Jean Louis
  0 siblings, 2 replies; 26+ messages in thread
From: Christopher Dimech @ 2021-05-23  8:58 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1049 bytes --]

It is useful for mathematical and scientific classification work.

I attach a texinfo file, where @usec, @usubsec, @usubsubsec are defined as headings.

You can use "Show Branches", "Show Children", and "Show Subtree".  But they all force
the user to move point to a specific heading, i.e. there are no operations which are global
across the buffer.

And it becomes more problematic for "Phylogenetic Trees" and "Geological Trees", particularly
when lists are long.

Regards
Christopher


> Sent: Sunday, May 23, 2021 at 4:48 PM
> From: "Ihor Radchenko" <yantar92@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: emacs-devel@gnu.org
> Subject: Re: Cycling first N heading levels in outline
>
> > It would be helpful to have outline show the first N heading levels using
> > a keybinding that changes N after every hit (from N to N+1), then reversing
> > when it reaches the last heading (from N to N-1).
>
> Could you provide an example use-case? It does not sound very useful for
> me.
>
> Best,
> Ihor
>

[-- Attachment #2: mtk-classif.texi --]
[-- Type: application/x-texinfo, Size: 446247 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-23  8:58   ` Christopher Dimech
@ 2021-05-23  9:46     ` Ihor Radchenko
  2021-05-23  9:53       ` Christopher Dimech
  2021-05-23 14:12     ` Jean Louis
  1 sibling, 1 reply; 26+ messages in thread
From: Ihor Radchenko @ 2021-05-23  9:46 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: emacs-devel

Christopher Dimech <dimech@gmx.com> writes:

> It is useful for mathematical and scientific classification work.
>
> I attach a texinfo file, where @usec, @usubsec, @usubsubsec are defined as headings.
>
> You can use "Show Branches", "Show Children", and "Show Subtree".  But they all force
> the user to move point to a specific heading, i.e. there are no operations which are global
> across the buffer.

Hmm. Have you tried org-shifttab (bound to S-<TAB>)? It operates
globally across the buffer.

Also, there is outline-hide-sublevels. When called with prefix argument,
it will display sublevels from level 1 up until the level equal to the
prefix argument.

Best,
Ihor



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Cycling first N heading levels in outline
  2021-05-23  9:46     ` Ihor Radchenko
@ 2021-05-23  9:53       ` Christopher Dimech
  2021-05-23 10:21         ` Ihor Radchenko
  2021-05-23 10:23         ` Ihor Radchenko
  0 siblings, 2 replies; 26+ messages in thread
From: Christopher Dimech @ 2021-05-23  9:53 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-devel



---------------------
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: Sunday, May 23, 2021 at 9:46 PM
> From: "Ihor Radchenko" <yantar92@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: emacs-devel@gnu.org
> Subject: Re: Cycling first N heading levels in outline
>
> Christopher Dimech <dimech@gmx.com> writes:
>
> > It is useful for mathematical and scientific classification work.
> >
> > I attach a texinfo file, where @usec, @usubsec, @usubsubsec are defined as headings.
> >
> > You can use "Show Branches", "Show Children", and "Show Subtree".  But they all force
> > the user to move point to a specific heading, i.e. there are no operations which are global
> > across the buffer.
>
> Hmm. Have you tried org-shifttab (bound to S-<TAB>)? It operates
> globally across the buffer.

I rather keep things to outline-minor-mode than apply org functionality.  Originally,
Was using org-mode as the major buffer but that removed programming highlighting.

Outline should take care of such things itself rather than workarounds with org
functionality.

> Also, there is outline-hide-sublevels. When called with prefix argument,
> it will display sublevels from level 1 up until the level equal to the
> prefix argument.

But LEVELS defaults to the level of the *current heading* or to 1 if the
*current line is not a heading*.  This means I got to go to a heading.

The problem occurs for long files, because I am forces to navigate the file.
If the heading level is deep, it is difficult to search through.


> Best,
> Ihor
>
>



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-23  9:53       ` Christopher Dimech
@ 2021-05-23 10:21         ` Ihor Radchenko
  2021-05-23 10:23         ` Ihor Radchenko
  1 sibling, 0 replies; 26+ messages in thread
From: Ihor Radchenko @ 2021-05-23 10:21 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: emacs-devel

Christopher Dimech <dimech@gmx.com> writes:

>> Hmm. Have you tried org-shifttab (bound to S-<TAB>)? It operates
>> globally across the buffer.
>
> I rather keep things to outline-minor-mode than apply org functionality.  Originally,
> Was using org-mode as the major buffer but that removed programming highlighting.
> Outline should take care of such things itself rather than workarounds with org
> functionality.

Sorry, I actually mixed this message with org mailing list because of
the contents. I initially though that you referred to org.

As for highlighting issue, please report is as a bug if you think that
Org does something wrongly.

>> Also, there is outline-hide-sublevels. When called with prefix argument,
>> it will display sublevels from level 1 up until the level equal to the
>> prefix argument.
>
> But LEVELS defaults to the level of the *current heading* or to 1 if the
> *current line is not a heading*.  This means I got to go to a heading.
>
> The problem occurs for long files, because I am forces to navigate the file.
> If the heading level is deep, it is difficult to search through.

Yet, with *numeric* prefix argument it will forcefully show all the
levels between 1 and number passed as prefix argument.

Best,
Ihor



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-23  9:53       ` Christopher Dimech
  2021-05-23 10:21         ` Ihor Radchenko
@ 2021-05-23 10:23         ` Ihor Radchenko
  2021-05-23 13:10           ` Christopher Dimech
  1 sibling, 1 reply; 26+ messages in thread
From: Ihor Radchenko @ 2021-05-23 10:23 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: emacs-devel

Christopher Dimech <dimech@gmx.com> writes:
>> Hmm. Have you tried org-shifttab (bound to S-<TAB>)? It operates
>> globally across the buffer.
>
> I rather keep things to outline-minor-mode than apply org functionality.  Originally,
> Was using org-mode as the major buffer but that removed programming highlighting.
>
> Outline should take care of such things itself rather than workarounds with org
> functionality.

Also, I just checked with outline-mode on Emacs master. S-<TAB> is bound
to outline-cycle-buffer, which is the equivalent of org-shifttab, but
native in outline-mode.

Best,
Ihor



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Cycling first N heading levels in outline
  2021-05-23 10:23         ` Ihor Radchenko
@ 2021-05-23 13:10           ` Christopher Dimech
  2021-05-23 14:14             ` Ihor Radchenko
  2021-05-23 14:14             ` Jean Louis
  0 siblings, 2 replies; 26+ messages in thread
From: Christopher Dimech @ 2021-05-23 13:10 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-devel


How can I use the outline.el code from master without installing the master
version, to try outline-cycle-buffer?

> Sent: Sunday, May 23, 2021 at 10:23 PM
> From: "Ihor Radchenko" <yantar92@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: emacs-devel@gnu.org
> Subject: Re: Cycling first N heading levels in outline
>
> Christopher Dimech <dimech@gmx.com> writes:
> >> Hmm. Have you tried org-shifttab (bound to S-<TAB>)? It operates
> >> globally across the buffer.
> >
> > I rather keep things to outline-minor-mode than apply org functionality.  Originally,
> > Was using org-mode as the major buffer but that removed programming highlighting.
> >
> > Outline should take care of such things itself rather than workarounds with org
> > functionality.
>
> Also, I just checked with outline-mode on Emacs master. S-<TAB> is bound
> to outline-cycle-buffer, which is the equivalent of org-shifttab, but
> native in outline-mode.
>
> Best,
> Ihor
>



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-23  8:58   ` Christopher Dimech
  2021-05-23  9:46     ` Ihor Radchenko
@ 2021-05-23 14:12     ` Jean Louis
  2021-05-23 14:35       ` Ihor Radchenko
  1 sibling, 1 reply; 26+ messages in thread
From: Jean Louis @ 2021-05-23 14:12 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Ihor Radchenko, emacs-devel

* Christopher Dimech <dimech@gmx.com> [2021-05-23 11:59]:
> It is useful for mathematical and scientific classification work.
> 
> I attach a texinfo file, where @usec, @usubsec, @usubsubsec are defined as headings.
> 
> You can use "Show Branches", "Show Children", and "Show Subtree".  But they all force
> the user to move point to a specific heading, i.e. there are no operations which are global
> across the buffer.
> 
> And it becomes more problematic for "Phylogenetic Trees" and "Geological Trees", particularly
> when lists are long.

I just don't know how is it Org related... ☻ 

Org is not same as outline-minor-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/



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-23 13:10           ` Christopher Dimech
@ 2021-05-23 14:14             ` Ihor Radchenko
  2021-05-23 14:14             ` Jean Louis
  1 sibling, 0 replies; 26+ messages in thread
From: Ihor Radchenko @ 2021-05-23 14:14 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: emacs-devel

Christopher Dimech <dimech@gmx.com> writes:

> How can I use the outline.el code from master without installing the master
> version, to try outline-cycle-buffer?

Download the master version of outline.el from [1], add its location in
front of your load-path, and (require 'outline) early in your config.

[1]  http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/outline.el



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-23 13:10           ` Christopher Dimech
  2021-05-23 14:14             ` Ihor Radchenko
@ 2021-05-23 14:14             ` Jean Louis
  2021-05-23 14:34               ` Christopher Dimech
  1 sibling, 1 reply; 26+ messages in thread
From: Jean Louis @ 2021-05-23 14:14 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Ihor Radchenko, emacs-devel

* Christopher Dimech <dimech@gmx.com> [2021-05-23 16:11]:
> 
> How can I use the outline.el code from master without installing the master
> version, to try outline-cycle-buffer?

Just M-x load-file 


-- 
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/



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Cycling first N heading levels in outline
  2021-05-23 14:14             ` Jean Louis
@ 2021-05-23 14:34               ` Christopher Dimech
  2021-05-23 14:37                 ` Jean Louis
  0 siblings, 1 reply; 26+ messages in thread
From: Christopher Dimech @ 2021-05-23 14:34 UTC (permalink / raw)
  To: Jean Louis; +Cc: Ihor Radchenko, emacs-devel


> Sent: Monday, May 24, 2021 at 2:14 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Ihor Radchenko" <yantar92@gmail.com>, emacs-devel@gnu.org
> Subject: Re: Cycling first N heading levels in outline
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-23 16:11]:
> >
> > How can I use the outline.el code from master without installing the master
> > version, to try outline-cycle-buffer?
>
> Just M-x load-file

What would happen with outline.el installed with emacs when I call a command?

> --
> 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/
>



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-23 14:12     ` Jean Louis
@ 2021-05-23 14:35       ` Ihor Radchenko
  2021-05-23 17:57         ` Jean Louis
  0 siblings, 1 reply; 26+ messages in thread
From: Ihor Radchenko @ 2021-05-23 14:35 UTC (permalink / raw)
  To: Jean Louis; +Cc: Christopher Dimech, emacs-devel

Jean Louis <bugs@gnu.support> writes:
> I just don't know how is it Org related... ☻ 

When you have a hammer... (and I rarely use outline-minor-mode).



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-23 14:34               ` Christopher Dimech
@ 2021-05-23 14:37                 ` Jean Louis
  0 siblings, 0 replies; 26+ messages in thread
From: Jean Louis @ 2021-05-23 14:37 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Ihor Radchenko, emacs-devel

* Christopher Dimech <dimech@gmx.com> [2021-05-23 17:34]:
> > Just M-x load-file
> 
> What would happen with outline.el installed with emacs when I call a
> command?

Functions are overwritten in memory with new functions. If there are
many changes things can happen.

Best way to find out is to try to load the file.

Save your data before doing it, for safety. 😇	

-- 
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/



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-23 14:35       ` Ihor Radchenko
@ 2021-05-23 17:57         ` Jean Louis
  2021-05-23 18:55           ` Christopher Dimech
  2021-05-26 13:57           ` Ihor Radchenko
  0 siblings, 2 replies; 26+ messages in thread
From: Jean Louis @ 2021-05-23 17:57 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Christopher Dimech, emacs-devel

* Ihor Radchenko <yantar92@gmail.com> [2021-05-23 17:31]:
> Jean Louis <bugs@gnu.support> writes:
> > I just don't know how is it Org related... ☻ 
> 
> When you have a hammer... (and I rarely use outline-minor-mode).

Especially for Org users the outline-minor-mode is universal and gives
similar concepts of outline in various other modes:

- editing Asciidoctor files? Fold levels and sublevels

- editing Emacs Lisp? Fold levels, sections, functions and open it. It
  gives visual index of functions, it becomes very easy to move them
  from place to place;

- editing any kind of files in any mode? Define your headings yourself
  and cycle, fold, unfold.


-- 
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/



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Cycling first N heading levels in outline
  2021-05-23 17:57         ` Jean Louis
@ 2021-05-23 18:55           ` Christopher Dimech
  2021-05-23 19:06             ` Tassilo Horn
  2021-05-23 19:55             ` Stefan Monnier
  2021-05-26 13:57           ` Ihor Radchenko
  1 sibling, 2 replies; 26+ messages in thread
From: Christopher Dimech @ 2021-05-23 18:55 UTC (permalink / raw)
  To: Jean Louis; +Cc: Ihor Radchenko, emacs-devel


Hi Jean, do you know how to have subheadings for elisp using outline-minor-mode?

> Sent: Monday, May 24, 2021 at 5:57 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Ihor Radchenko" <yantar92@gmail.com>
> Cc: "Christopher Dimech" <dimech@gmx.com>, emacs-devel@gnu.org
> Subject: Re: Cycling first N heading levels in outline
>
> * Ihor Radchenko <yantar92@gmail.com> [2021-05-23 17:31]:
> > Jean Louis <bugs@gnu.support> writes:
> > > I just don't know how is it Org related... ☻ 
> > 
> > When you have a hammer... (and I rarely use outline-minor-mode).
> 
> Especially for Org users the outline-minor-mode is universal and gives
> similar concepts of outline in various other modes:
> 
> - editing Asciidoctor files? Fold levels and sublevels
> 
> - editing Emacs Lisp? Fold levels, sections, functions and open it. It
>   gives visual index of functions, it becomes very easy to move them
>   from place to place;
> 
> - editing any kind of files in any mode? Define your headings yourself
>   and cycle, fold, unfold.
> 
> 
> -- 
> 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/
>



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-23 18:55           ` Christopher Dimech
@ 2021-05-23 19:06             ` Tassilo Horn
  2021-05-23 19:55             ` Stefan Monnier
  1 sibling, 0 replies; 26+ messages in thread
From: Tassilo Horn @ 2021-05-23 19:06 UTC (permalink / raw)
  To: emacs-devel

Christopher Dimech <dimech@gmx.com> writes:

> Hi Jean, do you know how to have subheadings for elisp using outline-minor-mode?

FWIW, I use these outline settings which gives me 8 levels of outlines
in any programming mode where the outline headings start with the
comment started of the mode followed by one or more asterisks.

--8<---------------cut here---------------start------------->8---
(defun th/outline-minor-mode-prefix-init ()
  "Set `outline-minor-mode-prefix' for the current mode."
  (let ((comment-starter (if comment-start
                             (replace-regexp-in-string
                              "[[:space:]]+" "" comment-start)
                           "")))
    (setq comment-starter (replace-regexp-in-string "*" "[*]" comment-starter))
    ;; Just because ;;* looks better than ;* and won't be indented.
    (when (string= comment-starter ";")
      (setq comment-starter ";;"))
    (when (eq major-mode 'bibtex-mode)
      (setq comment-starter (if (eq bibtex-dialect 'biblatex)
                                "%"
                              "")))
    (setq-local outline-minor-mode-prefix
                (concat "^\\(?:" (regexp-quote comment-starter) "\\)"))))

(defun th/outline-minor-mode-init ()
  (th/outline-minor-mode-prefix-init)
  (setq-local outline-regexp (concat outline-minor-mode-prefix "[*]+"))

  (font-lock-add-keywords
   nil
   `((,(concat outline-minor-mode-prefix "[*] .*$")                      0 'org-level-1 t)
     (,(concat outline-minor-mode-prefix "[*][*] .*$")                   0 'org-level-2 t)
     (,(concat outline-minor-mode-prefix "[*][*][*] .*$")                0 'org-level-3 t)
     (,(concat outline-minor-mode-prefix "[*][*][*][*] .*$")             0 'org-level-4 t)
     (,(concat outline-minor-mode-prefix "[*][*][*][*][*] .*$")          0 'org-level-5 t)
     (,(concat outline-minor-mode-prefix "[*][*][*][*][*][*] .*$")       0 'org-level-6 t)
     (,(concat outline-minor-mode-prefix "[*][*][*][*][*][*][*] .*$")    0 'org-level-7 t)
     (,(concat outline-minor-mode-prefix "[*][*][*][*][*][*][*][*] .*$") 0 'org-level-8 t))))

(add-hook 'outline-minor-mode-hook #'th/outline-minor-mode-init)

(defvar th/outline-minor-mode-modes
  '(c-mode c++-mode java-mode emacs-lisp-mode lisp-mode ruby-mode haskell-mode
           lua-mode clojure-mode python-mode sh-mode bibtex-mode restclient-mode
           TeX-mode LaTeX-mode))

(dolist (mode th/outline-minor-mode-modes)
  (add-hook (intern (concat (symbol-name mode) "-hook")) #'outline-minor-mode))
--8<---------------cut here---------------end--------------->8---

So in elisp I write:

;;* Top Level Heading
;;** 2nd Level Heading
;;*** 3rd Level Heading

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-23 18:55           ` Christopher Dimech
  2021-05-23 19:06             ` Tassilo Horn
@ 2021-05-23 19:55             ` Stefan Monnier
  2021-05-24 10:34               ` Christopher Dimech
  2021-05-24 10:39               ` Christopher Dimech
  1 sibling, 2 replies; 26+ messages in thread
From: Stefan Monnier @ 2021-05-23 19:55 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Jean Louis, Ihor Radchenko, emacs-devel

> Hi Jean, do you know how to have subheadings for elisp using outline-minor-mode?

The convention used in ELisp is:

   ;;; Section
   ;;;; Subsection
   ;;;;; Subsubsection
   ;;;;;; Subsubsubsection
   ;;;;;;; Subsubsubsubsection
   [...]


-- Stefan




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Cycling first N heading levels in outline
  2021-05-23 19:55             ` Stefan Monnier
@ 2021-05-24 10:34               ` Christopher Dimech
  2021-05-24 10:57                 ` Kévin Le Gouguec
  2021-05-24 10:39               ` Christopher Dimech
  1 sibling, 1 reply; 26+ messages in thread
From: Christopher Dimech @ 2021-05-24 10:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Ihor Radchenko, Jean Louis, emacs-devel

> Sent: Monday, May 24, 2021 at 7:55 AM
> From: "Stefan Monnier" <monnier@iro.umontreal.ca>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Jean Louis" <bugs@gnu.support>, "Ihor Radchenko" <yantar92@gmail.com>, emacs-devel@gnu.org
> Subject: Re: Cycling first N heading levels in outline
>
> > Hi Jean, do you know how to have subheadings for elisp using outline-minor-mode?
>
> The convention used in ELisp is:
>
>    ;;; Section
>    ;;;; Subsection
>    ;;;;; Subsubsection
>    ;;;;;; Subsubsubsection
>    ;;;;;;; Subsubsubsubsection
>    [...]

The headings still look like comments, whereas they are supposed to get highlighted
according to the heading level.

Could we get that to work in said way?

Regards
Christopher

> -- Stefan
>
>



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Cycling first N heading levels in outline
  2021-05-23 19:55             ` Stefan Monnier
  2021-05-24 10:34               ` Christopher Dimech
@ 2021-05-24 10:39               ` Christopher Dimech
  2021-05-24 16:27                 ` Stefan Monnier
  1 sibling, 1 reply; 26+ messages in thread
From: Christopher Dimech @ 2021-05-24 10:39 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Ihor Radchenko, Jean Louis, emacs-devel


I have looked at how functions are folded.  But if you call elisp code (which
always involves using parentheses) they also get to be interpreted as headings.

Can this be fixed please, so that only elisp structure constructs are interpreted
as headlines [e.g. "(defun" "(defvar"].

Regards
Christopher

> Sent: Monday, May 24, 2021 at 7:55 AM
> From: "Stefan Monnier" <monnier@iro.umontreal.ca>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Jean Louis" <bugs@gnu.support>, "Ihor Radchenko" <yantar92@gmail.com>, emacs-devel@gnu.org
> Subject: Re: Cycling first N heading levels in outline
>
> > Hi Jean, do you know how to have subheadings for elisp using outline-minor-mode?
>
> The convention used in ELisp is:
>
>    ;;; Section
>    ;;;; Subsection
>    ;;;;; Subsubsection
>    ;;;;;; Subsubsubsection
>    ;;;;;;; Subsubsubsubsection
>    [...]
>
>
> -- Stefan
>
>



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-24 10:34               ` Christopher Dimech
@ 2021-05-24 10:57                 ` Kévin Le Gouguec
  2021-05-24 11:23                   ` Christopher Dimech
  2021-05-25 17:41                   ` Christopher Dimech
  0 siblings, 2 replies; 26+ messages in thread
From: Kévin Le Gouguec @ 2021-05-24 10:57 UTC (permalink / raw)
  To: Christopher Dimech
  Cc: emacs-devel, Stefan Monnier, Jean Louis, Ihor Radchenko

Christopher Dimech <dimech@gmx.com> writes:

>> The convention used in ELisp is:
>>
>>    ;;; Section
>>    ;;;; Subsection
>>    ;;;;; Subsubsection
>>    ;;;;;; Subsubsubsection
>>    ;;;;;;; Subsubsubsubsection
>>    [...]
>
> The headings still look like comments, whereas they are supposed to get highlighted
> according to the heading level.
>
> Could we get that to work in said way?

On Emacs master, the outline-minor-mode-highlight option allows you to
customize how headings are fontified:

> When t, it puts outline faces only if there are no major mode’s faces
> on headings.  When ‘override’, it completely overwrites major mode’s
> faces with outline faces.  When ‘append’, it tries to append outline
> faces to major mode’s faces.



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Cycling first N heading levels in outline
  2021-05-24 10:57                 ` Kévin Le Gouguec
@ 2021-05-24 11:23                   ` Christopher Dimech
  2021-05-25 17:41                   ` Christopher Dimech
  1 sibling, 0 replies; 26+ messages in thread
From: Christopher Dimech @ 2021-05-24 11:23 UTC (permalink / raw)
  To: Kévin Le Gouguec
  Cc: emacs-devel, Stefan Monnier, Jean Louis, Ihor Radchenko

I am using GNU Emacs 27.1 and that functionality is not present.  Have tried to install
the development version and am getting

checking for libXaw... configure: error: No X toolkit could be found.

> Sent: Monday, May 24, 2021 at 10:57 PM
> From: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Stefan Monnier" <monnier@iro.umontreal.ca>, "Ihor Radchenko" <yantar92@gmail.com>, "Jean Louis" <bugs@gnu.support>, emacs-devel@gnu.org
> Subject: Re: Cycling first N heading levels in outline
>
> Christopher Dimech <dimech@gmx.com> writes:
> 
> >> The convention used in ELisp is:
> >>
> >>    ;;; Section
> >>    ;;;; Subsection
> >>    ;;;;; Subsubsection
> >>    ;;;;;; Subsubsubsection
> >>    ;;;;;;; Subsubsubsubsection
> >>    [...]
> >
> > The headings still look like comments, whereas they are supposed to get highlighted
> > according to the heading level.
> >
> > Could we get that to work in said way?
> 
> On Emacs master, the outline-minor-mode-highlight option allows you to
> customize how headings are fontified:
> 
> > When t, it puts outline faces only if there are no major mode’s faces
> > on headings.  When ‘override’, it completely overwrites major mode’s
> > faces with outline faces.  When ‘append’, it tries to append outline
> > faces to major mode’s faces.
>



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-24 10:39               ` Christopher Dimech
@ 2021-05-24 16:27                 ` Stefan Monnier
  2021-05-24 17:43                   ` Christopher Dimech
  0 siblings, 1 reply; 26+ messages in thread
From: Stefan Monnier @ 2021-05-24 16:27 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Jean Louis, Ihor Radchenko, emacs-devel

> I have looked at how functions are folded.  But if you call elisp code (which
> always involves using parentheses) they also get to be interpreted as headings.
> Can this be fixed please, so that only elisp structure constructs are interpreted
> as headlines [e.g. "(defun" "(defvar"].

This is not a bug but a feature.  If you want to group several ELisp
code entries together, you can wrap them in a `progn` (or something
else like Setup's `setup` macro, or `use-package`, ...).

In ELisp packages (as opposed to user config files), there pretty much
shouldn't be any function calls at top-level, since loading such a file
should have virtually no user-visible effect.


        Stefan




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Cycling first N heading levels in outline
  2021-05-24 16:27                 ` Stefan Monnier
@ 2021-05-24 17:43                   ` Christopher Dimech
  0 siblings, 0 replies; 26+ messages in thread
From: Christopher Dimech @ 2021-05-24 17:43 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Ihor Radchenko, Jean Louis, emacs-devel


> Sent: Tuesday, May 25, 2021 at 4:27 AM
> From: "Stefan Monnier" <monnier@iro.umontreal.ca>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Jean Louis" <bugs@gnu.support>, "Ihor Radchenko" <yantar92@gmail.com>, emacs-devel@gnu.org
> Subject: Re: Cycling first N heading levels in outline
>
> > I have looked at how functions are folded.  But if you call elisp code (which
> > always involves using parentheses) they also get to be interpreted as headings.
> > Can this be fixed please, so that only elisp structure constructs are interpreted
> > as headlines [e.g. "(defun" "(defvar"].
>
> This is not a bug but a feature.  If you want to group several ELisp
> code entries together, you can wrap them in a `progn` (or something
> else like Setup's `setup` macro, or `use-package`, ...).
>
> In ELisp packages (as opposed to user config files), there pretty much
> shouldn't be any function calls at top-level, since loading such a file
> should have virtually no user-visible effect.

It is more of an assumption then.  User Config Files should then not be too
extensive, or otherwise organised into a number ofspecific functions.

What can one use to unfold and fold a specific function?



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Cycling first N heading levels in outline
  2021-05-24 10:57                 ` Kévin Le Gouguec
  2021-05-24 11:23                   ` Christopher Dimech
@ 2021-05-25 17:41                   ` Christopher Dimech
  1 sibling, 0 replies; 26+ messages in thread
From: Christopher Dimech @ 2021-05-25 17:41 UTC (permalink / raw)
  To: Kévin Le Gouguec
  Cc: emacs-devel, Stefan Monnier, Jean Louis, Ihor Radchenko

I need some help on how to use "outline-minor-mode-highlight" option to customize 
the colours for headings because they are showing up as normal comments.

I am in emacs-lisp-mode. 


> Sent: Monday, May 24, 2021 at 10:57 PM
> From: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Stefan Monnier" <monnier@iro.umontreal.ca>, "Ihor Radchenko" <yantar92@gmail.com>, "Jean Louis" <bugs@gnu.support>, emacs-devel@gnu.org
> Subject: Re: Cycling first N heading levels in outline
>
> Christopher Dimech <dimech@gmx.com> writes:
> 
> >> The convention used in ELisp is:
> >>
> >>    ;;; Section
> >>    ;;;; Subsection
> >>    ;;;;; Subsubsection
> >>    ;;;;;; Subsubsubsection
> >>    ;;;;;;; Subsubsubsubsection
> >>    [...]
> >
> > The headings still look like comments, whereas they are supposed to get highlighted
> > according to the heading level.
> >
> > Could we get that to work in said way?
> 
> On Emacs master, the outline-minor-mode-highlight option allows you to
> customize how headings are fontified:
> 
> > When t, it puts outline faces only if there are no major mode’s faces
> > on headings.  When ‘override’, it completely overwrites major mode’s
> > faces with outline faces.  When ‘append’, it tries to append outline
> > faces to major mode’s faces.
>



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Cycling first N heading levels in outline
  2021-05-23 17:57         ` Jean Louis
  2021-05-23 18:55           ` Christopher Dimech
@ 2021-05-26 13:57           ` Ihor Radchenko
  1 sibling, 0 replies; 26+ messages in thread
From: Ihor Radchenko @ 2021-05-26 13:57 UTC (permalink / raw)
  To: Jean Louis; +Cc: Christopher Dimech, emacs-devel

Jean Louis <bugs@gnu.support> writes:

> Especially for Org users the outline-minor-mode is universal and gives
> similar concepts of outline in various other modes:

Thanks for pointing this out. A long time ago, before I knew about
outline-minor-mode, I started using hideshow package with similar
functionality. Now, comparing the two, I can see how outline-minor-mode
can be sometimes better (not always though).

> - editing Emacs Lisp? Fold levels, sections, functions and open it. It
>   gives visual index of functions, it becomes very easy to move them
>   from place to place;

outline-minor-mode is definitely very nice when handling Elisp file
sections. Yet, it unfortunately cannot fold sexps inside functions
independently, unlike hideshow (correct me if I am wrong). I ended up
using both outline-minor-mode and hs-minor-mode for the time being. The
former for folding top-level defuns and comments and the latter for
folding sexps inside defuns.

Best,
Ihor



^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2021-05-26 13:57 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-22 16:16 Cycling first N heading levels in outline Christopher Dimech
2021-05-23  4:48 ` Ihor Radchenko
2021-05-23  8:58   ` Christopher Dimech
2021-05-23  9:46     ` Ihor Radchenko
2021-05-23  9:53       ` Christopher Dimech
2021-05-23 10:21         ` Ihor Radchenko
2021-05-23 10:23         ` Ihor Radchenko
2021-05-23 13:10           ` Christopher Dimech
2021-05-23 14:14             ` Ihor Radchenko
2021-05-23 14:14             ` Jean Louis
2021-05-23 14:34               ` Christopher Dimech
2021-05-23 14:37                 ` Jean Louis
2021-05-23 14:12     ` Jean Louis
2021-05-23 14:35       ` Ihor Radchenko
2021-05-23 17:57         ` Jean Louis
2021-05-23 18:55           ` Christopher Dimech
2021-05-23 19:06             ` Tassilo Horn
2021-05-23 19:55             ` Stefan Monnier
2021-05-24 10:34               ` Christopher Dimech
2021-05-24 10:57                 ` Kévin Le Gouguec
2021-05-24 11:23                   ` Christopher Dimech
2021-05-25 17:41                   ` Christopher Dimech
2021-05-24 10:39               ` Christopher Dimech
2021-05-24 16:27                 ` Stefan Monnier
2021-05-24 17:43                   ` Christopher Dimech
2021-05-26 13:57           ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).