The following patch solves the problem of losing the value of
match-data when you change buffers while the gutter/tabs are visible.
As a demonstration of the problem, consider the output from the
following xemacs (21.2.22) "one-liners":
$ xemacs -vanilla -batch -eval '
(let (x y)
(setq gutter-visible-p (set-specifier default-gutter-visible-p nil))
(insert "foo")
(beginning-of-line)
(re-search-forward "foo")
(setq x (match-data t))
(split-window-vertically)
(other-window 1)
(setq y (match-data t))
(message "%s %s" x y))'
(1 4) (1 4)
$ xemacs -vanilla -batch -eval '
(let (x y)
(insert "foo")
(beginning-of-line)
(re-search-forward "foo")
(setq x (match-data t))
(split-window-vertically)
(other-window 1)
(setq y (match-data t))
(message "%s %s" x y))'
(1 4) (0 1)
The patch simply wraps the buffers-tab-items in a save-match-data.
-Mark
1999-12-02 Mark Thomas <mthomas(a)jprc.com>
* gutter-items.el (buffers-tab-items): Wrap the function in a
save-match-data
--- gutter-items.el Fri Oct 15 06:11:40 1999
+++ gutter-items.el.patched Thu Dec 2 19:08:30 1999
@@ -205,24 +205,25 @@
efficiency reasons. You can control how many buffers will be shown by
setting `buffers-tab-max-size'. You can control the text of the tab
items by redefining the function `format-buffers-menu-line'."
- (let* ((buffers (delete-if buffers-tab-omit-function (buffer-list frame)))
- (first-buf (car buffers)))
- ;; if we're in deletion ignore the current buffer
- (when in-deletion
- (setq buffers (delq (current-buffer) buffers))
- (setq first-buf (car buffers)))
- ;; group buffers by mode
- (when buffers-tab-selection-function
- (delete-if-not #'(lambda (buf)
- (funcall buffers-tab-selection-function
- first-buf buf)) buffers))
- (and (integerp buffers-tab-max-size)
- (> buffers-tab-max-size 1)
- (> (length buffers) buffers-tab-max-size)
- ;; shorten list of buffers
- (setcdr (nthcdr buffers-tab-max-size buffers) nil))
- (setq buffers (build-buffers-tab-internal buffers))
- buffers))
+ (save-match-data
+ (let* ((buffers (delete-if buffers-tab-omit-function (buffer-list frame)))
+ (first-buf (car buffers)))
+ ;; if we're in deletion ignore the current buffer
+ (when in-deletion
+ (setq buffers (delq (current-buffer) buffers))
+ (setq first-buf (car buffers)))
+ ;; group buffers by mode
+ (when buffers-tab-selection-function
+ (delete-if-not #'(lambda (buf)
+ (funcall buffers-tab-selection-function
+ first-buf buf)) buffers))
+ (and (integerp buffers-tab-max-size)
+ (> buffers-tab-max-size 1)
+ (> (length buffers) buffers-tab-max-size)
+ ;; shorten list of buffers
+ (setcdr (nthcdr buffers-tab-max-size buffers) nil))
+ (setq buffers (build-buffers-tab-internal buffers))
+ buffers)))
(defun add-tab-to-gutter ()
"Put a tab control in the gutter area to hold the most recent buffers."