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 14:04:46 +0000	[thread overview]
Message-ID: <20081122140446.GC3330@muc.de> (raw)
In-Reply-To: <9331FB10-71C6-4B1B-94B6-B5C9B3667B74@xahlee.org>

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.







  reply	other threads:[~2008-11-22 14:04 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
2008-11-22 12:53       ` xah lee
2008-11-22 13:01         ` xah lee
2008-11-22 14:04           ` Alan Mackenzie [this message]
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=20081122140446.GC3330@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).