emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

find-file-noselect needs save-match-data


From: Herbert Euler
Subject: find-file-noselect needs save-match-data
Date: Mon, 04 Jun 2007 23:17:19 +0800

If `find-file-noselect' is without `save-match-data', there will be a
bug when `type-break-mode' is turned on.  To reproduce the bug, start
emacs with the -Q option and execute the following expressions:

(type-break-mode 1)
(setq s "This is a sentence")
(string-match "sen" s)
(substring s (match-beginning 0) (match-end 0))

The following patch helps understanding where is wrong:

*** files.el.~1.666.2.82.~      2007-06-04 23:06:41.000000000 -0400
--- files.el    2007-06-04 23:07:29.000000000 -0400
***************
*** 1422,1427 ****
--- 1422,1428 ----
 and visit all the matching files.  When wildcards are actually
 used and expanded, return a list of buffers that are visiting
 the various files."
+   (save-match-data
   (setq filename
       (abbreviate-file-name
        (expand-file-name filename)))
***************
*** 1593,1599 ****
         (setq buf (create-file-buffer filename))
         ;; find-file-noselect-1 may use a different buffer.
         (find-file-noselect-1 buf filename nowarn
!                               rawfile truename number))))))

 (defun find-file-noselect-1 (buf filename nowarn rawfile truename number)
   (let (error)
--- 1594,1600 ----
         (setq buf (create-file-buffer filename))
         ;; find-file-noselect-1 may use a different buffer.
         (find-file-noselect-1 buf filename nowarn
!                               rawfile truename number)))))))

 (defun find-file-noselect-1 (buf filename nowarn rawfile truename number)
   (let (error)

To make the patch short, many lines that should be re-indented are
left as they were.

Regards,
Guanpeng Xu

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]