diff options
| author | Juanma Barranquero | 2006-01-31 16:32:00 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2006-01-31 16:32:00 +0000 |
| commit | ca6b8248f7adfee9d9035e9866d3e0e2b86f15f7 (patch) | |
| tree | 98c33cd694995f78c76d880474f327ff7e841dd7 | |
| parent | 448541bcd937b7fe28b5b61343cd3b7149f43ef6 (diff) | |
| download | emacs-ca6b8248f7adfee9d9035e9866d3e0e2b86f15f7.tar.gz emacs-ca6b8248f7adfee9d9035e9866d3e0e2b86f15f7.zip | |
Allow non-default values of `bs-header-lines-length'.
(bs--running-in-xemacs): Remove (not used anymore).
(bs--set-window-height): Simplify by using `fit-window-to-buffer' instead of
`shrink-window', thus avoiding having to compute the height of the window.
(bs--up): Wrap around even when there's no header.
(bs--down): Use `forward-line' instead of `next-line'.
| -rw-r--r-- | lisp/bs.el | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/lisp/bs.el b/lisp/bs.el index 464f6086a04..bdeb00f5804 100644 --- a/lisp/bs.el +++ b/lisp/bs.el | |||
| @@ -180,9 +180,6 @@ return a string representing the column's value." | |||
| 180 | :group 'bs-appearance | 180 | :group 'bs-appearance |
| 181 | :type '(repeat sexp)) | 181 | :type '(repeat sexp)) |
| 182 | 182 | ||
| 183 | (defvar bs--running-in-xemacs (string-match "XEmacs" (emacs-version)) | ||
| 184 | "Non-nil when running under XEmacs.") | ||
| 185 | |||
| 186 | (defun bs--make-header-match-string () | 183 | (defun bs--make-header-match-string () |
| 187 | "Return a regexp matching the first line of a Buffer Selection Menu buffer." | 184 | "Return a regexp matching the first line of a Buffer Selection Menu buffer." |
| 188 | (let ((res "^\\(") | 185 | (let ((res "^\\(") |
| @@ -701,12 +698,7 @@ Return nil if there is no such buffer." | |||
| 701 | (defun bs--set-window-height () | 698 | (defun bs--set-window-height () |
| 702 | "Change the height of the selected window to suit the current buffer list." | 699 | "Change the height of the selected window to suit the current buffer list." |
| 703 | (unless (one-window-p t) | 700 | (unless (one-window-p t) |
| 704 | (shrink-window (- (window-height (selected-window)) | 701 | (fit-window-to-buffer (selected-window) bs-max-window-height))) |
| 705 | ;; window-height in xemacs includes mode-line | ||
| 706 | (+ (if bs--running-in-xemacs 3 1) | ||
| 707 | bs-header-lines-length | ||
| 708 | (min (length bs-current-list) | ||
| 709 | bs-max-window-height)))))) | ||
| 710 | 702 | ||
| 711 | (defun bs--current-buffer () | 703 | (defun bs--current-buffer () |
| 712 | "Return buffer on current line. | 704 | "Return buffer on current line. |
| @@ -1011,13 +1003,11 @@ Uses function `vc-toggle-read-only'." | |||
| 1011 | "Move cursor vertically up one line. | 1003 | "Move cursor vertically up one line. |
| 1012 | If on top of buffer list go to last line." | 1004 | If on top of buffer list go to last line." |
| 1013 | (interactive "p") | 1005 | (interactive "p") |
| 1014 | (previous-line 1) | 1006 | (if (> (count-lines 1 (point)) bs-header-lines-length) |
| 1015 | (if (<= (count-lines 1 (point)) (1- bs-header-lines-length)) | 1007 | (forward-line -1) |
| 1016 | (progn | 1008 | (goto-char (point-max)) |
| 1017 | (goto-char (point-max)) | 1009 | (beginning-of-line) |
| 1018 | (beginning-of-line) | 1010 | (recenter -1))) |
| 1019 | (recenter -1)) | ||
| 1020 | (beginning-of-line))) | ||
| 1021 | 1011 | ||
| 1022 | (defun bs-down (arg) | 1012 | (defun bs-down (arg) |
| 1023 | "Move cursor vertically down ARG lines in Buffer Selection Menu." | 1013 | "Move cursor vertically down ARG lines in Buffer Selection Menu." |
| @@ -1029,10 +1019,9 @@ If on top of buffer list go to last line." | |||
| 1029 | (defun bs--down () | 1019 | (defun bs--down () |
| 1030 | "Move cursor vertically down one line. | 1020 | "Move cursor vertically down one line. |
| 1031 | If at end of buffer list go to first line." | 1021 | If at end of buffer list go to first line." |
| 1032 | (let ((last (line-end-position))) | 1022 | (if (eq (line-end-position) (point-max)) |
| 1033 | (if (eq last (point-max)) | 1023 | (goto-line (1+ bs-header-lines-length)) |
| 1034 | (goto-line (1+ bs-header-lines-length)) | 1024 | (forward-line 1))) |
| 1035 | (next-line 1)))) | ||
| 1036 | 1025 | ||
| 1037 | (defun bs-visits-non-file (buffer) | 1026 | (defun bs-visits-non-file (buffer) |
| 1038 | "Return t or nil whether BUFFER visits no file. | 1027 | "Return t or nil whether BUFFER visits no file. |