unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: xah lee <xah@xahlee.org>
To: bug-gnu-emacs@gnu.org
Subject: bug#1406: backward-up-list reports scan error incorrectly?
Date: Fri, 21 Nov 2008 13:24:30 -0800	[thread overview]
Message-ID: <EAA45A2E-4CC6-4F13-863A-9A934FF60165@xahlee.org> (raw)

This appears to be a bug of backward-up-list.

Summary: when i do backward-up-list in a particular lisp file, when  
the cursor is inside a double quote, it tell me Unbalanced  
parentheses, but there does not seems to be any unbalanced paren. The  
file byte-compiles fine.

steps to reproduce:

Save the following function to a file.

(defun replace-keybinding-notation (p1 p2)
   "Do a bunch of find/replace on current text selection."
   (interactive "r")

   (let (mystr (case-fold-search nil) (case-replace nil))
     (setq mystr (buffer-substring p1 p2))

     (setq mystr
           (with-temp-buffer
             (insert mystr)

             ;; C-
             (goto-char (point-min))
             (while
                 (search-forward-regexp "C-" nil t)
               (replace-match "Ctlr+" t) )

             ;; M-
             (goto-char (point-min))
             (while
                 (search-forward-regexp "M-" nil t)
               (replace-match "Alt+" t) )

             ;; Ctrl+Alt+t
             (goto-char (point-min))
             (while
                 (search-forward-regexp "Ctrl\\+Alt\\+\\([[:graph:]]\ 
\)" nil t)
               (replace-match "<span class=\"kbd\"><span class=\"key 
\">Ctrl</span>+<span class=\"key\">Alt</span>+<span class=\"key\">\ 
\1</span></span>" t) )

             ;; Cmd+Shift+t
             (goto-char (point-min))
             (while
                 (search-forward-regexp "Cmd\\+Shift\\+\\([[:graph:]]\ 
\)" nil t)
               (replace-match "<span class=\"kbd\"><span class=\"key 
\">Cmd</span>+<span class=\"key\">Shift</span>+<span class=\"key\">\ 
\1</span></span>" t) )

             ;; Alt+Shift+t
             (goto-char (point-min))
             (while
                 (search-forward-regexp "Alt\\+Shift\\+\\([[:graph:]]\ 
\)" nil t)
               (replace-match "<span class=\"kbd\"><span class=\"key 
\">Alt</span>+<span class=\"key\">Shift</span>+<span class=\"key\">\ 
\1</span></span>" t) )

             ;; Ctrl+t Ctrl+t
             (goto-char (point-min))
             (while
                 (search-forward-regexp "Ctrl\\+\\([[:graph:]]\\) Ctrl 
\\+\\([[:graph:]]\\)" nil t)
               (replace-match "<span class=\"kbd\"><span class=\"key 
\">Ctrl</span>+<span class=\"key\">\\1</span> <span class=\"key 
\">Ctrl</span>+<span class=\"key\">\\2</span></span>" t) )

             ;; Ctrl+t
             (goto-char (point-min))
             (while
                 (search-forward-regexp "Ctrl\\+\\([[:graph:]]\\)"  
nil t)
               (replace-match "<span class=\"kbd\"><span class=\"key 
\">Ctrl</span>+<span class=\"key\">\\1</span></span>" t) )

             ;; Alt+t
             (goto-char (point-min))
             (while
                 (search-forward-regexp "Alt\\+\\([[:graph:]]\\)" nil t)
               (replace-match "<span class=\"kbd\"><span class=\"key 
\">Alt</span>+<span class=\"key\">\\1</span></span>" t) )

             ;; Meta+t
             (goto-char (point-min))
             (while
                 (search-forward-regexp "Meta\\+\\([[:graph:]]\\)"  
nil t)
               (replace-match "<span class=\"kbd\"><span class=\"key 
\">Meta</span>+<span class=\"key\">\\1</span></span>" t) )

             ;; Cmd+t
             (goto-char (point-min))
             (while
                 (search-forward-regexp "Cmd\\+\\([[:graph:]]\\)" nil t)
               (replace-match "<span class=\"kbd\"><span class=\"key 
\">Cmd</span>+<span class=\"key\">\\1</span></span>" t) )

             (buffer-string)
             )
           )

     (delete-region p1 p2)
     (insert mystr)
     )
   )

• start emacs by /Applications/Emacs.app/Contents/MacOS/Emacs -q

• open the file.

• interactive search for “M-”, do it twice so that your cursor  
is in between the double quote on the line: (search-forward-regexp  
"M-" nil t). Press return so that your cursor is just before the  
closing quote.

• press Ctrl+Alt+↑ (invoke backward-up-list).

• emacs says: “up-list: Scan error: "Unbalanced parentheses", 582,  
1”

---------------------------------

In GNU Emacs 22.2.1 (powerpc-apple-darwin8.11.0, Carbon Version 1.6.0)
  of 2008-04-05 on g5.tokyo.stp.isas.jaxa.jp
Windowing system distributor `Apple Inc.', version 10.4.11
configured using `configure  '--prefix=/Applications/Emacs.app/ 
Contents/Resources' '--with-carbon' '--without-x' '--libexecdir=/ 
Volumes/Emacs/Emacs.app/Contents/MacOS/libexec' 'CFLAGS=-Os -arch  
i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -DUSE_ATSUI - 
DUSE_MAC_TSM''

   Xah
∑ http://xahlee.org/

             reply	other threads:[~2008-11-21 21:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-21 21:24 xah lee [this message]
     [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
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=EAA45A2E-4CC6-4F13-863A-9A934FF60165@xahlee.org \
    --to=xah@xahlee.org \
    --cc=1406@emacsbugs.donarmstrong.com \
    --cc=bug-gnu-emacs@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 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).