Subject: 24.0.50; up-list broken with custom forward-sexp-function

From: Alan Malloy <[email-masked]>
Date: Fri, 20 May 2011 13:00:30 -0700

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)