[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch to make elp use header-line-format
From: |
Tom Tromey |
Subject: |
Patch to make elp use header-line-format |
Date: |
Thu, 27 Dec 2007 23:09:58 -0700 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.990 (gnu/linux) |
I was trying out elp today and noticed that it inserts titles into the
buffer. This patch changes it to use header-line-format, unless elp
is printing to stdout.
Tom
ChangeLog:
2007-12-28 Tom Tromey <address@hidden>
* emacs-lisp/elp.el (elp-results): Use header-line-format for
header.
Index: emacs-lisp/elp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/elp.el,v
retrieving revision 1.41
diff -u -r1.41 elp.el
--- emacs-lisp/elp.el 9 Nov 2007 09:45:30 -0000 1.41
+++ emacs-lisp/elp.el 28 Dec 2007 06:37:11 -0000
@@ -596,20 +596,39 @@
symname)))))
elp-all-instrumented-list))
) ; end let*
- (insert title)
- (if (> longest titlelen)
+ ;; If printing to stdout, insert the header so it will print.
+ ;; Otherwise use header-line-format.
+ (setq elp-field-len (max titlelen longest))
+ (if (or elp-use-standard-output noninteractive)
(progn
- (insert-char 32 (- longest titlelen))
- (setq elp-field-len longest)))
- (insert " " cc-header " " et-header " " at-header "\n")
- (insert-char ?= elp-field-len)
- (insert " ")
- (insert-char ?= elp-cc-len)
- (insert " ")
- (insert-char ?= elp-et-len)
- (insert " ")
- (insert-char ?= elp-at-len)
- (insert "\n")
+ (insert title)
+ (if (> longest titlelen)
+ (progn
+ (insert-char 32 (- longest titlelen))))
+ (insert " " cc-header " " et-header " " at-header "\n")
+ (insert-char ?= elp-field-len)
+ (insert " ")
+ (insert-char ?= elp-cc-len)
+ (insert " ")
+ (insert-char ?= elp-et-len)
+ (insert " ")
+ (insert-char ?= elp-at-len)
+ (insert "\n"))
+ (let ((column 0))
+ (setq header-line-format
+ (mapconcat
+ (lambda (title)
+ (prog1
+ (concat
+ (propertize " "
+ 'display (list 'space :align-to column)
+ 'face 'fixed-pitch)
+ title)
+ (setq column (+ column 1
+ (if (= column 0)
+ elp-field-len
+ (length title))))))
+ (list title cc-header et-header at-header) ""))))
;; if sorting is enabled, then sort the results list. in either
;; case, call elp-output-result to output the result in the
;; buffer
- Patch to make elp use header-line-format,
Tom Tromey <=