unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: xah lee <xah@xahlee.org>
Cc: 1406@emacsbugs.donarmstrong.com, bug-gnu-emacs@gnu.org
Subject: bug#1406: backward-up-list reports scan error incorrectly?
Date: Sat, 22 Nov 2008 12:36:45 +0000	[thread overview]
Message-ID: <20081122123644.GA3330@muc.de> (raw)
In-Reply-To: <5F3AB054-C158-4518-9C93-6938EB2D123D@xahlee.org>

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).







  reply	other threads:[~2008-11-22 12:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-21 21:24 bug#1406: backward-up-list reports scan error incorrectly? xah lee
     [not found] ` <handler.1406.B.122730266611840.ack@emacsbugs.donarmstrong.com>
2008-11-21 21:39   ` bug#1406: Acknowledgement (backward-up-list reports scan error incorrectly?) xah lee
2008-11-21 23:19 ` bug#1406: backward-up-list reports scan error incorrectly? Alan Mackenzie
2008-11-21 23:26   ` xah lee
2008-11-22 12:36     ` Alan Mackenzie [this message]
2008-11-22 12:53       ` xah lee
2008-11-22 13:01         ` xah lee
2008-11-22 14:04           ` Alan Mackenzie
2011-07-09 18:04             ` Glenn Morris

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=20081122123644.GA3330@muc.de \
    --to=acm@muc.de \
    --cc=1406@emacsbugs.donarmstrong.com \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=xah@xahlee.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 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).