Mercurial > emacs
annotate lisp/progmodes/ps-mode.el @ 94657:11f8893e574f
(compilation-error-regexp-alist-alist): Tweak Open Watcom regexp to
distinguish between errors and warnings.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Tue, 06 May 2008 03:23:26 +0000 |
parents | 842d446b22d9 |
children | 52b7a8c22af5 |
rev | line source |
---|---|
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
33965
diff
changeset
|
1 ;;; ps-mode.el --- PostScript mode for GNU Emacs |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2 |
79717 | 3 ;; Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
64699
629afbe74e61
Update copyright for release of 22.1 for progmodes directory.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
5 |
63574
545e1eb57222
Update version and maintainer's email address.
Eli Zaretskii <eliz@gnu.org>
parents:
62402
diff
changeset
|
6 ;; Author: Peter Kleiweg <p.c.j.kleiweg@rug.nl> |
545e1eb57222
Update version and maintainer's email address.
Eli Zaretskii <eliz@gnu.org>
parents:
62402
diff
changeset
|
7 ;; Maintainer: Peter Kleiweg <p.c.j.kleiweg@rug.nl> |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
8 ;; Created: 20 Aug 1997 |
63574
545e1eb57222
Update version and maintainer's email address.
Eli Zaretskii <eliz@gnu.org>
parents:
62402
diff
changeset
|
9 ;; Version: 1.1h, 16 Jun 2005 |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
10 ;; Keywords: PostScript, languages |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
11 |
94116
842d446b22d9
Cleanup the bug-report email addresses and make sure the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93975
diff
changeset
|
12 ;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this |
842d446b22d9
Cleanup the bug-report email addresses and make sure the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93975
diff
changeset
|
13 ;; file on 18/3/2008, and the maintainer agreed that when a bug is |
842d446b22d9
Cleanup the bug-report email addresses and make sure the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93975
diff
changeset
|
14 ;; filed in the Emacs bug reporting system against this file, a copy |
842d446b22d9
Cleanup the bug-report email addresses and make sure the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93975
diff
changeset
|
15 ;; of the bug report be sent to the maintainer's email address, but |
842d446b22d9
Cleanup the bug-report email addresses and make sure the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93975
diff
changeset
|
16 ;; only if: "... those e-mails have a link to the bug report system, |
842d446b22d9
Cleanup the bug-report email addresses and make sure the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93975
diff
changeset
|
17 ;; where I can cancel these e-mails if I want to.". |
842d446b22d9
Cleanup the bug-report email addresses and make sure the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93975
diff
changeset
|
18 |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
19 ;; This file is part of GNU Emacs. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
20 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
21 ;; GNU Emacs is free software; you can redistribute it and/or modify |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
22 ;; it under the terms of the GNU General Public License as published by |
78234
c1ec1c8a8d2e
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
23 ;; the Free Software Foundation; either version 3, or (at your option) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
24 ;; any later version. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
25 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
26 ;; GNU Emacs is distributed in the hope that it will be useful, |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
27 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
28 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
29 ;; GNU General Public License for more details. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
30 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
31 ;; You should have received a copy of the GNU General Public License |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
32 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 33 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
34 ;; Boston, MA 02110-1301, USA. | |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
35 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
36 ;;; Commentary: |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
37 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
38 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
39 ;;; Code: |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
40 |
63574
545e1eb57222
Update version and maintainer's email address.
Eli Zaretskii <eliz@gnu.org>
parents:
62402
diff
changeset
|
41 (defconst ps-mode-version "1.1h, 16 Jun 2005") |
545e1eb57222
Update version and maintainer's email address.
Eli Zaretskii <eliz@gnu.org>
parents:
62402
diff
changeset
|
42 (defconst ps-mode-maintainer-address "Peter Kleiweg <p.c.j.kleiweg@rug.nl>") |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
43 |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
44 (require 'easymenu) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
45 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
46 ;; Define core `PostScript' group. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
47 (defgroup PostScript nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
48 "PostScript mode for Emacs." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
49 :group 'languages) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
50 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
51 (defgroup PostScript-edit nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
52 "PostScript editing." |
66963
a11fdee52c05
Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents:
65584
diff
changeset
|
53 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
54 :prefix "ps-mode-" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
55 :group 'PostScript) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
56 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
57 (defgroup PostScript-interaction nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
58 "PostScript interaction." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
59 :prefix "ps-run-" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
60 :group 'PostScript) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
61 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
62 ;; User variables. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
63 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
64 (defcustom ps-mode-auto-indent t |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
65 "*Should we use autoindent?" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
66 :group 'PostScript-edit |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
67 :type 'boolean) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
68 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
69 (defcustom ps-mode-tab 4 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
70 "*Number of spaces to use when indenting." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
71 :group 'PostScript-edit |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
72 :type 'integer) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
73 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
74 (defcustom ps-mode-paper-size '(595 842) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
75 "*Default paper size. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
76 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
77 When inserting an EPSF template these values are used |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
78 to set the boundingbox to include the whole page. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
79 When the figure is finished these values should be replaced." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
80 :group 'PostScript-edit |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
81 :type '(choice |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
82 (const :tag "letter" (612 792)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
83 (const :tag "legal" (612 1008)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
84 (const :tag "a0" (2380 3368)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
85 (const :tag "a1" (1684 2380)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
86 (const :tag "a2" (1190 1684)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
87 (const :tag "a3" (842 1190)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
88 (const :tag "a4" (595 842)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
89 (const :tag "a5" (421 595)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
90 (const :tag "a6" (297 421)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
91 (const :tag "a7" (210 297)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
92 (const :tag "a8" (148 210)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
93 (const :tag "a9" (105 148)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
94 (const :tag "a10" (74 105)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
95 (const :tag "b0" (2836 4008)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
96 (const :tag "b1" (2004 2836)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
97 (const :tag "b2" (1418 2004)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
98 (const :tag "b3" (1002 1418)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
99 (const :tag "b4" (709 1002)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
100 (const :tag "b5" (501 709)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
101 (const :tag "archE" (2592 3456)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
102 (const :tag "archD" (1728 2592)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
103 (const :tag "archC" (1296 1728)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
104 (const :tag "archB" (864 1296)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
105 (const :tag "archA" (648 864)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
106 (const :tag "flsa" (612 936)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
107 (const :tag "flse" (612 936)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
108 (const :tag "halfletter" (396 612)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
109 (const :tag "11x17" (792 1224)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
110 (const :tag "tabloid" (792 1224)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
111 (const :tag "ledger" (1224 792)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
112 (const :tag "csheet" (1224 1584)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
113 (const :tag "dsheet" (1584 2448)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
114 (const :tag "esheet" (2448 3168)))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
115 |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
116 (defcustom ps-mode-print-function |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
117 (lambda () |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
118 (let ((lpr-switches nil) |
87595
4c6c79916238
* configure.in: Remove references to unsupported systems.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87123
diff
changeset
|
119 (lpr-command (if (memq system-type '(usg-unix-v hpux irix)) |
26384
b23b59eb6a78
(ps-mode-print-function): Changed default
Gerd Moellmann <gerd@gnu.org>
parents:
26093
diff
changeset
|
120 "lp" "lpr"))) |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
121 (lpr-buffer))) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
122 "*Lisp function to print current buffer as PostScript." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
123 :group 'PostScript-edit |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
124 :type 'function) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
125 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
126 (defcustom ps-run-prompt "\\(GS\\(<[0-9]+\\)?>\\)+" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
127 "*Regexp to match prompt in interactive PostScript." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
128 :group 'PostScript-interaction |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
129 :type 'regexp) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
130 |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
131 (defcustom ps-run-font-lock-keywords-2 |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
132 (append (unless (string= ps-run-prompt "") |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
133 (list (list (if (= ?^ (string-to-char ps-run-prompt)) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
134 ps-run-prompt |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
135 (concat "^" ps-run-prompt)) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
136 '(0 font-lock-function-name-face nil nil)))) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
137 '((">>showpage, press <return> to continue<<" |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
138 (0 font-lock-keyword-face nil nil)) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
139 ("^\\(Error\\|Can't\\).*" |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
140 (0 font-lock-warning-face nil nil)) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
141 ("^\\(Current file position is\\) \\([0-9]+\\)" |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
142 (1 font-lock-comment-face nil nil) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
143 (2 font-lock-warning-face nil nil)))) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
144 "*Medium level highlighting of messages from the PostScript interpreter. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
145 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
146 See documentation on font-lock for details." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
147 :group 'PostScript-interaction |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
148 :type '(repeat (list :tag "Expression with one or more highlighters" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
149 :value ("" (0 default nil t)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
150 (regexp :tag "Expression") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
151 (repeat :tag "Highlighters" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
152 :inline regexp |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
153 (list :tag "Highlighter" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
154 (integer :tag "Subexp") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
155 face |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
156 (boolean :tag "Override") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
157 (boolean :tag "Laxmatch" :value t)))))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
158 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
159 (defcustom ps-run-x '("gs" "-r72" "-sPAPERSIZE=a4") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
160 "*Command as list to run PostScript with graphic display." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
161 :group 'PostScript-interaction |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
162 :type '(repeat string)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
163 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
164 (defcustom ps-run-dumb '("gs" "-dNODISPLAY") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
165 "*Command as list to run PostScript without graphic display." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
166 :group 'PostScript-interaction |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
167 :type '(repeat string)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
168 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
169 (defcustom ps-run-init nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
170 "*String of commands to send to PostScript to start interactive. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
171 |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
172 Example: \"executive\" |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
173 |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
174 You won't need to set this option for Ghostscript." |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
175 :group 'PostScript-interaction |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
176 :type '(choice (const nil) string)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
177 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
178 (defcustom ps-run-error-line-numbers nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
179 "*What values are used by the PostScript interpreter in error messages?" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
180 :group 'PostScript-interaction |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
181 :type '(choice (const :tag "line numbers" t) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
182 (const :tag "byte counts" nil))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
183 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
184 (defcustom ps-run-tmp-dir nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
185 "*Name of directory to place temporary file. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
186 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
187 If nil, the following are tried in turn, until success: |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
188 1. \"$TEMP\" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
189 2. \"$TMP\" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
190 3. \"$HOME/tmp\" |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
191 4. \"/tmp\"" |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
192 :group 'PostScript-interaction |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
193 :type '(choice (const nil) directory)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
194 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
195 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
196 ;; Constants used for font-lock. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
197 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
198 ;; Only a small set of the PostScript operators is selected for fontification. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
199 ;; Fontification is meant to clarify the document structure and process flow, |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
200 ;; fontifying all known PostScript operators would hinder that objective. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
201 (defconst ps-mode-operators |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
202 (let ((ops '("clear" "mark" "cleartomark" "counttomark" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
203 "forall" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
204 "dict" "begin" "end" "def" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
205 "true" "false" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
206 "exec" "if" "ifelse" "for" "repeat" "loop" "exit" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
207 "stop" "stopped" "countexecstack" "execstack" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
208 "quit" "start" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
209 "save" "restore" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
210 "bind" "null" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
211 "gsave" "grestore" "grestoreall" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
212 "showpage"))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
213 (concat "\\<" (regexp-opt ops t) "\\>")) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
214 "Regexp of PostScript operators that will be fontified.") |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
215 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
216 ;; Level 1 font-lock: |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
217 ;; - Special comments (reference face) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
218 ;; - Strings and other comments |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
219 ;; - Partial strings (warning face) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
220 ;; - 8bit characters (warning face) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
221 ;; Multiline strings are not supported. Strings with nested brackets are. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
222 (defconst ps-mode-font-lock-keywords-1 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
223 '(("\\`%!PS.*" . font-lock-reference-face) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
224 ("^%%BoundingBox:[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]*$" |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
225 . font-lock-reference-face) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
226 (ps-mode-match-string-or-comment |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
227 (1 font-lock-comment-face nil t) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
228 (2 font-lock-string-face nil t)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
229 ("([^()\n%]*\\|[^()\n]*)" . font-lock-warning-face) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
230 ("[\200-\377]+" (0 font-lock-warning-face prepend nil))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
231 "Subdued level highlighting for PostScript mode.") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
232 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
233 ;; Level 2 font-lock: |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
234 ;; - All from level 1 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
235 ;; - PostScript operators (keyword face) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
236 (defconst ps-mode-font-lock-keywords-2 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
237 (append |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
238 ps-mode-font-lock-keywords-1 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
239 (list |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
240 (cons |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
241 ;; exclude names prepended by `/' |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
242 (concat "\\(^\\|[^/\n]\\)" ps-mode-operators) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
243 '(2 font-lock-keyword-face)))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
244 "Medium level highlighting for PostScript mode.") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
245 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
246 ;; Level 3 font-lock: |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
247 ;; - All from level 2 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
248 ;; - Immediately evaluated names: those starting with `//' (type face) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
249 ;; - Names that look like they are used for the definition of: |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
250 ;; * a function |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
251 ;; * an array |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
252 ;; * a dictionary |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
253 ;; * a "global" variable |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
254 ;; (function name face) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
255 ;; - Other names (variable name face) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
256 ;; The rules used to determine what names fit in the first category are: |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
257 ;; - Only names that are at the left margin, and one of these on the same line: |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
258 ;; * Nothing after the name except possibly one or more `[' or a comment |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
259 ;; * A `{' or `<<' or `[0-9]+ dict' following the name |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
260 ;; * A `def' somewhere in the same line |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
261 ;; Names are fontified before PostScript operators, allowing the use of |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
262 ;; a more simple (efficient) regexp than the one used in level 2. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
263 (defconst ps-mode-font-lock-keywords-3 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
264 (append |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
265 ps-mode-font-lock-keywords-1 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
266 (list |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
267 '("//\\w+" . font-lock-type-face) |
40901
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
268 `(,(concat |
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
269 "^\\(/\\w+\\)\\>" |
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
270 "\\([[ \t]*\\(%.*\\)?\r?$" ; Nothing but `[' or comment after the name. |
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
271 "\\|[ \t]*\\({\\|<<\\)" ; `{' or `<<' following the name. |
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
272 "\\|[ \t]+[0-9]+[ \t]+dict\\>" ; `[0-9]+ dict' following the name. |
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
273 "\\|.*\\<def\\>\\)") ; `def' somewhere on the same line. |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
274 . (1 font-lock-function-name-face)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
275 '("/\\w+" . font-lock-variable-name-face) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
276 (cons ps-mode-operators 'font-lock-keyword-face))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
277 "High level highliting for PostScript mode.") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
278 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
279 (defconst ps-mode-font-lock-keywords ps-mode-font-lock-keywords-1 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
280 "Default expressions to highlight in PostScript mode.") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
281 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
282 ;; Level 1 font-lock for ps-run-mode |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
283 ;; - prompt (function name face) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
284 (defconst ps-run-font-lock-keywords-1 |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
285 (unless (string= "" ps-run-prompt) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
286 (list (cons (if (= ?^ (string-to-char ps-run-prompt)) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
287 ps-run-prompt |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
288 (concat "^" ps-run-prompt)) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
289 'font-lock-function-name-face))) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
290 "Subdued level highlighting for PostScript run mode.") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
291 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
292 (defconst ps-run-font-lock-keywords ps-run-font-lock-keywords-1 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
293 "Default expressions to highlight in PostScript run mode.") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
294 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
295 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
296 ;; Variables. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
297 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
298 (defvar ps-mode-map nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
299 "Local keymap to use in PostScript mode.") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
300 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
301 (defvar ps-mode-syntax-table nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
302 "Syntax table used while in PostScript mode.") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
303 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
304 (defvar ps-run-mode-map nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
305 "Local keymap to use in PostScript run mode.") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
306 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
307 (defvar ps-mode-tmp-file nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
308 "Name of temporary file, set by `ps-run'.") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
309 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
310 (defvar ps-run-mark nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
311 "Mark to start of region that was sent to PostScript interpreter.") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
312 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
313 (defvar ps-run-parent nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
314 "Parent window of interactive PostScript.") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
315 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
316 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
317 ;; Menu |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
318 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
319 (defconst ps-mode-menu-main |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
320 '("PostScript" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
321 ["EPSF Template, Sparse" ps-mode-epsf-sparse t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
322 ["EPSF Template, Rich" ps-mode-epsf-rich t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
323 "---" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
324 ("Cookbook" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
325 ["RE" ps-mode-RE t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
326 ["ISOLatin1Extended" ps-mode-latin-extended t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
327 ["center" ps-mode-center t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
328 ["right" ps-mode-right t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
329 ["Heapsort" ps-mode-heapsort t]) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
330 ("Fonts (1)" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
331 ["Times-Roman" (insert "/Times-Roman ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
332 ["Times-Bold" (insert "/Times-Bold ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
333 ["Times-Italic" (insert "/Times-Italic ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
334 ["Times-BoldItalic" (insert "/Times-BoldItalic ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
335 ["Helvetica" (insert "/Helvetica ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
336 ["Helvetica-Bold" (insert "/Helvetica-Bold ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
337 ["Helvetica-Oblique" (insert "/Helvetica-Oblique ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
338 ["Helvetica-BoldOblique" (insert "/Helvetica-BoldOblique ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
339 ["Courier" (insert "/Courier ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
340 ["Courier-Bold" (insert "/Courier-Bold ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
341 ["Courier-Oblique" (insert "/Courier-Oblique ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
342 ["Courier-BoldOblique" (insert "/Courier-BoldOblique ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
343 ["Symbol" (insert "/Symbol") t ]) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
344 ("Fonts (2)" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
345 ["AvantGarde-Book" (insert "/AvantGarde-Book ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
346 ["AvantGarde-Demi" (insert "/AvantGarde-Demi ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
347 ["AvantGarde-BookOblique" (insert "/AvantGarde-BookOblique ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
348 ["AvantGarde-DemiOblique" (insert "/AvantGarde-DemiOblique ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
349 ["Bookman-Light" (insert "/Bookman-Light ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
350 ["Bookman-Demi" (insert "/Bookman-Demi ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
351 ["Bookman-LightItalic" (insert "/Bookman-LightItalic ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
352 ["Bookman-DemiItalic" (insert "/Bookman-DemiItalic ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
353 ["Helvetica-Narrow" (insert "/Helvetica-Narrow ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
354 ["Helvetica-Narrow-Bold" (insert "/Helvetica-Narrow-Bold ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
355 ["Helvetica-Narrow-Oblique" (insert "/Helvetica-Narrow-Oblique ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
356 ["Helvetica-Narrow-BoldOblique" (insert "/Helvetica-Narrow-BoldOblique ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
357 ["NewCenturySchlbk-Roman" (insert "/NewCenturySchlbk-Roman ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
358 ["NewCenturySchlbk-Bold" (insert "/NewCenturySchlbk-Bold ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
359 ["NewCenturySchlbk-Italic" (insert "/NewCenturySchlbk-Italic ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
360 ["NewCenturySchlbk-BoldItalic" (insert "/NewCenturySchlbk-BoldItalic ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
361 ["Palatino-Roman" (insert "/Palatino-Roman ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
362 ["Palatino-Bold" (insert "/Palatino-Bold ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
363 ["Palatino-Italic" (insert "/Palatino-Italic ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
364 ["Palatino-BoldItalic" (insert "/Palatino-BoldItalic ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
365 ["ZapfChancery-MediumItalic" (insert "/ZapfChancery-MediumItalic ") t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
366 ["ZapfDingbats" (insert "/ZapfDingbats ") t]) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
367 "---" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
368 ["Comment Out Region" ps-mode-comment-out-region (mark t)] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
369 ["Uncomment Region" ps-mode-uncomment-region (mark t)] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
370 "---" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
371 ["8-bit to Octal Buffer" ps-mode-octal-buffer t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
372 ["8-bit to Octal Region" ps-mode-octal-region (mark t)] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
373 "---" |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
374 ["Auto Indent" (setq ps-mode-auto-indent (not ps-mode-auto-indent)) |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
375 :style toggle :selected ps-mode-auto-indent] |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
376 "---" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
377 ["Start PostScript" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
378 ps-run-start |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
379 t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
380 ["Quit PostScript" ps-run-quit (process-status "ps-run")] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
381 ["Kill PostScript" ps-run-kill (process-status "ps-run")] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
382 ["Send Buffer to Interpreter" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
383 ps-run-buffer |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
384 (process-status "ps-run")] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
385 ["Send Region to Interpreter" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
386 ps-run-region |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
387 (and (mark t) (process-status "ps-run"))] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
388 ["Send Newline to Interpreter" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
389 ps-mode-other-newline |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
390 (process-status "ps-run")] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
391 ["View BoundingBox" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
392 ps-run-boundingbox |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
393 (process-status "ps-run")] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
394 ["Clear/Reset PostScript Graphics" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
395 ps-run-clear |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
396 (process-status "ps-run")] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
397 "---" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
398 ["Print Buffer as PostScript" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
399 ps-mode-print-buffer |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
400 t] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
401 ["Print Region as PostScript" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
402 ps-mode-print-region |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
403 (mark t)] |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
404 "---" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
405 ["Customize for PostScript" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
406 (customize-group "PostScript") |
26402
541f35936e05
(ps-mode-maintainer-address): New constant.
Gerd Moellmann <gerd@gnu.org>
parents:
26384
diff
changeset
|
407 t] |
541f35936e05
(ps-mode-maintainer-address): New constant.
Gerd Moellmann <gerd@gnu.org>
parents:
26384
diff
changeset
|
408 "---" |
541f35936e05
(ps-mode-maintainer-address): New constant.
Gerd Moellmann <gerd@gnu.org>
parents:
26384
diff
changeset
|
409 ["Submit Bug Report" |
541f35936e05
(ps-mode-maintainer-address): New constant.
Gerd Moellmann <gerd@gnu.org>
parents:
26384
diff
changeset
|
410 ps-mode-submit-bug-report |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
411 t])) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
412 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
413 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
414 ;; Mode maps for PostScript edit mode and PostScript interaction mode. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
415 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
416 (unless ps-mode-map |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
417 (setq ps-mode-map (make-sparse-keymap)) |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
418 (define-key ps-mode-map "\C-c\C-v" 'ps-run-boundingbox) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
419 (define-key ps-mode-map "\C-c\C-u" 'ps-mode-uncomment-region) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
420 (define-key ps-mode-map "\C-c\C-t" 'ps-mode-epsf-rich) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
421 (define-key ps-mode-map "\C-c\C-s" 'ps-run-start) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
422 (define-key ps-mode-map "\C-c\C-r" 'ps-run-region) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
423 (define-key ps-mode-map "\C-c\C-q" 'ps-run-quit) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
424 (define-key ps-mode-map "\C-c\C-p" 'ps-mode-print-buffer) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
425 (define-key ps-mode-map "\C-c\C-o" 'ps-mode-comment-out-region) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
426 (define-key ps-mode-map "\C-c\C-k" 'ps-run-kill) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
427 (define-key ps-mode-map "\C-c\C-j" 'ps-mode-other-newline) |
85666
2a7d60a28bcf
(ps-mode-map): Delete C-c v binding.
Richard M. Stallman <rms@gnu.org>
parents:
78234
diff
changeset
|
428 (define-key ps-mode-map "\C-c\C-l" 'ps-run-clear) |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
429 (define-key ps-mode-map "\C-c\C-b" 'ps-run-buffer) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
430 (define-key ps-mode-map ">" 'ps-mode-r-gt) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
431 (define-key ps-mode-map "]" 'ps-mode-r-angle) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
432 (define-key ps-mode-map "}" 'ps-mode-r-brace) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
433 (define-key ps-mode-map "\177" 'ps-mode-backward-delete-char) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
434 (define-key ps-mode-map "\t" 'ps-mode-tabkey) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
435 (define-key ps-mode-map "\r" 'ps-mode-newline) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
436 (define-key ps-mode-map [return] 'ps-mode-newline) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
437 (easy-menu-define ps-mode-main ps-mode-map "PostScript" ps-mode-menu-main)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
438 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
439 (unless ps-run-mode-map |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
440 (setq ps-run-mode-map (make-sparse-keymap)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
441 (define-key ps-run-mode-map "\C-c\C-q" 'ps-run-quit) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
442 (define-key ps-run-mode-map "\C-c\C-k" 'ps-run-kill) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
443 (define-key ps-run-mode-map "\C-c\C-e" 'ps-run-goto-error) |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
444 (define-key ps-run-mode-map [mouse-2] 'ps-run-mouse-goto-error) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
445 (define-key ps-run-mode-map "\r" 'ps-run-newline) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
446 (define-key ps-run-mode-map [return] 'ps-run-newline)) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
447 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
448 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
449 ;; Syntax table. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
450 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
451 (unless ps-mode-syntax-table |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
452 (setq ps-mode-syntax-table (make-syntax-table)) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
453 |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
454 (modify-syntax-entry ?\% "< " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
455 (modify-syntax-entry ?\n "> " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
456 (modify-syntax-entry ?\r "> " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
457 (modify-syntax-entry ?\f "> " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
458 (modify-syntax-entry ?\< "(>" ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
459 (modify-syntax-entry ?\> ")<" ps-mode-syntax-table) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
460 |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
461 (modify-syntax-entry ?\! "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
462 (modify-syntax-entry ?\" "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
463 (modify-syntax-entry ?\# "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
464 (modify-syntax-entry ?\$ "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
465 (modify-syntax-entry ?\& "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
466 (modify-syntax-entry ?\' "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
467 (modify-syntax-entry ?\* "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
468 (modify-syntax-entry ?\+ "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
469 (modify-syntax-entry ?\, "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
470 (modify-syntax-entry ?\- "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
471 (modify-syntax-entry ?\. "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
472 (modify-syntax-entry ?\: "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
473 (modify-syntax-entry ?\; "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
474 (modify-syntax-entry ?\= "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
475 (modify-syntax-entry ?\? "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
476 (modify-syntax-entry ?\@ "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
477 (modify-syntax-entry ?\\ "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
478 (modify-syntax-entry ?^ "w " ps-mode-syntax-table) ; NOT: ?\^ |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
479 (modify-syntax-entry ?\_ "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
480 (modify-syntax-entry ?\` "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
481 (modify-syntax-entry ?\| "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
482 (modify-syntax-entry ?\~ "w " ps-mode-syntax-table) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
483 |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
484 (let ((i 128)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
485 (while (< i 256) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
486 (modify-syntax-entry i "w " ps-mode-syntax-table) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
487 (setq i (1+ i))))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
488 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
489 |
86247
fc93e9674475
* progmodes/python.el (info-lookup-maybe-add-help):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85785
diff
changeset
|
490 |
87123
d56e1ecaeed7
Remove directory part from filenames in function declarations.
Glenn Morris <rgm@gnu.org>
parents:
86247
diff
changeset
|
491 (declare-function doc-view-minor-mode "doc-view") |
86247
fc93e9674475
* progmodes/python.el (info-lookup-maybe-add-help):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85785
diff
changeset
|
492 |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
493 ;; PostScript mode. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
494 |
51417
0910a521766a
(ps-mode): Use autoload cookie in the standard way.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
43684
diff
changeset
|
495 ;;;###autoload |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
496 (define-derived-mode ps-mode fundamental-mode "PostScript" |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
497 "Major mode for editing PostScript with GNU Emacs. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
498 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
499 Entry to this mode calls `ps-mode-hook'. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
500 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
501 The following variables hold user options, and can |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
502 be set through the `customize' command: |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
503 |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
504 `ps-mode-auto-indent' |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
505 `ps-mode-tab' |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
506 `ps-mode-paper-size' |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
507 `ps-mode-print-function' |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
508 `ps-run-prompt' |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
509 `ps-run-font-lock-keywords-2' |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
510 `ps-run-x' |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
511 `ps-run-dumb' |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
512 `ps-run-init' |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
513 `ps-run-error-line-numbers' |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
514 `ps-run-tmp-dir' |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
515 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
516 Type \\[describe-variable] for documentation on these options. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
517 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
518 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
519 \\{ps-mode-map} |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
520 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
521 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
522 When starting an interactive PostScript process with \\[ps-run-start], |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
523 a second window will be displayed, and `ps-run-mode-hook' will be called. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
524 The keymap for this second window is: |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
525 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
526 \\{ps-run-mode-map} |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
527 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
528 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
529 When Ghostscript encounters an error it displays an error message |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
530 with a file position. Clicking mouse-2 on this number will bring |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
531 point to the corresponding spot in the PostScript window, if input |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
532 to the interpreter was sent from that window. |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
533 Typing \\<ps-run-mode-map>\\[ps-run-goto-error] when the cursor is at the number has the same effect." |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
534 (set (make-local-variable 'font-lock-defaults) |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
535 '((ps-mode-font-lock-keywords |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
536 ps-mode-font-lock-keywords-1 |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
537 ps-mode-font-lock-keywords-2 |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
538 ps-mode-font-lock-keywords-3) |
40901
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
539 t)) |
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
540 (set (make-local-variable 'comment-start) "%") |
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
541 ;; NOTE: `\' has a special meaning in strings only |
85785
c3e74b102623
Tassilo Horn <tassilo at member.fsf.org>
Glenn Morris <rgm@gnu.org>
parents:
85666
diff
changeset
|
542 (set (make-local-variable 'comment-start-skip) "%+[ \t]*") |
c3e74b102623
Tassilo Horn <tassilo at member.fsf.org>
Glenn Morris <rgm@gnu.org>
parents:
85666
diff
changeset
|
543 ;; enable doc-view-minor-mode => C-c C-c starts viewing the current ps file |
c3e74b102623
Tassilo Horn <tassilo at member.fsf.org>
Glenn Morris <rgm@gnu.org>
parents:
85666
diff
changeset
|
544 ;; with doc-view-mode. |
c3e74b102623
Tassilo Horn <tassilo at member.fsf.org>
Glenn Morris <rgm@gnu.org>
parents:
85666
diff
changeset
|
545 (doc-view-minor-mode 1)) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
546 |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
547 (defun ps-mode-show-version () |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
548 "Show current version of PostScript mode." |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
549 (interactive) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
550 (message " *** PostScript Mode (ps-mode) Version %s *** " ps-mode-version)) |
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
551 |
26402
541f35936e05
(ps-mode-maintainer-address): New constant.
Gerd Moellmann <gerd@gnu.org>
parents:
26384
diff
changeset
|
552 (defun ps-mode-submit-bug-report () |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
553 "Submit via mail a bug report on PostScript mode." |
26402
541f35936e05
(ps-mode-maintainer-address): New constant.
Gerd Moellmann <gerd@gnu.org>
parents:
26384
diff
changeset
|
554 (interactive) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
555 (when (y-or-n-p "Submit bug report on PostScript mode? ") |
26421
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
556 (let ((reporter-prompt-for-summary-p nil) |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
557 (reporter-dont-compact-list '(ps-mode-print-function |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
558 ps-run-font-lock-keywords-2))) |
26402
541f35936e05
(ps-mode-maintainer-address): New constant.
Gerd Moellmann <gerd@gnu.org>
parents:
26384
diff
changeset
|
559 (reporter-submit-bug-report |
541f35936e05
(ps-mode-maintainer-address): New constant.
Gerd Moellmann <gerd@gnu.org>
parents:
26384
diff
changeset
|
560 ps-mode-maintainer-address |
26421
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
561 (format "ps-mode.el %s [%s]" ps-mode-version system-type) |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
562 '(ps-mode-auto-indent |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
563 ps-mode-tab |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
564 ps-mode-paper-size |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
565 ps-mode-print-function |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
566 ps-run-prompt |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
567 ps-run-font-lock-keywords-2 |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
568 ps-run-x |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
569 ps-run-dumb |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
570 ps-run-init |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
571 ps-run-error-line-numbers |
a89f2624e1eb
(ps-mode-submit-bug-report): Added list
Gerd Moellmann <gerd@gnu.org>
parents:
26402
diff
changeset
|
572 ps-run-tmp-dir))))) |
26402
541f35936e05
(ps-mode-maintainer-address): New constant.
Gerd Moellmann <gerd@gnu.org>
parents:
26384
diff
changeset
|
573 |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
574 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
575 ;; Helper functions for font-lock. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
576 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
577 ;; When this function is called, point is at an opening bracket. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
578 ;; This function should test if point is at the start of a string |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
579 ;; with nested brackets. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
580 ;; If true: move point to end of string |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
581 ;; set string to match data nr 2 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
582 ;; return new point |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
583 ;; If false: return nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
584 (defun ps-mode-looking-at-nested (limit) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
585 (let ((first (point)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
586 (level 1) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
587 pos) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
588 ;; Move past opening bracket. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
589 (forward-char 1) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
590 (setq pos (point)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
591 (while (and (> level 0) (< pos limit)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
592 ;; Search next bracket, stepping over escaped brackets. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
593 (if (not (looking-at "\\([^()\\\n]\\|\\\\.\\)*\\([()]\\)")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
594 (setq level -1) |
40901
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
595 (setq level (+ level (if (string= "(" (match-string 2)) 1 -1))) |
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
596 (goto-char (setq pos (match-end 0))))) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
597 (if (not (= level 0)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
598 nil |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
599 ;; Found string with nested brackets, now set match data nr 2. |
40901
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
600 (set-match-data (list first pos nil nil first pos)) |
f2a856e8a39c
(ps-mode-font-lock-keywords-1): Merge two regular expressions into one.
Richard M. Stallman <rms@gnu.org>
parents:
40321
diff
changeset
|
601 pos))) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
602 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
603 ;; This function should search for a string or comment |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
604 ;; If comment, return as match data nr 1 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
605 ;; If string, return as match data nr 2 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
606 (defun ps-mode-match-string-or-comment (limit) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
607 ;; Find the first potential match. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
608 (if (not (re-search-forward "[%(]" limit t)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
609 ;; Nothing found: return failure. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
610 nil |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
611 (let ((end (match-end 0))) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
612 (goto-char (match-beginning 0)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
613 (cond ((looking-at "\\(%.*\\)\\|\\((\\([^()\\\n]\\|\\\\.\\)*)\\)") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
614 ;; It's a comment or string without nested, unescaped brackets. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
615 (goto-char (match-end 0)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
616 (point)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
617 ((ps-mode-looking-at-nested limit) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
618 ;; It's a string with nested brackets. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
619 (point)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
620 (t |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
621 ;; Try next match. |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
622 (goto-char end) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
623 (ps-mode-match-string-or-comment limit)))))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
624 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
625 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
626 ;; Key-handlers. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
627 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
628 (defun ps-mode-target-column () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
629 "To what column should text on current line be indented? |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
630 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
631 Identation is increased if the last token on the current line |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
632 defines the beginning of a group. These tokens are: { [ <<" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
633 (save-excursion |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
634 (beginning-of-line) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
635 (if (looking-at "[ \t]*\\(}\\|\\]\\|>>\\)") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
636 (condition-case err |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
637 (progn |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
638 (goto-char (match-end 0)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
639 (backward-sexp 1) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
640 (beginning-of-line) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
641 (if (looking-at "[ \t]+") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
642 (goto-char (match-end 0))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
643 (current-column)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
644 (error |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
645 (ding) |
65584
6dbba0bd58df
Message format fixes, commit no. 3
Deepak Goel <deego@gnufans.org>
parents:
64699
diff
changeset
|
646 (message "%s" (error-message-string err)) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
647 0)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
648 (let (target) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
649 (if (not (re-search-backward "[^ \t\n\r\f][ \t\n\r\f]*\\=" nil t)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
650 0 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
651 (goto-char (match-beginning 0)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
652 (beginning-of-line) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
653 (if (looking-at "[ \t]+") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
654 (goto-char (match-end 0))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
655 (setq target (current-column)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
656 (end-of-line) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
657 (if (re-search-backward "\\({\\|\\[\\|<<\\)[ \t]*\\(%[^\n]*\\)?\\=" nil t) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
658 (setq target (+ target ps-mode-tab))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
659 target))))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
660 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
661 (defun ps-mode-newline () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
662 "Insert newline with proper indentation." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
663 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
664 (delete-horizontal-space) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
665 (insert "\n") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
666 (if ps-mode-auto-indent |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
667 (indent-to (ps-mode-target-column)))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
668 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
669 (defun ps-mode-tabkey () |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
670 "Indent/reindent current line, or insert tab." |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
671 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
672 (let ((column (current-column)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
673 target) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
674 (if (or (not ps-mode-auto-indent) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
675 (< ps-mode-tab 1) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
676 (not (re-search-backward "^[ \t]*\\=" nil t))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
677 (insert "\t") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
678 (setq target (ps-mode-target-column)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
679 (while (<= target column) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
680 (setq target (+ target ps-mode-tab))) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
681 (indent-line-to target)))) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
682 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
683 (defun ps-mode-backward-delete-char () |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
684 "Delete backward indentation, or delete backward character." |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
685 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
686 (let ((column (current-column)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
687 target) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
688 (if (or (not ps-mode-auto-indent) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
689 (< ps-mode-tab 1) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
690 (not (re-search-backward "^[ \t]+\\=" nil t))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
691 (delete-backward-char 1) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
692 (setq target (ps-mode-target-column)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
693 (while (> column target) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
694 (setq target (+ target ps-mode-tab))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
695 (while (>= target column) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
696 (setq target (- target ps-mode-tab))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
697 (if (< target 0) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
698 (setq target 0)) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
699 (indent-line-to target)))) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
700 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
701 (defun ps-mode-r-brace () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
702 "Insert `}' and perform balance." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
703 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
704 (insert "}") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
705 (ps-mode-r-balance "}")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
706 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
707 (defun ps-mode-r-angle () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
708 "Insert `]' and perform balance." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
709 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
710 (insert "]") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
711 (ps-mode-r-balance "]")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
712 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
713 (defun ps-mode-r-gt () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
714 "Insert `>' and perform balance." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
715 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
716 (insert ">") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
717 (ps-mode-r-balance ">>")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
718 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
719 (defun ps-mode-r-balance (right) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
720 "Adjust indentification if point after RIGHT." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
721 (if ps-mode-auto-indent |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
722 (save-excursion |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
723 (when (re-search-backward (concat "^[ \t]*" (regexp-quote right) "\\=") nil t) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
724 (indent-line-to (ps-mode-target-column))))) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
725 (blink-matching-open)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
726 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
727 (defun ps-mode-other-newline () |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
728 "Perform newline in `*ps run*' buffer." |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
729 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
730 (let ((buf (current-buffer))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
731 (set-buffer "*ps run*") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
732 (ps-run-newline) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
733 (set-buffer buf))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
734 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
735 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
736 ;; Print PostScript. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
737 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
738 (defun ps-mode-print-buffer () |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
739 "Print buffer as PostScript." |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
740 (interactive) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
741 (funcall ps-mode-print-function)) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
742 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
743 (defun ps-mode-print-region (begin end) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
744 "Print region as PostScript, adding minimal header and footer lines: |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
745 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
746 %!PS |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
747 <region> |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
748 showpage" |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
749 (interactive "r") |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
750 (let ((buf (current-buffer))) |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
751 (with-temp-buffer |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
752 (insert "%!PS\n") |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
753 (insert-buffer-substring buf begin end) |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
754 (insert "\nshowpage\n") |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
755 (funcall ps-mode-print-function)))) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
756 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
757 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
758 ;; Comment Out / Uncomment. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
759 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
760 (defun ps-mode-comment-out-region (begin end) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
761 "Comment out region." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
762 (interactive "r") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
763 (let ((endm (make-marker))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
764 (set-marker endm end) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
765 (save-excursion |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
766 (goto-char begin) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
767 (if (= (current-column) 0) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
768 (insert "%")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
769 (while (and (= (forward-line) 0) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
770 (< (point) (marker-position endm))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
771 (insert "%"))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
772 (set-marker endm nil))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
773 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
774 (defun ps-mode-uncomment-region (begin end) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
775 "Uncomment region. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
776 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
777 Only one `%' is removed, and it has to be in the first column." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
778 (interactive "r") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
779 (let ((endm (make-marker))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
780 (set-marker endm end) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
781 (save-excursion |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
782 (goto-char begin) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
783 (if (looking-at "^%") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
784 (delete-char 1)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
785 (while (and (= (forward-line) 0) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
786 (< (point) (marker-position endm))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
787 (if (looking-at "%") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
788 (delete-char 1)))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
789 (set-marker endm nil))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
790 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
791 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
792 ;; Convert 8-bit to octal codes. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
793 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
794 (defun ps-mode-octal-buffer () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
795 "Change 8-bit characters to octal codes in buffer." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
796 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
797 (ps-mode-octal-region (point-min) (point-max))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
798 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
799 (defun ps-mode-octal-region (begin end) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
800 "Change 8-bit characters to octal codes in region." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
801 (interactive "r") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
802 (if buffer-read-only |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
803 (progn |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
804 (ding) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
805 (message "Buffer is read only")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
806 (save-excursion |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
807 (let (endm i) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
808 (setq endm (make-marker)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
809 (set-marker endm end) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
810 (goto-char begin) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
811 (setq i 0) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
812 (while (re-search-forward "[\200-\377]" (marker-position endm) t) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
813 (setq i (1+ i)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
814 (backward-char) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
815 (insert (format "\\%03o" (string-to-char (buffer-substring (point) (1+ (point)))))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
816 (delete-char 1)) |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
817 (message "%d change%s made" i (if (= i 1) "" "s")) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
818 (set-marker endm nil))))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
819 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
820 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
821 ;; Cookbook. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
822 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
823 (defun ps-mode-center () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
824 "Insert function /center." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
825 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
826 (insert " |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
827 /center { |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
828 dup stringwidth |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
829 exch 2 div neg |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
830 exch 2 div neg |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
831 rmoveto |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
832 } bind def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
833 ")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
834 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
835 (defun ps-mode-right () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
836 "Insert function /right." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
837 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
838 (insert " |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
839 /right { |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
840 dup stringwidth |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
841 exch neg |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
842 exch neg |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
843 rmoveto |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
844 } bind def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
845 ")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
846 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
847 (defun ps-mode-RE () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
848 "Insert function /RE." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
849 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
850 (insert " |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
851 % `new-font-name' `encoding-vector' `old-font-name' RE - |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
852 /RE { |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
853 findfont |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
854 dup maxlength dict begin { |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
855 1 index /FID ne { def } { pop pop } ifelse |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
856 } forall |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
857 /Encoding exch def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
858 dup /FontName exch def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
859 currentdict end definefont pop |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
860 } bind def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
861 ")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
862 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
863 (defun ps-mode-latin-extended () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
864 "Insert array /ISOLatin1Extended. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
865 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
866 This encoding vector contains all the entries from ISOLatin1Encoding |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
867 plus the usually uncoded characters inserted on positions 1 through 28." |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
868 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
869 (insert " |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
870 % ISOLatin1Encoding, extended with remaining uncoded glyphs |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
871 /ISOLatin1Extended [ |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
872 /.notdef /Lslash /lslash /OE /oe /Scaron /scaron /Zcaron /zcaron |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
873 /Ydieresis /trademark /bullet /dagger /daggerdbl /ellipsis /emdash |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
874 /endash /fi /fl /florin /fraction /guilsinglleft /guilsinglright |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
875 /perthousand /quotedblbase /quotedblleft /quotedblright |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
876 /quotesinglbase /quotesingle /.notdef /.notdef /.notdef /space |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
877 /exclam /quotedbl /numbersign /dollar /percent /ampersand |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
878 /quoteright /parenleft /parenright /asterisk /plus /comma /minus |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
879 /period /slash /zero /one /two /three /four /five /six /seven /eight |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
880 /nine /colon /semicolon /less /equal /greater /question /at /A /B /C |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
881 /D /E /F /G /H /I /J /K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
882 /bracketleft /backslash /bracketright /asciicircum /underscore |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
883 /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o /p /q /r /s |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
884 /t /u /v /w /x /y /z /braceleft /bar /braceright /asciitilde |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
885 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
886 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
887 /.notdef /.notdef /.notdef /dotlessi /grave /acute /circumflex |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
888 /tilde /macron /breve /dotaccent /dieresis /.notdef /ring /cedilla |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
889 /.notdef /hungarumlaut /ogonek /caron /space /exclamdown /cent |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
890 /sterling /currency /yen /brokenbar /section /dieresis /copyright |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
891 /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
892 /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
893 /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
894 /onequarter /onehalf /threequarters /questiondown /Agrave /Aacute |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
895 /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
896 /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
897 /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
898 /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
899 /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
900 /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
901 /iacute /icircumflex /idieresis /eth /ntilde /ograve /oacute |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
902 /ocircumflex /otilde /odieresis /divide /oslash /ugrave /uacute |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
903 /ucircumflex /udieresis /yacute /thorn /ydieresis |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
904 ] def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
905 ")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
906 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
907 (defun ps-mode-heapsort () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
908 "Insert function /Heapsort." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
909 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
910 (insert " |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
911 % `array-element' Heapsort-cvi-or-cvr-or-cvs `number-or-string' |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
912 /Heapsort-cvi-or-cvr-or-cvs { |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
913 % 0 get |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
914 } bind def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
915 % `array' Heapsort `sorted-array' |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
916 /Heapsort { |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
917 dup length /hsR exch def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
918 /hsL hsR 2 idiv 1 add def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
919 { |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
920 hsR 2 lt { exit } if |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
921 hsL 1 gt { |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
922 /hsL hsL 1 sub def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
923 } { |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
924 /hsR hsR 1 sub def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
925 dup dup dup 0 get exch dup hsR get |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
926 0 exch put |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
927 hsR exch put |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
928 } ifelse |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
929 dup hsL 1 sub get /hsT exch def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
930 /hsJ hsL def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
931 { |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
932 /hsS hsJ def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
933 /hsJ hsJ dup add def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
934 hsJ hsR gt { exit } if |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
935 hsJ hsR lt { |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
936 dup dup hsJ 1 sub get Heapsort-cvi-or-cvr-or-cvs |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
937 exch hsJ get Heapsort-cvi-or-cvr-or-cvs |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
938 lt { /hsJ hsJ 1 add def } if |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
939 } if |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
940 dup hsJ 1 sub get Heapsort-cvi-or-cvr-or-cvs |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
941 hsT Heapsort-cvi-or-cvr-or-cvs |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
942 le { exit } if |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
943 dup dup hsS 1 sub exch hsJ 1 sub get put |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
944 } loop |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
945 dup hsS 1 sub hsT put |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
946 } loop |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
947 } bind def |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
948 ")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
949 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
950 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
951 ;; EPSF document lay-out. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
952 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
953 (defun ps-mode-epsf-sparse () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
954 "Insert sparse EPSF template." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
955 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
956 (goto-char (point-max)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
957 (unless (re-search-backward "%%EOF[ \t\n]*\\'" nil t) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
958 (goto-char (point-max)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
959 (insert "\n%%EOF\n")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
960 (goto-char (point-max)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
961 (unless (re-search-backward "\\bshowpage[ \t\n]+%%EOF[ \t\n]*\\'" nil t) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
962 (re-search-backward "%%EOF") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
963 (insert "showpage\n")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
964 (goto-char (point-max)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
965 (unless (re-search-backward "\\bend[ \t\n]+\\bshowpage[ \t\n]+%%EOF[ \t\n]*\\'" nil t) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
966 (re-search-backward "showpage") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
967 (insert "\nend\n")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
968 (goto-char (point-min)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
969 (insert "%!PS-Adobe-3.0 EPSF-3.0\n%%BoundingBox: 0 0 ") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
970 (insert (format "%d %d\n\n" |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
971 (car ps-mode-paper-size) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
972 (car (cdr ps-mode-paper-size)))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
973 (insert "64 dict begin\n\n")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
974 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
975 (defun ps-mode-epsf-rich () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
976 "Insert rich EPSF template." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
977 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
978 (ps-mode-epsf-sparse) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
979 (forward-line -3) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
980 (when buffer-file-name |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
981 (insert "%%Title: " (file-name-nondirectory buffer-file-name) "\n")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
982 (insert "%%Creator: " (user-full-name) "\n") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
983 (insert "%%CreationDate: " (current-time-string) "\n") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
984 (insert "%%EndComments\n") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
985 (forward-line 3)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
986 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
987 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
988 ;; Interactive PostScript interpreter. |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
989 |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
990 (define-derived-mode ps-run-mode fundamental-mode "Interactive PS" |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
991 "Major mode in interactive PostScript window. |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
992 This mode is invoked from `ps-mode' and should not be called directly. |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
993 |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
994 \\{ps-run-mode-map}" |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
995 (set (make-local-variable 'font-lock-defaults) |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
996 '((ps-run-font-lock-keywords |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
997 ps-run-font-lock-keywords-1 |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
998 ps-run-font-lock-keywords-2) |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
999 t)) |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
1000 (setq mode-line-process '(":%s"))) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1001 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1002 (defun ps-run-running () |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
1003 "Error if not in `ps-mode' or not running PostScript." |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1004 (unless (equal major-mode 'ps-mode) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1005 (error "This function can only be called from PostScript mode")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1006 (unless (equal (process-status "ps-run") 'run) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1007 (error "No PostScript process running"))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1008 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1009 (defun ps-run-start () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1010 "Start interactive PostScript." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1011 (interactive) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
1012 (let ((command (or (and window-system ps-run-x) ps-run-dumb)) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1013 (init-file nil) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1014 (process-connection-type nil) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
1015 (oldwin (selected-window))) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1016 (unless command |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1017 (error "No command specified to run interactive PostScript")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1018 (unless (and ps-run-mark (markerp ps-run-mark)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1019 (setq ps-run-mark (make-marker))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1020 (when ps-run-init |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1021 (setq init-file (ps-run-make-tmp-filename)) |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
1022 (write-region (concat ps-run-init "\n") 0 init-file) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1023 (setq init-file (list init-file))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1024 (pop-to-buffer "*ps run*") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1025 (ps-run-mode) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1026 (when (process-status "ps-run") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1027 (delete-process "ps-run")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1028 (erase-buffer) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
1029 (setq command (append command init-file)) |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
1030 (insert (mapconcat 'identity command " ") "\n") |
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
1031 (apply 'start-process "ps-run" "*ps run*" command) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1032 (select-window oldwin))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1033 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1034 (defun ps-run-quit () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1035 "Quit interactive PostScript." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1036 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1037 (ps-run-send-string "quit" t) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1038 (ps-run-cleanup)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1039 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1040 (defun ps-run-kill () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1041 "Kill interactive PostScript." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1042 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1043 (delete-process "ps-run") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1044 (ps-run-cleanup)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1045 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1046 (defun ps-run-clear () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1047 "Clear/reset PostScript graphics." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1048 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1049 (ps-run-send-string "showpage" t) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1050 (sit-for 1) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1051 (ps-run-send-string "" t)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1052 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1053 (defun ps-run-buffer () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1054 "Send buffer to PostScript interpreter." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1055 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1056 (ps-run-region (point-min) (point-max))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1057 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1058 (defun ps-run-region (begin end) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1059 "Send region to PostScript interpreter." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1060 (interactive "r") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1061 (ps-run-running) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1062 (setq ps-run-parent (buffer-name)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1063 (let ((f (ps-run-make-tmp-filename))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1064 (set-marker ps-run-mark begin) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1065 (write-region begin end f) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1066 (ps-run-send-string (format "(%s) run" f) t))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1067 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1068 (defun ps-run-boundingbox () |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
1069 "View BoundingBox." |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1070 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1071 (ps-run-running) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1072 (let (x1 y1 x2 y2 f |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1073 (buf (current-buffer))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1074 (save-excursion |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1075 (goto-char 1) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1076 (re-search-forward |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1077 "^%%BoundingBox:[ \t]+\\(-?[0-9]+\\)[ \t]+\\(-?[0-9]+\\)[ \t]+\\(-?[0-9]+\\)[ \t]+\\(-?[0-9]+\\)") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1078 (setq x1 (match-string 1) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1079 y1 (match-string 2) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1080 x2 (match-string 3) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1081 y2 (match-string 4))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1082 (unless (< (string-to-number x1) (string-to-number x2)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1083 (error "x1 (%s) should be less than x2 (%s)" x1 x2)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1084 (unless (< (string-to-number y1) (string-to-number y2)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1085 (error "y1 (%s) should be less than y2 (%s)" y1 y2)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1086 (setq f (ps-run-make-tmp-filename)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1087 (write-region |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1088 (format |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1089 "gsave |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1090 initgraphics |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1091 2 setlinewidth |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1092 %s %s moveto |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1093 %s %s lineto |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1094 %s %s lineto |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1095 %s %s lineto |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1096 closepath |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1097 gsave |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1098 [ 4 20 ] 0 setdash |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1099 1 0 0 setrgbcolor |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1100 stroke |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1101 grestore |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1102 gsave |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1103 [ 4 20 ] 8 setdash |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1104 0 1 0 setrgbcolor |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1105 stroke |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1106 grestore |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1107 [ 4 20 ] 16 setdash |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1108 0 0 1 setrgbcolor |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1109 stroke |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1110 grestore |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1111 " x1 y1 x2 y1 x2 y2 x1 y2) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1112 0 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1113 f) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1114 (ps-run-send-string (format "(%s) run" f) t) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1115 (set-buffer buf))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1116 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1117 (defun ps-run-send-string (string &optional echo) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1118 (let ((oldwin (selected-window))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1119 (pop-to-buffer "*ps run*") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1120 (goto-char (point-max)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1121 (when echo |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1122 (insert string "\n")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1123 (set-marker (process-mark (get-process "ps-run")) (point)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1124 (process-send-string "ps-run" (concat string "\n")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1125 (select-window oldwin))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1126 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1127 (defun ps-run-make-tmp-filename () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1128 (unless ps-mode-tmp-file |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1129 (cond (ps-run-tmp-dir) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1130 ((setq ps-run-tmp-dir (getenv "TEMP"))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1131 ((setq ps-run-tmp-dir (getenv "TMP"))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1132 ((setq ps-run-tmp-dir (getenv "HOME")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1133 (setq |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1134 ps-run-tmp-dir |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1135 (concat (file-name-as-directory ps-run-tmp-dir) "tmp")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1136 (unless (file-directory-p ps-run-tmp-dir) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1137 (setq ps-run-tmp-dir nil)))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1138 (unless ps-run-tmp-dir |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1139 (setq ps-run-tmp-dir "/tmp")) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1140 (setq ps-mode-tmp-file |
43684
4111d9e8065d
(ps-run-make-tmp-filename): Use make-temp-file.
Richard M. Stallman <rms@gnu.org>
parents:
40901
diff
changeset
|
1141 (make-temp-file |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1142 (concat |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1143 (if ps-run-tmp-dir |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1144 (file-name-as-directory ps-run-tmp-dir) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1145 "") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1146 "ps-run-")))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1147 ps-mode-tmp-file) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1148 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1149 ;; Remove temporary file |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1150 ;; This shouldn't fail twice, because it is called at kill-emacs |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1151 (defun ps-run-cleanup () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1152 (when ps-mode-tmp-file |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1153 (let ((i ps-mode-tmp-file)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1154 (setq ps-mode-tmp-file nil) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1155 (when (file-exists-p i) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1156 (delete-file i))))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1157 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1158 (defun ps-run-mouse-goto-error (event) |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
1159 "Set point at mouse click, then call `ps-run-goto-error'." |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1160 (interactive "e") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1161 (mouse-set-point event) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1162 (ps-run-goto-error)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1163 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1164 (defun ps-run-newline () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1165 "Process newline in PostScript interpreter window." |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1166 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1167 (end-of-line) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1168 (insert "\n") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1169 (forward-line -1) |
26093
6b9477637c7c
(ps-mode-print-function): Fix default
Gerd Moellmann <gerd@gnu.org>
parents:
25990
diff
changeset
|
1170 (when (looking-at ps-run-prompt) |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1171 (goto-char (match-end 0))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1172 (looking-at ".*") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1173 (goto-char (1+ (match-end 0))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1174 (ps-run-send-string (buffer-substring (match-beginning 0) (match-end 0)))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1175 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1176 (defun ps-run-goto-error () |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1177 "Jump to buffer position read as integer at point. |
40321
bdb409454d22
(ps-mode-print-function): Remove quote for
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
1178 Use line numbers if `ps-run-error-line-numbers' is not nil" |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1179 (interactive) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1180 (let ((p (point))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1181 (unless (looking-at "[0-9]") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1182 (goto-char (max 1 (1- (point))))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1183 (when (looking-at "[0-9]") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1184 (forward-char 1) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1185 (forward-word -1) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1186 (when (looking-at "[0-9]+") |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1187 (let (i) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1188 (setq |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1189 i |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
1190 (string-to-number |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1191 (buffer-substring (match-beginning 0) (match-end 0)))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1192 (goto-char p) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1193 (pop-to-buffer ps-run-parent) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1194 (if ps-run-error-line-numbers |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1195 (progn |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1196 (goto-char (marker-position ps-run-mark)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1197 (forward-line (1- i)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1198 (end-of-line)) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1199 (goto-char (+ i (marker-position ps-run-mark))))))))) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1200 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1201 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1202 ;; |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1203 (add-hook 'kill-emacs-hook 'ps-run-cleanup) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1204 |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1205 (provide 'ps-mode) |
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1206 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1207 ;; arch-tag: dce13d2d-69fb-4ec4-9d5d-6dd29c3f0e6e |
25990
2b2b161bac67
New file. Major mode for editing PostScript.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1208 ;;; ps-mode.el ends here |