[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#1406: backward-up-list reports scan error incorrectly?
From: |
Alan Mackenzie |
Subject: |
bug#1406: backward-up-list reports scan error incorrectly? |
Date: |
Sat, 22 Nov 2008 12:36:45 +0000 |
User-agent: |
Mutt/1.5.9i |
Hi, Xah!
On Fri, Nov 21, 2008 at 03:26:03PM -0800, xah lee wrote:
> Hi Alan,
> it works if you switch to text mode though.
> It doesn't work while in emacs-lisp-mode and fundamental mode.
> In any case, normally it works when inside string too. Just not in
> this particular case.
OK, I think half of the problem here is your prolixity, the other half
is my prolixity. :-)
Try instead the following example:
(defun foo (arg)
"foo does nothing."
(interactive "P"))
Put point inside "P", and do C-M-u `backward-up-list'. You get the
error. Now modify the above function by inserting an open paren into
the doc string,
(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.
> Xah
--
Alan Mackenzie (Nuremberg, Germany).