* bug#24172: 25.1; Doc of parse-sexp-ignore-comments: what does a value of nil mean? @ 2016-08-06 23:28 Michael Heerdegen 2019-07-27 15:21 ` Lars Ingebrigtsen 2019-07-28 9:20 ` Alan McKenzie 0 siblings, 2 replies; 7+ messages in thread From: Michael Heerdegen @ 2016-08-06 23:28 UTC (permalink / raw) To: 24172 Hello, 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? Thanks in advance, Michael. In GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.20.6) of 2016-08-04 built on drachen Repository revision: 72221f51439d666d54f5d147f00ecdbb3778ab1b Windowing system distributor 'The X.Org Foundation', version 11.0.11804000 System Description: Debian GNU/Linux testing (stretch) Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#24172: 25.1; Doc of parse-sexp-ignore-comments: what does a value of nil mean? 2016-08-06 23:28 bug#24172: 25.1; Doc of parse-sexp-ignore-comments: what does a value of nil mean? Michael Heerdegen @ 2019-07-27 15:21 ` Lars Ingebrigtsen 2021-10-23 17:32 ` Stefan Kangas 2019-07-28 9:20 ` Alan McKenzie 1 sibling, 1 reply; 7+ messages in thread From: Lars Ingebrigtsen @ 2019-07-27 15:21 UTC (permalink / raw) To: Michael Heerdegen; +Cc: 24172 Michael Heerdegen <michael_heerdegen@web.de> 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. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#24172: 25.1; Doc of parse-sexp-ignore-comments: what does a value of nil mean? 2019-07-27 15:21 ` Lars Ingebrigtsen @ 2021-10-23 17:32 ` Stefan Kangas 2021-10-24 13:11 ` Lars Ingebrigtsen 0 siblings, 1 reply; 7+ messages in thread From: Stefan Kangas @ 2021-10-23 17:32 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: Michael Heerdegen, 24172 Lars Ingebrigtsen <larsi@gnus.org> writes: > Michael Heerdegen <michael_heerdegen@web.de> 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. So is there anything more to do here, or could this be closed? I can't see anything actionable from reading this thread. ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#24172: 25.1; Doc of parse-sexp-ignore-comments: what does a value of nil mean? 2021-10-23 17:32 ` Stefan Kangas @ 2021-10-24 13:11 ` Lars Ingebrigtsen 0 siblings, 0 replies; 7+ messages in thread From: Lars Ingebrigtsen @ 2021-10-24 13:11 UTC (permalink / raw) To: Stefan Kangas; +Cc: Michael Heerdegen, 24172 Stefan Kangas <stefan@marxist.se> writes: > So is there anything more to do here, or could this be closed? I can't > see anything actionable from reading this thread. Yes, I tried adding some more to the doc string there, and it just ended up restating the first line, but negatively, which doesn't seem to help any: -- If nil, text that has been commented out is taken into consideration when doing commands like `forward-sexp'. -- So I'm closing this bug report without doing that. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#24172: 25.1; Doc of parse-sexp-ignore-comments: what does a value of nil mean? 2016-08-06 23:28 bug#24172: 25.1; Doc of parse-sexp-ignore-comments: what does a value of nil mean? Michael Heerdegen 2019-07-27 15:21 ` Lars Ingebrigtsen @ 2019-07-28 9:20 ` Alan McKenzie 2019-07-29 2:18 ` Michael Heerdegen 1 sibling, 1 reply; 7+ messages in thread From: Alan McKenzie @ 2019-07-28 9:20 UTC (permalink / raw) To: 24172 Hello, Lars. In article <mailman.2415.1564240928.2688.bug-gnu-emacs@gnu.org> you wrote: > Michael Heerdegen <michael_heerdegen@web.de> 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). ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#24172: 25.1; Doc of parse-sexp-ignore-comments: what does a value of nil mean? 2019-07-28 9:20 ` Alan McKenzie @ 2019-07-29 2:18 ` Michael Heerdegen 0 siblings, 0 replies; 7+ messages in thread From: Michael Heerdegen @ 2019-07-29 2:18 UTC (permalink / raw) To: Alan McKenzie; +Cc: 24172 Alan McKenzie <MAILER-DAEMON@mail.muc.de> writes: > 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. My question mainly arised from pondering whether this variable could be useful for el-search, a package for searching Elisp code (with patterns). It could be of minor use if it allowed to search commented code. But I can also implement this in other ways. Apart from that, I have no use cases, so I wrote the bug report only because of the unclear documentation. But the variable seems to be used. I have 75 matches in my load-path. Michael. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <20190728082012.19960.qmail@mail.muc.de>]
* bug#24172: 25.1; Doc of parse-sexp-ignore-comments: what does a value of nil mean? [not found] <20190728082012.19960.qmail@mail.muc.de> @ 2019-07-28 10:11 ` Lars Ingebrigtsen 0 siblings, 0 replies; 7+ messages in thread From: Lars Ingebrigtsen @ 2019-07-28 10:11 UTC (permalink / raw) To: Alan Mackenzie; +Cc: Michael Heerdegen, 24172 (Looks like the debbugs address in the Cc was mangled, so I'm just resending the entire email to have it end up in the bug tracker.) Alan Mackenzie <acm@muc.de> writes: > Hello, Lars. > > In article <mailman.2415.1564240928.2688.bug-gnu-emacs@gnu.org> you wrote: >> Michael Heerdegen <michael_heerdegen@web.de> 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-10-24 13:11 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-08-06 23:28 bug#24172: 25.1; Doc of parse-sexp-ignore-comments: what does a value of nil mean? Michael Heerdegen 2019-07-27 15:21 ` Lars Ingebrigtsen 2021-10-23 17:32 ` Stefan Kangas 2021-10-24 13:11 ` Lars Ingebrigtsen 2019-07-28 9:20 ` Alan McKenzie 2019-07-29 2:18 ` Michael Heerdegen [not found] <20190728082012.19960.qmail@mail.muc.de> 2019-07-28 10:11 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.