[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Format code snippets of the wolfram language to improve readability.
From: |
Hongyi Zhao |
Subject: |
Re: Format code snippets of the wolfram language to improve readability. |
Date: |
Wed, 27 Apr 2022 08:32:13 +0800 |
On Tue, Apr 26, 2022 at 10:31 PM Thibaut Verron
<thibaut.verron@gmail.com> wrote:
>
> On 26/04/2022 16:00, Hongyi Zhao wrote:
> > On Tue, Apr 26, 2022 at 9:17 PM Thibaut Verron <thibaut.verron@gmail.com>
> > wrote:
> >> Hi,
> >>
> >> Once the mode is activated, introducing newlines at key places should
> >> make the formula readable.
> > Yes. It works. But this method needs to hit many times on <RET> to
> > achieve the goal.
> >> You can also use sexp-navigation commands to
> >> quickly navigate the parentheses and find those key points.
> > I don't have this command, as shown in the attachment.
>
> It's not one command, but a set of commands for navigating paired
> expressions: for example forward-sexp C-M-f (jumping over a symbol or a
> paired expression), backward-sexp C-M-b, and down-list C-M-d (jumping
> inside the next paired expression). Those commands are designed for lisp
> languages, but they work remarkably well for most programming languages
> (and are even occasionally useful with natural languages).
>
> For example for your expression, you can get the formatted version I
> sent with: (indented to follow the depth in the expression)
>
> C-M-d
> C-M-d
> C-j
> C-M-f C-M-f C-f C-j
> C-M-d
> C-j
> C-M-d
> C-M-d
> C-M-f C-M-f C-f C-j
> C-M-f C-M-f C-f C-j
> C-M-f C-M-f C-f C-j
> C-M-f
> C-f
> C-f C-j
> C-M-f C-M-f
> C-f
> C-f C-j
>
> I know that it looks somewhat complicated and long, but it's easier done
> interactively than read. :)
It would be much more useful to generalize the working logic like the
one above and use a function implementation to handle the work here.
Regards,
HZ
- Format code snippets of the wolfram language to improve readability., Hongyi Zhao, 2022/04/26
- Re: Format code snippets of the wolfram language to improve readability., Robert Pluim, 2022/04/26
- Re: Format code snippets of the wolfram language to improve readability., Hongyi Zhao, 2022/04/26
- Re: Format code snippets of the wolfram language to improve readability., Hongyi Zhao, 2022/04/26
- Re: Format code snippets of the wolfram language to improve readability., Thibaut Verron, 2022/04/26
- Re: Format code snippets of the wolfram language to improve readability., Hongyi Zhao, 2022/04/26
- Re: Format code snippets of the wolfram language to improve readability., Thibaut Verron, 2022/04/26
- Re: Format code snippets of the wolfram language to improve readability.,
Hongyi Zhao <=
- Re: Format code snippets of the wolfram language to improve readability., Emanuel Berg, 2022/04/26
- Re: Format code snippets of the wolfram language to improve readability., Thibaut Verron, 2022/04/27
- Re: Format code snippets of the wolfram language to improve readability., Hongyi Zhao, 2022/04/27
- Re: Format code snippets of the wolfram language to improve readability., thibaut . verron, 2022/04/27