Commit 46447ab3 authored by Dan Nicolaescu's avatar Dan Nicolaescu
Browse files

* mail/vms-pmail.el (insert-signature): Don't use end-of-buffer.

* tooltip.el: Use featurep 'xemacs.

* printing.el: Move variable definitions before use, no code
change.
parent e79beb56
2007-10-22 Dan Nicolaescu <dann@ics.uci.edu>
* mail/vms-pmail.el (insert-signature): Don't use end-of-buffer.
* tooltip.el: Use featurep 'xemacs.
* printing.el: Move variable definitions before use, no code
change.
2007-10-22 Juri Linkov <juri@jurta.org>
* simple.el (goto-history-element): Allow minibuffer-default to be
......
......@@ -110,7 +110,7 @@ First try the file indicated by environment variable MAIL$TRAILER.
If that fails, try the file \"~/.signature\".
If neither file exists, fails quietly."
(interactive)
(end-of-buffer)
(goto-char (point-max))
(newline)
(if (vms-system-info "LOGICAL" "MAIL$TRAILER")
(if (file-attributes (vms-system-info "LOGICAL" "MAIL$TRAILER"))
......
......@@ -1094,1039 +1094,958 @@ If SUFFIX is non-nil, add that at the end of the file name."
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; XEmacs Definitions
(cond
((featurep 'xemacs) ; XEmacs
;; XEmacs
(defalias 'pr-f-set-keymap-parents 'set-keymap-parents)
(defalias 'pr-f-set-keymap-name 'set-keymap-name)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; User Interface (II)
;; XEmacs
(defun pr-f-read-string (prompt initial history default)
(let ((str (read-string prompt initial)))
(if (and str (not (string= str "")))
str
default)))
;; XEmacs
(defvar zmacs-region-stays nil)
(defcustom pr-path-alist
'((unix PATH)
(cygwin PATH)
(windows PATH))
"*Specify an alist for command paths.
;; XEmacs
(defun pr-keep-region-active ()
(setq zmacs-region-stays t))
It's used to find commands used for printing package, like gv, gs, gsview.exe,
mpage, print.exe, etc. See also `pr-command' function.
;; XEmacs
(defun pr-region-active-p ()
(and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p)))
Each element has the form:
;; XEmacs
(defun pr-menu-char-height ()
(font-height (face-font 'default)))
(ENTRY DIRECTORY...)
;; XEmacs
(defun pr-menu-char-width ()
(font-width (face-font 'default)))
Where:
;; XEmacs
(defmacro pr-xemacs-global-menubar (&rest body)
`(save-excursion
(let ((temp (get-buffer-create (make-temp-name " *Temp"))))
;; be sure to access global menubar
(set-buffer temp)
,@body
(kill-buffer temp))))
ENTRY It's a symbol, used to identify this entry.
There must exist at least one of the following entries:
;; XEmacs
(defun pr-global-menubar (pr-menu-spec)
;; Menu binding
(pr-xemacs-global-menubar
(add-submenu nil (cons "Printing" pr-menu-spec) "Apps"))
(setq pr-menu-print-item nil))
unix this entry is used when Emacs is running on GNU or
Unix system.
;; XEmacs
(defvar current-mouse-event nil)
(defun pr-menu-position (entry index horizontal)
(make-event
'button-release
(list 'button 1
'x (- (event-x-pixel current-mouse-event) ; X
(* horizontal pr-menu-char-width))
'y (- (event-y-pixel current-mouse-event) ; Y
(* (pr-menu-index entry index) pr-menu-char-height)))))
cygwin this entry is used when Emacs is running on Windows
95/98/NT/2000 with Cygwin.
(defvar pr-menu-position nil)
(defvar pr-menu-state nil)
windows this entry is used when Emacs is running on Windows
95/98/NT/2000.
;; XEmacs
(defvar current-menubar nil) ; to avoid compilation gripes
(defun pr-menu-lookup (path)
(car (find-menu-item current-menubar (cons "Printing" path))))
DIRECTORY It should be a string or a symbol. If it's a symbol, it should
exist an equal entry in `pr-path-alist'. If it's a string,
it's considered a directory specification.
;; XEmacs
(defun pr-menu-lock (entry index horizontal state path)
(when pr-menu-lock
(or (and pr-menu-position (eq state pr-menu-state))
(setq pr-menu-position (pr-menu-position entry index horizontal)
pr-menu-state state))
(let* ((menu (pr-menu-lookup path))
(result (get-popup-menu-response menu pr-menu-position)))
(and (misc-user-event-p result)
(funcall (event-function result)
(event-object result))))
(setq pr-menu-position nil)))
The directory specification may contain:
$var environment variable expansion
~/ tilde expansion
./ current directory
../ previous directory
;; XEmacs
(defalias 'pr-update-mode-line 'set-menubar-dirty-flag)
For example, let's say the home directory is /home/my and the
current directory is /home/my/dir, so:
;; XEmacs
(defvar pr-ps-name-old "PostScript Printers")
(defvar pr-txt-name-old "Text Printers")
(defvar pr-ps-utility-old "PostScript Utility")
(defvar pr-even-or-odd-old "Print All Pages")
THE ENTRY IS EXPANDED TO
~/entry /home/my/entry
./entry /home/my/dir/entry
../entry /home/my/entry
$HOME/entry /home/my/entry
$HOME/~/other/../my/entry /home/my/entry
;; XEmacs
(defun pr-do-update-menus (&optional force)
(pr-menu-alist pr-ps-printer-alist
'pr-ps-name
'pr-menu-set-ps-title
'("Printing")
'pr-ps-printer-menu-modified
force
pr-ps-name-old
'postscript 2)
(pr-menu-alist pr-txt-printer-alist
'pr-txt-name
'pr-menu-set-txt-title
'("Printing")
'pr-txt-printer-menu-modified
force
pr-txt-name-old
'text 2)
(let ((save-var pr-ps-utility-menu-modified))
(pr-menu-alist pr-ps-utility-alist
'pr-ps-utility
'pr-menu-set-utility-title
'("Printing" "PostScript Print" "File")
'save-var
force
pr-ps-utility-old
nil 1))
(pr-menu-alist pr-ps-utility-alist
'pr-ps-utility
'pr-menu-set-utility-title
'("Printing" "PostScript Preview" "File")
'pr-ps-utility-menu-modified
force
pr-ps-utility-old
nil 1)
(pr-even-or-odd-pages ps-even-or-odd-pages force))
SPECIAL SYMBOL: If the symbol `PATH' is used in the directory
list and there isn't a `PATH' entry in `pr-path-alist' or the
`PATH' entry has a null directory list, the PATH environment
variable is used.
;; XEmacs
(defun pr-menu-alist (alist var-sym fun menu-path modified-sym force name
entry index)
(when (and alist (or force (symbol-value modified-sym)))
(pr-xemacs-global-menubar
(add-submenu menu-path
(pr-menu-create name alist var-sym
fun entry index)))
(funcall fun (symbol-value var-sym))
(set modified-sym nil)))
Examples:
;; XEmacs
(defun pr-relabel-menu-item (newname var-sym)
(pr-xemacs-global-menubar
(relabel-menu-item
(list "Printing" (symbol-value var-sym))
newname)
(set var-sym newname)))
* On GNU or Unix system:
;; XEmacs
(defun pr-menu-set-ps-title (value &optional item entry index)
(pr-relabel-menu-item (format "PostScript Printer: %s" value)
'pr-ps-name-old)
(pr-ps-set-printer value)
(and index
(pr-menu-lock entry index 12 'toggle nil)))
'((unix \".\" \"~/bin\" ghostview mpage PATH)
(ghostview \"$HOME/bin/gsview-dir\")
(mpage \"$HOME/bin/mpage-dir\")
)
;; XEmacs
(defun pr-menu-set-txt-title (value &optional item entry index)
(pr-relabel-menu-item (format "Text Printer: %s" value)
'pr-txt-name-old)
(pr-txt-set-printer value)
(and index
(pr-menu-lock entry index 12 'toggle nil)))
* On Windows system:
;; XEmacs
(defun pr-menu-set-utility-title (value &optional item entry index)
(pr-xemacs-global-menubar
(let ((newname (format "%s" value)))
(relabel-menu-item
(list "Printing" "PostScript Print" "File" pr-ps-utility-old)
newname)
(relabel-menu-item
(list "Printing" "PostScript Preview" "File" pr-ps-utility-old)
newname)
(setq pr-ps-utility-old newname)))
(pr-ps-set-utility value)
(and index
(pr-menu-lock entry index 5 nil '("PostScript Print" "File"))))
'((windows \"c:/applications/executables\" PATH ghostview mpage)
(ghostview \"c:/gs/gsview-dir\")
(mpage \"c:/mpage-dir\")
)"
:type '(repeat
(cons :tag ""
(symbol :tag "Identifier ")
(repeat :tag "Directory List"
(choice :menu-tag "Directory"
:tag "Directory"
(string :value "")
(symbol :value symbol)))))
:version "20"
:group 'printing)
;; XEmacs
(defun pr-even-or-odd-pages (value &optional no-lock)
(pr-relabel-menu-item (cdr (assq value pr-even-or-odd-alist))
'pr-even-or-odd-old)
(setq ps-even-or-odd-pages value)
(or no-lock
(pr-menu-lock 'postscript-options 8 12 'toggle nil)))
)
(t ; GNU Emacs
;; Do nothing
)) ; end cond featurep
(defcustom pr-txt-name 'default
"*Specify a printer for printing a text file.
The printer name symbol should be defined on `pr-txt-printer-alist' (see it for
documentation).
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; GNU Emacs Definitions
This variable should be modified by customization engine. If this variable is
modified by other means (for example, a lisp function), use `pr-update-menus'
function (see it for documentation) to update text printer menu."
:type 'symbol
:set 'pr-txt-name-custom-set
:version "20"
:group 'printing)
(cond
((featurep 'xemacs) ; XEmacs
;; Do nothing
)
(t ; GNU Emacs
;; GNU Emacs
(defalias 'pr-f-set-keymap-parents 'set-keymap-parent)
(defalias 'pr-f-set-keymap-name 'ignore)
(defalias 'pr-f-read-string 'read-string)
(defcustom pr-txt-printer-alist
(list (list 'default lpr-command nil
(cond ((boundp 'printer-name) printer-name)
(ps-windows-system "PRN")
(t nil)
)))
;; Examples:
;; * On GNU or Unix system:
;; '((prt_06a "lpr" nil "prt_06a")
;; (prt_07c nil nil "prt_07c")
;; )
;; * On Windows system:
;; '((prt_06a "print" nil "/D:\\\\printers\\prt_06a")
;; (prt_07c nil nil "/D:\\\\printers\\prt_07c")
;; (PRN "" nil "PRN")
;; (standard "redpr.exe" nil "")
;; )
"*Specify an alist of all text printers (text printer database).
;; GNU Emacs
(defvar deactivate-mark)
The alist element has the form:
;; GNU Emacs
(defun pr-keep-region-active ()
(setq deactivate-mark nil))
(SYMBOL COMMAND SWITCHES NAME)
;; GNU Emacs
(defun pr-region-active-p ()
(and pr-auto-region transient-mark-mode mark-active))
Where:
;; GNU Emacs
(defun pr-menu-char-height ()
(frame-char-height))
SYMBOL It's a symbol to identify a text printer. It's for
`pr-txt-name' variable setting and for menu selection.
Examples:
'prt_06a
'my_printer
;; GNU Emacs
(defun pr-menu-char-width ()
(frame-char-width))
COMMAND Name of the program for printing a text file. On MS-DOS and
MS-Windows systems, if the value is an empty string, then Emacs
will write directly to the printer port given by NAME (see text
below), that is, the NAME should be something like \"PRN\" or
\"LPT1:\".
If NAME is something like \"\\\\\\\\host\\\\share-name\" then
COMMAND shouldn't be an empty string.
The programs `print' and `nprint' (the standard print programs
on Windows NT and Novell Netware respectively) are handled
specially, using NAME as the destination for output; any other
program is treated like `lpr' except that an explicit filename
is given as the last argument.
If COMMAND is nil, it's used the default printing program:
`print' for Windows system, `lp' for lp system and `lpr' for
all other systems. See also `pr-path-alist'.
Examples:
\"print\"
\"lpr\"
\"lp\"
;; GNU Emacs
;; Menu binding
;; Replace existing "print" item by "Printing" item.
;; If you're changing this file, you'll load it a second,
;; third... time, but "print" item exists only in the first load.
(eval-and-compile
(cond
;; GNU Emacs 20
((< emacs-major-version 21)
(defun pr-global-menubar (pr-menu-spec)
(require 'easymenu)
(easy-menu-change '("tools") "Printing" pr-menu-spec pr-menu-print-item)
(when pr-menu-print-item
(easy-menu-remove-item nil '("tools") pr-menu-print-item)
(setq pr-menu-print-item nil
pr-menu-bar (vector 'menu-bar 'tools
(pr-get-symbol "Printing")))))
)
;; GNU Emacs 21 & 22
(t
(defun pr-global-menubar (pr-menu-spec)
(require 'easymenu)
(let ((menu-file (if (= emacs-major-version 21)
'("menu-bar" "files") ; GNU Emacs 21
'("menu-bar" "file")))) ; GNU Emacs 22 or higher
(cond
(pr-menu-print-item
(easy-menu-add-item global-map menu-file
(easy-menu-create-menu "Print" pr-menu-spec)
"print-buffer")
(dolist (item '("print-buffer" "print-region"
"ps-print-buffer-faces" "ps-print-region-faces"
"ps-print-buffer" "ps-print-region"))
(easy-menu-remove-item global-map menu-file item))
(setq pr-menu-print-item nil
pr-menu-bar (vector 'menu-bar
(pr-get-symbol (nth 1 menu-file))
(pr-get-symbol "Print"))))
(t
(easy-menu-add-item global-map menu-file
(easy-menu-create-menu "Print" pr-menu-spec)))
)))
)))
SWITCHES List of sexp's to pass as extra options for text printer
program. It is recommended to set NAME (see text below)
instead of including an explicit switch on this list.
Example:
. for lpr
'(\"-#3\" \"-l\")
nil
(eval-and-compile
(cond
(ps-windows-system
;; GNU Emacs for Windows 9x/NT
(defun pr-menu-position (entry index horizontal)
(let ((pos (cdr (mouse-pixel-position))))
(list
(list (or (car pos) 0) ; X
(- (or (cdr pos) 0) ; Y
(* (pr-menu-index entry index) pr-menu-char-height)))
(selected-frame)))) ; frame
)
(t
;; GNU Emacs
(defun pr-menu-position (entry index horizontal)
(let ((pos (cdr (mouse-pixel-position))))
(list
(list (- (or (car pos) 0) ; X
(* horizontal pr-menu-char-width))
(- (or (cdr pos) 0) ; Y
(* (pr-menu-index entry index) pr-menu-char-height)))
(selected-frame)))) ; frame
)))
NAME A string that specifies a text printer name.
On Unix-like systems, a string value should be a name
understood by lpr's -P option (or lp's -d option).
On MS-DOS and MS-Windows systems, it is the name of a printer
device or port. Typical non-default settings would be \"LPT1:\"
to \"LPT3:\" for parallel printers, or \"COM1\" to \"COM4\" or
\"AUX\" for serial printers, or \"\\\\\\\\hostname\\\\printer\"
(or \"/D:\\\\\\\\hostname\\\\printer\") for a shared network
printer. You can also set it to a name of a file, in which
case the output gets appended to that file. If you want to
discard the printed output, set this to \"NUL\".
Examples:
. for print.exe
\"/D:\\\\\\\\host\\\\share-name\"
\"LPT1:\"
\"PRN\"
(defvar pr-menu-position nil)
(defvar pr-menu-state nil)
. for lpr or lp
\"share-name\"
;; GNU Emacs
(defun pr-menu-lookup (path)
(lookup-key global-map
(if path
(vconcat pr-menu-bar
(mapcar 'pr-get-symbol
(if (listp path)
path
(list path))))
pr-menu-bar)))
This variable should be modified by customization engine. If this variable is
modified by other means (for example, a lisp function), use `pr-update-menus'
function (see it for documentation) to update text printer menu.
;; GNU Emacs
(defun pr-menu-lock (entry index horizontal state path)
(when pr-menu-lock
(or (and pr-menu-position (eq state pr-menu-state))
(setq pr-menu-position (pr-menu-position entry index horizontal)
pr-menu-state state))
(let* ((menu (pr-menu-lookup path))
(result (x-popup-menu pr-menu-position menu)))
(and result
(let ((command (lookup-key menu (vconcat result))))
(if (fboundp command)
(funcall command)
(eval command)))))
(setq pr-menu-position nil)))
Examples:
;; GNU Emacs
(defalias 'pr-update-mode-line 'force-mode-line-update)
* On GNU or Unix system:
;; GNU Emacs
(defun pr-do-update-menus (&optional force)
(pr-menu-alist pr-ps-printer-alist
'pr-ps-name
'pr-menu-set-ps-title
"PostScript Printers"
'pr-ps-printer-menu-modified
force
"PostScript Printers"
'postscript 2)
(pr-menu-alist pr-txt-printer-alist
'pr-txt-name
'pr-menu-set-txt-title
"Text Printers"
'pr-txt-printer-menu-modified
force
"Text Printers"
'text 2)
(let ((save-var pr-ps-utility-menu-modified))
(pr-menu-alist pr-ps-utility-alist
'pr-ps-utility
'pr-menu-set-utility-title
'("PostScript Print" "File" "PostScript Utility")
'save-var
force
"PostScript Utility"
nil 1))
(pr-menu-alist pr-ps-utility-alist
'pr-ps-utility
'pr-menu-set-utility-title
'("PostScript Preview" "File" "PostScript Utility")
'pr-ps-utility-menu-modified
force
"PostScript Utility"
nil 1)
(pr-even-or-odd-pages ps-even-or-odd-pages force))
'((prt_06a \"lpr\" nil \"prt_06a\")
(prt_07c nil nil \"prt_07c\")
)
;; GNU Emacs
(defun pr-menu-get-item (name-list)
;; NAME-LIST is a string or a list of strings.
(or (listp name-list)
(setq name-list (list name-list)))
(and name-list
(let* ((reversed (reverse name-list))
(name (pr-get-symbol (car reversed)))
(path (nreverse (cdr reversed)))
(menu (lookup-key
global-map
(vconcat pr-menu-bar
(mapcar 'pr-get-symbol path)))))
(assq name (nthcdr 2 menu)))))
* On Windows system:
;; GNU Emacs
(defvar pr-temp-menu nil)
'((prt_06a \"print\" nil \"/D:\\\\\\\\printers\\\\prt_06a\")
(prt_07c nil nil \"/D:\\\\\\\\printers\\\\prt_07c\")
(PRN \"\" nil \"PRN\")
(standard \"redpr.exe\" nil \"\")
)
;; GNU Emacs
(defun pr-menu-alist (alist var-sym fun menu-path modified-sym force name
entry index)
(when (and alist (or force (symbol-value modified-sym)))
(easy-menu-define pr-temp-menu nil ""
(pr-menu-create name alist var-sym fun entry index))
(let ((item (pr-menu-get-item menu-path)))
(and item
(let* ((binding (nthcdr 3 item))
(key-binding (cdr binding)))
(setcar binding pr-temp-menu)
(and key-binding (listp (car key-binding))
(setcdr binding (cdr key-binding))) ; skip KEY-BINDING
(funcall fun (symbol-value var-sym) item))))
(set modified-sym nil)))
Useful links:
;; GNU Emacs
(defun pr-menu-set-item-name (item name)
(and item
(setcar (nthcdr 2 item) name))) ; ITEM-NAME
* Information about the print command (print.exe)
`http://www.computerhope.com/printhlp.htm'
;; GNU Emacs
(defun pr-menu-set-ps-title (value &optional item entry index)
(pr-menu-set-item-name (or item
(pr-menu-get-item "PostScript Printers"))
(format "PostScript Printer: %s" value))
(pr-ps-set-printer value)
(and index
(pr-menu-lock entry index 12 'toggle nil)))
* RedMon - Redirection Port Monitor (redpr.exe)
`http://www.cs.wisc.edu/~ghost/redmon/index.htm'
;; GNU Emacs
(defun pr-menu-set-txt-title (value &optional item entry index)
(pr-menu-set-item-name (or item
(pr-menu-get-item "Text Printers"))
(format "Text Printer: %s" value))
(pr-txt-set-printer value)
(and index
(pr-menu-lock entry index 12 'toggle nil)))
* Redirection Port Monitor (redpr.exe on-line help)
`http://www.cs.wisc.edu/~ghost/redmon/en/redmon.htm'
;; GNU Emacs
(defun pr-menu-set-utility-title (value &optional item entry index)
(let ((name (symbol-name value)))
(if item
(pr-menu-set-item-name item name)
(pr-menu-set-item-name
(pr-menu-get-item
'("PostScript Print" "File" "PostScript Utility"))
name)
(pr-menu-set-item-name
(pr-menu-get-item
'("PostScript Preview" "File" "PostScript Utility"))
name)))