From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Stephen Leake <stephen_leake@stephe-leake.org>, emacs-devel@gnu.org
Subject: Re: scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".]
Date: Sun, 15 Jul 2018 18:45:38 +0000 [thread overview]
Message-ID: <20180715184538.GC4897@ACM> (raw)
In-Reply-To: <83bmb8a5x0.fsf@gnu.org>
Hello, Eli,
thanks for the review. The code is still preliminary, and is missing
quite a lot of comments, still.
I have had doubts about the mechanism (e.g. C-M-b will take a lot of
work to make it functional), see my reply to Stephen.
On Sun, Jul 15, 2018 at 18:13:15 +0300, Eli Zaretskii wrote:
> > From: Stephen Leake <stephen_leake@stephe-leake.org>
> > Date: Sun, 15 Jul 2018 04:00:23 -0500
> > Anything I can do to help merge this to main?
> A few things:
> . NEWS
> . Updates for the relevant parts in the manual(s)
> . Minor nits below:
> > +(defcustom font-lock-warn-open-string t
> > + "Fontify the opening quote of an unterminated string with warning face?
> > +This is done when this variable is non-nil.
> We use a slightly different style for such options (slightly rephrased
> to fit on one line):
Well done for the compression!
> "Non-nil means show opening quotes of unterminated strings with warning face."
> > +This works only when the syntax-table entry for newline contains the flag `s'
> > +\(see page \"xxx\" in the Elisp manual)."
> Please replace "xxx" with an actual value. Also, we don't refer to
> our manuals as "pages", that is a relic from the "man pages" era.
Yes, thanks. Just "see \"<page name>\"", without the "page"?
> > +#define DEC_AT \
> Please #undef DEC_AT when you are done using it (at function's end).
OK.
> > + /* Find the alleged string opener. */
> Please leave 2 spaces between the end of the comment and "*/" (here
> and elsewhere in the patch)
OK. As a matter of interest, what is the reason for this? I've seen
it all over the Emacs C code. Is it something to do with filling?
> > + while ((at > stop)
> > + && (code != Sstring)
> > + && (!SYNTAX_FLAGS_CLOSE_STRING (syntax)))
> > + {
> > + DEC_AT;
> > + }
> A single line doesn't need braces.
I'm intending to put more code in there.
> > + /* Search back for a terminating string delimiter: */
> > + while ((at > stop)
> > + && (code != Sstring)
> > + && (code != Sstring_fence)
> > + && (!SYNTAX_FLAGS_CLOSE_STRING (syntax)))
> > + {
> > + DEC_AT;
> > + /* Check for comment and "other" strings. */
> > + }
> Is the last comment at its correct place? It doesn't seem to refer to
> any code.
It's a FIXME: "Put in code here to check for comment and "other"
strings.".
> > + lose:
> > + UPDATE_SYNTAX_TABLE_FORWARD (*from);
> > + return false;
> > +
> > + lossage:
> > + /* We've encountered possible comments or strings with mixed
> > + delimiters. Bail out and scan forward from a safe position. */
> "lose" and "lossage" are too similar. Can we have a better name for
> the latter?
OK. I took the names from, I think, back_comment.
> > + {
> > + struct lisp_parse_state state;
> > + bool adjusted = true;
> Why did you need the braces here? C99 allows to mix declarations and
> statements, so we no longer need such braces.
OK.
> > + find_start_value
> > + = CONSP (state.levelstarts) ? XINT (XCAR (state.levelstarts))
> > + : state.thislevelstart >= 0 ? state.thislevelstart
> > + : find_start_value;
> Please use parentheses here for better readability (to clearly show
> which parts belong to which condition).
Yes, it didn't indent well by itself. Maybe I should raise this with
the CC Mode maintainer. But yes, I'll put parens in.
> > -Comments are ignored if `parse-sexp-ignore-comments' is non-nil.
> > +Comments are skipped over if `parse-sexp-ignore-comments' is non-nil.
> We nowadays prefer to quote 'like this' in comments and plain text.
OK.
> > -Comments are ignored if `parse-sexp-ignore-comments' is non-nil.
> > +Comments are skipped over if `parse-sexp-ignore-comments' is non-nil.
> Likewise.
> Thanks again for working on this.
I'll make the stylistic corrections, then get working on it again in
earnest.
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2018-07-15 18:45 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-22 7:42 [Emacs-diffs] master bb591f139f: Enhance CC Mode's fontification, etc., of unterminated strings Tino Calancha
2018-05-22 17:40 ` Alan Mackenzie
2018-05-22 19:21 ` João Távora
2018-05-22 19:34 ` Eli Zaretskii
2018-05-22 20:25 ` João Távora
2018-05-22 22:17 ` João Távora
2018-05-23 14:52 ` Eli Zaretskii
2018-05-23 20:46 ` Alan Mackenzie
2018-05-23 21:12 ` João Távora
2018-05-23 23:21 ` Michael Welsh Duggan
2018-05-31 12:37 ` CC Mode and electric-pair "problem". (Was: ... master bb591f139f: Enhance CC Mode's fontification, etc., of unterminated strings.) Alan Mackenzie
2018-05-31 16:07 ` CC Mode and electric-pair "problem" João Távora
2018-05-31 17:28 ` Alan Mackenzie
2018-05-31 18:37 ` João Távora
2018-06-02 13:02 ` Alan Mackenzie
2018-06-03 3:00 ` João Távora
2018-06-17 16:58 ` Glenn Morris
2018-06-17 20:13 ` Alan Mackenzie
2018-06-17 21:07 ` Stefan Monnier
2018-06-17 21:27 ` João Távora
2018-06-18 10:36 ` Alan Mackenzie
2018-06-18 13:24 ` João Távora
2018-06-18 15:18 ` Eli Zaretskii
2018-06-18 15:37 ` João Távora
2018-06-18 16:46 ` Eli Zaretskii
2018-06-18 17:21 ` Eli Zaretskii
2018-06-18 23:49 ` João Távora
2018-06-19 2:37 ` Eli Zaretskii
2018-06-19 8:13 ` João Távora
2018-06-19 16:59 ` Eli Zaretskii
2018-06-19 19:40 ` João Távora
2018-06-18 20:24 ` Glenn Morris
2018-06-19 2:03 ` João Távora
2018-06-18 15:42 ` Alan Mackenzie
2018-06-18 17:01 ` João Távora
2018-06-18 18:07 ` Yuri Khan
2018-06-18 22:52 ` João Távora
2018-06-18 18:08 ` Alan Mackenzie
2018-06-18 23:43 ` João Távora
2018-06-19 1:35 ` João Távora
2018-06-19 1:48 ` Stefan Monnier
2018-06-19 3:52 ` Clément Pit-Claudel
2018-06-19 6:38 ` Stefan Monnier
2018-06-20 13:48 ` Clément Pit-Claudel
2018-06-26 16:08 ` Fontifying unterminated strings [was: CC Mode and electric-pair "problem".] Alan Mackenzie
2018-06-26 20:02 ` João Távora
2018-06-28 23:56 ` Stefan Monnier
2018-06-29 0:43 ` Stefan Monnier
2018-06-18 22:41 ` CC Mode and electric-pair "problem" Stephen Leake
2018-06-19 0:02 ` João Távora
2018-06-19 3:15 ` Clément Pit-Claudel
2018-06-19 8:16 ` João Távora
2018-06-19 5:02 ` Alan Mackenzie
2018-06-20 14:16 ` Stefan Monnier
2018-06-26 18:23 ` Alan Mackenzie
2018-06-27 13:37 ` João Távora
2018-06-29 3:42 ` Stefan Monnier
2018-06-30 18:09 ` Alan Mackenzie
2018-07-01 3:37 ` Stefan Monnier
2018-07-01 15:24 ` Eli Zaretskii
2018-07-06 21:58 ` Stephen Leake
2018-07-01 15:57 ` Paul Eggert
2018-06-27 18:27 ` Alan Mackenzie
2018-06-29 4:11 ` Stefan Monnier
2018-06-30 19:03 ` Alan Mackenzie
2018-06-30 19:29 ` Eli Zaretskii
2018-06-30 20:14 ` Alan Mackenzie
2018-07-01 3:50 ` Stefan Monnier
2018-07-01 9:58 ` Alan Mackenzie
2018-07-01 11:22 ` João Távora
2018-07-01 15:25 ` Eli Zaretskii
2018-07-01 15:22 ` Eli Zaretskii
2018-07-01 16:38 ` scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".] Alan Mackenzie
2018-07-08 8:29 ` Stephen Leake
2018-07-15 9:00 ` Stephen Leake
2018-07-15 15:13 ` Eli Zaretskii
2018-07-15 18:45 ` Alan Mackenzie [this message]
2018-07-16 2:23 ` Indentation of ?: in C-mode (was: scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".]) Stefan Monnier
2018-07-16 14:18 ` Eli Zaretskii
2018-07-16 15:54 ` Indentation of ?: in C-mode Stefan Monnier
2018-07-15 16:56 ` scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".] Alan Mackenzie
2018-07-17 3:41 ` Stephen Leake
2018-07-01 4:02 ` CC Mode and electric-pair "problem" Stefan Monnier
2018-07-01 10:58 ` Alan Mackenzie
2018-07-01 11:46 ` João Távora
2018-07-01 16:13 ` Stefan Monnier
2018-07-01 18:18 ` Alan Mackenzie
2018-07-01 23:16 ` Stefan Monnier
2018-07-02 19:18 ` Alan Mackenzie
2018-07-03 2:10 ` Stefan Monnier
2018-06-26 18:52 ` Alan Mackenzie
2018-06-26 19:45 ` João Távora
2018-06-26 20:09 ` Alan Mackenzie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180715184538.GC4897@ACM \
--to=acm@muc.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=stephen_leake@stephe-leake.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).