# HG changeset patch # User Stefan Monnier # Date 1047924762 0 # Node ID 48610ee0507dd106782f905afa149e8d324ce3af # Parent cc9c3fcd6f7f9bc1f627308322a54bdfe07b7696 (list-buffers-noselect): Use the display property to properly align header-line text with the buffer's contents. diff -r cc9c3fcd6f7f -r 48610ee0507d lisp/buff-menu.el --- 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