From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.devel Subject: Patch to make elp use header-line-format Date: Thu, 27 Dec 2007 23:09:58 -0700 Message-ID: Reply-To: tromey@redhat.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1198823961 8816 80.91.229.12 (28 Dec 2007 06:39:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Dec 2007 06:39:21 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 28 07:39:35 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J88sY-0004EE-E7 for ged-emacs-devel@m.gmane.org; Fri, 28 Dec 2007 07:39:34 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J88sD-0004ut-VI for ged-emacs-devel@m.gmane.org; Fri, 28 Dec 2007 01:39:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J88sA-0004uo-QU for emacs-devel@gnu.org; Fri, 28 Dec 2007 01:39:10 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J88s9-0004tr-7x for emacs-devel@gnu.org; Fri, 28 Dec 2007 01:39:09 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J88s9-0004tY-0f for emacs-devel@gnu.org; Fri, 28 Dec 2007 01:39:09 -0500 Original-Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J88s8-00028H-72 for emacs-devel@gnu.org; Fri, 28 Dec 2007 01:39:08 -0500 Original-Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id lBS6d2jJ020042 for ; Fri, 28 Dec 2007 01:39:02 -0500 Original-Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lBS6d2vV010614 for ; Fri, 28 Dec 2007 01:39:02 -0500 Original-Received: from opsy.redhat.com (ton.yyz.redhat.com [10.15.16.15]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lBS6d0W2018780; Fri, 28 Dec 2007 01:39:01 -0500 Original-Received: by opsy.redhat.com (Postfix, from userid 500) id 24772508021; Thu, 27 Dec 2007 23:09:58 -0700 (MST) X-Attribution: Tom User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.990 (gnu/linux) X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:85532 Archived-At: 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 * 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