GNU bug report logs - #1406
backward-up-list reports scan error incorrectly?

Previous Next

Package: emacs;

Reported by: xah lee <xah <at> xahlee.org>

Date: Fri, 21 Nov 2008 21:30:03 UTC

Severity: normal

Tags: notabug, wontfix

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #65 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: xah lee <xah <at> xahlee.org>
Cc: 1406 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#1406: backward-up-list reports scan error incorrectly?
Date: Sat, 22 Nov 2008 14:04:46 +0000
Hi, Xah!

On Sat, Nov 22, 2008 at 05:01:10AM -0800, xah lee wrote:
> i was able to duplicate your error. Some of my testing in previous
> post went wrong because i was in text-mode.

> though, isn't this something easy to fix?

No, because it isn't a bug.  It's the way the function is meant to work.
If there is a bug, it's that the doc-string (and maybe the elisp manual,
I haven't looked) is vague and incomplete.

It seems that you really want a slightly different function.

> I mean, it surely is easy  to determine if cursor is in inside double
> quotes, therefore it can simply move out the quote then do
> backward-up-list?

Well, it's easy, but very slow.  You first have to define what "inside"
and "outside" mean.

For example, you might scan from BOB, and point is inside a string if
there've been an odd number of string-quotes up to now (taking comments,
etc. into account).

Emacs Lisp Mode defines "inside a string" as an odd number of
string-quotes since the last "(" in column-0.  Try going into a large
Elisp file and deleting one of the "s.  It throws the fontification out
for the rest of the function, but then "recovers" for the rest of the
file.

> In any case, thanks.

You're welcome!

>   Xah
> ??? http://xahlee.org/

-- 
Alan Mackenzie (Nuremberg, Germany).


> On Nov 22, 2008, at 4:53 AM, xah lee wrote:
 
> hi Alan,

> >(defun foo (arg)
> >  "foo does nothing."
> >  (interactive "P"))

> >Put point inside "P", and do C-M-u `backward-up-list'.  You get the
> >error.

> (defun foo (arg)
>   "foo does nothing. ("
>     (interactive "P"))

> , and do the same again.  It finds that paren.  Why?  Because
> backward-up-list assumes its starting point is NOT in a string.  It
> jumps backwards over (what it thinks is) the string

>     "\n(interactive "

> , and then finds the ?\(.

> This is exactly what is happening in your somewhat larger example.

> In text mode, presumably the syntax table doesn't define ?\" as a string
> quote.  In fundamental mode, presumably it does.  "(syntax-after
> (point))" is your friend here.






This bug report was last modified 14 years and 5 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.