Mercurial > emacs
changeset 50172:48610ee0507d
(list-buffers-noselect): Use the display property
to properly align header-line text with the buffer's contents.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 17 Mar 2003 18:12:42 +0000 |
parents | cc9c3fcd6f7f |
children | ff64d91bf990 |
files | lisp/buff-menu.el |
diffstat | 1 files changed, 26 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/buff-menu.el Mon Mar 17 16:07:30 2003 +0000 +++ b/lisp/buff-menu.el Mon Mar 17 18:12:42 2003 +0000 @@ -557,9 +557,33 @@ (let* ((old-buffer (current-buffer)) (standard-output standard-output) (mode-end (make-string (- Buffer-menu-mode-width 2) ? )) - (header (concat "CRM " (Buffer-menu-buffer+size "Buffer" "Size") + (header (concat (propertize "CRM " 'face 'fixed-pitch) + (Buffer-menu-buffer+size "Buffer" "Size") " Mode" mode-end "File\n")) list desired-point name file mode) + (when Buffer-menu-use-header-line + (let ((spaces + ;; FIXME: This is using the settings of the current frame rather + ;; than the frame into which the buffer will be displayed. + (/ (+ 0.0 (or (frame-parameter nil 'left-fringe) 0) + (or (if (eq (frame-parameter nil 'vertical-scroll-bars) + 'left) + (frame-parameter nil 'scroll-bar-width)) + 0)) + (frame-char-width))) + (pos 0)) + ;; Turn spaces in the header into stretch specs so they work + ;; regardless of the header-line face. + (while (string-match "[ \t]+" header pos) + (setq pos (match-end 0)) + (put-text-property (match-beginning 0) pos 'display + ;; Assume fixed-size chars + (list 'space :align-to (+ spaces pos)) + header)) + ;; Add the leading space + (setq header (concat (propertize (make-string (floor spaces) ? ) + 'display (list 'space :width spaces)) + header)))) (save-excursion (set-buffer (get-buffer-create "*Buffer List*")) (setq buffer-read-only nil) @@ -639,16 +663,7 @@ (princ "\n")) (Buffer-menu-mode) (when Buffer-menu-use-header-line - (let ((spaces - (/ (+ (or (frame-parameter nil 'left-fringe) 0) - (or (if (eq (frame-parameter nil 'vertical-scroll-bars) - 'left) - (frame-parameter nil 'scroll-bar-width)) - 0)) - (frame-char-width)))) - (set (make-local-variable 'Buffer-menu-header-line) - (concat (make-string spaces ? ) header))) - (setq header-line-format 'Buffer-menu-header-line)) + (setq header-line-format header)) ;; DESIRED-POINT doesn't have to be set; it is not when the ;; current buffer is not displayed for some reason. (and desired-point