aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2001-10-26 09:14:37 +0000
committerGerd Moellmann2001-10-26 09:14:37 +0000
commit627a4e30dcec779bb6f419d21916a7e94e5a4a2d (patch)
tree42deae5290cb15655115e08c87b9091d54fe1580
parent6436765542a0f14d8c0d65bf7616d78bc6767289 (diff)
downloademacs-627a4e30dcec779bb6f419d21916a7e94e5a4a2d.tar.gz
emacs-627a4e30dcec779bb6f419d21916a7e94e5a4a2d.zip
(ps-mode-print-function): Remove quote for
lambda expression. (ps-mode-menu-main): Submenu with options on/off was replaced with a toggle button. (ps-mode, ps-run-mode): Define with `define-derived-mode' (ps-mode): Autoload cookie added on same line as comment (ps-mode-tabkey, ps-mode-backward-delete-char): (ps-mode-r-balance): Replace `delete-horizontal-space' and `indent-to' with `indent-line-to' (ps-mode-print-buffer, ps-mode-print-region): Use `funcall' instead of `eval'. (ps-mode-print-region): Use `with-temp-buffer'. (ps-run-start): Use of `mapconcat'. Use `apply' instead of `eval'. (numerous places): Add back-tick and tick around names in docstrings, fix punctuation in docstrings, remove trailing spaces.
-rw-r--r--lisp/ChangeLog19
-rw-r--r--lisp/progmodes/ps-mode.el185
2 files changed, 95 insertions, 109 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f9f6d35650a..473a019d616 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,22 @@
12001-10-26 Peter Kleiweg <kleiweg@let.rug.nl>
2
3 * progmodes/ps-mode.el (ps-mode-print-function): Remove quote for
4 lambda expression.
5 (ps-mode-menu-main): Submenu with options on/off was replaced with
6 a toggle button.
7 (ps-mode, ps-run-mode): Define with `define-derived-mode'
8 (ps-mode): Autoload cookie added on same line as comment
9 (ps-mode-tabkey, ps-mode-backward-delete-char):
10 (ps-mode-r-balance): Replace `delete-horizontal-space' and
11 `indent-to' with `indent-line-to'
12 (ps-mode-print-buffer, ps-mode-print-region): Use `funcall'
13 instead of `eval'.
14 (ps-mode-print-region): Use `with-temp-buffer'.
15 (ps-run-start): Use of `mapconcat'. Use `apply' instead of
16 `eval'.
17 (numerous places): Add back-tick and tick around names in
18 docstrings, fix punctuation in docstrings, remove trailing spaces.
19
12001-10-25 Sam Steingold <sds@gnu.org> 202001-10-25 Sam Steingold <sds@gnu.org>
2 21
3 * add-log.el (add-log-always-start-new-record): New user option. 22 * add-log.el (add-log-always-start-new-record): New user option.
diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el
index 772374de6ab..cf9c53749d5 100644
--- a/lisp/progmodes/ps-mode.el
+++ b/lisp/progmodes/ps-mode.el
@@ -1,11 +1,11 @@
1;;; ps-mode.el --- PostScript mode for GNU Emacs 1;;; ps-mode.el --- PostScript mode for GNU Emacs
2 2
3;; Copyright (C) 1999 Free Software Foundation, Inc. 3;; Copyright (C) 1999, 2001 Free Software Foundation, Inc.
4 4
5;; Author: Peter Kleiweg <kleiweg@let.rug.nl> 5;; Author: Peter Kleiweg <kleiweg@let.rug.nl>
6;; Maintainer: Peter Kleiweg <kleiweg@let.rug.nl> 6;; Maintainer: Peter Kleiweg <kleiweg@let.rug.nl>
7;; Created: 20 Aug 1997 7;; Created: 20 Aug 1997
8;; Version: 1.1e, 11 Nov 1999 8;; Version: 1.1f, 25 Oct 2001
9;; Keywords: PostScript, languages 9;; Keywords: PostScript, languages
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
@@ -30,7 +30,7 @@
30 30
31;;; Code: 31;;; Code:
32 32
33(defconst ps-mode-version "1.1e, 11 Nov 1999") 33(defconst ps-mode-version "1.1f, 25 Oct 2001")
34(defconst ps-mode-maintainer-address "Peter Kleiweg <kleiweg@let.rug.nl>") 34(defconst ps-mode-maintainer-address "Peter Kleiweg <kleiweg@let.rug.nl>")
35 35
36(require 'easymenu) 36(require 'easymenu)
@@ -104,8 +104,8 @@ When the figure is finished these values should be replaced."
104 (const :tag "dsheet" (1584 2448)) 104 (const :tag "dsheet" (1584 2448))
105 (const :tag "esheet" (2448 3168)))) 105 (const :tag "esheet" (2448 3168))))
106 106
107(defcustom ps-mode-print-function 107(defcustom ps-mode-print-function
108 '(lambda () 108 (lambda ()
109 (let ((lpr-switches nil) 109 (let ((lpr-switches nil)
110 (lpr-command (if (memq system-type '(usg-unix-v dgux hpux irix)) 110 (lpr-command (if (memq system-type '(usg-unix-v dgux hpux irix))
111 "lp" "lpr"))) 111 "lp" "lpr")))
@@ -129,7 +129,7 @@ When the figure is finished these values should be replaced."
129 (0 font-lock-keyword-face nil nil)) 129 (0 font-lock-keyword-face nil nil))
130 ("^\\(Error\\|Can't\\).*" 130 ("^\\(Error\\|Can't\\).*"
131 (0 font-lock-warning-face nil nil)) 131 (0 font-lock-warning-face nil nil))
132 ("^\\(Current file position is\\) \\([0-9]+\\)" 132 ("^\\(Current file position is\\) \\([0-9]+\\)"
133 (1 font-lock-comment-face nil nil) 133 (1 font-lock-comment-face nil nil)
134 (2 font-lock-warning-face nil nil)))) 134 (2 font-lock-warning-face nil nil))))
135 "*Medium level highlighting of messages from the PostScript interpreter. 135 "*Medium level highlighting of messages from the PostScript interpreter.
@@ -162,8 +162,7 @@ See documentation on font-lock for details."
162 162
163Example: \"executive\" 163Example: \"executive\"
164 164
165You won't need to set this option for Ghostscript. 165You won't need to set this option for Ghostscript."
166"
167 :group 'PostScript-interaction 166 :group 'PostScript-interaction
168 :type '(choice (const nil) string)) 167 :type '(choice (const nil) string))
169 168
@@ -180,8 +179,7 @@ If nil, the following are tried in turn, until success:
180 1. \"$TEMP\" 179 1. \"$TEMP\"
181 2. \"$TMP\" 180 2. \"$TMP\"
182 3. \"$HOME/tmp\" 181 3. \"$HOME/tmp\"
183 4. \"/tmp\" 182 4. \"/tmp\""
184"
185 :group 'PostScript-interaction 183 :group 'PostScript-interaction
186 :type '(choice (const nil) directory)) 184 :type '(choice (const nil) directory))
187 185
@@ -204,7 +202,7 @@ If nil, the following are tried in turn, until success:
204 "gsave" "grestore" "grestoreall" 202 "gsave" "grestore" "grestoreall"
205 "showpage"))) 203 "showpage")))
206 (concat "\\<" (regexp-opt ops t) "\\>")) 204 (concat "\\<" (regexp-opt ops t) "\\>"))
207 "Regexp of PostScript operators that will be fontified") 205 "Regexp of PostScript operators that will be fontified.")
208 206
209;; Level 1 font-lock: 207;; Level 1 font-lock:
210;; - Special comments (reference face) 208;; - Special comments (reference face)
@@ -214,7 +212,7 @@ If nil, the following are tried in turn, until success:
214;; Multiline strings are not supported. Strings with nested brackets are. 212;; Multiline strings are not supported. Strings with nested brackets are.
215(defconst ps-mode-font-lock-keywords-1 213(defconst ps-mode-font-lock-keywords-1
216 '(("\\`%!PS.*" . font-lock-reference-face) 214 '(("\\`%!PS.*" . font-lock-reference-face)
217 ("^%%BoundingBox:[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]*$" 215 ("^%%BoundingBox:[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]*$"
218 . font-lock-reference-face) 216 . font-lock-reference-face)
219 (ps-mode-match-string-or-comment 217 (ps-mode-match-string-or-comment
220 (1 font-lock-comment-face nil t) 218 (1 font-lock-comment-face nil t)
@@ -258,7 +256,7 @@ If nil, the following are tried in turn, until success:
258 ps-mode-font-lock-keywords-1 256 ps-mode-font-lock-keywords-1
259 (list 257 (list
260 '("//\\w+" . font-lock-type-face) 258 '("//\\w+" . font-lock-type-face)
261 '("^\\(/\\w+\\)\\>[[ \t]*\\(%.*\\)?\r?$" 259 '("^\\(/\\w+\\)\\>[[ \t]*\\(%.*\\)?\r?$"
262 . (1 font-lock-function-name-face)) 260 . (1 font-lock-function-name-face))
263 '("^\\(/\\w+\\)\\>\\([ \t]*{\\|[ \t]*<<\\|.*\\<def\\>\\|[ \t]+[0-9]+[ \t]+dict\\>\\)" 261 '("^\\(/\\w+\\)\\>\\([ \t]*{\\|[ \t]*<<\\|.*\\<def\\>\\|[ \t]+[0-9]+[ \t]+dict\\>\\)"
264 . (1 font-lock-function-name-face)) 262 . (1 font-lock-function-name-face))
@@ -361,9 +359,8 @@ If nil, the following are tried in turn, until success:
361 ["8-bit to Octal Buffer" ps-mode-octal-buffer t] 359 ["8-bit to Octal Buffer" ps-mode-octal-buffer t]
362 ["8-bit to Octal Region" ps-mode-octal-region (mark t)] 360 ["8-bit to Octal Region" ps-mode-octal-region (mark t)]
363 "---" 361 "---"
364 ("Auto Indent" 362 ["Auto Indent" (setq ps-mode-auto-indent (not ps-mode-auto-indent))
365 ["On" (setq ps-mode-auto-indent t) (not ps-mode-auto-indent)] 363 :style toggle :selected ps-mode-auto-indent]
366 ["Off" (setq ps-mode-auto-indent nil) ps-mode-auto-indent])
367 "---" 364 "---"
368 ["Start PostScript" 365 ["Start PostScript"
369 ps-run-start 366 ps-run-start
@@ -442,14 +439,14 @@ If nil, the following are tried in turn, until success:
442 439
443(unless ps-mode-syntax-table 440(unless ps-mode-syntax-table
444 (setq ps-mode-syntax-table (make-syntax-table)) 441 (setq ps-mode-syntax-table (make-syntax-table))
445 442
446 (modify-syntax-entry ?\% "< " ps-mode-syntax-table) 443 (modify-syntax-entry ?\% "< " ps-mode-syntax-table)
447 (modify-syntax-entry ?\n "> " ps-mode-syntax-table) 444 (modify-syntax-entry ?\n "> " ps-mode-syntax-table)
448 (modify-syntax-entry ?\r "> " ps-mode-syntax-table) 445 (modify-syntax-entry ?\r "> " ps-mode-syntax-table)
449 (modify-syntax-entry ?\f "> " ps-mode-syntax-table) 446 (modify-syntax-entry ?\f "> " ps-mode-syntax-table)
450 (modify-syntax-entry ?\< "(>" ps-mode-syntax-table) 447 (modify-syntax-entry ?\< "(>" ps-mode-syntax-table)
451 (modify-syntax-entry ?\> ")<" ps-mode-syntax-table) 448 (modify-syntax-entry ?\> ")<" ps-mode-syntax-table)
452 449
453 (modify-syntax-entry ?\! "w " ps-mode-syntax-table) 450 (modify-syntax-entry ?\! "w " ps-mode-syntax-table)
454 (modify-syntax-entry ?\" "w " ps-mode-syntax-table) 451 (modify-syntax-entry ?\" "w " ps-mode-syntax-table)
455 (modify-syntax-entry ?\# "w " ps-mode-syntax-table) 452 (modify-syntax-entry ?\# "w " ps-mode-syntax-table)
@@ -472,7 +469,7 @@ If nil, the following are tried in turn, until success:
472 (modify-syntax-entry ?\` "w " ps-mode-syntax-table) 469 (modify-syntax-entry ?\` "w " ps-mode-syntax-table)
473 (modify-syntax-entry ?\| "w " ps-mode-syntax-table) 470 (modify-syntax-entry ?\| "w " ps-mode-syntax-table)
474 (modify-syntax-entry ?\~ "w " ps-mode-syntax-table) 471 (modify-syntax-entry ?\~ "w " ps-mode-syntax-table)
475 472
476 (let ((i 128)) 473 (let ((i 128))
477 (while (< i 256) 474 (while (< i 256)
478 (modify-syntax-entry i "w " ps-mode-syntax-table) 475 (modify-syntax-entry i "w " ps-mode-syntax-table)
@@ -481,8 +478,9 @@ If nil, the following are tried in turn, until success:
481 478
482;; PostScript mode. 479;; PostScript mode.
483 480
484;;;###autoload 481;;;###autoload (autoload (quote ps-mode) "ps-mode" "Major mode for editing PostScript with GNU Emacs.\n" t)
485(defun ps-mode () 482
483(define-derived-mode ps-mode fundamental-mode "PostScript"
486 "Major mode for editing PostScript with GNU Emacs. 484 "Major mode for editing PostScript with GNU Emacs.
487 485
488Entry to this mode calls `ps-mode-hook'. 486Entry to this mode calls `ps-mode-hook'.
@@ -490,17 +488,17 @@ Entry to this mode calls `ps-mode-hook'.
490The following variables hold user options, and can 488The following variables hold user options, and can
491be set through the `customize' command: 489be set through the `customize' command:
492 490
493 ps-mode-auto-indent 491 `ps-mode-auto-indent'
494 ps-mode-tab 492 `ps-mode-tab'
495 ps-mode-paper-size 493 `ps-mode-paper-size'
496 ps-mode-print-function 494 `ps-mode-print-function'
497 ps-run-prompt 495 `ps-run-prompt'
498 ps-run-font-lock-keywords-2 496 `ps-run-font-lock-keywords-2'
499 ps-run-x 497 `ps-run-x'
500 ps-run-dumb 498 `ps-run-dumb'
501 ps-run-init 499 `ps-run-init'
502 ps-run-error-line-numbers 500 `ps-run-error-line-numbers'
503 ps-run-tmp-dir 501 `ps-run-tmp-dir'
504 502
505Type \\[describe-variable] for documentation on these options. 503Type \\[describe-variable] for documentation on these options.
506 504
@@ -519,34 +517,23 @@ When Ghostscript encounters an error it displays an error message
519with a file position. Clicking mouse-2 on this number will bring 517with a file position. Clicking mouse-2 on this number will bring
520point to the corresponding spot in the PostScript window, if input 518point to the corresponding spot in the PostScript window, if input
521to the interpreter was sent from that window. 519to the interpreter was sent from that window.
522Typing \\<ps-run-mode-map>\\[ps-run-goto-error] when the cursor is at the number has the same effect. 520Typing \\<ps-run-mode-map>\\[ps-run-goto-error] when the cursor is at the number has the same effect."
523" 521 (set (make-local-variable 'font-lock-defaults)
524 (interactive) 522 '((ps-mode-font-lock-keywords
525 (kill-all-local-variables) 523 ps-mode-font-lock-keywords-1
526 (make-local-variable 'font-lock-defaults) 524 ps-mode-font-lock-keywords-2
527 (setq font-lock-defaults '((ps-mode-font-lock-keywords 525 ps-mode-font-lock-keywords-3)
528 ps-mode-font-lock-keywords-1 526 t)))
529 ps-mode-font-lock-keywords-2
530 ps-mode-font-lock-keywords-3)
531 t)
532 major-mode 'ps-mode
533 mode-name "PostScript")
534 (use-local-map ps-mode-map)
535 (set-syntax-table ps-mode-syntax-table)
536 (set (make-local-variable 'comment-start) "%")
537 (set (make-local-variable 'comment-start-skip)
538 "\\(\\(^\\|[^\\]\\)\\(\\\\\\\\\\)*\\)\\(%+ *\\)")
539 (run-hooks 'ps-mode-hook))
540 527
541(defun ps-mode-show-version () 528(defun ps-mode-show-version ()
542 "Show current version of PostScript mode" 529 "Show current version of PostScript mode."
543 (interactive) 530 (interactive)
544 (message " *** PostScript Mode (ps-mode) Version %s *** " ps-mode-version)) 531 (message " *** PostScript Mode (ps-mode) Version %s *** " ps-mode-version))
545 532
546(defun ps-mode-submit-bug-report () 533(defun ps-mode-submit-bug-report ()
547 "Submit via mail a bug report on PostScript mode" 534 "Submit via mail a bug report on PostScript mode."
548 (interactive) 535 (interactive)
549 (when (y-or-n-p "Submit bug report on PostScript mode? ") 536 (when (y-or-n-p "Submit bug report on PostScript mode? ")
550 (let ((reporter-prompt-for-summary-p nil) 537 (let ((reporter-prompt-for-summary-p nil)
551 (reporter-dont-compact-list '(ps-mode-print-function 538 (reporter-dont-compact-list '(ps-mode-print-function
552 ps-run-font-lock-keywords-2))) 539 ps-run-font-lock-keywords-2)))
@@ -604,9 +591,8 @@ Typing \\<ps-run-mode-map>\\[ps-run-goto-error] when the cursor is at the number
604 (if (not (re-search-forward "[%(]" limit t)) 591 (if (not (re-search-forward "[%(]" limit t))
605 ;; Nothing found: return failure. 592 ;; Nothing found: return failure.
606 nil 593 nil
607 (let (end) 594 (let ((end (match-end 0)))
608 (goto-char (match-beginning 0)) 595 (goto-char (match-beginning 0))
609 (setq end (match-end 0))
610 (cond ((looking-at "\\(%.*\\)\\|\\((\\([^()\\\n]\\|\\\\.\\)*)\\)") 596 (cond ((looking-at "\\(%.*\\)\\|\\((\\([^()\\\n]\\|\\\\.\\)*)\\)")
611 ;; It's a comment or string without nested, unescaped brackets. 597 ;; It's a comment or string without nested, unescaped brackets.
612 (goto-char (match-end 0)) 598 (goto-char (match-end 0))
@@ -615,7 +601,7 @@ Typing \\<ps-run-mode-map>\\[ps-run-goto-error] when the cursor is at the number
615 ;; It's a string with nested brackets. 601 ;; It's a string with nested brackets.
616 (point)) 602 (point))
617 (t 603 (t
618 ;; Try next match. 604 ;; Try next match.
619 (goto-char end) 605 (goto-char end)
620 (ps-mode-match-string-or-comment limit)))))) 606 (ps-mode-match-string-or-comment limit))))))
621 607
@@ -664,7 +650,7 @@ defines the beginning of a group. These tokens are: { [ <<"
664 (indent-to (ps-mode-target-column)))) 650 (indent-to (ps-mode-target-column))))
665 651
666(defun ps-mode-tabkey () 652(defun ps-mode-tabkey ()
667 "Indent/reindent current line, or insert tab" 653 "Indent/reindent current line, or insert tab."
668 (interactive) 654 (interactive)
669 (let ((column (current-column)) 655 (let ((column (current-column))
670 target) 656 target)
@@ -675,11 +661,10 @@ defines the beginning of a group. These tokens are: { [ <<"
675 (setq target (ps-mode-target-column)) 661 (setq target (ps-mode-target-column))
676 (while (<= target column) 662 (while (<= target column)
677 (setq target (+ target ps-mode-tab))) 663 (setq target (+ target ps-mode-tab)))
678 (delete-horizontal-space) 664 (indent-line-to target))))
679 (indent-to target))))
680 665
681(defun ps-mode-backward-delete-char () 666(defun ps-mode-backward-delete-char ()
682 "Delete backward indentation, or delete backward character" 667 "Delete backward indentation, or delete backward character."
683 (interactive) 668 (interactive)
684 (let ((column (current-column)) 669 (let ((column (current-column))
685 target) 670 target)
@@ -694,8 +679,7 @@ defines the beginning of a group. These tokens are: { [ <<"
694 (setq target (- target ps-mode-tab))) 679 (setq target (- target ps-mode-tab)))
695 (if (< target 0) 680 (if (< target 0)
696 (setq target 0)) 681 (setq target 0))
697 (delete-horizontal-space) 682 (indent-line-to target))))
698 (indent-to target))))
699 683
700(defun ps-mode-r-brace () 684(defun ps-mode-r-brace ()
701 "Insert `}' and perform balance." 685 "Insert `}' and perform balance."
@@ -720,12 +704,11 @@ defines the beginning of a group. These tokens are: { [ <<"
720 (if ps-mode-auto-indent 704 (if ps-mode-auto-indent
721 (save-excursion 705 (save-excursion
722 (when (re-search-backward (concat "^[ \t]*" (regexp-quote right) "\\=") nil t) 706 (when (re-search-backward (concat "^[ \t]*" (regexp-quote right) "\\=") nil t)
723 (delete-horizontal-space) 707 (indent-line-to (ps-mode-target-column)))))
724 (indent-to (ps-mode-target-column)))))
725 (blink-matching-open)) 708 (blink-matching-open))
726 709
727(defun ps-mode-other-newline () 710(defun ps-mode-other-newline ()
728 "Perform newline in `*ps run*' buffer" 711 "Perform newline in `*ps run*' buffer."
729 (interactive) 712 (interactive)
730 (let ((buf (current-buffer))) 713 (let ((buf (current-buffer)))
731 (set-buffer "*ps run*") 714 (set-buffer "*ps run*")
@@ -736,29 +719,23 @@ defines the beginning of a group. These tokens are: { [ <<"
736;; Print PostScript. 719;; Print PostScript.
737 720
738(defun ps-mode-print-buffer () 721(defun ps-mode-print-buffer ()
739 "Print buffer as PostScript" 722 "Print buffer as PostScript."
740 (interactive) 723 (interactive)
741 (eval (list ps-mode-print-function))) 724 (funcall ps-mode-print-function))
742 725
743(defun ps-mode-print-region (begin end) 726(defun ps-mode-print-region (begin end)
744 "Print region as PostScript, adding minimal header and footer lines: 727 "Print region as PostScript, adding minimal header and footer lines:
745 728
746%!PS 729%!PS
747<region> 730<region>
748showpage 731showpage"
749"
750 (interactive "r") 732 (interactive "r")
751 (let ((oldbuf (current-buffer)) 733 (let ((buf (current-buffer)))
752 (tmpbuf (get-buffer-create "*ps print*"))) 734 (with-temp-buffer
753 (copy-to-buffer tmpbuf begin end) 735 (insert "%!PS\n")
754 (set-buffer tmpbuf) 736 (insert-buffer-substring buf begin end)
755 (goto-char 1) 737 (insert "\nshowpage\n")
756 (insert "%!PS\n") 738 (funcall ps-mode-print-function))))
757 (goto-char (point-max))
758 (insert "\nshowpage\n")
759 (eval (list ps-mode-print-function))
760 (set-buffer oldbuf)
761 (kill-buffer tmpbuf)))
762 739
763 740
764;; Comment Out / Uncomment. 741;; Comment Out / Uncomment.
@@ -870,8 +847,7 @@ Only one `%' is removed, and it has to be in the first column."
870 "Insert array /ISOLatin1Extended. 847 "Insert array /ISOLatin1Extended.
871 848
872This encoding vector contains all the entries from ISOLatin1Encoding 849This encoding vector contains all the entries from ISOLatin1Encoding
873plus the usually uncoded characters inserted on positions 1 through 28. 850plus the usually uncoded characters inserted on positions 1 through 28."
874"
875 (interactive) 851 (interactive)
876 (insert " 852 (insert "
877% ISOLatin1Encoding, extended with remaining uncoded glyphs 853% ISOLatin1Encoding, extended with remaining uncoded glyphs
@@ -994,26 +970,20 @@ plus the usually uncoded characters inserted on positions 1 through 28.
994 970
995;; Interactive PostScript interpreter. 971;; Interactive PostScript interpreter.
996 972
997(defun ps-run-mode () 973(define-derived-mode ps-run-mode fundamental-mode "Interactive PS"
998 "Major mode in interactive PostScript window. 974 "Major mode in interactive PostScript window.
999This mode is invoked from ps-mode and should not be called directly. 975This mode is invoked from `ps-mode' and should not be called directly.
1000 976
1001\\{ps-run-mode-map} 977\\{ps-run-mode-map}"
1002" 978 (set (make-local-variable 'font-lock-defaults)
1003 (kill-all-local-variables) 979 '((ps-run-font-lock-keywords
1004 (make-local-variable 'font-lock-defaults) 980 ps-run-font-lock-keywords-1
1005 (setq font-lock-defaults '((ps-run-font-lock-keywords 981 ps-run-font-lock-keywords-2)
1006 ps-run-font-lock-keywords-1 982 t))
1007 ps-run-font-lock-keywords-2) 983 (setq mode-line-process '(":%s")))
1008 t)
1009 major-mode 'ps-run-mode
1010 mode-name "Interactive PS"
1011 mode-line-process '(":%s"))
1012 (use-local-map ps-run-mode-map)
1013 (run-hooks 'ps-run-mode-hook))
1014 984
1015(defun ps-run-running () 985(defun ps-run-running ()
1016 "Error if not in ps-mode or not running PostScript." 986 "Error if not in `ps-mode' or not running PostScript."
1017 (unless (equal major-mode 'ps-mode) 987 (unless (equal major-mode 'ps-mode)
1018 (error "This function can only be called from PostScript mode")) 988 (error "This function can only be called from PostScript mode"))
1019 (unless (equal (process-status "ps-run") 'run) 989 (unless (equal (process-status "ps-run") 'run)
@@ -1022,11 +992,10 @@ This mode is invoked from ps-mode and should not be called directly.
1022(defun ps-run-start () 992(defun ps-run-start ()
1023 "Start interactive PostScript." 993 "Start interactive PostScript."
1024 (interactive) 994 (interactive)
1025 (let ((command (if (and window-system ps-run-x) ps-run-x ps-run-dumb)) 995 (let ((command (or (and window-system ps-run-x) ps-run-dumb))
1026 (init-file nil) 996 (init-file nil)
1027 (process-connection-type nil) 997 (process-connection-type nil)
1028 (oldwin (selected-window)) 998 (oldwin (selected-window)))
1029 i)
1030 (unless command 999 (unless command
1031 (error "No command specified to run interactive PostScript")) 1000 (error "No command specified to run interactive PostScript"))
1032 (unless (and ps-run-mark (markerp ps-run-mark)) 1001 (unless (and ps-run-mark (markerp ps-run-mark))
@@ -1040,11 +1009,9 @@ This mode is invoked from ps-mode and should not be called directly.
1040 (when (process-status "ps-run") 1009 (when (process-status "ps-run")
1041 (delete-process "ps-run")) 1010 (delete-process "ps-run"))
1042 (erase-buffer) 1011 (erase-buffer)
1043 (setq i (append command init-file)) 1012 (setq command (append command init-file))
1044 (while i 1013 (insert (mapconcat 'identity command " ") "\n")
1045 (insert (car i) (if (cdr i) " " "\n")) 1014 (apply 'start-process "ps-run" "*ps run*" command)
1046 (setq i (cdr i)))
1047 (eval (append '(start-process "ps-run" "*ps run*") command init-file))
1048 (select-window oldwin))) 1015 (select-window oldwin)))
1049 1016
1050(defun ps-run-quit () 1017(defun ps-run-quit ()
@@ -1082,7 +1049,7 @@ This mode is invoked from ps-mode and should not be called directly.
1082 (ps-run-send-string (format "(%s) run" f) t))) 1049 (ps-run-send-string (format "(%s) run" f) t)))
1083 1050
1084(defun ps-run-boundingbox () 1051(defun ps-run-boundingbox ()
1085 "View BoundingBox" 1052 "View BoundingBox."
1086 (interactive) 1053 (interactive)
1087 (ps-run-running) 1054 (ps-run-running)
1088 (let (x1 y1 x2 y2 f 1055 (let (x1 y1 x2 y2 f
@@ -1172,7 +1139,7 @@ grestore
1172 (delete-file i))))) 1139 (delete-file i)))))
1173 1140
1174(defun ps-run-mouse-goto-error (event) 1141(defun ps-run-mouse-goto-error (event)
1175 "Set point at mouse click, then call ps-run-goto-error." 1142 "Set point at mouse click, then call `ps-run-goto-error'."
1176 (interactive "e") 1143 (interactive "e")
1177 (mouse-set-point event) 1144 (mouse-set-point event)
1178 (ps-run-goto-error)) 1145 (ps-run-goto-error))
@@ -1191,7 +1158,7 @@ grestore
1191 1158
1192(defun ps-run-goto-error () 1159(defun ps-run-goto-error ()
1193 "Jump to buffer position read as integer at point. 1160 "Jump to buffer position read as integer at point.
1194Use line numbers if ps-run-error-line-numbers is not nil" 1161Use line numbers if `ps-run-error-line-numbers' is not nil"
1195 (interactive) 1162 (interactive)
1196 (let ((p (point))) 1163 (let ((p (point)))
1197 (unless (looking-at "[0-9]") 1164 (unless (looking-at "[0-9]")