unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Alan Mackenzie <acm@muc.de>
Cc: John Wiegley <jwiegley@gmail.com>,
	Philipp Stephani <p.stephani2@gmail.com>,
	22983@debbugs.gnu.org
Subject: bug#22983: [ Patch ] Re: bug#22983: syntax-ppss returns wrong result.
Date: Tue, 12 Sep 2017 03:24:08 +0300	[thread overview]
Message-ID: <aebd9cb3-a74d-2265-8c25-3cc5ed3c71e7@yandex.ru> (raw)
In-Reply-To: <20170911201204.GC3605@ACM>

On 9/11/17 11:12 PM, Alan Mackenzie wrote:

>> Before, we had syntax-ppss-cache and syntax-ppss-last. The patch adds 8
>> new ones.
> 
> Yes.  But each one has a very single purpose, and there are no loops in
> the new code, which makes it easier to be sure it is correct.

On the one hand, yes, on the other hand, the more code you have (or the 
more vars you have to juggle), the harder it is to keep track.

> I'm in favour rather of setting syntax-ppss-{cache,last} to the
> appropriate stored cache.  This will avoid needing to change the
> function syntax-ppss much.

My proposal will change syntax-ppss, yes. So, unfortunately, the patch 
will be more difficult to read. But not the resulting code, hopefully.

But I think I see what you mean. The disadvantage is that we'll need 
code that will ferry those values back to the appropriate variables as 
well (which we see in your patch). We can discuss that option after.

> A disadvantage of using such a cons is in debugging.  It is more
> difficult to understand a cons like this when it is printed out, than
> the two component lists (which are difficult enough themselves).

You win some, you lose some. We could use structs, if you like, but 
overall, the values are already complex, so consing won't make that much 
worse.

> When there's a lot of buffer changing going on, it is an overhead having
> to clear both (or several) caches continually.  (I'm thinking about the
> possible extension to using an alist of caches, which could be quite
> long.)

Both caches - yes, but shouldn't be too bad. The "alist of caches" 
approach would most likely require that laziness, but I'm not sure we 
really want to go there (see another email).

> Also clearing both caches at the same time would be a bigger change to
> syntax-ppss-flush-cache than it's suffered so far.

True.

>> - Any package than advises syntax-ppss will have to juggle fewer global
>> variables.
> 
> I was intending that the new variables be purely internal, and that no
> external elisp would need to access them.  I suppose I really ought to
> have put "--" in the middle of their names.

Yes, but if we can make life easier for some, why not? Sometimes 
third-party author can life with breakage between Emacs versions.

>> So Vatalie's polymode will have an easier time of it. It could even
>> reuse some of the cache-while-narrowed logic by substituting the
>> values of syntax-ppss-data-narrow and
>> syntax-ppss-data-narrow-point-min as appropriate.
> 
> That sounds a little dangerous.

Not much worse than what multi-mode packages already do, though.

>> The obvious downside is, of course, extra indirection, which translates
>> to extra overhead. We don't know how significant it will be, though.
> 
> I wouldn't be keen on seeing lots of (car compound-variable) and (cdr
> compound-variable) throughout the syntax-ppss function.  I think it
> would make it significantly more difficult to understand.

Hopefully there will be only several such places. But again, we can use 
structs.

>> Would you like to see the code?
> 
> Yes, why not?

Please give me until the end of the week.

> But just to make my position clear, I'm not particularly fixed on my
> patch as submitted.  It was optimised for simplicity and correctness
> rather than elegance, though I don't think it's too bad.  I'm fairly
> open on whether we use your suggestions or Stefan's suggestion of having
> an alist of caches.

Cool.





  reply	other threads:[~2017-09-12  0:24 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 15:15 bug#22983: syntax-ppss returns wrong result Alan Mackenzie
2016-03-11 20:31 ` Dmitry Gutov
2016-03-11 21:24   ` Alan Mackenzie
2016-03-11 21:35     ` Dmitry Gutov
2016-03-11 22:15       ` Alan Mackenzie
2016-03-11 22:38         ` Dmitry Gutov
2016-03-13 17:37           ` Stefan Monnier
2016-03-13 18:57             ` Alan Mackenzie
2016-03-14  0:47               ` Dmitry Gutov
2016-03-14  1:04                 ` Drew Adams
2016-04-03 22:55                   ` John Wiegley
2016-03-14  1:49               ` Stefan Monnier
2016-03-13 17:32     ` Stefan Monnier
2016-03-13 18:52 ` Andreas Röhler
2016-03-13 18:56   ` Dmitry Gutov
2016-03-18  0:49 ` Dmitry Gutov
2016-03-19 12:27   ` Alan Mackenzie
2016-03-19 18:47     ` Dmitry Gutov
2016-03-27  0:51       ` John Wiegley
2016-03-27  1:14         ` Dmitry Gutov
2016-04-03 22:58           ` John Wiegley
2016-04-03 23:15             ` Dmitry Gutov
2017-09-02 13:12               ` Eli Zaretskii
2017-09-02 17:40                 ` Alan Mackenzie
2017-09-02 17:53                   ` Eli Zaretskii
2017-09-03 20:44                   ` John Wiegley
2017-09-04 23:34                   ` Dmitry Gutov
2017-09-05  6:57                     ` Andreas Röhler
2017-09-05 12:28                     ` John Wiegley
2017-09-07 20:45                       ` Alan Mackenzie
2017-09-08 16:04                         ` Andreas Röhler
2017-09-10 18:26                           ` Alan Mackenzie
2017-09-09  9:44                         ` Dmitry Gutov
2017-09-09 10:20                           ` Alan Mackenzie
2017-09-09 12:18                             ` Dmitry Gutov
2017-09-10 11:42                               ` Alan Mackenzie
2017-09-10 11:36                           ` bug#22983: [ Patch ] " Alan Mackenzie
2017-09-10 22:53                             ` Stefan Monnier
2017-09-10 23:36                               ` Dmitry Gutov
2017-09-11 11:10                                 ` Stefan Monnier
2017-09-12  0:11                                   ` Dmitry Gutov
2017-09-12 22:12                                     ` Richard Stallman
2017-09-11 19:42                               ` Alan Mackenzie
2017-09-11 20:20                                 ` Stefan Monnier
2017-09-11  0:11                             ` Dmitry Gutov
2017-09-11 20:12                               ` Alan Mackenzie
2017-09-12  0:24                                 ` Dmitry Gutov [this message]
2017-09-17 10:29                                   ` Alan Mackenzie
2017-09-17 23:43                                     ` Dmitry Gutov
2017-09-18 19:08                                       ` Alan Mackenzie
2017-09-19  0:02                                         ` Dmitry Gutov
2017-09-19 20:47                                           ` Alan Mackenzie
2017-09-22 14:09                                             ` Dmitry Gutov
2017-09-24 11:26                                               ` Alan Mackenzie
2017-09-25 23:53                                                 ` Dmitry Gutov
2017-10-01 16:36                                                   ` Alan Mackenzie
2017-10-04 20:07                                                 ` Johan Bockgård
2017-09-17 11:12                             ` Philipp Stephani
2017-09-19 20:50                               ` Alan Mackenzie
2017-09-07 17:56                     ` Alan Mackenzie
2017-09-07 20:36                       ` Dmitry Gutov
2016-03-19 23:16     ` Vitalie Spinu
2016-03-19 23:00   ` Vitalie Spinu
2016-03-19 23:20     ` Dmitry Gutov
     [not found] ` <mailman.7307.1457709188.843.bug-gnu-emacs@gnu.org>
2017-10-01 16:31   ` 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=aebd9cb3-a74d-2265-8c25-3cc5ed3c71e7@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=22983@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=jwiegley@gmail.com \
    --cc=p.stephani2@gmail.com \
    /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).