]> code.delx.au - gnu-emacs/commitdiff
* ibuffer.el (ibuffer-mode): If `show-paren-mode' is enabled,
authorJohn Paul Wallington <jpw@pobox.com>
Mon, 9 Dec 2002 23:46:12 +0000 (23:46 +0000)
committerJohn Paul Wallington <jpw@pobox.com>
Mon, 9 Dec 2002 23:46:12 +0000 (23:46 +0000)
disable it buffer-locally.
(ibuffer-mouse-popup-menu): Use `=' instead of `eq' to compare
`eventpt' and point.

* ibuf-ext.el (ibuffer-remove-duplicates): New function.
(ibuffer-set-filter-groups-by-mode): Use it instead of
`delete-duplicates' so we don't require cl library at runtime.
(ibuffer-insert-filter-group-before): Don't use `position' so we
don't require cl library at runtime.

* chistory.el (command-history-mode): Add interactive spec.
Improve doc string.

lisp/ChangeLog
lisp/chistory.el
lisp/ibuf-ext.el
lisp/ibuffer.el

index 27db4bafca44b920508f03a966ca778f0d99f7a6..9316a030e6ca46e9312739f1fd1e882d365bd3e3 100644 (file)
@@ -1,3 +1,19 @@
+2002-12-09  John Paul Wallington  <jpw@shootybangbang.com>
+
+       * ibuffer.el (ibuffer-mode): If `show-paren-mode' is enabled,
+       disable it buffer-locally.
+       (ibuffer-mouse-popup-menu): Use `=' instead of `eq' to compare
+       `eventpt' and point.
+
+       * ibuf-ext.el (ibuffer-remove-duplicates): New function.
+       (ibuffer-set-filter-groups-by-mode): Use it instead of
+       `delete-duplicates' so we don't require cl library at runtime.
+       (ibuffer-insert-filter-group-before): Don't use `position' so we
+       don't require cl library at runtime.
+
+       * chistory.el (command-history-mode): Add interactive spec.
+       Improve doc string.
+
 2002-12-09  Richard M. Stallman  <rms@gnu.org>
 
        * isearch.el (isearch-no-upper-case-p): \\ only quotes one character.
index 56fef3712e0a9b400d358bc72b6b451c99c6ef11..aae1d728ee715b86509351767e393723b62d29c4 100644 (file)
@@ -126,7 +126,11 @@ The buffer is left in Command History mode."
        (command-history-mode)))))
 
 (defun command-history-mode ()
-  "Major mode for listing and repeating recent commands."
+  "Major mode for listing and repeating recent commands.
+
+Keybindings:
+\\{command-history-map}"
+  (interactive)
   (Command-history-setup)
   (setq major-mode 'command-history-mode)
   (setq mode-name "Command History")
index 19389abf984da267d1d065e17f9fd29b134934c6..c568f2c3fe729540df39395a81a4bc01b9a12320 100644 (file)
       (setq alist (delete entry alist)))
     alist))
 
+;; borrowed from Gnus
+(defun ibuffer-remove-duplicates (list)
+  "Return a copy of LIST with duplicate elements removed."
+  (let ((new nil)
+       (tail list))
+    (while tail
+      (or (member (car tail) new)
+         (setq new (cons (car tail) new)))
+      (setq tail (cdr tail)))
+    (nreverse new)))
+
 (defun ibuffer-split-list (ibuffer-split-list-fn ibuffer-split-list-elts)
   (let ((hip-crowd nil)
        (lamers nil))
@@ -545,7 +556,7 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'."
         (mapcar (lambda (mode)
                   (cons (format "%s" mode) `((mode . ,mode))))
                 (let ((modes
-                       (delete-duplicates
+                       (ibuffer-remove-duplicates
                         (mapcar (lambda (buf) (with-current-buffer buf major-mode))
                                 (buffer-list)))))
                   (if ibuffer-view-ibuffer
@@ -646,13 +657,20 @@ See also `ibuffer-kill-filter-group'."
               #'kill-line arg)))
 
 (defun ibuffer-insert-filter-group-before (newgroup group)
-  (let ((pos (or (position group (mapcar #'car ibuffer-filter-groups)
-                          :test #'equal)
-                (length ibuffer-filter-groups))))
-    (cond ((<= pos 0)
-          (push newgroup ibuffer-filter-groups))
-         ((= pos (length ibuffer-filter-groups))
+  (let* ((found nil)
+        (pos (let ((groups (mapcar #'car ibuffer-filter-groups))
+                   (res 0))
+               (while groups
+                 (if (equal (car groups) group)
+                     (setq found t
+                           groups nil)
+                   (incf res)
+                   (setq groups (cdr groups))))
+               res)))
+    (cond ((not found)
           (setq ibuffer-filter-groups (nconc ibuffer-filter-groups (list newgroup))))
+         ((zerop pos)
+          (push newgroup ibuffer-filter-groups))
          (t
           (let ((cell (nthcdr pos ibuffer-filter-groups)))
             (setf (cdr cell) (cons (car cell) (cdr cell)))
index 3838212b3041fe7b9d10cf384ec652a480dd5e4d..0fa9207bf54c1e7e27225c37b6bd464bff46a8ed 100644 (file)
@@ -883,7 +883,7 @@ width and the longest string in LIST."
             (save-excursion
               (popup-menu ibuffer-mode-operate-map)))))
       (setq buffer-read-only t)
-      (if (eq eventpt (point))
+      (if (= eventpt (point))
          (goto-char origpt)))))
 
 (defun ibuffer-skip-properties (props direction)
@@ -2387,6 +2387,9 @@ will be inserted before the group at point."
   ;; This makes things less ugly for Emacs 21 users with a non-nil
   ;; `show-trailing-whitespace'.
   (setq show-trailing-whitespace nil)
+  ;; disable `show-paren-mode' buffer-locally
+  (if (bound-and-true-p show-paren-mode)
+      (set (make-local-variable 'show-paren-mode) nil))
   (set (make-local-variable 'revert-buffer-function)
        #'ibuffer-update)
   (set (make-local-variable 'ibuffer-sorting-mode)