unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Proposal for lpr.el pager options.
@ 2006-09-05 14:59 Michaël Cadilhac
  0 siblings, 0 replies; only message in thread
From: Michaël Cadilhac @ 2006-09-05 14:59 UTC (permalink / raw)



[-- Attachment #1.1.1: Type: text/plain, Size: 366 bytes --]


Hi!

I use `a2ps' as a pager [1], but I had to make some changes in `lpr.el' to
use it.

$ a2ps -h
prints ... the help of a2ps, yes.  But in `lpr.el', `-h' is used as
the option to pass the page title.

I propose the following change, but maybe it is better to add a var
`lpr-page-header-title-switch' (set by default to `-h', in my case to
`--center-title' [2]).


[-- Attachment #1.1.2: lpr.patch --]
[-- Type: text/x-patch, Size: 2531 bytes --]

Index: lisp/lpr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/lpr.el,v
retrieving revision 1.69
diff -c -r1.69 lpr.el
*** lisp/lpr.el	6 Feb 2006 14:33:34 -0000	1.69
--- lisp/lpr.el	5 Sep 2006 14:22:01 -0000
***************
*** 140,147 ****
  
  ;; Berkeley systems support -F, and GNU pr supports both -f and -F,
  ;; So it looks like -F is a better default.
! (defcustom lpr-page-header-switches '("-F")
!   "*List of strings to use as options for the page-header-generating program.
  The variable `lpr-page-header-program' specifies the program to use."
    :type '(repeat string)
    :group 'lpr)
--- 140,148 ----
  
  ;; Berkeley systems support -F, and GNU pr supports both -f and -F,
  ;; So it looks like -F is a better default.
! (defcustom lpr-page-header-switches '("-h %s" "-F")
!   "List of strings to use as options for the page-header-generating program.
+ If `%s' appears in one of the strings, it is substituted by the page title.
  The variable `lpr-page-header-program' specifies the program to use."
    :type '(repeat string)
    :group 'lpr)
***************
*** 243,250 ****
  	    (let ((new-coords (print-region-new-buffer start end)))
  	      (apply 'call-process-region (car new-coords) (cdr new-coords)
  		     lpr-page-header-program t t nil
! 		     (nconc (list "-h" title)
! 			    lpr-page-header-switches)))
  	    (setq start (point-min)
  		  end   (point-max))))
        (apply (or print-region-function 'call-process-region)
--- 244,251 ----
  	    (let ((new-coords (print-region-new-buffer start end)))
  	      (apply 'call-process-region (car new-coords) (cdr new-coords)
  		     lpr-page-header-program t t nil
! 		     (mapcar (lambda (e) (format e title))
! 			     lpr-page-header-switches)))
  	    (setq start (point-min)
  		  end   (point-max))))
        (apply (or print-region-function 'call-process-region)
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.9966
diff -c -0 -r1.9966 ChangeLog
*** lisp/ChangeLog	27 Aug 2006 07:08:19 -0000	1.9966
--- lisp/ChangeLog	5 Sep 2006 14:22:14 -0000
***************
*** 0 ****
--- 1,5 ----
+ 2006-09-05  Michaël Cadilhac  <michael.cadilhac@lrde.org>
+ 
+ 	* lpr.el (lpr-page-header-switches): Page title switch is one of them.
+ 	(print-region-1): Substitute `%s' in every switches by the page title.
+ 

[-- Attachment #1.1.3: Type: text/plain, Size: 531 bytes --]



Footnotes: 
[1]  (setq lpr-page-header-program "a2ps")

[2]  Oops, I just tested that. a2ps wants `--center-title=TITLE' only,
and `--center-title TITLE' is not permitted, so this is not a good fix.

-- 
 |      Michaël `Micha' Cadilhac   |  Mieux vaut se taire                   |
 |         Epita/LRDE Promo 2007   |   Que de parler trop fort.             |
 | http://www.lrde.org/~cadilh_m   |           -- As de trèfle              |
 `--  -   JID: micha@amessage.be --'                                   -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-09-05 14:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-05 14:59 Proposal for lpr.el pager options Michaël Cadilhac

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).