all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: Bug #22983 (syntax-ppss returns wrong result) is still open.  Could we fix it before the release, please.
Date: Tue, 7 Jun 2016 22:09:28 +0000	[thread overview]
Message-ID: <20160607220928.GA5155@acm.fritz.box> (raw)

Hello, Emacs.

Bug #22983 is that syntax-ppss is broken.  It's text is this:

    The fundamental contract in syntax-ppss is that (syntax-ppss POS)
    returns the same value as (parse-partial-sexp (point-min) POS) (with the
    exception of elements 2 and 6).  This is currently not always the case.

    In the master branch, emacs -Q and visit xdisp.c with C-x C-f.  Follow
    this recipe:

        M-: (syntax-ppss-flush-cache 1)
        M-: (setq ppss-0 (syntax-ppss 40000))
        M-<
        C-s #include " <CR>
        M->
        C-x n n
        M-: (setq ppss-1 (syntax-ppss 40000))
        M-: (setq parse (parse-partial-sexp (point-min) 40000))

    At this point, `ppss-1' and `parse' should match (apart from elements 2
    and 6).  What we actually have is:

        ppss-1: (2 39992 nil nil nil nil 2 nil nil (39975 39992))
        parse:  (0 nil 15674 34 nil nil 0 nil 15675 nil)

    . 

.  I've just tried it again in the emacs-25 branch, and it is as badly
broken as it was back in March.

Personally, I believe that syntax-ppss is such a bad function, we should
work to expunge it from Emacs.  However, I recognise that that is a view
unlikely to prevail.

My suggestion for a fix, discussed in the thread for the bug, is to come
up with a new function similar to syntax-ppss which always returns the
equivalent of

    (parse-partial-sexp 1 pos)

in place of syntax-ppss's

    (parse-partial-sexp (point-min) pos)

.  Being realistic, this new function would have to bear the name
"syntax-ppss", leaving lots of room for confusion, but it's probably the
best fix we'll get.  I'm willing to make and commit this change.

With this fix, and using this new function in place of the current
syntax-ppss in accordance with its spec, the above bug wouldn't happen.

If my fix isn't wanted, can somebody who likes syntax-ppss PLEASE fix it
before the release, so that, finally, it behaves according to its
specification.

Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).



             reply	other threads:[~2016-06-07 22:09 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 22:09 Alan Mackenzie [this message]
2016-06-07 22:15 ` Bug #22983 (syntax-ppss returns wrong result) is still open. Could we fix it before the release, please Dmitry Gutov
2016-06-07 22:48   ` Alan Mackenzie
2016-06-07 23:25     ` Dmitry Gutov
2016-06-11 10:07       ` Alan Mackenzie
2016-06-11 16:10         ` Dmitry Gutov
2016-06-11 19:50           ` Alan Mackenzie
2016-06-11 22:52             ` Dmitry Gutov
2016-06-12  9:34               ` Alan Mackenzie
2016-06-12 22:58                 ` Dmitry Gutov
2016-06-13  1:44                   ` Clément Pit--Claudel
2016-06-13 12:28                   ` Alan Mackenzie
2016-06-13 12:56                     ` Stefan Monnier
2016-06-13 13:28                       ` Drew Adams
2016-06-13 15:36                     ` Dmitry Gutov
2016-06-14 14:55                       ` Alan Mackenzie
2016-06-13 21:12           ` John Wiegley
2016-06-13 21:16     ` John Wiegley
2016-06-08 12:43 ` Stefan Monnier
2016-06-11 10:24   ` Alan Mackenzie
2016-06-11 15:00     ` Stefan Monnier
2016-06-11 16:29       ` Dmitry Gutov
2016-06-11 21:24         ` Stefan Monnier
2016-06-11 21:44           ` Alan Mackenzie
2016-06-11 21:49             ` Stefan Monnier
2016-06-11 22:13               ` Alan Mackenzie
2016-06-12  4:06                 ` Stefan Monnier
2016-06-11 22:17               ` Dmitry Gutov
2016-06-11 22:21             ` Dmitry Gutov
2016-06-11 16:32     ` Dmitry Gutov
2016-06-11 19:58       ` Alan Mackenzie
2016-06-11 22:28         ` Dmitry Gutov
2016-06-14  9:17         ` Andreas Röhler
2016-06-15 22:11           ` Stefan Monnier

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160607220928.GA5155@acm.fritz.box \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /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 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.