From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan McKenzie Newsgroups: gmane.emacs.bugs Subject: bug#24172: 25.1; Doc of parse-sexp-ignore-comments: what does a value of nil mean? Date: Sun, 28 Jul 2019 09:20:38 +0000 Message-ID: <20190728092038.GC5072@ACM> References: <874m6xqxy9.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="223949"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) To: 24172@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 28 17:43:09 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hrlKG-000w85-L5 for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Jul 2019 17:43:08 +0200 Original-Received: from localhost ([::1]:45750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrlKF-0003ET-KD for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Jul 2019 11:43:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57820) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrlKB-0003EH-8v for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2019 11:43:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hrlKA-0002nm-4G for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2019 11:43:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38211) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hrlKA-0002nZ-0n for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2019 11:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hrlK9-0001oX-Qy for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2019 11:43:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <874m6xqxy9.fsf@web.de> Resent-From: Alan McKenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Jul 2019 15:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24172 X-GNU-PR-Package: emacs Original-Received: via spool by 24172-submit@debbugs.gnu.org id=B24172.15643285726955 (code B ref 24172); Sun, 28 Jul 2019 15:43:01 +0000 Original-Received: (at 24172) by debbugs.gnu.org; 28 Jul 2019 15:42:52 +0000 Original-Received: from localhost ([127.0.0.1]:47032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hrlJz-0001o6-SS for submit@debbugs.gnu.org; Sun, 28 Jul 2019 11:42:52 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:65001 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hrfM9-0001yx-3F for 24172@debbugs.gnu.org; Sun, 28 Jul 2019 05:20:42 -0400 Original-Received: (qmail 22490 invoked by uid 3782); 28 Jul 2019 08:28:09 -0000 Original-Received: from acm.muc.de (p2E5D5404.dip0.t-ipconnect.de [46.93.84.4]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 28 Jul 2019 10:28:08 +0200 Original-Received: (qmail 5188 invoked by uid 1000); 28 Jul 2019 09:20:38 -0000 Content-Disposition: inline Original-Received: (qmail 5176 invoked from network); 28 Jul 2019 09:16:29 -0000 Original-Received: from unknown (HELO acm) (::1) by ACM with ESMTP; 28 Jul 2019 09:16:29 -0000 Original-Received: from mail.muc.de [193.149.48.3] by acm with IMAP (fetchmail-6.3.26) for (single-drop); Sun, 28 Jul 2019 09:16:29 +0000 (UTC) Original-Received: (qmail 19986 invoked for bounce); 28 Jul 2019 08:20:16 -0000 X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-Mailman-Approved-At: Sun, 28 Jul 2019 11:42:50 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:163976 Archived-At: Hello, Lars. In article you wrote: > Michael Heerdegen writes: >> in the docstring of `parse-sexp-ignore-comments' (or at least in the >> manual), I miss a description about what a value of nil exactly means: >> How are comments treated then? Are they treated as separate units that >> can then be parsed as well, but separately from code, or are they treated >> as indistinguishable from code? >> For example, if parsing starts from within a comment, and parsing finds >> the end of the comment and is not yet finished, is parsing just >> continued inside the following code, or does it fail? > After doing some testing, it seems that if it's nil, the commands > affected by the setting just treat the commented-out text as if it > wasn't commented out. > So the answer to your last question seems to be "yes". > ;; (foo > (bar zot)) > However, pretty much the same thing happens with a non-nil value, too -- > with point before (foo C-M-f will advance past zot)). > So it doesn't treat comments as whitespace, really -- it only does that > if point is outside (before, at the end of a line, etc) the comment to > begin with. Seems like you could write an essay about it, but perhaps > it's not worth listing the eccentricities here which I guess could change. parse-sexp-ignore-comments (or, rather, parse_sexp_ignore_comments) is tested, and acted upon, by precisely one C function, scan_lists in syntax.c. scan_lists is used by just two primitives, scan-lists and scan-sexps. These, in turn, are called by forward-list, etc. When this variable is nil, scan_lists fails to recognise comment delimiters - it just goes past them as though they were random punctuation characters. By contrast, when parse-sexp-ignore-comments is t, scan_lists calls a comment scanning function when it encounters a comment delimiter. Noteworthy is that parse-partial-sexp doesn't respect the setting of parse-sexp-ignore-comments. This might be considered a bug. All in all, this variable seems not to be a good idea. It is not tested consistently by the syntax routines (see above), must be set explicitly to t by any major mode with comments, the nil value is rarely used, and it is not clear whether this nil value is actually ever useful. It would seem that if a major mode does not want comments to be recognised, it would be better not to give any character comment syntax in its syntax table. > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany).