[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 305dbc7 2/4: Move description of value to syntax-ppss functio
From: |
Alan Mackenzie |
Subject: |
Re: master 305dbc7 2/4: Move description of value to syntax-ppss function. |
Date: |
Wed, 30 Oct 2019 20:34:21 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Hello, Lars.
On Wed, Oct 30, 2019 at 16:29:44 +0100, Lars Ingebrigtsen wrote:
> Lars Ingebrigtsen <address@hidden> writes:
> > So perhaps that patch should be reverted anyway. Or have the list in
> > both functions. Or, even better, stop saying
> > (if (nth 5 state)
> > (do-something-incomprehensible)
> > (do-something-else-incomprehensible))
> > everywhere and just add accessor functions already, so that the code
> > becomes marginally more readable. Because trying to make sense of it
> > now is just too hard, and it doesn't have to be.
> If we want to do this, I volunteer to start doing the rewrite -- I have
> some functions for this from the decoded time makeover...
> So what would the accessor macros be? Err... looking at the doc
> string, something like:
> ppss-depth
> ppss-start-innermost
> ppss-start-last-complete-sexp
> ppss-string-terminator
> ppss-comment-nesting
> ppss-after-quote-character
> ppss-minimum-paren-depth
> ppss-comment-style
> ppss-start-comment-or-string
> ppss-open-paren-positions
> ppss-two-character-syntax
> ppss-internal
For a start, why the prefix "ppss-"? The values are the results of
calling parse-partial-sexp (however indirectly), so "pps-" would be more
accurate, as well as being a character shorter.
But I'm thoroughly against this change. It's bloat. On a good day,
(or (nth 3 s) (nth 4 s))
will easily fit onto a single line of code, often with room for a
comment such as "; in a string or comment.".
(or (pps-string-terminator s) (pps-comment-nesting s))
is much less likely to do so. So we end up with an extra line, whether
a continuation line added by redisplay, or a real extra line added by
the hacker. In either case this is undesirable.
I doubt these macros will be easier to read than the use of nth. They
are too long to be instantly recognised - the eye and the brain must
scan them piece by piece. (nth 3 s) can be a mental atom, requiring no
effort.
In practice, by far most of the accesses to the state returned by
parse-partial-sexp are elements 3, 4, and 8, so anybody using
parse-partial-sexp quickly learns what these mean. Others can be
explained by comments, if needed. Anybody who doesn't recognise elts 3,
4, and 8 is probably best advised to read the pertinent manual page
anyway.
These new macro names would be a burden to learn and use, and a burden
on the Emacs Lisp manual.
Please don't do this.
> --
> (domestic pets only, the antidote for overdose, milk.)
> bloggy blog: http://lars.ingebrigtsen.no
--
Alan Mackenzie (Nuremberg, Germany).
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function., (continued)
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function., Lars Ingebrigtsen, 2019/10/30
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function., Dmitry Gutov, 2019/10/30
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function., Lars Ingebrigtsen, 2019/10/30
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function., Dmitry Gutov, 2019/10/30
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function., Lars Ingebrigtsen, 2019/10/30
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function., Stefan Monnier, 2019/10/30
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function., Lars Ingebrigtsen, 2019/10/30
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function.,
Alan Mackenzie <=
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function., Dmitry Gutov, 2019/10/30
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function., Stefan Monnier, 2019/10/30
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function., Lars Ingebrigtsen, 2019/10/31
- Re: master 305dbc7 2/4: Move description of value to syntax-ppss function., Alan Mackenzie, 2019/10/30