* Patch to make elp use header-line-format
@ 2007-12-28 6:09 Tom Tromey
2007-12-31 15:49 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2007-12-28 6:09 UTC (permalink / raw)
To: emacs-devel
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 <tromey@redhat.com>
* 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch to make elp use header-line-format
2007-12-28 6:09 Patch to make elp use header-line-format Tom Tromey
@ 2007-12-31 15:49 ` Tom Tromey
2007-12-31 22:30 ` Richard Stallman
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2007-12-31 15:49 UTC (permalink / raw)
To: emacs-devel
>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
Tom> I was trying out elp today and noticed that it inserts titles into the
Tom> buffer. This patch changes it to use header-line-format, unless elp
Tom> is printing to stdout.
I also noticed that point is at the end of the results buffer after
M-x elp-results. That seemed weird to me, so here is an updated patch
that moves point to the start of the buffer.
Tom
ChangeLog:
2007-12-28 Tom Tromey <tromey@redhat.com>
* 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 31 Dec 2007 16:14:27 -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
@@ -621,7 +640,8 @@
(pop-to-buffer resultsbuf)
;; copy results to standard-output?
(if (or elp-use-standard-output noninteractive)
- (princ (buffer-substring (point-min) (point-max))))
+ (princ (buffer-substring (point-min) (point-max)))
+ (goto-char (point-min)))
;; reset profiling info if desired
(and elp-reset-after-results
(elp-reset-all))))
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-12-31 23:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-28 6:09 Patch to make elp use header-line-format Tom Tromey
2007-12-31 15:49 ` Tom Tromey
2007-12-31 22:30 ` Richard Stallman
2007-12-31 23:26 ` Nick Roberts
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.