Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!lll-crg!nike!ucbcad!ucbvax!CC5.BBN.COM!jr From: jr@CC5.BBN.COM (John Robinson) Newsgroups: net.emacs Subject: Re: print-buffer args error? (GNU) Message-ID: <8608011352.AA21078@ucbvax.Berkeley.EDU> Date: Fri, 1-Aug-86 09:46:02 EDT Article-I.D.: ucbvax.8608011352.AA21078 Posted: Fri Aug 1 09:46:02 1986 Date-Received: Sat, 2-Aug-86 09:18:24 EDT References: <624@gcc-milo.ARPA> Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 36 It looks as though the function print-region-1 will screw up when it has to call expand to diddle the tabs, which it does if the tab stops are other than every 8 characters. It fails to recompute the region boundaries (formals start and end) after filtering the print stuff through expand. In fact, it looks as if the normal (non-error) case will chop off (fail to print) the end of the buffer or region. Here's an attempt at a fixed print-region-1. Since we don't run lpr here, I can't really test it. It might be better to construct a shell pipeline with expand and lpr to avoid the extra process step (and the bug!); that is an exercise for the reader or maintainer. /jr (defun print-region-1 (start end switches) (save-excursion (message "Spooling...") (if (/= tab-width 8) (let ((oldbuf (current-buffer))) (set-buffer (get-buffer-create " *spool temp*")) (widen) (erase-buffer) (insert-buffer-substring oldbuf) (set-mark (max start end)) (call-process-region start end "expand" t t nil (format "-%d" tab-width)) (if (> start end) (setq start (mark)) (setq end (mark))))) (apply 'call-process-region (nconc (list start end "lpr" nil nil nil "-J" (concat (buffer-name) " Emacs buffer") "-T" (concat (buffer-name) " Emacs buffer")) switches)) (message "Spooling...done")))