aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2003-03-17 18:12:42 +0000
committerStefan Monnier2003-03-17 18:12:42 +0000
commit748a336b9221ac84859e5db3e1f1f8e993832f77 (patch)
tree762d547cbfc9557ab679a25e804998ede4e82b55
parentf9b3d256db310566de76c8ecccc49efadaa0cbff (diff)
downloademacs-748a336b9221ac84859e5db3e1f1f8e993832f77.tar.gz
emacs-748a336b9221ac84859e5db3e1f1f8e993832f77.zip
(list-buffers-noselect): Use the display property
to properly align header-line text with the buffer's contents.
-rw-r--r--lisp/buff-menu.el37
1 files changed, 26 insertions, 11 deletions
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index f17666422b3..34423a836f1 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -557,9 +557,33 @@ For more information, see the function `buffer-menu'."
557 (let* ((old-buffer (current-buffer)) 557 (let* ((old-buffer (current-buffer))
558 (standard-output standard-output) 558 (standard-output standard-output)
559 (mode-end (make-string (- Buffer-menu-mode-width 2) ? )) 559 (mode-end (make-string (- Buffer-menu-mode-width 2) ? ))
560 (header (concat "CRM " (Buffer-menu-buffer+size "Buffer" "Size") 560 (header (concat (propertize "CRM " 'face 'fixed-pitch)
561 (Buffer-menu-buffer+size "Buffer" "Size")
561 " Mode" mode-end "File\n")) 562 " Mode" mode-end "File\n"))
562 list desired-point name file mode) 563 list desired-point name file mode)
564 (when Buffer-menu-use-header-line
565 (let ((spaces
566 ;; FIXME: This is using the settings of the current frame rather
567 ;; than the frame into which the buffer will be displayed.
568 (/ (+ 0.0 (or (frame-parameter nil 'left-fringe) 0)
569 (or (if (eq (frame-parameter nil 'vertical-scroll-bars)
570 'left)
571 (frame-parameter nil 'scroll-bar-width))
572 0))
573 (frame-char-width)))
574 (pos 0))
575 ;; Turn spaces in the header into stretch specs so they work
576 ;; regardless of the header-line face.
577 (while (string-match "[ \t]+" header pos)
578 (setq pos (match-end 0))
579 (put-text-property (match-beginning 0) pos 'display
580 ;; Assume fixed-size chars
581 (list 'space :align-to (+ spaces pos))
582 header))
583 ;; Add the leading space
584 (setq header (concat (propertize (make-string (floor spaces) ? )
585 'display (list 'space :width spaces))
586 header))))
563 (save-excursion 587 (save-excursion
564 (set-buffer (get-buffer-create "*Buffer List*")) 588 (set-buffer (get-buffer-create "*Buffer List*"))
565 (setq buffer-read-only nil) 589 (setq buffer-read-only nil)
@@ -639,16 +663,7 @@ For more information, see the function `buffer-menu'."
639 (princ "\n")) 663 (princ "\n"))
640 (Buffer-menu-mode) 664 (Buffer-menu-mode)
641 (when Buffer-menu-use-header-line 665 (when Buffer-menu-use-header-line
642 (let ((spaces 666 (setq header-line-format header))
643 (/ (+ (or (frame-parameter nil 'left-fringe) 0)
644 (or (if (eq (frame-parameter nil 'vertical-scroll-bars)
645 'left)
646 (frame-parameter nil 'scroll-bar-width))
647 0))
648 (frame-char-width))))
649 (set (make-local-variable 'Buffer-menu-header-line)
650 (concat (make-string spaces ? ) header)))
651 (setq header-line-format 'Buffer-menu-header-line))
652 ;; DESIRED-POINT doesn't have to be set; it is not when the 667 ;; DESIRED-POINT doesn't have to be set; it is not when the
653 ;; current buffer is not displayed for some reason. 668 ;; current buffer is not displayed for some reason.
654 (and desired-point 669 (and desired-point