[Mew-dist 11813] Re: how to change printer name

Shun-ichi TAHARA ( 田原 俊一 ) jado at example.com
1999年 12月 14日 (火) 09:24:11 JST


From: KONNO Akihisa <minnie at example.com>
Message-Id: <19991214085602T.minnie at example.com>

> > 研究室のPC-UNIXでmewを使わせてもらっているのですが、
> > 研究室にはプリンタが二つあります。そこで、"#"キーを押したときにプリン
> > タ名を選択できるような設定にしたいのですが、それが可能なのかどうか、ま
> > た可能ならどうすればいいのかどなたか御教示願えませんでしょうか。
> 
>   以下のような設定を ~/.emacs にしてみると、お望みに近い機能が得られる
> ようです。"Printer: "と聞かれたらプリンタ名を打ち込みます。プリンタが2
> つということなので、二者択一にするなど工夫するべきでしょうが、そのへん
> はご自分でいろいろいじってみてください。

> (setq mew-print-function
>       (function (lambda ()
> 		  (let ((lpr-switches
> 			 (list (format "-P%s"
> 				       (read-from-minibuffer "Printer: ")))))
> 		    (lpr-buffer)))))
> 

みなさん、いろいろやってるようですね。
ちなみに、これだと、lpr-bufferで直接プリンタに送られてしまうので、
Postscriptプリンタには出せませんよね。

FAQの3.5に、プリンタがPostscriptな場合の解法が載っていますが、私は、これ
を元にプリンタ名の選択もくっつけて、以下のようなsite-lispをでっち上げて
使っています。

# もう少し工夫すれば、プリンタ名の補完くらいできますが :-)
_______________________________
田原 俊一   jado at example.com, shunichi_tahara at example.com
                             http://www2.osk.3web.ne.jp/~jado/
FingerPrint: 16 9E 70 3B 05 86 5D 08 - B8 4C 47 3A E7 E9 8E D9
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
-------------- next part --------------
;;; mew-print.el	-*-Emacs-Lisp-*-
;;;
;;; Commentary:
;;; Print message with user-customizable command line
;;;
;;; Keywords:
;;; Mew Print
;;;
;;; Time-stamp: <99/07/02 16:37:17 jado at example.com>

;;; How to use:
;;; Require it when initialize, and type '#' to print out.

;;; Code:

(provide 'mew-print)

;;;

(defvar mew-print-command "a2ps | lpr")
(defvar mew-print-printer-switch "-P")

(setq mew-print-printer "")

(defun mew-print-region (begin end)
  (interactive "r")

  (let ((printer-switch nil)
	(command nil))
    (setq mew-print-printer (read-string "Printer name: " mew-print-printer))
    (if (not (string= mew-print-printer ""))
	(setq printer-switch
	      (concat " " mew-print-printer-switch mew-print-printer)))
    (setq command (concat mew-print-command printer-switch))
    (shell-command-on-region begin end command)))

(defun mew-print-buffer ()
  (interactive "")
  (mew-print-region (point-min) (point-max)))

(setq mew-print-function (function mew-print-buffer))

;;; mew-print.el ends here


Mew-dist メーリングリストの案内