unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: forward-sexp when on a floating point number
Date: Wed, 20 Jan 2016 23:15:53 +0100	[thread overview]
Message-ID: <87powv6go6.fsf@mbork.pl> (raw)
In-Reply-To: <jwvio2qmv9o.fsf-monnier+emacs@gnu.org>


On 2016-01-18, at 22:34, Stefan Monnier <monnier@IRO.UMontreal.CA> wrote:

>> FWIW, I did something like this for (La)TeX here:
>> https://github.com/mbork/tex-plus.el (note: this is still WiP, and
>> contains more than just tokenizing TeX).  Either TeX token syntax is
>> weird and/or difficult, either I really suck at writing lexers/parsers,
>> or this is indeed a (potentially) difficult problem.  (Probably all
>> three.)
>
> Don't know about the middle one, but the other two indeed apply.  In the
> general case, the esiest way to solve this problem is probably to go
> back to a safe earlier state and then lex forward from there.

Yes, in case of TeX, it is relatively easy (assuming the user did not
play around with catcodes - in such a case, /anything/ can happen (see
e.g. https://tug.org/TUGboat/tb19-4/tb61carl.pdf - try it!).

> A "safe earlier state" could be "right after a character which can only
> appear at the end of a token" [ of course, there's no guarantee that such
> a character exists ].

In TeX (under normal catcode regime), it's just like that: newline.

> Also "going back and then lex forward" implies a potential serious
> performance problem, so it would require some form of caching.

Exactly, and I wanted to avoid that.  Frankly, I had no idea how to do
this anyway; now I'm a bit wiser, and I guess I could run an idle timer
to update the cache, and have a global variable for keeping the state
(cache synchronized or not), set to "not in sync" after any
text-changing command.  Of course, any command that actually needs
a cache would have to recreate it, too.  Would that be a good plan?

>         Stefan

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



      reply	other threads:[~2016-01-20 22:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12 10:42 forward-sexp when on a floating point number Oleh Krehel
2016-01-12 13:58 ` Herring, Davis
2016-01-12 14:20 ` Andreas Schwab
2016-01-12 14:41   ` Oleh Krehel
2016-01-12 17:35 ` John Wiegley
2016-01-12 17:45 ` Dmitry Gutov
2016-01-17 23:07 ` Stefan Monnier
2016-01-17 23:42   ` John Wiegley
2016-01-18  1:36     ` Stefan Monnier
2016-01-18  5:08       ` John Wiegley
2016-01-18 13:30         ` Stefan Monnier
2016-01-18 19:02           ` John Wiegley
2016-01-18 21:03           ` Marcin Borkowski
2016-01-18 21:34             ` Stefan Monnier
2016-01-20 22:15               ` Marcin Borkowski [this message]

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=87powv6go6.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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).