Function: ps-mode

ps-mode is an autoloaded, interactive and byte-compiled function defined in ps-mode.el.gz.

Signature

(ps-mode)

Documentation

Major mode for editing PostScript with GNU Emacs.

Entry to this mode calls ps-mode-hook.

The following variables hold user options, and can be set through the customize command:

  ps-mode-tab
  ps-mode-paper-size
  ps-mode-print-function
  ps-run-prompt
  ps-run-font-lock-keywords-2
  ps-run-x
  ps-run-dumb
  ps-run-init
  ps-run-error-line-numbers
  ps-run-tmp-dir

Type C-h v (describe-variable) for documentation on these options.


C-c C-b ps-run-buffer
C-c C-j ps-mode-other-newline
C-c C-k ps-run-kill
C-c C-l ps-run-clear
C-c C-o ps-mode-comment-out-region
C-c C-p ps-mode-print-buffer
C-c C-q ps-run-quit
C-c C-r ps-run-region
C-c C-s ps-run-start
C-c C-t ps-mode-epsf-rich
C-c C-u ps-mode-uncomment-region
C-c C-v ps-run-boundingbox
DEL ps-mode-backward-delete-char


When starting an interactive PostScript process with M-x ps-run-start (ps-run-start), a second window will be displayed, and ps-run-mode-hook will be called. The keymap for this second window is:

<delete> delete-forward-char
<kp-delete> delete-forward-char
<mouse-2> comint-insert-input
<mouse-2> ps-run-mouse-goto-error
C-<down> comint-next-input
C-<up> comint-previous-input
C-M-l comint-show-output
C-c . comint-insert-previous-argument
C-c C-\ comint-quit-subjob
C-c C-a comint-bol-or-process-mark
C-c C-c comint-interrupt-subjob
C-c C-d comint-send-eof
C-c C-e comint-show-maximum-output
C-c C-e ps-run-goto-error
C-c C-k ps-run-kill
C-c C-l comint-dynamic-list-input-ring
C-c C-n comint-next-prompt
C-c C-o comint-delete-output
C-c C-p comint-previous-prompt
C-c C-q ps-run-quit
C-c C-r comint-show-output
C-c C-s comint-write-output
C-c C-u comint-kill-input
C-c C-w backward-kill-word
C-c C-x comint-get-next-from-history
C-c C-z comint-stop-subjob
C-c M-o comint-clear-buffer
C-c M-r comint-previous-matching-input-from-input
C-c M-s comint-next-matching-input-from-input
C-c RET comint-copy-old-input
C-c SPC comint-accumulate
C-d comint-delchar-or-maybe-eof
C-x <up> comint-complete-input-ring
M-n comint-next-input
M-p comint-previous-input
M-r comint-history-isearch-backward-regexp
RET comint-send-input


When Ghostscript encounters an error it displays an error message with a file position. Clicking mouse-2 on this number will bring point to the corresponding spot in the PostScript window, if input to the interpreter was sent from that window. Typing C-c C-e (ps-run-goto-error) when the cursor is at the number has the same effect.

Probably introduced at or before Emacs version 21.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/ps-mode.el.gz
;;;###autoload
(define-derived-mode ps-mode prog-mode "PostScript"
  "Major mode for editing PostScript with GNU Emacs.

Entry to this mode calls `ps-mode-hook'.

The following variables hold user options, and can
be set through the `customize' command:

  `ps-mode-tab'
  `ps-mode-paper-size'
  `ps-mode-print-function'
  `ps-run-prompt'
  `ps-run-font-lock-keywords-2'
  `ps-run-x'
  `ps-run-dumb'
  `ps-run-init'
  `ps-run-error-line-numbers'
  `ps-run-tmp-dir'

Type \\[describe-variable] for documentation on these options.


\\{ps-mode-map}


When starting an interactive PostScript process with \\[ps-run-start],
a second window will be displayed, and `ps-run-mode-hook' will be called.
The keymap for this second window is:

\\{ps-run-mode-map}


When Ghostscript encounters an error it displays an error message
with a file position.  Clicking mouse-2 on this number will bring
point to the corresponding spot in the PostScript window, if input
to the interpreter was sent from that window.
Typing \\<ps-run-mode-map>\\[ps-run-goto-error] when the cursor is at the number has the same effect."
  (setq-local syntax-propertize-function #'ps-mode-syntax-propertize)
  (setq-local font-lock-defaults
              '((ps-mode-font-lock-keywords
                 ps-mode-font-lock-keywords-1
                 ps-mode-font-lock-keywords-2
                 ps-mode-font-lock-keywords-3)
                nil))
  (smie-setup nil #'ps-mode-smie-rules)
  (setq-local editorconfig-indent-size-vars '(ps-mode-tab))
  (setq-local electric-indent-chars
              (append '(?> ?\] ?\}) electric-indent-chars))
  (setq-local comment-start "%")
  ;; NOTE: `\' has a special meaning in strings only
  (setq-local comment-start-skip "%+[ \t]*")
  ;; enable doc-view-minor-mode => C-c C-c starts viewing the current ps file
  ;; with doc-view-mode.
  (doc-view-minor-mode 1))