diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/mail/vms-pmail.el | 2 | ||||
| -rw-r--r-- | lisp/printing.el | 1132 | ||||
| -rw-r--r-- | lisp/tooltip.el | 2 |
4 files changed, 575 insertions, 570 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c6dd6c68c43..aeba7efff8b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2007-10-22 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | * mail/vms-pmail.el (insert-signature): Don't use end-of-buffer. | ||
| 4 | |||
| 5 | * tooltip.el: Use featurep 'xemacs. | ||
| 6 | |||
| 7 | * printing.el: Move variable definitions before use, no code | ||
| 8 | change. | ||
| 9 | |||
| 1 | 2007-10-22 Juri Linkov <juri@jurta.org> | 10 | 2007-10-22 Juri Linkov <juri@jurta.org> |
| 2 | 11 | ||
| 3 | * simple.el (goto-history-element): Allow minibuffer-default to be | 12 | * simple.el (goto-history-element): Allow minibuffer-default to be |
diff --git a/lisp/mail/vms-pmail.el b/lisp/mail/vms-pmail.el index 2d01e2a612b..022a8070a2e 100644 --- a/lisp/mail/vms-pmail.el +++ b/lisp/mail/vms-pmail.el | |||
| @@ -110,7 +110,7 @@ First try the file indicated by environment variable MAIL$TRAILER. | |||
| 110 | If that fails, try the file \"~/.signature\". | 110 | If that fails, try the file \"~/.signature\". |
| 111 | If neither file exists, fails quietly." | 111 | If neither file exists, fails quietly." |
| 112 | (interactive) | 112 | (interactive) |
| 113 | (end-of-buffer) | 113 | (goto-char (point-max)) |
| 114 | (newline) | 114 | (newline) |
| 115 | (if (vms-system-info "LOGICAL" "MAIL$TRAILER") | 115 | (if (vms-system-info "LOGICAL" "MAIL$TRAILER") |
| 116 | (if (file-attributes (vms-system-info "LOGICAL" "MAIL$TRAILER")) | 116 | (if (file-attributes (vms-system-info "LOGICAL" "MAIL$TRAILER")) |
diff --git a/lisp/printing.el b/lisp/printing.el index 0f589564083..b487abb1f92 100644 --- a/lisp/printing.el +++ b/lisp/printing.el | |||
| @@ -1094,552 +1094,6 @@ If SUFFIX is non-nil, add that at the end of the file name." | |||
| 1094 | 1094 | ||
| 1095 | 1095 | ||
| 1096 | 1096 | ||
| 1097 | ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1098 | ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1099 | ;; XEmacs Definitions | ||
| 1100 | |||
| 1101 | |||
| 1102 | (cond | ||
| 1103 | ((featurep 'xemacs) ; XEmacs | ||
| 1104 | ;; XEmacs | ||
| 1105 | (defalias 'pr-f-set-keymap-parents 'set-keymap-parents) | ||
| 1106 | (defalias 'pr-f-set-keymap-name 'set-keymap-name) | ||
| 1107 | |||
| 1108 | ;; XEmacs | ||
| 1109 | (defun pr-f-read-string (prompt initial history default) | ||
| 1110 | (let ((str (read-string prompt initial))) | ||
| 1111 | (if (and str (not (string= str ""))) | ||
| 1112 | str | ||
| 1113 | default))) | ||
| 1114 | |||
| 1115 | ;; XEmacs | ||
| 1116 | (defvar zmacs-region-stays nil) | ||
| 1117 | |||
| 1118 | ;; XEmacs | ||
| 1119 | (defun pr-keep-region-active () | ||
| 1120 | (setq zmacs-region-stays t)) | ||
| 1121 | |||
| 1122 | ;; XEmacs | ||
| 1123 | (defun pr-region-active-p () | ||
| 1124 | (and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p))) | ||
| 1125 | |||
| 1126 | ;; XEmacs | ||
| 1127 | (defun pr-menu-char-height () | ||
| 1128 | (font-height (face-font 'default))) | ||
| 1129 | |||
| 1130 | ;; XEmacs | ||
| 1131 | (defun pr-menu-char-width () | ||
| 1132 | (font-width (face-font 'default))) | ||
| 1133 | |||
| 1134 | ;; XEmacs | ||
| 1135 | (defmacro pr-xemacs-global-menubar (&rest body) | ||
| 1136 | `(save-excursion | ||
| 1137 | (let ((temp (get-buffer-create (make-temp-name " *Temp")))) | ||
| 1138 | ;; be sure to access global menubar | ||
| 1139 | (set-buffer temp) | ||
| 1140 | ,@body | ||
| 1141 | (kill-buffer temp)))) | ||
| 1142 | |||
| 1143 | ;; XEmacs | ||
| 1144 | (defun pr-global-menubar (pr-menu-spec) | ||
| 1145 | ;; Menu binding | ||
| 1146 | (pr-xemacs-global-menubar | ||
| 1147 | (add-submenu nil (cons "Printing" pr-menu-spec) "Apps")) | ||
| 1148 | (setq pr-menu-print-item nil)) | ||
| 1149 | |||
| 1150 | ;; XEmacs | ||
| 1151 | (defvar current-mouse-event nil) | ||
| 1152 | (defun pr-menu-position (entry index horizontal) | ||
| 1153 | (make-event | ||
| 1154 | 'button-release | ||
| 1155 | (list 'button 1 | ||
| 1156 | 'x (- (event-x-pixel current-mouse-event) ; X | ||
| 1157 | (* horizontal pr-menu-char-width)) | ||
| 1158 | 'y (- (event-y-pixel current-mouse-event) ; Y | ||
| 1159 | (* (pr-menu-index entry index) pr-menu-char-height))))) | ||
| 1160 | |||
| 1161 | (defvar pr-menu-position nil) | ||
| 1162 | (defvar pr-menu-state nil) | ||
| 1163 | |||
| 1164 | ;; XEmacs | ||
| 1165 | (defvar current-menubar nil) ; to avoid compilation gripes | ||
| 1166 | (defun pr-menu-lookup (path) | ||
| 1167 | (car (find-menu-item current-menubar (cons "Printing" path)))) | ||
| 1168 | |||
| 1169 | ;; XEmacs | ||
| 1170 | (defun pr-menu-lock (entry index horizontal state path) | ||
| 1171 | (when pr-menu-lock | ||
| 1172 | (or (and pr-menu-position (eq state pr-menu-state)) | ||
| 1173 | (setq pr-menu-position (pr-menu-position entry index horizontal) | ||
| 1174 | pr-menu-state state)) | ||
| 1175 | (let* ((menu (pr-menu-lookup path)) | ||
| 1176 | (result (get-popup-menu-response menu pr-menu-position))) | ||
| 1177 | (and (misc-user-event-p result) | ||
| 1178 | (funcall (event-function result) | ||
| 1179 | (event-object result)))) | ||
| 1180 | (setq pr-menu-position nil))) | ||
| 1181 | |||
| 1182 | ;; XEmacs | ||
| 1183 | (defalias 'pr-update-mode-line 'set-menubar-dirty-flag) | ||
| 1184 | |||
| 1185 | ;; XEmacs | ||
| 1186 | (defvar pr-ps-name-old "PostScript Printers") | ||
| 1187 | (defvar pr-txt-name-old "Text Printers") | ||
| 1188 | (defvar pr-ps-utility-old "PostScript Utility") | ||
| 1189 | (defvar pr-even-or-odd-old "Print All Pages") | ||
| 1190 | |||
| 1191 | ;; XEmacs | ||
| 1192 | (defun pr-do-update-menus (&optional force) | ||
| 1193 | (pr-menu-alist pr-ps-printer-alist | ||
| 1194 | 'pr-ps-name | ||
| 1195 | 'pr-menu-set-ps-title | ||
| 1196 | '("Printing") | ||
| 1197 | 'pr-ps-printer-menu-modified | ||
| 1198 | force | ||
| 1199 | pr-ps-name-old | ||
| 1200 | 'postscript 2) | ||
| 1201 | (pr-menu-alist pr-txt-printer-alist | ||
| 1202 | 'pr-txt-name | ||
| 1203 | 'pr-menu-set-txt-title | ||
| 1204 | '("Printing") | ||
| 1205 | 'pr-txt-printer-menu-modified | ||
| 1206 | force | ||
| 1207 | pr-txt-name-old | ||
| 1208 | 'text 2) | ||
| 1209 | (let ((save-var pr-ps-utility-menu-modified)) | ||
| 1210 | (pr-menu-alist pr-ps-utility-alist | ||
| 1211 | 'pr-ps-utility | ||
| 1212 | 'pr-menu-set-utility-title | ||
| 1213 | '("Printing" "PostScript Print" "File") | ||
| 1214 | 'save-var | ||
| 1215 | force | ||
| 1216 | pr-ps-utility-old | ||
| 1217 | nil 1)) | ||
| 1218 | (pr-menu-alist pr-ps-utility-alist | ||
| 1219 | 'pr-ps-utility | ||
| 1220 | 'pr-menu-set-utility-title | ||
| 1221 | '("Printing" "PostScript Preview" "File") | ||
| 1222 | 'pr-ps-utility-menu-modified | ||
| 1223 | force | ||
| 1224 | pr-ps-utility-old | ||
| 1225 | nil 1) | ||
| 1226 | (pr-even-or-odd-pages ps-even-or-odd-pages force)) | ||
| 1227 | |||
| 1228 | ;; XEmacs | ||
| 1229 | (defun pr-menu-alist (alist var-sym fun menu-path modified-sym force name | ||
| 1230 | entry index) | ||
| 1231 | (when (and alist (or force (symbol-value modified-sym))) | ||
| 1232 | (pr-xemacs-global-menubar | ||
| 1233 | (add-submenu menu-path | ||
| 1234 | (pr-menu-create name alist var-sym | ||
| 1235 | fun entry index))) | ||
| 1236 | (funcall fun (symbol-value var-sym)) | ||
| 1237 | (set modified-sym nil))) | ||
| 1238 | |||
| 1239 | ;; XEmacs | ||
| 1240 | (defun pr-relabel-menu-item (newname var-sym) | ||
| 1241 | (pr-xemacs-global-menubar | ||
| 1242 | (relabel-menu-item | ||
| 1243 | (list "Printing" (symbol-value var-sym)) | ||
| 1244 | newname) | ||
| 1245 | (set var-sym newname))) | ||
| 1246 | |||
| 1247 | ;; XEmacs | ||
| 1248 | (defun pr-menu-set-ps-title (value &optional item entry index) | ||
| 1249 | (pr-relabel-menu-item (format "PostScript Printer: %s" value) | ||
| 1250 | 'pr-ps-name-old) | ||
| 1251 | (pr-ps-set-printer value) | ||
| 1252 | (and index | ||
| 1253 | (pr-menu-lock entry index 12 'toggle nil))) | ||
| 1254 | |||
| 1255 | ;; XEmacs | ||
| 1256 | (defun pr-menu-set-txt-title (value &optional item entry index) | ||
| 1257 | (pr-relabel-menu-item (format "Text Printer: %s" value) | ||
| 1258 | 'pr-txt-name-old) | ||
| 1259 | (pr-txt-set-printer value) | ||
| 1260 | (and index | ||
| 1261 | (pr-menu-lock entry index 12 'toggle nil))) | ||
| 1262 | |||
| 1263 | ;; XEmacs | ||
| 1264 | (defun pr-menu-set-utility-title (value &optional item entry index) | ||
| 1265 | (pr-xemacs-global-menubar | ||
| 1266 | (let ((newname (format "%s" value))) | ||
| 1267 | (relabel-menu-item | ||
| 1268 | (list "Printing" "PostScript Print" "File" pr-ps-utility-old) | ||
| 1269 | newname) | ||
| 1270 | (relabel-menu-item | ||
| 1271 | (list "Printing" "PostScript Preview" "File" pr-ps-utility-old) | ||
| 1272 | newname) | ||
| 1273 | (setq pr-ps-utility-old newname))) | ||
| 1274 | (pr-ps-set-utility value) | ||
| 1275 | (and index | ||
| 1276 | (pr-menu-lock entry index 5 nil '("PostScript Print" "File")))) | ||
| 1277 | |||
| 1278 | ;; XEmacs | ||
| 1279 | (defun pr-even-or-odd-pages (value &optional no-lock) | ||
| 1280 | (pr-relabel-menu-item (cdr (assq value pr-even-or-odd-alist)) | ||
| 1281 | 'pr-even-or-odd-old) | ||
| 1282 | (setq ps-even-or-odd-pages value) | ||
| 1283 | (or no-lock | ||
| 1284 | (pr-menu-lock 'postscript-options 8 12 'toggle nil))) | ||
| 1285 | |||
| 1286 | ) | ||
| 1287 | (t ; GNU Emacs | ||
| 1288 | ;; Do nothing | ||
| 1289 | )) ; end cond featurep | ||
| 1290 | |||
| 1291 | |||
| 1292 | |||
| 1293 | ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1294 | ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1295 | ;; GNU Emacs Definitions | ||
| 1296 | |||
| 1297 | |||
| 1298 | (cond | ||
| 1299 | ((featurep 'xemacs) ; XEmacs | ||
| 1300 | ;; Do nothing | ||
| 1301 | ) | ||
| 1302 | (t ; GNU Emacs | ||
| 1303 | ;; GNU Emacs | ||
| 1304 | (defalias 'pr-f-set-keymap-parents 'set-keymap-parent) | ||
| 1305 | (defalias 'pr-f-set-keymap-name 'ignore) | ||
| 1306 | (defalias 'pr-f-read-string 'read-string) | ||
| 1307 | |||
| 1308 | ;; GNU Emacs | ||
| 1309 | (defvar deactivate-mark) | ||
| 1310 | |||
| 1311 | ;; GNU Emacs | ||
| 1312 | (defun pr-keep-region-active () | ||
| 1313 | (setq deactivate-mark nil)) | ||
| 1314 | |||
| 1315 | ;; GNU Emacs | ||
| 1316 | (defun pr-region-active-p () | ||
| 1317 | (and pr-auto-region transient-mark-mode mark-active)) | ||
| 1318 | |||
| 1319 | ;; GNU Emacs | ||
| 1320 | (defun pr-menu-char-height () | ||
| 1321 | (frame-char-height)) | ||
| 1322 | |||
| 1323 | ;; GNU Emacs | ||
| 1324 | (defun pr-menu-char-width () | ||
| 1325 | (frame-char-width)) | ||
| 1326 | |||
| 1327 | ;; GNU Emacs | ||
| 1328 | ;; Menu binding | ||
| 1329 | ;; Replace existing "print" item by "Printing" item. | ||
| 1330 | ;; If you're changing this file, you'll load it a second, | ||
| 1331 | ;; third... time, but "print" item exists only in the first load. | ||
| 1332 | (eval-and-compile | ||
| 1333 | (cond | ||
| 1334 | ;; GNU Emacs 20 | ||
| 1335 | ((< emacs-major-version 21) | ||
| 1336 | (defun pr-global-menubar (pr-menu-spec) | ||
| 1337 | (require 'easymenu) | ||
| 1338 | (easy-menu-change '("tools") "Printing" pr-menu-spec pr-menu-print-item) | ||
| 1339 | (when pr-menu-print-item | ||
| 1340 | (easy-menu-remove-item nil '("tools") pr-menu-print-item) | ||
| 1341 | (setq pr-menu-print-item nil | ||
| 1342 | pr-menu-bar (vector 'menu-bar 'tools | ||
| 1343 | (pr-get-symbol "Printing"))))) | ||
| 1344 | ) | ||
| 1345 | ;; GNU Emacs 21 & 22 | ||
| 1346 | (t | ||
| 1347 | (defun pr-global-menubar (pr-menu-spec) | ||
| 1348 | (require 'easymenu) | ||
| 1349 | (let ((menu-file (if (= emacs-major-version 21) | ||
| 1350 | '("menu-bar" "files") ; GNU Emacs 21 | ||
| 1351 | '("menu-bar" "file")))) ; GNU Emacs 22 or higher | ||
| 1352 | (cond | ||
| 1353 | (pr-menu-print-item | ||
| 1354 | (easy-menu-add-item global-map menu-file | ||
| 1355 | (easy-menu-create-menu "Print" pr-menu-spec) | ||
| 1356 | "print-buffer") | ||
| 1357 | (dolist (item '("print-buffer" "print-region" | ||
| 1358 | "ps-print-buffer-faces" "ps-print-region-faces" | ||
| 1359 | "ps-print-buffer" "ps-print-region")) | ||
| 1360 | (easy-menu-remove-item global-map menu-file item)) | ||
| 1361 | (setq pr-menu-print-item nil | ||
| 1362 | pr-menu-bar (vector 'menu-bar | ||
| 1363 | (pr-get-symbol (nth 1 menu-file)) | ||
| 1364 | (pr-get-symbol "Print")))) | ||
| 1365 | (t | ||
| 1366 | (easy-menu-add-item global-map menu-file | ||
| 1367 | (easy-menu-create-menu "Print" pr-menu-spec))) | ||
| 1368 | ))) | ||
| 1369 | ))) | ||
| 1370 | |||
| 1371 | (eval-and-compile | ||
| 1372 | (cond | ||
| 1373 | (ps-windows-system | ||
| 1374 | ;; GNU Emacs for Windows 9x/NT | ||
| 1375 | (defun pr-menu-position (entry index horizontal) | ||
| 1376 | (let ((pos (cdr (mouse-pixel-position)))) | ||
| 1377 | (list | ||
| 1378 | (list (or (car pos) 0) ; X | ||
| 1379 | (- (or (cdr pos) 0) ; Y | ||
| 1380 | (* (pr-menu-index entry index) pr-menu-char-height))) | ||
| 1381 | (selected-frame)))) ; frame | ||
| 1382 | ) | ||
| 1383 | (t | ||
| 1384 | ;; GNU Emacs | ||
| 1385 | (defun pr-menu-position (entry index horizontal) | ||
| 1386 | (let ((pos (cdr (mouse-pixel-position)))) | ||
| 1387 | (list | ||
| 1388 | (list (- (or (car pos) 0) ; X | ||
| 1389 | (* horizontal pr-menu-char-width)) | ||
| 1390 | (- (or (cdr pos) 0) ; Y | ||
| 1391 | (* (pr-menu-index entry index) pr-menu-char-height))) | ||
| 1392 | (selected-frame)))) ; frame | ||
| 1393 | ))) | ||
| 1394 | |||
| 1395 | (defvar pr-menu-position nil) | ||
| 1396 | (defvar pr-menu-state nil) | ||
| 1397 | |||
| 1398 | ;; GNU Emacs | ||
| 1399 | (defun pr-menu-lookup (path) | ||
| 1400 | (lookup-key global-map | ||
| 1401 | (if path | ||
| 1402 | (vconcat pr-menu-bar | ||
| 1403 | (mapcar 'pr-get-symbol | ||
| 1404 | (if (listp path) | ||
| 1405 | path | ||
| 1406 | (list path)))) | ||
| 1407 | pr-menu-bar))) | ||
| 1408 | |||
| 1409 | ;; GNU Emacs | ||
| 1410 | (defun pr-menu-lock (entry index horizontal state path) | ||
| 1411 | (when pr-menu-lock | ||
| 1412 | (or (and pr-menu-position (eq state pr-menu-state)) | ||
| 1413 | (setq pr-menu-position (pr-menu-position entry index horizontal) | ||
| 1414 | pr-menu-state state)) | ||
| 1415 | (let* ((menu (pr-menu-lookup path)) | ||
| 1416 | (result (x-popup-menu pr-menu-position menu))) | ||
| 1417 | (and result | ||
| 1418 | (let ((command (lookup-key menu (vconcat result)))) | ||
| 1419 | (if (fboundp command) | ||
| 1420 | (funcall command) | ||
| 1421 | (eval command))))) | ||
| 1422 | (setq pr-menu-position nil))) | ||
| 1423 | |||
| 1424 | ;; GNU Emacs | ||
| 1425 | (defalias 'pr-update-mode-line 'force-mode-line-update) | ||
| 1426 | |||
| 1427 | ;; GNU Emacs | ||
| 1428 | (defun pr-do-update-menus (&optional force) | ||
| 1429 | (pr-menu-alist pr-ps-printer-alist | ||
| 1430 | 'pr-ps-name | ||
| 1431 | 'pr-menu-set-ps-title | ||
| 1432 | "PostScript Printers" | ||
| 1433 | 'pr-ps-printer-menu-modified | ||
| 1434 | force | ||
| 1435 | "PostScript Printers" | ||
| 1436 | 'postscript 2) | ||
| 1437 | (pr-menu-alist pr-txt-printer-alist | ||
| 1438 | 'pr-txt-name | ||
| 1439 | 'pr-menu-set-txt-title | ||
| 1440 | "Text Printers" | ||
| 1441 | 'pr-txt-printer-menu-modified | ||
| 1442 | force | ||
| 1443 | "Text Printers" | ||
| 1444 | 'text 2) | ||
| 1445 | (let ((save-var pr-ps-utility-menu-modified)) | ||
| 1446 | (pr-menu-alist pr-ps-utility-alist | ||
| 1447 | 'pr-ps-utility | ||
| 1448 | 'pr-menu-set-utility-title | ||
| 1449 | '("PostScript Print" "File" "PostScript Utility") | ||
| 1450 | 'save-var | ||
| 1451 | force | ||
| 1452 | "PostScript Utility" | ||
| 1453 | nil 1)) | ||
| 1454 | (pr-menu-alist pr-ps-utility-alist | ||
| 1455 | 'pr-ps-utility | ||
| 1456 | 'pr-menu-set-utility-title | ||
| 1457 | '("PostScript Preview" "File" "PostScript Utility") | ||
| 1458 | 'pr-ps-utility-menu-modified | ||
| 1459 | force | ||
| 1460 | "PostScript Utility" | ||
| 1461 | nil 1) | ||
| 1462 | (pr-even-or-odd-pages ps-even-or-odd-pages force)) | ||
| 1463 | |||
| 1464 | ;; GNU Emacs | ||
| 1465 | (defun pr-menu-get-item (name-list) | ||
| 1466 | ;; NAME-LIST is a string or a list of strings. | ||
| 1467 | (or (listp name-list) | ||
| 1468 | (setq name-list (list name-list))) | ||
| 1469 | (and name-list | ||
| 1470 | (let* ((reversed (reverse name-list)) | ||
| 1471 | (name (pr-get-symbol (car reversed))) | ||
| 1472 | (path (nreverse (cdr reversed))) | ||
| 1473 | (menu (lookup-key | ||
| 1474 | global-map | ||
| 1475 | (vconcat pr-menu-bar | ||
| 1476 | (mapcar 'pr-get-symbol path))))) | ||
| 1477 | (assq name (nthcdr 2 menu))))) | ||
| 1478 | |||
| 1479 | ;; GNU Emacs | ||
| 1480 | (defvar pr-temp-menu nil) | ||
| 1481 | |||
| 1482 | ;; GNU Emacs | ||
| 1483 | (defun pr-menu-alist (alist var-sym fun menu-path modified-sym force name | ||
| 1484 | entry index) | ||
| 1485 | (when (and alist (or force (symbol-value modified-sym))) | ||
| 1486 | (easy-menu-define pr-temp-menu nil "" | ||
| 1487 | (pr-menu-create name alist var-sym fun entry index)) | ||
| 1488 | (let ((item (pr-menu-get-item menu-path))) | ||
| 1489 | (and item | ||
| 1490 | (let* ((binding (nthcdr 3 item)) | ||
| 1491 | (key-binding (cdr binding))) | ||
| 1492 | (setcar binding pr-temp-menu) | ||
| 1493 | (and key-binding (listp (car key-binding)) | ||
| 1494 | (setcdr binding (cdr key-binding))) ; skip KEY-BINDING | ||
| 1495 | (funcall fun (symbol-value var-sym) item)))) | ||
| 1496 | (set modified-sym nil))) | ||
| 1497 | |||
| 1498 | ;; GNU Emacs | ||
| 1499 | (defun pr-menu-set-item-name (item name) | ||
| 1500 | (and item | ||
| 1501 | (setcar (nthcdr 2 item) name))) ; ITEM-NAME | ||
| 1502 | |||
| 1503 | ;; GNU Emacs | ||
| 1504 | (defun pr-menu-set-ps-title (value &optional item entry index) | ||
| 1505 | (pr-menu-set-item-name (or item | ||
| 1506 | (pr-menu-get-item "PostScript Printers")) | ||
| 1507 | (format "PostScript Printer: %s" value)) | ||
| 1508 | (pr-ps-set-printer value) | ||
| 1509 | (and index | ||
| 1510 | (pr-menu-lock entry index 12 'toggle nil))) | ||
| 1511 | |||
| 1512 | ;; GNU Emacs | ||
| 1513 | (defun pr-menu-set-txt-title (value &optional item entry index) | ||
| 1514 | (pr-menu-set-item-name (or item | ||
| 1515 | (pr-menu-get-item "Text Printers")) | ||
| 1516 | (format "Text Printer: %s" value)) | ||
| 1517 | (pr-txt-set-printer value) | ||
| 1518 | (and index | ||
| 1519 | (pr-menu-lock entry index 12 'toggle nil))) | ||
| 1520 | |||
| 1521 | ;; GNU Emacs | ||
| 1522 | (defun pr-menu-set-utility-title (value &optional item entry index) | ||
| 1523 | (let ((name (symbol-name value))) | ||
| 1524 | (if item | ||
| 1525 | (pr-menu-set-item-name item name) | ||
| 1526 | (pr-menu-set-item-name | ||
| 1527 | (pr-menu-get-item | ||
| 1528 | '("PostScript Print" "File" "PostScript Utility")) | ||
| 1529 | name) | ||
| 1530 | (pr-menu-set-item-name | ||
| 1531 | (pr-menu-get-item | ||
| 1532 | '("PostScript Preview" "File" "PostScript Utility")) | ||
| 1533 | name))) | ||
| 1534 | (pr-ps-set-utility value) | ||
| 1535 | (and index | ||
| 1536 | (pr-menu-lock entry index 5 nil '("PostScript Print" "File")))) | ||
| 1537 | |||
| 1538 | ;; GNU Emacs | ||
| 1539 | (defun pr-even-or-odd-pages (value &optional no-lock) | ||
| 1540 | (pr-menu-set-item-name (pr-menu-get-item "Print All Pages") | ||
| 1541 | (cdr (assq value pr-even-or-odd-alist))) | ||
| 1542 | (setq ps-even-or-odd-pages value) | ||
| 1543 | (or no-lock | ||
| 1544 | (pr-menu-lock 'postscript-options 8 12 'toggle nil))) | ||
| 1545 | |||
| 1546 | )) ; end cond featurep | ||
| 1547 | |||
| 1548 | |||
| 1549 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1550 | ;; Customization Functions | ||
| 1551 | |||
| 1552 | |||
| 1553 | (defun pr-alist-custom-set (symbol value) | ||
| 1554 | "Set the value of custom variables for printer & utility selection." | ||
| 1555 | (set symbol value) | ||
| 1556 | (and (featurep 'printing) ; update only after printing is loaded | ||
| 1557 | (pr-update-menus t))) | ||
| 1558 | |||
| 1559 | |||
| 1560 | (defun pr-ps-utility-custom-set (symbol value) | ||
| 1561 | "Update utility menu entry." | ||
| 1562 | (set symbol value) | ||
| 1563 | (and (featurep 'printing) ; update only after printing is loaded | ||
| 1564 | (pr-menu-set-utility-title value))) | ||
| 1565 | |||
| 1566 | |||
| 1567 | (defun pr-ps-name-custom-set (symbol value) | ||
| 1568 | "Update `PostScript Printer:' menu entry." | ||
| 1569 | (set symbol value) | ||
| 1570 | (and (featurep 'printing) ; update only after printing is loaded | ||
| 1571 | (pr-menu-set-ps-title value))) | ||
| 1572 | |||
| 1573 | |||
| 1574 | (defun pr-txt-name-custom-set (symbol value) | ||
| 1575 | "Update `Text Printer:' menu entry." | ||
| 1576 | (set symbol value) | ||
| 1577 | (and (featurep 'printing) ; update only after printing is loaded | ||
| 1578 | (pr-menu-set-txt-title value))) | ||
| 1579 | |||
| 1580 | |||
| 1581 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1582 | ;; User Interface (I) | ||
| 1583 | |||
| 1584 | |||
| 1585 | (defgroup printing nil | ||
| 1586 | "Printing Utilities group." | ||
| 1587 | :tag "Printing Utilities" | ||
| 1588 | :link '(emacs-library-link :tag "Source Lisp File" "printing.el") | ||
| 1589 | :prefix "pr-" | ||
| 1590 | :version "20" | ||
| 1591 | :group 'wp | ||
| 1592 | :group 'postscript) | ||
| 1593 | |||
| 1594 | |||
| 1595 | (defcustom pr-path-style | ||
| 1596 | (if (and (not pr-cygwin-system) | ||
| 1597 | ps-windows-system) | ||
| 1598 | 'windows | ||
| 1599 | 'unix) | ||
| 1600 | "*Specify which path style to use for external commands. | ||
| 1601 | |||
| 1602 | Valid values are: | ||
| 1603 | |||
| 1604 | windows Windows 9x/NT style (\\) | ||
| 1605 | |||
| 1606 | unix Unix style (/)" | ||
| 1607 | :type '(choice :tag "Path style" | ||
| 1608 | (const :tag "Windows 9x/NT Style (\\)" :value windows) | ||
| 1609 | (const :tag "Unix Style (/)" :value unix)) | ||
| 1610 | :version "20" | ||
| 1611 | :group 'printing) | ||
| 1612 | |||
| 1613 | |||
| 1614 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1615 | ;; Internal Functions (I) | ||
| 1616 | |||
| 1617 | |||
| 1618 | (defun pr-dosify-file-name (path) | ||
| 1619 | "Replace unix-style directory separator character with dos/windows one." | ||
| 1620 | (interactive "sPath: ") | ||
| 1621 | (if (eq pr-path-style 'windows) | ||
| 1622 | (subst-char-in-string ?/ ?\\ path) | ||
| 1623 | path)) | ||
| 1624 | |||
| 1625 | |||
| 1626 | (defun pr-unixify-file-name (path) | ||
| 1627 | "Replace dos/windows-style directory separator character with unix one." | ||
| 1628 | (interactive "sPath: ") | ||
| 1629 | (if (eq pr-path-style 'windows) | ||
| 1630 | (subst-char-in-string ?\\ ?/ path) | ||
| 1631 | path)) | ||
| 1632 | |||
| 1633 | |||
| 1634 | (defun pr-standard-file-name (path) | ||
| 1635 | "Ensure the proper directory separator depending on the OS. | ||
| 1636 | That is, if Emacs is running on DOS/Windows, ensure dos/windows-style directory | ||
| 1637 | separator; otherwise, ensure unix-style directory separator." | ||
| 1638 | (if (or pr-cygwin-system ps-windows-system) | ||
| 1639 | (subst-char-in-string ?/ ?\\ path) | ||
| 1640 | (subst-char-in-string ?\\ ?/ path))) | ||
| 1641 | |||
| 1642 | |||
| 1643 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1097 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 1644 | ;; User Interface (II) | 1098 | ;; User Interface (II) |
| 1645 | 1099 | ||
| @@ -3115,6 +2569,13 @@ It's used by `pr-interface'." | |||
| 3115 | :version "20" | 2569 | :version "20" |
| 3116 | :group 'printing) | 2570 | :group 'printing) |
| 3117 | 2571 | ||
| 2572 | (defconst pr-even-or-odd-alist | ||
| 2573 | '((nil . "Print All Pages") | ||
| 2574 | (even-page . "Print Even Pages") | ||
| 2575 | (odd-page . "Print Odd Pages") | ||
| 2576 | (even-sheet . "Print Even Sheets") | ||
| 2577 | (odd-sheet . "Print Odd Sheets"))) | ||
| 2578 | |||
| 3118 | 2579 | ||
| 3119 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 2580 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 3120 | ;; Internal Variables | 2581 | ;; Internal Variables |
| @@ -3158,6 +2619,563 @@ See `pr-ps-printer-alist'.") | |||
| 3158 | (defvar pr-menu-bar nil | 2619 | (defvar pr-menu-bar nil |
| 3159 | "Specify Printing menu-bar entry.") | 2620 | "Specify Printing menu-bar entry.") |
| 3160 | 2621 | ||
| 2622 | (defvar pr-menu-print-item "print" | ||
| 2623 | "Non-nil means that menu binding was not done. | ||
| 2624 | |||
| 2625 | Used by `pr-menu-bind' and `pr-update-menus'.") | ||
| 2626 | |||
| 2627 | |||
| 2628 | (defvar pr-ps-printer-menu-modified t | ||
| 2629 | "Non-nil means `pr-ps-printer-alist' was modified and we need to update menu.") | ||
| 2630 | (defvar pr-txt-printer-menu-modified t | ||
| 2631 | "Non-nil means `pr-txt-printer-alist' was modified and we need to update menu.") | ||
| 2632 | (defvar pr-ps-utility-menu-modified t | ||
| 2633 | "Non-nil means `pr-ps-utility-alist' was modified and we need to update menu.") | ||
| 2634 | |||
| 2635 | ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 2636 | ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 2637 | ;; XEmacs Definitions | ||
| 2638 | |||
| 2639 | |||
| 2640 | (cond | ||
| 2641 | ((featurep 'xemacs) ; XEmacs | ||
| 2642 | ;; XEmacs | ||
| 2643 | (defalias 'pr-f-set-keymap-parents 'set-keymap-parents) | ||
| 2644 | (defalias 'pr-f-set-keymap-name 'set-keymap-name) | ||
| 2645 | |||
| 2646 | ;; XEmacs | ||
| 2647 | (defun pr-f-read-string (prompt initial history default) | ||
| 2648 | (let ((str (read-string prompt initial))) | ||
| 2649 | (if (and str (not (string= str ""))) | ||
| 2650 | str | ||
| 2651 | default))) | ||
| 2652 | |||
| 2653 | ;; XEmacs | ||
| 2654 | (defvar zmacs-region-stays nil) | ||
| 2655 | |||
| 2656 | ;; XEmacs | ||
| 2657 | (defun pr-keep-region-active () | ||
| 2658 | (setq zmacs-region-stays t)) | ||
| 2659 | |||
| 2660 | ;; XEmacs | ||
| 2661 | (defun pr-region-active-p () | ||
| 2662 | (and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p))) | ||
| 2663 | |||
| 2664 | ;; XEmacs | ||
| 2665 | (defun pr-menu-char-height () | ||
| 2666 | (font-height (face-font 'default))) | ||
| 2667 | |||
| 2668 | ;; XEmacs | ||
| 2669 | (defun pr-menu-char-width () | ||
| 2670 | (font-width (face-font 'default))) | ||
| 2671 | |||
| 2672 | ;; XEmacs | ||
| 2673 | (defmacro pr-xemacs-global-menubar (&rest body) | ||
| 2674 | `(save-excursion | ||
| 2675 | (let ((temp (get-buffer-create (make-temp-name " *Temp")))) | ||
| 2676 | ;; be sure to access global menubar | ||
| 2677 | (set-buffer temp) | ||
| 2678 | ,@body | ||
| 2679 | (kill-buffer temp)))) | ||
| 2680 | |||
| 2681 | ;; XEmacs | ||
| 2682 | (defun pr-global-menubar (pr-menu-spec) | ||
| 2683 | ;; Menu binding | ||
| 2684 | (pr-xemacs-global-menubar | ||
| 2685 | (add-submenu nil (cons "Printing" pr-menu-spec) "Apps")) | ||
| 2686 | (setq pr-menu-print-item nil)) | ||
| 2687 | |||
| 2688 | ;; XEmacs | ||
| 2689 | (defvar current-mouse-event nil) | ||
| 2690 | (defun pr-menu-position (entry index horizontal) | ||
| 2691 | (make-event | ||
| 2692 | 'button-release | ||
| 2693 | (list 'button 1 | ||
| 2694 | 'x (- (event-x-pixel current-mouse-event) ; X | ||
| 2695 | (* horizontal pr-menu-char-width)) | ||
| 2696 | 'y (- (event-y-pixel current-mouse-event) ; Y | ||
| 2697 | (* (pr-menu-index entry index) pr-menu-char-height))))) | ||
| 2698 | |||
| 2699 | (defvar pr-menu-position nil) | ||
| 2700 | (defvar pr-menu-state nil) | ||
| 2701 | |||
| 2702 | ;; XEmacs | ||
| 2703 | (defvar current-menubar nil) ; to avoid compilation gripes | ||
| 2704 | (defun pr-menu-lookup (path) | ||
| 2705 | (car (find-menu-item current-menubar (cons "Printing" path)))) | ||
| 2706 | |||
| 2707 | ;; XEmacs | ||
| 2708 | (defun pr-menu-lock (entry index horizontal state path) | ||
| 2709 | (when pr-menu-lock | ||
| 2710 | (or (and pr-menu-position (eq state pr-menu-state)) | ||
| 2711 | (setq pr-menu-position (pr-menu-position entry index horizontal) | ||
| 2712 | pr-menu-state state)) | ||
| 2713 | (let* ((menu (pr-menu-lookup path)) | ||
| 2714 | (result (get-popup-menu-response menu pr-menu-position))) | ||
| 2715 | (and (misc-user-event-p result) | ||
| 2716 | (funcall (event-function result) | ||
| 2717 | (event-object result)))) | ||
| 2718 | (setq pr-menu-position nil))) | ||
| 2719 | |||
| 2720 | ;; XEmacs | ||
| 2721 | (defalias 'pr-update-mode-line 'set-menubar-dirty-flag) | ||
| 2722 | |||
| 2723 | ;; XEmacs | ||
| 2724 | (defvar pr-ps-name-old "PostScript Printers") | ||
| 2725 | (defvar pr-txt-name-old "Text Printers") | ||
| 2726 | (defvar pr-ps-utility-old "PostScript Utility") | ||
| 2727 | (defvar pr-even-or-odd-old "Print All Pages") | ||
| 2728 | |||
| 2729 | ;; XEmacs | ||
| 2730 | (defun pr-do-update-menus (&optional force) | ||
| 2731 | (pr-menu-alist pr-ps-printer-alist | ||
| 2732 | 'pr-ps-name | ||
| 2733 | 'pr-menu-set-ps-title | ||
| 2734 | '("Printing") | ||
| 2735 | 'pr-ps-printer-menu-modified | ||
| 2736 | force | ||
| 2737 | pr-ps-name-old | ||
| 2738 | 'postscript 2) | ||
| 2739 | (pr-menu-alist pr-txt-printer-alist | ||
| 2740 | 'pr-txt-name | ||
| 2741 | 'pr-menu-set-txt-title | ||
| 2742 | '("Printing") | ||
| 2743 | 'pr-txt-printer-menu-modified | ||
| 2744 | force | ||
| 2745 | pr-txt-name-old | ||
| 2746 | 'text 2) | ||
| 2747 | (let ((save-var pr-ps-utility-menu-modified)) | ||
| 2748 | (pr-menu-alist pr-ps-utility-alist | ||
| 2749 | 'pr-ps-utility | ||
| 2750 | 'pr-menu-set-utility-title | ||
| 2751 | '("Printing" "PostScript Print" "File") | ||
| 2752 | 'save-var | ||
| 2753 | force | ||
| 2754 | pr-ps-utility-old | ||
| 2755 | nil 1)) | ||
| 2756 | (pr-menu-alist pr-ps-utility-alist | ||
| 2757 | 'pr-ps-utility | ||
| 2758 | 'pr-menu-set-utility-title | ||
| 2759 | '("Printing" "PostScript Preview" "File") | ||
| 2760 | 'pr-ps-utility-menu-modified | ||
| 2761 | force | ||
| 2762 | pr-ps-utility-old | ||
| 2763 | nil 1) | ||
| 2764 | (pr-even-or-odd-pages ps-even-or-odd-pages force)) | ||
| 2765 | |||
| 2766 | ;; XEmacs | ||
| 2767 | (defun pr-menu-alist (alist var-sym fun menu-path modified-sym force name | ||
| 2768 | entry index) | ||
| 2769 | (when (and alist (or force (symbol-value modified-sym))) | ||
| 2770 | (pr-xemacs-global-menubar | ||
| 2771 | (add-submenu menu-path | ||
| 2772 | (pr-menu-create name alist var-sym | ||
| 2773 | fun entry index))) | ||
| 2774 | (funcall fun (symbol-value var-sym)) | ||
| 2775 | (set modified-sym nil))) | ||
| 2776 | |||
| 2777 | ;; XEmacs | ||
| 2778 | (defun pr-relabel-menu-item (newname var-sym) | ||
| 2779 | (pr-xemacs-global-menubar | ||
| 2780 | (relabel-menu-item | ||
| 2781 | (list "Printing" (symbol-value var-sym)) | ||
| 2782 | newname) | ||
| 2783 | (set var-sym newname))) | ||
| 2784 | |||
| 2785 | ;; XEmacs | ||
| 2786 | (defun pr-menu-set-ps-title (value &optional item entry index) | ||
| 2787 | (pr-relabel-menu-item (format "PostScript Printer: %s" value) | ||
| 2788 | 'pr-ps-name-old) | ||
| 2789 | (pr-ps-set-printer value) | ||
| 2790 | (and index | ||
| 2791 | (pr-menu-lock entry index 12 'toggle nil))) | ||
| 2792 | |||
| 2793 | ;; XEmacs | ||
| 2794 | (defun pr-menu-set-txt-title (value &optional item entry index) | ||
| 2795 | (pr-relabel-menu-item (format "Text Printer: %s" value) | ||
| 2796 | 'pr-txt-name-old) | ||
| 2797 | (pr-txt-set-printer value) | ||
| 2798 | (and index | ||
| 2799 | (pr-menu-lock entry index 12 'toggle nil))) | ||
| 2800 | |||
| 2801 | ;; XEmacs | ||
| 2802 | (defun pr-menu-set-utility-title (value &optional item entry index) | ||
| 2803 | (pr-xemacs-global-menubar | ||
| 2804 | (let ((newname (format "%s" value))) | ||
| 2805 | (relabel-menu-item | ||
| 2806 | (list "Printing" "PostScript Print" "File" pr-ps-utility-old) | ||
| 2807 | newname) | ||
| 2808 | (relabel-menu-item | ||
| 2809 | (list "Printing" "PostScript Preview" "File" pr-ps-utility-old) | ||
| 2810 | newname) | ||
| 2811 | (setq pr-ps-utility-old newname))) | ||
| 2812 | (pr-ps-set-utility value) | ||
| 2813 | (and index | ||
| 2814 | (pr-menu-lock entry index 5 nil '("PostScript Print" "File")))) | ||
| 2815 | |||
| 2816 | ;; XEmacs | ||
| 2817 | (defun pr-even-or-odd-pages (value &optional no-lock) | ||
| 2818 | (pr-relabel-menu-item (cdr (assq value pr-even-or-odd-alist)) | ||
| 2819 | 'pr-even-or-odd-old) | ||
| 2820 | (setq ps-even-or-odd-pages value) | ||
| 2821 | (or no-lock | ||
| 2822 | (pr-menu-lock 'postscript-options 8 12 'toggle nil))) | ||
| 2823 | |||
| 2824 | ) | ||
| 2825 | (t ; GNU Emacs | ||
| 2826 | ;; Do nothing | ||
| 2827 | )) ; end cond featurep | ||
| 2828 | |||
| 2829 | |||
| 2830 | |||
| 2831 | ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 2832 | ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 2833 | ;; GNU Emacs Definitions | ||
| 2834 | |||
| 2835 | |||
| 2836 | (cond | ||
| 2837 | ((featurep 'xemacs) ; XEmacs | ||
| 2838 | ;; Do nothing | ||
| 2839 | ) | ||
| 2840 | (t ; GNU Emacs | ||
| 2841 | ;; GNU Emacs | ||
| 2842 | (defalias 'pr-f-set-keymap-parents 'set-keymap-parent) | ||
| 2843 | (defalias 'pr-f-set-keymap-name 'ignore) | ||
| 2844 | (defalias 'pr-f-read-string 'read-string) | ||
| 2845 | |||
| 2846 | ;; GNU Emacs | ||
| 2847 | (defvar deactivate-mark) | ||
| 2848 | |||
| 2849 | ;; GNU Emacs | ||
| 2850 | (defun pr-keep-region-active () | ||
| 2851 | (setq deactivate-mark nil)) | ||
| 2852 | |||
| 2853 | ;; GNU Emacs | ||
| 2854 | (defun pr-region-active-p () | ||
| 2855 | (and pr-auto-region transient-mark-mode mark-active)) | ||
| 2856 | |||
| 2857 | ;; GNU Emacs | ||
| 2858 | (defun pr-menu-char-height () | ||
| 2859 | (frame-char-height)) | ||
| 2860 | |||
| 2861 | ;; GNU Emacs | ||
| 2862 | (defun pr-menu-char-width () | ||
| 2863 | (frame-char-width)) | ||
| 2864 | |||
| 2865 | ;; GNU Emacs | ||
| 2866 | ;; Menu binding | ||
| 2867 | ;; Replace existing "print" item by "Printing" item. | ||
| 2868 | ;; If you're changing this file, you'll load it a second, | ||
| 2869 | ;; third... time, but "print" item exists only in the first load. | ||
| 2870 | (eval-and-compile | ||
| 2871 | (cond | ||
| 2872 | ;; GNU Emacs 20 | ||
| 2873 | ((< emacs-major-version 21) | ||
| 2874 | (defun pr-global-menubar (pr-menu-spec) | ||
| 2875 | (require 'easymenu) | ||
| 2876 | (easy-menu-change '("tools") "Printing" pr-menu-spec pr-menu-print-item) | ||
| 2877 | (when pr-menu-print-item | ||
| 2878 | (easy-menu-remove-item nil '("tools") pr-menu-print-item) | ||
| 2879 | (setq pr-menu-print-item nil | ||
| 2880 | pr-menu-bar (vector 'menu-bar 'tools | ||
| 2881 | (pr-get-symbol "Printing"))))) | ||
| 2882 | ) | ||
| 2883 | ;; GNU Emacs 21 & 22 | ||
| 2884 | (t | ||
| 2885 | (defun pr-global-menubar (pr-menu-spec) | ||
| 2886 | (require 'easymenu) | ||
| 2887 | (let ((menu-file (if (= emacs-major-version 21) | ||
| 2888 | '("menu-bar" "files") ; GNU Emacs 21 | ||
| 2889 | '("menu-bar" "file")))) ; GNU Emacs 22 or higher | ||
| 2890 | (cond | ||
| 2891 | (pr-menu-print-item | ||
| 2892 | (easy-menu-add-item global-map menu-file | ||
| 2893 | (easy-menu-create-menu "Print" pr-menu-spec) | ||
| 2894 | "print-buffer") | ||
| 2895 | (dolist (item '("print-buffer" "print-region" | ||
| 2896 | "ps-print-buffer-faces" "ps-print-region-faces" | ||
| 2897 | "ps-print-buffer" "ps-print-region")) | ||
| 2898 | (easy-menu-remove-item global-map menu-file item)) | ||
| 2899 | (setq pr-menu-print-item nil | ||
| 2900 | pr-menu-bar (vector 'menu-bar | ||
| 2901 | (pr-get-symbol (nth 1 menu-file)) | ||
| 2902 | (pr-get-symbol "Print")))) | ||
| 2903 | (t | ||
| 2904 | (easy-menu-add-item global-map menu-file | ||
| 2905 | (easy-menu-create-menu "Print" pr-menu-spec))) | ||
| 2906 | ))) | ||
| 2907 | ))) | ||
| 2908 | |||
| 2909 | (eval-and-compile | ||
| 2910 | (cond | ||
| 2911 | (ps-windows-system | ||
| 2912 | ;; GNU Emacs for Windows 9x/NT | ||
| 2913 | (defun pr-menu-position (entry index horizontal) | ||
| 2914 | (let ((pos (cdr (mouse-pixel-position)))) | ||
| 2915 | (list | ||
| 2916 | (list (or (car pos) 0) ; X | ||
| 2917 | (- (or (cdr pos) 0) ; Y | ||
| 2918 | (* (pr-menu-index entry index) pr-menu-char-height))) | ||
| 2919 | (selected-frame)))) ; frame | ||
| 2920 | ) | ||
| 2921 | (t | ||
| 2922 | ;; GNU Emacs | ||
| 2923 | (defun pr-menu-position (entry index horizontal) | ||
| 2924 | (let ((pos (cdr (mouse-pixel-position)))) | ||
| 2925 | (list | ||
| 2926 | (list (- (or (car pos) 0) ; X | ||
| 2927 | (* horizontal pr-menu-char-width)) | ||
| 2928 | (- (or (cdr pos) 0) ; Y | ||
| 2929 | (* (pr-menu-index entry index) pr-menu-char-height))) | ||
| 2930 | (selected-frame)))) ; frame | ||
| 2931 | ))) | ||
| 2932 | |||
| 2933 | (defvar pr-menu-position nil) | ||
| 2934 | (defvar pr-menu-state nil) | ||
| 2935 | |||
| 2936 | ;; GNU Emacs | ||
| 2937 | (defun pr-menu-lookup (path) | ||
| 2938 | (lookup-key global-map | ||
| 2939 | (if path | ||
| 2940 | (vconcat pr-menu-bar | ||
| 2941 | (mapcar 'pr-get-symbol | ||
| 2942 | (if (listp path) | ||
| 2943 | path | ||
| 2944 | (list path)))) | ||
| 2945 | pr-menu-bar))) | ||
| 2946 | |||
| 2947 | ;; GNU Emacs | ||
| 2948 | (defun pr-menu-lock (entry index horizontal state path) | ||
| 2949 | (when pr-menu-lock | ||
| 2950 | (or (and pr-menu-position (eq state pr-menu-state)) | ||
| 2951 | (setq pr-menu-position (pr-menu-position entry index horizontal) | ||
| 2952 | pr-menu-state state)) | ||
| 2953 | (let* ((menu (pr-menu-lookup path)) | ||
| 2954 | (result (x-popup-menu pr-menu-position menu))) | ||
| 2955 | (and result | ||
| 2956 | (let ((command (lookup-key menu (vconcat result)))) | ||
| 2957 | (if (fboundp command) | ||
| 2958 | (funcall command) | ||
| 2959 | (eval command))))) | ||
| 2960 | (setq pr-menu-position nil))) | ||
| 2961 | |||
| 2962 | ;; GNU Emacs | ||
| 2963 | (defalias 'pr-update-mode-line 'force-mode-line-update) | ||
| 2964 | |||
| 2965 | ;; GNU Emacs | ||
| 2966 | (defun pr-do-update-menus (&optional force) | ||
| 2967 | (pr-menu-alist pr-ps-printer-alist | ||
| 2968 | 'pr-ps-name | ||
| 2969 | 'pr-menu-set-ps-title | ||
| 2970 | "PostScript Printers" | ||
| 2971 | 'pr-ps-printer-menu-modified | ||
| 2972 | force | ||
| 2973 | "PostScript Printers" | ||
| 2974 | 'postscript 2) | ||
| 2975 | (pr-menu-alist pr-txt-printer-alist | ||
| 2976 | 'pr-txt-name | ||
| 2977 | 'pr-menu-set-txt-title | ||
| 2978 | "Text Printers" | ||
| 2979 | 'pr-txt-printer-menu-modified | ||
| 2980 | force | ||
| 2981 | "Text Printers" | ||
| 2982 | 'text 2) | ||
| 2983 | (let ((save-var pr-ps-utility-menu-modified)) | ||
| 2984 | (pr-menu-alist pr-ps-utility-alist | ||
| 2985 | 'pr-ps-utility | ||
| 2986 | 'pr-menu-set-utility-title | ||
| 2987 | '("PostScript Print" "File" "PostScript Utility") | ||
| 2988 | 'save-var | ||
| 2989 | force | ||
| 2990 | "PostScript Utility" | ||
| 2991 | nil 1)) | ||
| 2992 | (pr-menu-alist pr-ps-utility-alist | ||
| 2993 | 'pr-ps-utility | ||
| 2994 | 'pr-menu-set-utility-title | ||
| 2995 | '("PostScript Preview" "File" "PostScript Utility") | ||
| 2996 | 'pr-ps-utility-menu-modified | ||
| 2997 | force | ||
| 2998 | "PostScript Utility" | ||
| 2999 | nil 1) | ||
| 3000 | (pr-even-or-odd-pages ps-even-or-odd-pages force)) | ||
| 3001 | |||
| 3002 | ;; GNU Emacs | ||
| 3003 | (defun pr-menu-get-item (name-list) | ||
| 3004 | ;; NAME-LIST is a string or a list of strings. | ||
| 3005 | (or (listp name-list) | ||
| 3006 | (setq name-list (list name-list))) | ||
| 3007 | (and name-list | ||
| 3008 | (let* ((reversed (reverse name-list)) | ||
| 3009 | (name (pr-get-symbol (car reversed))) | ||
| 3010 | (path (nreverse (cdr reversed))) | ||
| 3011 | (menu (lookup-key | ||
| 3012 | global-map | ||
| 3013 | (vconcat pr-menu-bar | ||
| 3014 | (mapcar 'pr-get-symbol path))))) | ||
| 3015 | (assq name (nthcdr 2 menu))))) | ||
| 3016 | |||
| 3017 | ;; GNU Emacs | ||
| 3018 | (defvar pr-temp-menu nil) | ||
| 3019 | |||
| 3020 | ;; GNU Emacs | ||
| 3021 | (defun pr-menu-alist (alist var-sym fun menu-path modified-sym force name | ||
| 3022 | entry index) | ||
| 3023 | (when (and alist (or force (symbol-value modified-sym))) | ||
| 3024 | (easy-menu-define pr-temp-menu nil "" | ||
| 3025 | (pr-menu-create name alist var-sym fun entry index)) | ||
| 3026 | (let ((item (pr-menu-get-item menu-path))) | ||
| 3027 | (and item | ||
| 3028 | (let* ((binding (nthcdr 3 item)) | ||
| 3029 | (key-binding (cdr binding))) | ||
| 3030 | (setcar binding pr-temp-menu) | ||
| 3031 | (and key-binding (listp (car key-binding)) | ||
| 3032 | (setcdr binding (cdr key-binding))) ; skip KEY-BINDING | ||
| 3033 | (funcall fun (symbol-value var-sym) item)))) | ||
| 3034 | (set modified-sym nil))) | ||
| 3035 | |||
| 3036 | ;; GNU Emacs | ||
| 3037 | (defun pr-menu-set-item-name (item name) | ||
| 3038 | (and item | ||
| 3039 | (setcar (nthcdr 2 item) name))) ; ITEM-NAME | ||
| 3040 | |||
| 3041 | ;; GNU Emacs | ||
| 3042 | (defun pr-menu-set-ps-title (value &optional item entry index) | ||
| 3043 | (pr-menu-set-item-name (or item | ||
| 3044 | (pr-menu-get-item "PostScript Printers")) | ||
| 3045 | (format "PostScript Printer: %s" value)) | ||
| 3046 | (pr-ps-set-printer value) | ||
| 3047 | (and index | ||
| 3048 | (pr-menu-lock entry index 12 'toggle nil))) | ||
| 3049 | |||
| 3050 | ;; GNU Emacs | ||
| 3051 | (defun pr-menu-set-txt-title (value &optional item entry index) | ||
| 3052 | (pr-menu-set-item-name (or item | ||
| 3053 | (pr-menu-get-item "Text Printers")) | ||
| 3054 | (format "Text Printer: %s" value)) | ||
| 3055 | (pr-txt-set-printer value) | ||
| 3056 | (and index | ||
| 3057 | (pr-menu-lock entry index 12 'toggle nil))) | ||
| 3058 | |||
| 3059 | ;; GNU Emacs | ||
| 3060 | (defun pr-menu-set-utility-title (value &optional item entry index) | ||
| 3061 | (let ((name (symbol-name value))) | ||
| 3062 | (if item | ||
| 3063 | (pr-menu-set-item-name item name) | ||
| 3064 | (pr-menu-set-item-name | ||
| 3065 | (pr-menu-get-item | ||
| 3066 | '("PostScript Print" "File" "PostScript Utility")) | ||
| 3067 | name) | ||
| 3068 | (pr-menu-set-item-name | ||
| 3069 | (pr-menu-get-item | ||
| 3070 | '("PostScript Preview" "File" "PostScript Utility")) | ||
| 3071 | name))) | ||
| 3072 | (pr-ps-set-utility value) | ||
| 3073 | (and index | ||
| 3074 | (pr-menu-lock entry index 5 nil '("PostScript Print" "File")))) | ||
| 3075 | |||
| 3076 | ;; GNU Emacs | ||
| 3077 | (defun pr-even-or-odd-pages (value &optional no-lock) | ||
| 3078 | (pr-menu-set-item-name (pr-menu-get-item "Print All Pages") | ||
| 3079 | (cdr (assq value pr-even-or-odd-alist))) | ||
| 3080 | (setq ps-even-or-odd-pages value) | ||
| 3081 | (or no-lock | ||
| 3082 | (pr-menu-lock 'postscript-options 8 12 'toggle nil))) | ||
| 3083 | |||
| 3084 | )) ; end cond featurep | ||
| 3085 | |||
| 3086 | |||
| 3087 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 3088 | ;; Customization Functions | ||
| 3089 | |||
| 3090 | |||
| 3091 | (defun pr-alist-custom-set (symbol value) | ||
| 3092 | "Set the value of custom variables for printer & utility selection." | ||
| 3093 | (set symbol value) | ||
| 3094 | (and (featurep 'printing) ; update only after printing is loaded | ||
| 3095 | (pr-update-menus t))) | ||
| 3096 | |||
| 3097 | |||
| 3098 | (defun pr-ps-utility-custom-set (symbol value) | ||
| 3099 | "Update utility menu entry." | ||
| 3100 | (set symbol value) | ||
| 3101 | (and (featurep 'printing) ; update only after printing is loaded | ||
| 3102 | (pr-menu-set-utility-title value))) | ||
| 3103 | |||
| 3104 | |||
| 3105 | (defun pr-ps-name-custom-set (symbol value) | ||
| 3106 | "Update `PostScript Printer:' menu entry." | ||
| 3107 | (set symbol value) | ||
| 3108 | (and (featurep 'printing) ; update only after printing is loaded | ||
| 3109 | (pr-menu-set-ps-title value))) | ||
| 3110 | |||
| 3111 | |||
| 3112 | (defun pr-txt-name-custom-set (symbol value) | ||
| 3113 | "Update `Text Printer:' menu entry." | ||
| 3114 | (set symbol value) | ||
| 3115 | (and (featurep 'printing) ; update only after printing is loaded | ||
| 3116 | (pr-menu-set-txt-title value))) | ||
| 3117 | |||
| 3118 | |||
| 3119 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 3120 | ;; User Interface (I) | ||
| 3121 | |||
| 3122 | |||
| 3123 | (defgroup printing nil | ||
| 3124 | "Printing Utilities group." | ||
| 3125 | :tag "Printing Utilities" | ||
| 3126 | :link '(emacs-library-link :tag "Source Lisp File" "printing.el") | ||
| 3127 | :prefix "pr-" | ||
| 3128 | :version "20" | ||
| 3129 | :group 'wp | ||
| 3130 | :group 'postscript) | ||
| 3131 | |||
| 3132 | |||
| 3133 | (defcustom pr-path-style | ||
| 3134 | (if (and (not pr-cygwin-system) | ||
| 3135 | ps-windows-system) | ||
| 3136 | 'windows | ||
| 3137 | 'unix) | ||
| 3138 | "*Specify which path style to use for external commands. | ||
| 3139 | |||
| 3140 | Valid values are: | ||
| 3141 | |||
| 3142 | windows Windows 9x/NT style (\\) | ||
| 3143 | |||
| 3144 | unix Unix style (/)" | ||
| 3145 | :type '(choice :tag "Path style" | ||
| 3146 | (const :tag "Windows 9x/NT Style (\\)" :value windows) | ||
| 3147 | (const :tag "Unix Style (/)" :value unix)) | ||
| 3148 | :version "20" | ||
| 3149 | :group 'printing) | ||
| 3150 | |||
| 3151 | |||
| 3152 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 3153 | ;; Internal Functions (I) | ||
| 3154 | |||
| 3155 | |||
| 3156 | (defun pr-dosify-file-name (path) | ||
| 3157 | "Replace unix-style directory separator character with dos/windows one." | ||
| 3158 | (interactive "sPath: ") | ||
| 3159 | (if (eq pr-path-style 'windows) | ||
| 3160 | (subst-char-in-string ?/ ?\\ path) | ||
| 3161 | path)) | ||
| 3162 | |||
| 3163 | |||
| 3164 | (defun pr-unixify-file-name (path) | ||
| 3165 | "Replace dos/windows-style directory separator character with unix one." | ||
| 3166 | (interactive "sPath: ") | ||
| 3167 | (if (eq pr-path-style 'windows) | ||
| 3168 | (subst-char-in-string ?\\ ?/ path) | ||
| 3169 | path)) | ||
| 3170 | |||
| 3171 | |||
| 3172 | (defun pr-standard-file-name (path) | ||
| 3173 | "Ensure the proper directory separator depending on the OS. | ||
| 3174 | That is, if Emacs is running on DOS/Windows, ensure dos/windows-style directory | ||
| 3175 | separator; otherwise, ensure unix-style directory separator." | ||
| 3176 | (if (or pr-cygwin-system ps-windows-system) | ||
| 3177 | (subst-char-in-string ?/ ?\\ path) | ||
| 3178 | (subst-char-in-string ?\\ ?/ path))) | ||
| 3161 | 3179 | ||
| 3162 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 3180 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 3163 | ;; Macros | 3181 | ;; Macros |
| @@ -3438,12 +3456,6 @@ See `pr-ps-printer-alist'.") | |||
| 3438 | ))) | 3456 | ))) |
| 3439 | 3457 | ||
| 3440 | 3458 | ||
| 3441 | (defvar pr-menu-print-item "print" | ||
| 3442 | "Non-nil means that menu binding was not done. | ||
| 3443 | |||
| 3444 | Used by `pr-menu-bind' and `pr-update-menus'.") | ||
| 3445 | |||
| 3446 | |||
| 3447 | (defun pr-menu-bind () | 3459 | (defun pr-menu-bind () |
| 3448 | "Install `printing' menu in the menubar. | 3460 | "Install `printing' menu in the menubar. |
| 3449 | 3461 | ||
| @@ -5214,22 +5226,6 @@ If menu binding was not done, calls `pr-menu-bind'." | |||
| 5214 | (pr-do-update-menus force))) | 5226 | (pr-do-update-menus force))) |
| 5215 | 5227 | ||
| 5216 | 5228 | ||
| 5217 | (defvar pr-ps-printer-menu-modified t | ||
| 5218 | "Non-nil means `pr-ps-printer-alist' was modified and we need to update menu.") | ||
| 5219 | (defvar pr-txt-printer-menu-modified t | ||
| 5220 | "Non-nil means `pr-txt-printer-alist' was modified and we need to update menu.") | ||
| 5221 | (defvar pr-ps-utility-menu-modified t | ||
| 5222 | "Non-nil means `pr-ps-utility-alist' was modified and we need to update menu.") | ||
| 5223 | |||
| 5224 | |||
| 5225 | (defconst pr-even-or-odd-alist | ||
| 5226 | '((nil . "Print All Pages") | ||
| 5227 | (even-page . "Print Even Pages") | ||
| 5228 | (odd-page . "Print Odd Pages") | ||
| 5229 | (even-sheet . "Print Even Sheets") | ||
| 5230 | (odd-sheet . "Print Odd Sheets"))) | ||
| 5231 | |||
| 5232 | |||
| 5233 | (defun pr-menu-create (name alist var-sym fun entry index) | 5229 | (defun pr-menu-create (name alist var-sym fun entry index) |
| 5234 | (cons name | 5230 | (cons name |
| 5235 | (mapcar | 5231 | (mapcar |
diff --git a/lisp/tooltip.el b/lisp/tooltip.el index a5d0309f125..ffbebf06245 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el | |||
| @@ -273,7 +273,7 @@ is based on the current syntax table." | |||
| 273 | 273 | ||
| 274 | (defmacro tooltip-region-active-p () | 274 | (defmacro tooltip-region-active-p () |
| 275 | "Value is non-nil if the region is currently active." | 275 | "Value is non-nil if the region is currently active." |
| 276 | (if (string-match "^GNU" (emacs-version)) | 276 | (if (not (featurep 'xemacs)) |
| 277 | `(and transient-mark-mode mark-active) | 277 | `(and transient-mark-mode mark-active) |
| 278 | `(region-active-p))) | 278 | `(region-active-p))) |
| 279 | 279 | ||