From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Printer definition Date: Fri, 06 May 2011 13:40:49 -0300 Organization: A noiseless patient Spider Message-ID: References: <81dce585-a99e-4908-a73f-25729f644791@v10g2000yqn.googlegroups.com> <47db22c1-07c4-45f0-9f38-a1aca278f57e@p18g2000yqj.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1306268499 17202 80.91.229.12 (24 May 2011 20:21:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 24 May 2011 20:21:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 24 22:21:35 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QOy6h-0005t3-L9 for geh-help-gnu-emacs@m.gmane.org; Tue, 24 May 2011 22:21:35 +0200 Original-Received: from localhost ([::1]:59578 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOy6h-0000Mw-32 for geh-help-gnu-emacs@m.gmane.org; Tue, 24 May 2011 16:21:35 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-1.dfn.de!news.dfn.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 55 Injection-Info: mx02.eternal-september.org; posting-host="SH9UCpE8J/NOOMHA4fcilQ"; logging-data="1929"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+lAU5HYaqyfEIaruPYPbHM" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:UEICnnM0fWTLL3vmq9Hb3CZ6OFA= sha1:9VKPPvRkYRCm9U1WbsFqc4WaxEY= Original-Xref: usenet.stanford.edu gnu.emacs.help:186799 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:81125 Archived-At: > The best thing would be to trap the error (the way it does with pr) > and signal the user. I don't know what trapping you're referring to. > No response meant I had to manually debug the code. The man page for > the lpr that I use specifically says that it does not honor > the -d option. I've installed the change below (for the future Emacs-24), which makes print-buffer echo the output of lp/lpr. So the warning about "-d" not being supported is not silently discarded any more (it may still go unnoticed, of course, but that's another issue). Stefan === modified file 'lisp/lpr.el' --- lisp/lpr.el 2011-01-26 08:36:39 +0000 +++ lisp/lpr.el 2011-05-06 16:33:11 +0000 @@ -258,9 +258,13 @@ lpr-page-header-switches))) (setq start (point-min) end (point-max)))) + (let ((buf (current-buffer))) + (with-temp-buffer + (let ((tempbuf (current-buffer))) + (with-current-buffer buf (apply (or print-region-function 'call-process-region) (nconc (list start end lpr-command - nil nil nil) + nil tempbuf nil) (and lpr-add-switches (list "-J" name)) ;; These belong in pr if we are using that. @@ -269,10 +273,15 @@ (and (stringp printer-name) (list (concat lpr-printer-switch printer-name))) - nswitches)) + nswitches)))) (if (markerp end) (set-marker end nil)) - (message "Spooling%s...done" switch-string)))) + (message "Spooling%s...done%s%s" switch-string + (case (count-lines (point-min) (point-max)) + (0 "") + (1 ": ") + (t ":\n")) + (buffer-string))))))) ;; This function copies the text between start and end ;; into a new buffer, makes that buffer current.