Subject: 23.0.91; syntax-ppss / beginning-of-defun not saving match data

From: [email-masked]
Date: Fri, 27 Feb 2009 16:42:52 +0100

`beginning-of-defun' (and `syntax-ppss' as it invokes the former by
the variable `syntax-begin-function') does not save match data.

The issue also applies to 23.0.60.1, and 22.1.1.

Test case:

  (let ((buffer-sexpr "(defun *HERE*"))
  (with-temp-buffer
    (lisp-mode)
    (insert buffer-sexpr)
    (search-backward "*HERE*")
    (let ((old (match-data)))
      (progn (beginning-of-defun))
      (equal old (match-data)))))

               ==> nil

There are several possible options now:

  (i) `beginning-of-defun' is allowed to not save match data. If so,
      please document it.

  (ii) If (i) is true, still consider whether `syntax-ppss' is allowed
       to not save match data, too. Perhaps it should rather funcall
       `syntax-begin-function' wrapped in a `save-match-data'.
       Whatever the decision, please document it.

Thank you!

In GNU Emacs 23.0.91.1 (i686-pc-linux-gnu, GTK+ Version 2.12.9)
 of 2009-02-27 on thaleron
Windowing system distributor `The X.Org Foundation', version 11.0.10400090
configured using `configure  '--prefix=/home/tcr/software/emacs-cvs' '--with-x-toolkit=gtk' '--without-gpm' '--with-x' '--without-xpm' '--enable-asserts' 'CFLAGS=-g''

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: Lisp Interaction

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

Recent input:
<down> <return> C-x b * <backspace> <return> C-y C-M-x 
C-j <up> <up> <up> <right> <right> <right> <right> 
<right> <right> <right> M-d s a v e - m a t c h - d 
a t a C-e <down> C-j <up> <up> <right> <right> <right> 
<right> <right> <right> <right> <up> C-M-k r <backspace> 
p r o g n M-x r e p o r t - e m a c s - b u g <ret
urn>

Recent messages:
Loading /home/tcr/.emacs.d/config/lisp-config.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
nil

-- 
Diese Nachricht wurde auf Viren und andere gefaerliche Inhalte untersucht
und ist - aktuelle Virenscanner vorausgesetzt - sauber.
Freebits E-Mail Virus Scanner