* headings in sh-mode
2021-07-02 18:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-07-02 19:58 ` lisa-asket
2021-07-02 20:44 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-02 20:02 ` Yuri Khan
2021-07-02 20:43 ` Stefan Monnier via Users list for the GNU Emacs text editor
2 siblings, 1 reply; 18+ messages in thread
From: lisa-asket @ 2021-07-02 19:58 UTC (permalink / raw)
To: moasenwood, help-gnu-emacs
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: headings in sh-mode
Date: 02/07/2021 20:34:04 Europe/Paris
lisa-asket wrote:
> Then I did
>
> * Heading
>
> ** Heading
>
> *** Heading
>
> **** Heading
>
> The last headings took effect, but they srcew up the srcipt
> because they are not used as comments.
>Of course, you must obey the shell language rules (syntax in
>this case), if you'd like it to work.
It was by default, I did not set them up. Simply loaded a bash file,
called `M-x outline-minor-mode` and lines starting with `*` were
considered as headings. This screws up shell scripts. This problem
should be fixed so headings must start with `#` first.
>But honestly... you don't need a header hierarchy like this
>for a shell script, they should be simple and short (well, as
>short as possible, and long scripts aren't advanced, really,
>they are just long).
The header hierarchy functionality is available, so I do not see
how one can disregard a such a problem, advising people not to
use it.
I went to the doctor because my thumb hurts. He told me not to use it !
>If you really want something like that, can't `org-mode' do
>little buttons under each of the ranked headings, and the
>script will pop up and maybe execute, even?
>I'm not an org-mode user myself, what you describe I recognize
>from HTML and LaTeX but those are about organizing
>_information_, not bunching together shell tools executing on
>top of each other, and to the side...
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: headings in sh-mode
2021-07-02 18:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-02 19:58 ` lisa-asket
@ 2021-07-02 20:02 ` Yuri Khan
2021-07-02 20:32 ` lisa-asket
2021-07-02 23:11 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-02 20:43 ` Stefan Monnier via Users list for the GNU Emacs text editor
2 siblings, 2 replies; 18+ messages in thread
From: Yuri Khan @ 2021-07-02 20:02 UTC (permalink / raw)
To: Emanuel Berg, help-gnu-emacs
On Sat, 3 Jul 2021 at 01:34, Emanuel Berg via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> But honestly... you don't need a header hierarchy like this
> for a shell script, they should be simple and short (well, as
> short as possible, and long scripts aren't advanced, really,
> they are just long).
This. If your shell script is so long and/or nested that you want
folding, then you’re much better served by rewriting in a proper
programming language. My personal rule of thumb is, rewrite if you
want to do any arithmetics, or arrays, or the script no longer fits in
a single screenful.
A similar point goes for other programming languages: If you want to
fold parts of a function, the part you want to fold is a candidate for
extraction. If you want to hide some functions while looking at
others, maybe split your module.
A working folding facility can be a painkiller when working with
existing code. But don’t become addicted to painkillers.
^ permalink raw reply [flat|nested] 18+ messages in thread
* headings in sh-mode
2021-07-02 20:02 ` Yuri Khan
@ 2021-07-02 20:32 ` lisa-asket
2021-07-02 23:11 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 18+ messages in thread
From: lisa-asket @ 2021-07-02 20:32 UTC (permalink / raw)
To: Yuri Khan, Emanuel Berg, help-gnu-emacs
>From: Yuri Khan <yuri.v.khan@gmail.com>
>To: Emanuel Berg <moasenwood@zoho.eu>;
> help-gnu-emacs <help-gnu-emacs@gnu.org>
>Subject: Re: headings in sh-mode
>Date: 02/07/2021 22:02:57 Europe/Paris
>On Sat, 3 Jul 2021 at 01:34, Emanuel Berg via Users list for the GNU
>Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>> But honestly... you don't need a header hierarchy like this
>> for a shell script, they should be simple and short (well, as
>> short as possible, and long scripts aren't advanced, really,
>> they are just long).
>This. If your shell script is so long and/or nested that you want
>folding, then you’re much better served by rewriting in a proper
>programming language. My personal rule of thumb is, rewrite if you
>want to do any arithmetics, or arrays, or the script no longer fits in
>a single screenful.
I am not arguing on the merits or otherwise of header folding.
Only pointing out that headings using outline-minor-mode should be
made to work correctly as expected by the minor mode, irrespective
of whether a user ultimately uses the functionality or not.
Such rational does make sense actually.
>A similar point goes for other programming languages: If you want to
>fold parts of a function, the part you want to fold is a candidate for
>extraction. If you want to hide some functions while looking at
>others, maybe split your module.
>A working folding facility can be a painkiller when working with
>existing code. But don’t become addicted to painkillers.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: headings in sh-mode
2021-07-02 20:02 ` Yuri Khan
2021-07-02 20:32 ` lisa-asket
@ 2021-07-02 23:11 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 18+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-07-02 23:11 UTC (permalink / raw)
To: help-gnu-emacs
Yuri Khan wrote:
>> But honestly... you don't need a header hierarchy like this
>> for a shell script, they should be simple and short (well,
>> as short as possible, and long scripts aren't advanced,
>> really, they are just long).
>
> This. If your shell script is so long and/or nested that you
> want folding, then you’re much better served by rewriting in
> a proper programming language. My personal rule of thumb is,
> rewrite if you want to do any arithmetics, or arrays, or the
> script no longer fits in a single screenful.
>
> A similar point goes for other programming languages: If you
> want to fold parts of a function, the part you want to fold
> is a candidate for extraction. If you want to hide some
> functions while looking at others, maybe split your module.
>
> A working folding facility can be a painkiller when working
> with existing code. But don’t become addicted
> to painkillers.
In so many words, agreed.
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: headings in sh-mode
2021-07-02 18:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-02 19:58 ` lisa-asket
2021-07-02 20:02 ` Yuri Khan
@ 2021-07-02 20:43 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-02 20:53 ` lisa-asket
2021-07-02 23:13 ` Emanuel Berg via Users list for the GNU Emacs text editor
2 siblings, 2 replies; 18+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-07-02 20:43 UTC (permalink / raw)
To: help-gnu-emacs
> But honestly... you don't need a header hierarchy like this
> for a shell script, they should be simple and short (well, as
> short as possible, and long scripts aren't advanced, really,
> they are just long).
While I tend to agree, I plead guilty to not following this advice:
https://gitlab.com/monnier/bugit/-/raw/main/bugit
Stefan
^ permalink raw reply [flat|nested] 18+ messages in thread
* headings in sh-mode
2021-07-02 20:43 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-07-02 20:53 ` lisa-asket
2021-07-02 23:14 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-08 20:56 ` Nick Dokos
2021-07-02 23:13 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 2 replies; 18+ messages in thread
From: lisa-asket @ 2021-07-02 20:53 UTC (permalink / raw)
To: monnier, help-gnu-emacs
>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: headings in sh-mode
>Date: 02/07/2021 22:43:01 Europe/Paris
>> But honestly... you don't need a header hierarchy like this
>> for a shell script, they should be simple and short (well, as
>> short as possible, and long scripts aren't advanced, really,
>> they are just long).
>While I tend to agree, I plead guilty to not following this advice:
>https://gitlab.com/monnier/bugit/-/raw/main/bugit
Could the difficulties using outline-minor-mode be fixed nevertheless?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: headings in sh-mode
2021-07-02 20:43 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-02 20:53 ` lisa-asket
@ 2021-07-02 23:13 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 18+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-07-02 23:13 UTC (permalink / raw)
To: help-gnu-emacs
Stefan Monnier via Users list for the GNU Emacs text editor wrote:
>> But honestly... you don't need a header hierarchy like this
>> for a shell script, they should be simple and short (well,
>> as short as possible, and long scripts aren't advanced,
>> really, they are just long).
>
> While I tend to agree, I plead guilty to not following this
> advice:
>
> https://gitlab.com/monnier/bugit/-/raw/main/bugit
2640 lines :)
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 18+ messages in thread