changeset 50033:cd78fe221607

(Buffer-menu-mode-map): Add docstring. (Buffer-menu-buffer): Fix indentation. (list-buffers-noselect): Calculate header-line spacing to take into account width of left fringe and left scrollbar.
author John Paul Wallington <jpw@pobox.com>
date Thu, 06 Mar 2003 03:51:53 +0000
parents c919f0375a3e
children 85feb0c5366e
files lisp/buff-menu.el
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/buff-menu.el	Thu Mar 06 01:54:17 2003 +0000
+++ b/lisp/buff-menu.el	Thu Mar 06 03:51:53 2003 +0000
@@ -96,7 +96,8 @@
 
 (defconst Buffer-menu-buffer-column 4)
 
-(defvar Buffer-menu-mode-map nil "")
+(defvar Buffer-menu-mode-map nil
+  "Local keymap for `Buffer-menu-mode' buffers.")
 
 (if Buffer-menu-mode-map
     ()
@@ -199,8 +200,8 @@
 		(error "No buffer named `%s'" name)
 	      nil))
       (or (and buf (buffer-name buf) buf)
-      (if error-if-non-existent-p
-	  (error "No buffer on this line")
+	  (if error-if-non-existent-p
+	      (error "No buffer on this line")
 	    nil)))))
 
 (defun buffer-menu (&optional arg)
@@ -556,7 +557,6 @@
   (let* ((old-buffer (current-buffer))
 	 (standard-output standard-output)
 	 (mode-end (make-string (- Buffer-menu-mode-width 2) ? ))
-	 ;; Fixme: This is wrong for left-hand scroll-bars.
 	 (header (concat "CRM " (Buffer-menu-buffer+size "Buffer" "Size")
 			 "  Mode" mode-end "File\n"))
 	 list desired-point name file mode)
@@ -639,8 +639,15 @@
 	(princ "\n"))
       (Buffer-menu-mode)
       (when Buffer-menu-use-header-line
-	(set (make-local-variable 'Buffer-menu-header-line)
-	     (concat " " header))
+	(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))
       ;; DESIRED-POINT doesn't have to be set; it is not when the
       ;; current buffer is not displayed for some reason.