unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8708: 24.0.50; up-list broken with custom forward-sexp-function
@ 2011-05-20 20:00 Alan Malloy
  2011-05-23 16:41 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Malloy @ 2011-05-20 20:00 UTC (permalink / raw)
  To: 8708

Steps to reproduce:

emacs -Q
Switch to *scratch* (or any buffer)
M-x lisp-mode

Enter text (), move point between parens
M-x up-list
Point successfully moves to after the close-paren

Move point back inside parens
M-: (setq forward-sexp-function
       (lambda (n)
         (let ((forward-sexp-function nil))
           (forward-sexp n))))
M-x up-list

Expected behavior:

Same as before, because this function has behavior identical to built-in
forward-sexp

Actual behavior:

Point does not move, signal is raised, and error message is printed:
       up-list: Scan error: "Unbalanced parentheses", 193, 193

Bug does not exist in 23.1.1; something in the 24 series adds special
handling in up-list that checks if forward-sexp-function is set and
causes it to behave differently if so. Apparently that different
behavior doesn't have the same net effect as the original behavior

In GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.22.0)
  of 2011-05-18 on altair
Important settings:
   value of $LC_ALL: nil
   value of $LC_COLLATE: nil
   value of $LC_CTYPE: nil
   value of $LC_MESSAGES: nil
   value of $LC_MONETARY: nil
   value of $LC_NUMERIC: nil
   value of $LC_TIME: nil
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: nil
   locale-coding-system: utf-8-unix
   default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
   tooltip-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent input:
d - s e x p - f u n c i o n t SPC DEL DEL DEL DEL DEL
t i o n SPC n i l ) ) C-b C-b C-b C-b C-b C-b C-b C-b
C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b
C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b
C-b C-b C-b C-f C-f n C-e C-b C-f DEL DEL ) ) DEL (
f o r w a r d - s e x p SPC n ) ) ) ) RET ESC x f o
TAB r TAB w TAB s e TAB x TAB RET ESC C-f ESC x u p
TAB l DEL - l i TAB RET ESC " DEL C-_ ESC : ESC p C-a
C-k C-_ C-g C-g C-f C-g ESC x v e r s i o n RET ESC
x l i s p SPC m o d e RET ESC x C-g ESC : ESC p RET
C-b C-b C-k C-_ ESC x p a r e d TAB RET m TAB o TAB
RET C-k ESC x u p SPC l i s t RET C-f ESC x ESC p RET
ESC x p a r e d TAB m TAB o TAB RET C-b ESC x u p -
l i TAB RET C-a ESC C-k C-_ C-f ESC C-k C-_ ESC C-k
ESC C-k ESC C-k ESC C-k C-_ C-_ ESC x ESC p RET DEL
DEL DEL ESC x u p TAB = - DEL DEL - l i TAB RET C-x
b * M e TAB RET C-a C-@ C-n C-e C-p C-e ESC w C-a C-f
C-f C-f ESC x r e p o TAB r TAB RET

Recent messages:
Paredit mode disabled
up-list: Scan error: "Unbalanced parentheses", 196, 196
Undo! [2 times]
forward-sexp: Scan error: "Containing expression ends prematurely", 193, 
194 [2 times]
Undo! [2 times]
up-list: Scan error: "Unbalanced parentheses", 196, 196
Making completion list...
up-list: Scan error: "Unbalanced parentheses", 193, 193
Mark set
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message sendmail rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mailabbrev mail-utils gmm-utils mailheader emacsbug url-util url-parse
auth-source eieio byte-opt bytecomp byte-compile assoc gnus-util
time-date password-cache url-vars mm-util mail-prsvr vc-git
multi-isearch jka-compr find-func help-fns two-column iso-transl
help-mode easymenu view paredit-autoloads package clojure-mode rx
regexp-opt cl paredit edmacro kmacro tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
loaddefs button minibuffer faces cus-face files text-properties overlay
md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)






^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#8708: 24.0.50; up-list broken with custom forward-sexp-function
  2011-05-20 20:00 bug#8708: 24.0.50; up-list broken with custom forward-sexp-function Alan Malloy
@ 2011-05-23 16:41 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2011-05-23 16:41 UTC (permalink / raw)
  To: Alan Malloy; +Cc: 8708-done

>>>>> "Alan" == Alan Malloy <alan.malloy@yieldbuild.com> writes:
> Move point back inside parens
> M-: (setq forward-sexp-function
>       (lambda (n)
>         (let ((forward-sexp-function nil))
>           (forward-sexp n))))
> M-x up-list

> Actual behavior:

> Point does not move, signal is raised, and error message is printed:
>       up-list: Scan error: "Unbalanced parentheses", 193, 193

Oops, indeed.  I installed the patch below into trunk, which should
fix it.  Thank you,


        Stefan


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2011-05-23 15:03:04 +0000
+++ lisp/ChangeLog	2011-05-23 16:39:13 +0000
@@ -1,3 +1,7 @@
+2011-05-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/lisp.el (up-list): Fix forward movement (bug#8708).
+
 2011-05-23  Ken Manheimer  <ken.manheimer@gmail.com>
 
 	* allout.el (allout-inhibit-auto-fill-on-headline): Create new

=== modified file 'lisp/emacs-lisp/lisp.el'
--- lisp/emacs-lisp/lisp.el	2011-05-12 07:07:06 +0000
+++ lisp/emacs-lisp/lisp.el	2011-05-23 16:37:30 +0000
@@ -149,7 +149,7 @@
               (while (progn (setq pos (point))
                        (forward-sexp inc)
                        (/= (point) pos)))
-            (scan-error (goto-char (nth 2 err))))
+	  (scan-error (goto-char (nth (if (> arg 0) 3 2) err))))
         (if (= (point) pos)
             (signal 'scan-error
                     (list "Unbalanced parentheses" (point) (point)))))





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-23 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-20 20:00 bug#8708: 24.0.50; up-list broken with custom forward-sexp-function Alan Malloy
2011-05-23 16:41 ` Stefan Monnier

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