brad@gcc-milo.ARPA (Brad Parker) (07/31/86)
Using GNU 17.64.1, occationally when I use the "print-buffer" or "print-region" functions I get a beep and "args out of range xxx, xxx" message. Nothing prints. Any idea what the fix is for this? (seems to be dependant on the file) Also, the second arg in the arg range seems to be one line beyond the end of the buffer... Humm.... -thanks -- J Bradford Parker General Computer (HyperDrive Beach, 3rd Cabana) harvard!gcc-milo!brad Good Sex is easier than a good slow roll. ("Left Stick! Right Rudder!...")
jr@CC5.BBN.COM (John Robinson) (08/01/86)
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")))