From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".] Date: Sun, 15 Jul 2018 18:13:15 +0300 Message-ID: <83bmb8a5x0.fsf@gnu.org> References: <20180618154227.GB3973@ACM> <20180619050244.GA3946@ACM> <20180627182717.GA4625@ACM> <20180630190327.GC6816@ACM> <83tvpkkr93.fsf@gnu.org> <20180630201447.GE6816@ACM> <83o9frkmk7.fsf@gnu.org> <20180701163825.GC4697@ACM> <86bmbiceq7.fsf@stephe-leake.org> <86lgacswk8.fsf@stephe-leake.org> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1531667509 29016 195.159.176.226 (15 Jul 2018 15:11:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 15 Jul 2018 15:11:49 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stephen Leake Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 15 17:11:45 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1feiga-0007SR-GP for ged-emacs-devel@m.gmane.org; Sun, 15 Jul 2018 17:11:44 +0200 Original-Received: from localhost ([::1]:45870 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1feiih-0002C8-6r for ged-emacs-devel@m.gmane.org; Sun, 15 Jul 2018 11:13:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1feii1-0002B7-Jy for emacs-devel@gnu.org; Sun, 15 Jul 2018 11:13:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1feihy-00087F-Eb for emacs-devel@gnu.org; Sun, 15 Jul 2018 11:13:13 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:58119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1feihy-000879-9u; Sun, 15 Jul 2018 11:13:10 -0400 Original-Received: from [176.228.60.248] (port=1790 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1feihx-0004cr-LJ; Sun, 15 Jul 2018 11:13:10 -0400 In-reply-to: <86lgacswk8.fsf@stephe-leake.org> (message from Stephen Leake on Sun, 15 Jul 2018 04:00:23 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:227432 Archived-At: > From: Stephen Leake > 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): "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. > +#define DEC_AT \ Please #undef DEC_AT when you are done using it (at function's end). > + /* Find the alleged string opener. */ Please leave 2 spaces between the end of the comment and "*/" (here and elsewhere in the patch) > + while ((at > stop) > + && (code != Sstring) > + && (!SYNTAX_FLAGS_CLOSE_STRING (syntax))) > + { > + DEC_AT; > + } A single line doesn't need braces. > + /* 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. > + 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? > + { > + 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. > + 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). > -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. > -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.