Mercurial > emacs
comparison lisp/printing.el @ 87206:44a37723f2a9
Fix pr-interface-map initialization
author | Vinicius Jose Latorre <viniciusjl@ig.com.br> |
---|---|
date | Sun, 09 Dec 2007 12:55:00 +0000 |
parents | 5c531755dfac |
children | d5142579b974 |
comparison
equal
deleted
inserted
replaced
87205:c549a264e1f1 | 87206:44a37723f2a9 |
---|---|
1 ;;; printing.el --- printing utilities | 1 ;;; printing.el --- printing utilities |
2 | 2 |
3 ;; Copyright (C) 2000, 2001, 2003, 2004, 2005, | 3 ;; Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 |
4 ;; 2006, 2007 Free Software Foundation, Inc. | 4 ;; Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> | 6 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
7 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> | 7 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
8 ;; Keywords: wp, print, PostScript | 8 ;; Keywords: wp, print, PostScript |
9 ;; Version: 6.9.2 | 9 ;; Version: 6.9.3 |
10 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre | 10 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre |
11 | 11 |
12 (defconst pr-version "6.9.2" | 12 (defconst pr-version "6.9.3" |
13 "printing.el, v 6.9.2 <2007/10/26 vinicius> | 13 "printing.el, v 6.9.3 <2007/12/09 vinicius> |
14 | 14 |
15 Please send all bug fixes and enhancements to | 15 Please send all bug fixes and enhancements to |
16 Vinicius Jose Latorre <viniciusjl@ig.com.br> | 16 Vinicius Jose Latorre <viniciusjl@ig.com.br> |
17 ") | 17 ") |
18 | 18 |
1116 (defalias 'pr-menu-set-ps-title 'ignore) | 1116 (defalias 'pr-menu-set-ps-title 'ignore) |
1117 (defalias 'pr-menu-set-txt-title 'ignore) | 1117 (defalias 'pr-menu-set-txt-title 'ignore) |
1118 (defalias 'pr-region-active-p 'ignore) | 1118 (defalias 'pr-region-active-p 'ignore) |
1119 (defalias 'pr-do-update-menus 'ignore) | 1119 (defalias 'pr-do-update-menus 'ignore) |
1120 (defalias 'pr-update-mode-line 'ignore) | 1120 (defalias 'pr-update-mode-line 'ignore) |
1121 (defalias 'pr-f-read-string 'ignore) | 1121 (defalias 'pr-read-string 'ignore) |
1122 (defalias 'pr-f-set-keymap-parents 'ignore) | 1122 (defalias 'pr-set-keymap-parents 'ignore) |
1123 (defalias 'pr-keep-region-active 'ignore)) | 1123 (defalias 'pr-keep-region-active 'ignore)) |
1124 | 1124 |
1125 | 1125 |
1126 ;; Internal Vars --- defined here to avoid compiler warnings | 1126 ;; Internal Vars --- defined here to avoid compiler warnings |
1127 (defvar pr-menu-print-item "print" | 1127 (defvar pr-menu-print-item "print" |
1152 | 1152 |
1153 | 1153 |
1154 (cond | 1154 (cond |
1155 ((featurep 'xemacs) ; XEmacs | 1155 ((featurep 'xemacs) ; XEmacs |
1156 ;; XEmacs | 1156 ;; XEmacs |
1157 (defalias 'pr-f-set-keymap-parents 'set-keymap-parents) | 1157 (defalias 'pr-set-keymap-parents 'set-keymap-parents) |
1158 (defalias 'pr-f-set-keymap-name 'set-keymap-name) | 1158 (defalias 'pr-set-keymap-name 'set-keymap-name) |
1159 | 1159 |
1160 ;; XEmacs | 1160 ;; XEmacs |
1161 (defun pr-f-read-string (prompt initial history default) | 1161 (defun pr-read-string (prompt initial history default) |
1162 (let ((str (read-string prompt initial))) | 1162 (let ((str (read-string prompt initial))) |
1163 (if (and str (not (string= str ""))) | 1163 (if (and str (not (string= str ""))) |
1164 str | 1164 str |
1165 default))) | 1165 default))) |
1166 | 1166 |
1351 ((featurep 'xemacs) ; XEmacs | 1351 ((featurep 'xemacs) ; XEmacs |
1352 ;; Do nothing | 1352 ;; Do nothing |
1353 ) | 1353 ) |
1354 (t ; GNU Emacs | 1354 (t ; GNU Emacs |
1355 ;; GNU Emacs | 1355 ;; GNU Emacs |
1356 (defalias 'pr-f-set-keymap-parents 'set-keymap-parent) | 1356 (defalias 'pr-set-keymap-parents 'set-keymap-parent) |
1357 (defalias 'pr-f-set-keymap-name 'ignore) | 1357 (defalias 'pr-set-keymap-name 'ignore) |
1358 (defalias 'pr-f-read-string 'read-string) | 1358 (defalias 'pr-read-string 'read-string) |
1359 | 1359 |
1360 ;; GNU Emacs | 1360 ;; GNU Emacs |
1361 (defvar deactivate-mark) | 1361 (defvar deactivate-mark) |
1362 | 1362 |
1363 ;; GNU Emacs | 1363 ;; GNU Emacs |
1449 (* (pr-menu-index entry index) pr-menu-char-height))) | 1449 (* (pr-menu-index entry index) pr-menu-char-height))) |
1450 (selected-frame)))) ; frame | 1450 (selected-frame)))) ; frame |
1451 ))) | 1451 ))) |
1452 | 1452 |
1453 (defvar pr-menu-position nil) | 1453 (defvar pr-menu-position nil) |
1454 (defvar pr-menu-state nil) | 1454 (defvar pr-menu-state nil) |
1455 | 1455 |
1456 ;; GNU Emacs | 1456 ;; GNU Emacs |
1457 (defun pr-menu-lookup (path) | 1457 (defun pr-menu-lookup (path) |
1458 (lookup-key global-map | 1458 (lookup-key global-map |
1459 (if path | 1459 (if path |
5717 (defun pr-interactive-n-up (mess) | 5717 (defun pr-interactive-n-up (mess) |
5718 (or (stringp mess) (setq mess "*")) | 5718 (or (stringp mess) (setq mess "*")) |
5719 (save-match-data | 5719 (save-match-data |
5720 (let* ((fmt-prompt "%s[%s] N-up printing (default 1): ") | 5720 (let* ((fmt-prompt "%s[%s] N-up printing (default 1): ") |
5721 (prompt "") | 5721 (prompt "") |
5722 (str (pr-f-read-string (format fmt-prompt prompt mess) "1" nil "1")) | 5722 (str (pr-read-string (format fmt-prompt prompt mess) "1" nil "1")) |
5723 int) | 5723 int) |
5724 (while (if (string-match "^\\s *[0-9]+$" str) | 5724 (while (if (string-match "^\\s *[0-9]+$" str) |
5725 (setq int (string-to-number str) | 5725 (setq int (string-to-number str) |
5726 prompt (cond ((< int 1) "Integer below 1; ") | 5726 prompt (cond ((< int 1) "Integer below 1; ") |
5727 ((> int 100) "Integer above 100; ") | 5727 ((> int 100) "Integer above 100; ") |
5728 (t nil))) | 5728 (t nil))) |
5729 (setq prompt "Invalid integer syntax; ")) | 5729 (setq prompt "Invalid integer syntax; ")) |
5730 (ding) | 5730 (ding) |
5731 (setq str | 5731 (setq str |
5732 (pr-f-read-string (format fmt-prompt prompt mess) str nil "1"))) | 5732 (pr-read-string (format fmt-prompt prompt mess) str nil "1"))) |
5733 int))) | 5733 int))) |
5734 | 5734 |
5735 | 5735 |
5736 (defun pr-interactive-dir (mess) | 5736 (defun pr-interactive-dir (mess) |
5737 (let* ((dir-name (file-name-directory (or (buffer-file-name) | 5737 (let* ((dir-name (file-name-directory (or (buffer-file-name) |
5752 "" dir-name nil dir-name))) | 5752 "" dir-name nil dir-name))) |
5753 (file-name-as-directory dir))) | 5753 (file-name-as-directory dir))) |
5754 | 5754 |
5755 | 5755 |
5756 (defun pr-interactive-regexp (mess) | 5756 (defun pr-interactive-regexp (mess) |
5757 (pr-f-read-string (format "[%s] File regexp to print: " mess) "" nil "")) | 5757 (pr-read-string (format "[%s] File regexp to print: " mess) "" nil "")) |
5758 | 5758 |
5759 | 5759 |
5760 (defun pr-interactive-dir-args (mess) | 5760 (defun pr-interactive-dir-args (mess) |
5761 (list | 5761 (list |
5762 ;; get directory argument | 5762 ;; get directory argument |
6036 | 6036 |
6037 (defvar pr-interface-map nil | 6037 (defvar pr-interface-map nil |
6038 "Keymap for pr-interface.") | 6038 "Keymap for pr-interface.") |
6039 | 6039 |
6040 (unless pr-interface-map | 6040 (unless pr-interface-map |
6041 (setq pr-interface-map (make-sparse-keymap)) | 6041 (let ((map (make-sparse-keymap))) |
6042 (cond ((featurep 'xemacs) ; XEmacs | 6042 (cond ((featurep 'xemacs) ; XEmacs |
6043 (pr-f-set-keymap-parents pr-interface-map (list widget-keymap)) | 6043 (pr-set-keymap-parents map (list widget-keymap)) |
6044 (pr-f-set-keymap-name pr-interface-map 'pr-interface-map)) | 6044 (pr-set-keymap-name map 'pr-interface-map)) |
6045 (t ; GNU Emacs | 6045 (t ; GNU Emacs |
6046 (pr-f-set-keymap-parents pr-interface-map widget-keymap))) | 6046 (pr-set-keymap-parents map widget-keymap))) |
6047 (define-key pr-interface-map "q" 'pr-interface-quit) | 6047 (define-key map "q" 'pr-interface-quit) |
6048 (define-key pr-interface-map "?" 'pr-interface-help)) | 6048 (define-key map "?" 'pr-interface-help) |
6049 (setq pr-interface-map map))) | |
6049 | 6050 |
6050 | 6051 |
6051 (defmacro pr-interface-save (&rest body) | 6052 (defmacro pr-interface-save (&rest body) |
6052 `(save-excursion | 6053 `(save-excursion |
6053 (set-buffer pr-i-buffer) | 6054 (set-buffer pr-i-buffer) |