APPROVE COMMIT
2002-02-24 John Paul Wallington <jpw(a)xemacs.org>
* ibuffer.el: (ibuffer-button-1): new variable.
(ibuffer-button-2): ditto.
(ibuffer-name-map): use them.
(ibuffer-mode-name-map): use ibuffer-button-2.
[also tidy up whitespace]
Index: ibuffer.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/ibuffer/ibuffer.el,v
retrieving revision 1.15
diff -u -r1.15 ibuffer.el
--- ibuffer.el 2002/02/24 03:28:59 1.15
+++ ibuffer.el 2002/02/24 05:53:34
@@ -82,6 +82,15 @@
(t
(error "Couldn't make a suitable definition of
`ibuffer-event-position'")))
+ ;; Mouse events have different names.
+ (if (or (featurep 'xemacs)
+ (string-match "XEmacs\\|Lucid" (emacs-version)))
+ (progn
+ (defvar ibuffer-button-1 [button1])
+ (defvar ibuffer-button-2 [button2]))
+ (defvar ibuffer-button-1 [mouse-1])
+ (defvar ibuffer-button-2 [mouse-2]))
+
(cond ((fboundp 'posn-window)
;; Emacs
(defun ibuffer-event-window (event)
@@ -92,7 +101,7 @@
(event-window event)))
(t
(error "Couldn't make a suitable definition of
`ibuffer-event-window'")))
-
+
(if (fboundp 'line-beginning-position)
(defalias 'ibuffer-line-beginning-position 'line-beginning-position)
(defun ibuffer-line-beginning-position ()
@@ -130,7 +139,7 @@
(let ((end (with-current-buffer buf (point-max))))
(while (not (pos-visible-in-window-p end))
(enlarge-window 1)))))))
-
+
(if (fboundp 'replace-regexp-in-string)
(defalias 'ibuffer-replace-regexp-in-string 'replace-regexp-in-string)
(defun ibuffer-replace-regexp-in-string (regexp rep string &optional
@@ -203,8 +212,8 @@
(setq ibuffer-buffer-display-time (current-time)))))))
(add-hook 'buffer-list-changed-hook 'ibuffer-track-buffers 'append))
-
+
;;;###autoload
(defgroup ibuffer nil
"An advanced replacement for `buffer-menu'.
@@ -675,7 +684,7 @@
(define-key map (kbd "C-d") 'ibuffer-mark-for-delete-backwards)
(define-key map (kbd "k") 'ibuffer-mark-for-delete)
(define-key map (kbd "x") 'ibuffer-do-kill-on-deletion-marks)
-
+
;; immediate operations
(define-key map (kbd "n") 'ibuffer-forward-line)
(define-key map (kbd "SPC") 'forward-line)
@@ -713,7 +722,7 @@
(define-key map (kbd "/ TAB") 'ibuffer-exchange-filters)
(define-key map (kbd "/ o") 'ibuffer-or-filter)
(define-key map (kbd "/ /") 'ibuffer-filter-disable)
-
+
(define-key map (kbd "q") 'ibuffer-quit)
(define-key map (kbd "h") 'describe-mode)
(define-key map (kbd "?") 'describe-mode)
@@ -721,7 +730,7 @@
(define-key map (kbd "% n") 'ibuffer-mark-by-name-regexp)
(define-key map (kbd "% m") 'ibuffer-mark-by-mode-regexp)
(define-key map (kbd "% f") 'ibuffer-mark-by-file-name-regexp)
-
+
(define-key map (kbd "C-t") 'ibuffer-visit-tags-table)
(define-key map (kbd "|") 'ibuffer-do-shell-command-pipe)
@@ -747,7 +756,7 @@
(define-key map (kbd "V") 'ibuffer-do-revert)
(define-key map (kbd "W") 'ibuffer-do-view-and-eval)
(define-key map (kbd "X") 'ibuffer-do-shell-command-pipe)
-
+
(define-key map (kbd "k") 'ibuffer-do-kill-lines)
(define-key map (kbd "w") 'ibuffer-copy-filename-as-kill)
@@ -763,16 +772,16 @@
(define-key map (kbd "C-c C-a") 'ibuffer-auto-mode)
(define-key map (kbd "C-x 4 RET") 'ibuffer-visit-buffer-other-window)
(define-key map (kbd "C-x 5 RET") 'ibuffer-visit-buffer-other-frame)
-
+
(setq ibuffer-mode-map map))
)
-
+
(defvar ibuffer-name-map nil)
(unless ibuffer-name-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map ibuffer-mode-map)
- (define-key map [button1] 'ibuffer-mouse-toggle-mark)
- (define-key map [button2] 'ibuffer-mouse-visit-buffer)
+ (define-key map ibuffer-button-1 'ibuffer-mouse-toggle-mark)
+ (define-key map ibuffer-button-2 'ibuffer-mouse-visit-buffer)
(define-key map [down-mouse-3] 'ibuffer-mouse-popup-menu)
(setq ibuffer-name-map map)))
@@ -780,7 +789,7 @@
(unless ibuffer-mode-name-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map ibuffer-mode-map)
- (define-key map [button2] 'ibuffer-mouse-filter-by-mode)
+ (define-key map ibuffer-button-2 'ibuffer-mouse-filter-by-mode)
(define-key map (kbd "RET") 'ibuffer-interactive-filter-by-mode)
(setq ibuffer-mode-name-map map)))
@@ -1470,7 +1479,7 @@
elide nil))
(list sym min max align elide)))
form))
-
+
(defun ibuffer-compile-make-eliding-form (strvar elide from-end-p)
(let ((ellipsis (if ibuffer-use-fontification
(ibuffer-propertize ibuffer-eliding-string 'face 'bold)
@@ -1889,7 +1898,7 @@
(funcall pred buf))
(setq hit t)))
hit))
-
+
(defun ibuffer-filter-buffers (ibuffer-buf last bmarklist all)
(let ((ext-loaded (featurep 'ibuf-ext)))
(delq nil
@@ -2348,8 +2357,8 @@
;; This makes things less ugly for Emacs 21 users with a non-nil
;; `show-trailing-whitespace'.
(if (boundp 'show-trailing-whitespace)
- (setq show-trailing-whitespace nil))
-
+ (setq show-trailing-whitespace nil))
+
;; This should be nicer
(set (make-local-variable 'font-lock-defaults) nil)
(set (make-local-variable 'font-lock-fontify-region-function)
--
John Paul Wallington