diff options
| author | Luc Teirlinck | 2005-05-25 15:50:44 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2005-05-25 15:50:44 +0000 |
| commit | 3f9c9ff71d5584b45f82c94cc09d44167750673c (patch) | |
| tree | 4f6854962faddec13ab2edad3658eaf77c0168c7 | |
| parent | dd53d2c82ee07486c71c3d493e812796d83df645 (diff) | |
| download | emacs-3f9c9ff71d5584b45f82c94cc09d44167750673c.tar.gz emacs-3f9c9ff71d5584b45f82c94cc09d44167750673c.zip | |
(Buffer-menu-revert-function): Improve handling of point after reverting.
(Buffer-menu-make-sort-button): Handle the case where
Buffer-menu-use-header-line is nil.
| -rw-r--r-- | lisp/buff-menu.el | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 326fc54252b..e2ffe9f197d 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el | |||
| @@ -203,17 +203,21 @@ Letters do not insert themselves; instead, they are commands. | |||
| 203 | (or (eq buffer-undo-list t) | 203 | (or (eq buffer-undo-list t) |
| 204 | (setq buffer-undo-list nil)) | 204 | (setq buffer-undo-list nil)) |
| 205 | ;; We can not use save-excursion here. The buffer gets erased. | 205 | ;; We can not use save-excursion here. The buffer gets erased. |
| 206 | (let ((ocol (current-column)) | 206 | (let ((opoint (point)) |
| 207 | (eobp (eobp)) | ||
| 208 | (ocol (current-column)) | ||
| 207 | (oline (progn (move-to-column 4) | 209 | (oline (progn (move-to-column 4) |
| 208 | (get-text-property (point) 'buffer))) | 210 | (get-text-property (point) 'buffer))) |
| 209 | (prop (point-min)) | 211 | (prop (point-min)) |
| 210 | ;; do not make undo records for the reversion. | 212 | ;; do not make undo records for the reversion. |
| 211 | (buffer-undo-list t)) | 213 | (buffer-undo-list t)) |
| 212 | (list-buffers-noselect Buffer-menu-files-only) | 214 | (list-buffers-noselect Buffer-menu-files-only) |
| 213 | (while (setq prop (next-single-property-change prop 'buffer)) | 215 | (if oline |
| 214 | (when (eq (get-text-property prop 'buffer) oline) | 216 | (while (setq prop (next-single-property-change prop 'buffer)) |
| 215 | (goto-char prop) | 217 | (when (eq (get-text-property prop 'buffer) oline) |
| 216 | (move-to-column ocol))))) | 218 | (goto-char prop) |
| 219 | (move-to-column ocol))) | ||
| 220 | (goto-char (if eobp (point-max) opoint))))) | ||
| 217 | 221 | ||
| 218 | (defun Buffer-menu-toggle-files-only (arg) | 222 | (defun Buffer-menu-toggle-files-only (arg) |
| 219 | "Toggle whether the current buffer-menu displays only file buffers. | 223 | "Toggle whether the current buffer-menu displays only file buffers. |
| @@ -633,15 +637,29 @@ For more information, see the function `buffer-menu'." | |||
| 633 | (if (equal column Buffer-menu-sort-column) (setq column nil)) | 637 | (if (equal column Buffer-menu-sort-column) (setq column nil)) |
| 634 | (propertize name | 638 | (propertize name |
| 635 | 'help-echo (if column | 639 | 'help-echo (if column |
| 636 | (concat "mouse-2: sort by " (downcase name)) | 640 | (if Buffer-menu-use-header-line |
| 637 | "mouse-2: sort by visited order") | 641 | (concat "mouse-2: sort by " (downcase name)) |
| 642 | (concat "mouse-2, RET: sort by " | ||
| 643 | (downcase name))) | ||
| 644 | (if Buffer-menu-use-header-line | ||
| 645 | "mouse-2: sort by visited order" | ||
| 646 | "mouse-2, RET: sort by visited order")) | ||
| 638 | 'mouse-face 'highlight | 647 | 'mouse-face 'highlight |
| 639 | 'keymap (let ((map (make-sparse-keymap))) | 648 | 'keymap (let ((map (make-sparse-keymap))) |
| 640 | (define-key map [header-line mouse-2] | 649 | (if Buffer-menu-use-header-line |
| 641 | `(lambda (e) | 650 | (define-key map [header-line mouse-2] |
| 642 | (interactive "e") | 651 | `(lambda (e) |
| 643 | (save-window-excursion | 652 | (interactive "e") |
| 653 | (save-window-excursion | ||
| 654 | (if e (mouse-select-window e)) | ||
| 655 | (Buffer-menu-sort ,column)))) | ||
| 656 | (define-key map [mouse-2] | ||
| 657 | `(lambda (e) | ||
| 658 | (interactive "e") | ||
| 644 | (if e (mouse-select-window e)) | 659 | (if e (mouse-select-window e)) |
| 660 | (Buffer-menu-sort ,column))) | ||
| 661 | (define-key map "\C-m" | ||
| 662 | `(lambda () (interactive) | ||
| 645 | (Buffer-menu-sort ,column)))) | 663 | (Buffer-menu-sort ,column)))) |
| 646 | map))) | 664 | map))) |
| 647 | 665 | ||