emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Proposal for lpr.el pager options.


From: Michaël Cadilhac
Subject: Proposal for lpr.el pager options.
Date: Tue, 05 Sep 2006 16:59:12 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

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]).

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  <address@hidden>
+ 
+       * 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.
+ 

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: address@hidden --'                                   -  --'

Attachment: pgpOeXWsYDcRb.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]