emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/bs.el,v


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/lisp/bs.el,v
Date: Thu, 11 Oct 2007 16:09:34 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Juanma Barranquero <lektu>      07/10/11 16:09:34

Index: bs.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/bs.el,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- bs.el       9 Oct 2007 08:52:45 -0000       1.35
+++ bs.el       11 Oct 2007 16:09:34 -0000      1.36
@@ -864,35 +864,32 @@
   (bs--set-window-height)
   (bs--show-config-message what))
 
+(defun bs--mark-unmark (count fun)
+  "Call FUN on COUNT consecutive buffers of *buffer-selection*."
+  (let ((dir (if (> count 0) 1 -1)))
+    (dotimes (i (abs count))
+      (let ((buffer (bs--current-buffer)))
+       (when buffer (funcall fun buffer))
+       (bs--update-current-line)
+       (bs-down dir)))))
+
 (defun bs-mark-current (count)
   "Mark buffers.
 COUNT is the number of buffers to mark.
 Move cursor vertically down COUNT lines."
   (interactive "p")
-  (let ((dir (if (> count 0) 1 -1))
-       (count (abs count)))
-    (while (> count 0)
-      (let ((buffer (bs--current-buffer)))
-       (if buffer
-           (setq bs--marked-buffers (cons buffer bs--marked-buffers)))
-       (bs--update-current-line)
-       (bs-down dir))
-      (setq count (1- count)))))
+  (bs--mark-unmark count
+                  (lambda (buf)
+                    (add-to-list 'bs--marked-buffers buf))))
 
 (defun bs-unmark-current (count)
   "Unmark buffers.
 COUNT is the number of buffers to unmark.
 Move cursor vertically down COUNT lines."
   (interactive "p")
-  (let ((dir (if (> count 0) 1 -1))
-       (count (abs count)))
-    (while (> count 0)
-      (let ((buffer (bs--current-buffer)))
-       (if buffer
-           (setq bs--marked-buffers (delq buffer bs--marked-buffers)))
-       (bs--update-current-line)
-       (bs-down dir))
-      (setq count (1- count)))))
+  (bs--mark-unmark count
+                  (lambda (buf)
+                    (setq bs--marked-buffers (delq buf bs--marked-buffers)))))
 
 (defun bs--show-config-message (what)
   "Show message indicating the new showing status WHAT.




reply via email to

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