[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/ibuffer.el
From: |
Colin Walters |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/ibuffer.el |
Date: |
Sat, 13 Apr 2002 21:50:57 -0400 |
Index: emacs/lisp/ibuffer.el
diff -c emacs/lisp/ibuffer.el:1.17 emacs/lisp/ibuffer.el:1.18
*** emacs/lisp/ibuffer.el:1.17 Thu Apr 11 14:37:25 2002
--- emacs/lisp/ibuffer.el Sat Apr 13 21:50:57 2002
***************
*** 826,833 ****
(when (or (eobp)
(get-text-property (point) 'ibuffer-summary))
(goto-char (point-min)))
! (while (get-text-property (point) 'ibuffer-title)
! (forward-line 1))
(if (< arg 0)
(ibuffer-backward-line (- arg))
(while (> arg 0)
--- 826,836 ----
(when (or (eobp)
(get-text-property (point) 'ibuffer-summary))
(goto-char (point-min)))
! (when (get-text-property (point) 'ibuffer-title)
! (if (> arg 0)
! (decf arg))
! (while (get-text-property (point) 'ibuffer-title)
! (forward-line 1)))
(if (< arg 0)
(ibuffer-backward-line (- arg))
(while (> arg 0)
***************
*** 1006,1012 ****
(defun ibuffer-buffer-names-with-mark (mark)
(let ((ibuffer-buffer-names-with-mark-result nil))
(ibuffer-map-lines-nomodify
! #'(lambda (buf mk beg end)
(when (char-equal mark mk)
(push (buffer-name buf)
ibuffer-buffer-names-with-mark-result))))
--- 1009,1015 ----
(defun ibuffer-buffer-names-with-mark (mark)
(let ((ibuffer-buffer-names-with-mark-result nil))
(ibuffer-map-lines-nomodify
! #'(lambda (buf mk)
(when (char-equal mark mk)
(push (buffer-name buf)
ibuffer-buffer-names-with-mark-result))))
***************
*** 1021,1035 ****
(defun ibuffer-count-marked-lines (&optional all)
(if all
(ibuffer-map-lines-nomodify
! #'(lambda (buf mark beg end)
(not (char-equal mark ? ))))
(ibuffer-map-lines-nomodify
! #'(lambda (buf mark beg end)
(char-equal mark ibuffer-marked-char)))))
(defsubst ibuffer-count-deletion-lines ()
(ibuffer-map-lines-nomodify
! #'(lambda (buf mark beg end)
(char-equal mark ibuffer-deletion-char))))
(defsubst ibuffer-map-deletion-lines (func)
--- 1024,1038 ----
(defun ibuffer-count-marked-lines (&optional all)
(if all
(ibuffer-map-lines-nomodify
! #'(lambda (buf mark)
(not (char-equal mark ? ))))
(ibuffer-map-lines-nomodify
! #'(lambda (buf mark)
(char-equal mark ibuffer-marked-char)))))
(defsubst ibuffer-count-deletion-lines ()
(ibuffer-map-lines-nomodify
! #'(lambda (buf mark)
(char-equal mark ibuffer-deletion-char))))
(defsubst ibuffer-map-deletion-lines (func)
***************
*** 1095,1111 ****
(cond
((char-equal mark ibuffer-marked-char)
(ibuffer-map-marked-lines
! #'(lambda (buf mark beg end)
(ibuffer-set-mark-1 ? )
t)))
((char-equal mark ibuffer-deletion-char)
(ibuffer-map-deletion-lines
! #'(lambda (buf mark beg end)
(ibuffer-set-mark-1 ? )
t)))
(t
(ibuffer-map-lines
! #'(lambda (buf mark beg end)
(when (not (char-equal mark ? ))
(ibuffer-set-mark-1 ? ))
t)))))
--- 1098,1114 ----
(cond
((char-equal mark ibuffer-marked-char)
(ibuffer-map-marked-lines
! #'(lambda (buf mark)
(ibuffer-set-mark-1 ? )
t)))
((char-equal mark ibuffer-deletion-char)
(ibuffer-map-deletion-lines
! #'(lambda (buf mark)
(ibuffer-set-mark-1 ? )
t)))
(t
(ibuffer-map-lines
! #'(lambda (buf mark)
(when (not (char-equal mark ? ))
(ibuffer-set-mark-1 ? ))
t)))))
***************
*** 1118,1124 ****
(interactive)
(let ((count
(ibuffer-map-lines
! #'(lambda (buf mark beg end)
(cond ((eq mark ibuffer-marked-char)
(ibuffer-set-mark-1 ? )
nil)
--- 1121,1127 ----
(interactive)
(let ((count
(ibuffer-map-lines
! #'(lambda (buf mark)
(cond ((eq mark ibuffer-marked-char)
(ibuffer-set-mark-1 ? )
nil)
***************
*** 1596,1604 ****
(defun ibuffer-map-on-mark (mark func)
(ibuffer-map-lines
! #'(lambda (buf mk beg end)
(if (char-equal mark mk)
! (funcall func buf mark beg end)
nil))))
(defun ibuffer-map-lines (function &optional nomodify)
--- 1599,1607 ----
(defun ibuffer-map-on-mark (mark func)
(ibuffer-map-lines
! #'(lambda (buf mk)
(if (char-equal mark mk)
! (funcall func buf mark)
nil))))
(defun ibuffer-map-lines (function &optional nomodify)
***************
*** 1608,1658 ****
FUNCTION is called with four arguments: the buffer object itself, the
current mark symbol, and the beginning and ending line positions."
(assert (eq major-mode 'ibuffer-mode))
! (let ((curline (count-lines (point-min)
! (line-beginning-position)))
! (deleted-lines-count 0)
(ibuffer-map-lines-total 0)
(ibuffer-map-lines-count 0))
(unwind-protect
! (progn
! (setq buffer-read-only nil)
! (goto-char (point-min))
! (while (and (get-text-property (point) 'ibuffer-title)
! (not (eobp)))
! (forward-line 1))
! (while (and (not (eobp))
! (not (get-text-property (point) 'ibuffer-summary)))
! (let ((result
! (if (buffer-live-p (ibuffer-current-buffer))
! (save-excursion
! (funcall function
! (ibuffer-current-buffer)
! (ibuffer-current-mark)
! (line-beginning-position)
! (1+ (line-end-position))))
! ;; Kill the line if the buffer is dead
! 'kill)))
! ;; A given mapping function should return:
! ;; `nil' if it chose not to affect the buffer
! ;; `kill' means the remove line from the buffer list
! ;; `t' otherwise
! (incf ibuffer-map-lines-total)
! (cond ((null result)
! (forward-line 1))
! ((eq result 'kill)
! (delete-region (line-beginning-position)
! (1+ (line-end-position)))
! (incf deleted-lines-count)
! (incf ibuffer-map-lines-count))
! (t
! (incf ibuffer-map-lines-count)
! (forward-line 1)))))
! ibuffer-map-lines-count)
(progn
(setq buffer-read-only t)
(unless nomodify
(set-buffer-modified-p nil))
! (goto-line (- (1+ curline) deleted-lines-count))))))
(defun ibuffer-get-marked-buffers ()
"Return a list of buffer objects currently marked."
--- 1611,1664 ----
FUNCTION is called with four arguments: the buffer object itself, the
current mark symbol, and the beginning and ending line positions."
(assert (eq major-mode 'ibuffer-mode))
! (let ((orig-target-line (count-lines (point-min)
! (line-beginning-position)))
! (target-buf-count 0)
(ibuffer-map-lines-total 0)
(ibuffer-map-lines-count 0))
(unwind-protect
! (progn
! (setq buffer-read-only nil)
! (goto-char (point-min))
! (ibuffer-forward-line 0)
! (setq orig-target-line (1+ (- orig-target-line
! (count-lines (point-min) (point))))
! target-buf-count orig-target-line)
! (while (and (not (eobp))
! (not (get-text-property (point) 'ibuffer-summary)))
! (let ((result
! (if (buffer-live-p (ibuffer-current-buffer))
! (save-excursion
! (funcall function
! (ibuffer-current-buffer)
! (ibuffer-current-mark)))
! ;; Kill the line if the buffer is dead
! 'kill)))
! ;; A given mapping function should return:
! ;; `nil' if it chose not to affect the buffer
! ;; `kill' means the remove line from the buffer list
! ;; `t' otherwise
! (incf ibuffer-map-lines-total)
! (cond ((null result)
! (forward-line 1))
! ((eq result 'kill)
! (delete-region (line-beginning-position)
! (1+ (line-end-position)))
! (incf ibuffer-map-lines-count)
! (when (< ibuffer-map-lines-total
! orig-target-line)
! (decf target-buf-count)))
! (t
! (incf ibuffer-map-lines-count)
! (forward-line 1)))))
! ibuffer-map-lines-count)
(progn
(setq buffer-read-only t)
(unless nomodify
(set-buffer-modified-p nil))
! (goto-char (point-min))
! (ibuffer-forward-line 0)
! (ibuffer-forward-line (1- target-buf-count))))))
(defun ibuffer-get-marked-buffers ()
"Return a list of buffer objects currently marked."
***************
*** 1662,1682 ****
(car e)))
(ibuffer-current-state-list))))
! (defun ibuffer-current-state-list (&optional include-lines)
! "Return a list like (BUF . MARK) of all buffers in an ibuffer.
! If optional argument INCLUDE-LINES is non-nil, return a list like
! (BUF MARK BEGPOS)."
(let ((ibuffer-current-state-list-tmp '()))
;; ah, if only we had closures. I bet this will mysteriously
;; break later. Don't blame me.
(ibuffer-map-lines-nomodify
! (if include-lines
! #'(lambda (buf mark beg end)
! (when (buffer-live-p buf)
! (push (list buf mark beg) ibuffer-current-state-list-tmp)))
! #'(lambda (buf mark beg end)
! (when (buffer-live-p buf)
! (push (cons buf mark) ibuffer-current-state-list-tmp)))))
(nreverse ibuffer-current-state-list-tmp)))
(defun ibuffer-current-buffers-with-marks (curbufs)
--- 1668,1682 ----
(car e)))
(ibuffer-current-state-list))))
! (defun ibuffer-current-state-list ()
! "Return a list like (BUF . MARK) of all buffers in an ibuffer."
(let ((ibuffer-current-state-list-tmp '()))
;; ah, if only we had closures. I bet this will mysteriously
;; break later. Don't blame me.
(ibuffer-map-lines-nomodify
! #'(lambda (buf mark)
! (when (buffer-live-p buf)
! (push (cons buf mark) ibuffer-current-state-list-tmp))))
(nreverse ibuffer-current-state-list-tmp)))
(defun ibuffer-current-buffers-with-marks (curbufs)
***************
*** 1867,1872 ****
--- 1867,1873 ----
If SILENT is non-`nil', do not generate progress messages."
(interactive)
+ (ibuffer-forward-line 0)
(unless silent
(message "Redisplaying current buffer list..."))
(let ((blist (ibuffer-current-state-list)))
***************
*** 1878,1884 ****
(ibuffer-insert-buffers-and-marks blist t)
(ibuffer-update-mode-name)
(unless silent
! (message "Redisplaying current buffer list...done"))))
(defun ibuffer-update (arg &optional silent)
"Regenerate the list of all buffers.
--- 1879,1886 ----
(ibuffer-insert-buffers-and-marks blist t)
(ibuffer-update-mode-name)
(unless silent
! (message "Redisplaying current buffer list...done"))
! (ibuffer-forward-line 0)))
(defun ibuffer-update (arg &optional silent)
"Regenerate the list of all buffers.
***************
*** 1888,1893 ****
--- 1890,1896 ----
Do not display messages if SILENT is non-nil."
(interactive "P")
+ (ibuffer-forward-line 0)
(let* ((bufs (buffer-list))
(blist (ibuffer-filter-buffers
(current-buffer)
- [Emacs-diffs] Changes to emacs/lisp/ibuffer.el, Colin Walters, 2002/04/10
- [Emacs-diffs] Changes to emacs/lisp/ibuffer.el, Colin Walters, 2002/04/11
- [Emacs-diffs] Changes to emacs/lisp/ibuffer.el,
Colin Walters <=
- [Emacs-diffs] Changes to emacs/lisp/ibuffer.el, Colin Walters, 2002/04/17
- [Emacs-diffs] Changes to emacs/lisp/ibuffer.el, Colin Walters, 2002/04/23
- [Emacs-diffs] Changes to emacs/lisp/ibuffer.el, Colin Walters, 2002/04/24
- [Emacs-diffs] Changes to emacs/lisp/ibuffer.el, Colin Walters, 2002/04/25
- [Emacs-diffs] Changes to emacs/lisp/ibuffer.el, Colin Walters, 2002/04/25
- [Emacs-diffs] Changes to emacs/lisp/ibuffer.el, Colin Walters, 2002/04/28