From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Greg Hill Newsgroups: gmane.emacs.bugs Subject: ps-print-buffer ps-right-header Date: Tue, 6 May 2003 13:51:05 -0700 Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Trace: main.gmane.org 1052255569 1403 80.91.224.249 (6 May 2003 21:12:49 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 6 May 2003 21:12:49 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 06 23:12:45 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19D9jx-0000Lx-00 for ; Tue, 06 May 2003 23:12:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19D9kE-0007Mb-0C for gnu-bug-gnu-emacs@m.gmane.org; Tue, 06 May 2003 17:13:02 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19D9j8-0006Mo-00 for bug-gnu-emacs@gnu.org; Tue, 06 May 2003 17:11:54 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19D9fr-0004Kl-00 for bug-gnu-emacs@gnu.org; Tue, 06 May 2003 17:08:33 -0400 Original-Received: from renfield.synergymicro.com ([153.105.4.30] helo=synergymicro.com) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19D9PU-0006eT-00 for bug-gnu-emacs@gnu.org; Tue, 06 May 2003 16:51:37 -0400 Original-Received: from synergy.synergy.encinitas.ca.us ([153.105.4.29]) by synergymicro.com (8.9.3/8.9.3) with ESMTP id NAA25082 for ; Tue, 6 May 2003 13:53:00 -0700 Original-Received: from [198.17.100.22] (G_Hill_Mac [198.17.100.22]) h46Kptdc005929 for ; Tue, 6 May 2003 13:51:55 -0700 Original-To: bug-gnu-emacs@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:4973 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:4973 platform: GNU Emacs 21.2.2 (sparc-sun-solaris2.7, X toolkit) It appears as if a symbol-function provided as part of ps-right-header gets called twice before the first page is printed. I would expect the code below to print "1/2" at the top of the first page, and "2/2" at the top of the second page. Instead it prints out "2/2" and "3/2". In my *Messages* buffer I get: Formatting... 0% printPageNo called with PageNumber = 0 printPageNo called with PageNumber = 1 Formatting... 50% printPageNo called with PageNumber = 2 Of course you will probably have to change the values of ps-lpr-command and ps-lpr-switches to run this on your platform. (defun printPageNo () (message "printPageNo called with PageNumber = %d" PageNumber) (format "%d/%d" (setq PageNumber (1+ PageNumber)) NumPages)) (defun print-something () (let ((ps-left-header (list "(UpperHeader)" "(LowerHeader)")) (ps-right-header (list 'printPageNo 'ps-time-stamp-locale-default )) (ps-lpr-command "lp") (ps-lpr-switches (list "-dpclsw")) (PageNumber 0) (NumPages 2) ) (set-buffer (setq print-buffer (get-buffer-create "printTest"))) (erase-buffer) (insert "First page\fSecond page") (ps-print-buffer) )) --Greg