$Part3: $ File_is="FILL.EL" $ Check_Sum_is=2032307052 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY X;; Fill commands for Emacs X;; Copyright (C) 1985, 1986 Free Software Foundation, Inc. X X;; This file is part of GNU Emacs. X X;; GNU Emacs is distributed in the hope that it will be useful, X;; but WITHOUT ANY WARRANTY. No author or distributor X;; accepts responsibility to anyone for the consequences of using it X;; or for whether it serves any particular purpose or works at all, X;; unless he says so in writing. Refer to the GNU Emacs General Public X;; License for full details. X X;; Everyone is granted permission to copy, modify and redistribute X;; GNU Emacs, but only under the conditions described in the X;; GNU Emacs General Public License. A copy of this license is X;; supposed to have been given to you along with GNU Emacs so you X;; can know your rights and responsibilities. It should be in a X;; file named COPYING. Among other things, the copyright notice X;; and this notice must be preserved on all copies. X X X(defun set-fill-prefix () X "Set the fill-prefix to the current line up to point. XFilling expects lines to start with the fill prefix Xand reinserts the fill prefix in each resulting line." X (interactive) X (setq fill-prefix (buffer-substring X`009`009 (save-excursion (beginning-of-line) (point)) X`009`009 (point))) X (if (equal fill-prefix "") X (setq fill-prefix nil)) X (if fill-prefix X (message "fill-prefix: \"%s\"" fill-prefix) X (message "fill-prefix cancelled"))) X X(defun fill-region-as-paragraph (from to &optional justify-flag) X "Fill region as one paragraph: break lines to fit fill-column. XPrefix arg means justify too. XFrom program, pass args FROM, TO and JUSTIFY-FLAG." X (interactive "r\nP") X (save-restriction X (narrow-to-region from to) X (goto-char (point-min)) X (skip-chars-forward "\n") X (narrow-to-region (point) (point-max)) X (setq from (point)) X (let ((fpre (and fill-prefix (not (equal fill-prefix "")) X`009`009 (regexp-quote fill-prefix)))) X ;; Delete the fill prefix from every line except the first. X ;; The first line may not even have a fill prefix. X (and fpre X`009 (progn X`009 (if (>= (length fill-prefix) fill-column) X`009`009 (error "fill-prefix too long for specified width")) X`009 (goto-char (point-min)) X`009 (forward-line 1) X`009 (while (not (eobp)) X`009 (if (looking-at fpre) X`009`009 (delete-region (point) (match-end 0))) X`009 (forward-line 1)) X`009 (goto-char (point-min)) X`009 (and (looking-at fpre) (forward-char (length fill-prefix))) X`009 (setq from (point))))) X ;; from is now before the text to fill, X ;; but after any fill prefix on the first line. X X ;; Make sure sentences ending at end of line get an extra space. X (goto-char from) X (while (re-search-forward "[.?!][])""']*$" nil t) X (insert ? )) X ;; The change all newlines to spaces. X (subst-char-in-region from (point-max) ?\n ?\ ) X ;; Flush excess spaces, except in the paragraph indentation. X (goto-char from) X (skip-chars-forward " \t") X (while (re-search-forward " *" nil t) X (delete-region X (+ (match-beginning 0) X`009 (if (save-excursion X`009 (skip-chars-backward " ])\"'") X`009 (memq (preceding-char) '(?. ?? ?!))) X`009 2 1)) X (match-end 0))) X (goto-char (point-max)) X (delete-horizontal-space) X (insert " ") X (goto-char (point-min)) X (let ((prefixcol 0)) X (while (not (eobp)) X`009(move-to-column (1+ fill-column)) X`009(if (eobp) X`009 nil X`009 (skip-chars-backward "`094 \n") X`009 (if (if (zerop prefixcol) (bolp) (>= prefixcol (current-column))) X`009 (skip-chars-forward "`094 \n") X`009 (forward-char -1))) X`009(delete-horizontal-space) X`009(insert ?\n) X`009(and (not (eobp)) fill-prefix (not (equal fill-prefix "")) X`009 (progn X`009 (insert fill-prefix) X`009 (setq prefixcol (current-column)))) X`009(and justify-flag (not (eobp)) X`009 (progn X`009 (forward-line -1) X`009 (justify-current-line) X`009 (forward-line 1))))))) X X(defun fill-paragraph (arg) X "Fill paragraph at or after point. XPrefix arg means justify as well." X (interactive "P") X (save-excursion X (forward-paragraph) X (or (bolp) (newline 1)) X (let ((end (point))) X (backward-paragraph) X (fill-region-as-paragraph (point) end arg)))) X X(defun fill-region (from to &optional justify-flag) X "Fill each of the paragraphs in the region. XPrefix arg (non-nil third arg, if called from program) Xmeans justify as well." X (interactive "r\nP") X (save-restriction X (narrow-to-region from to) X (goto-char (point-min)) X (while (not (eobp)) X (let ((initial (point)) X`009 (end (progn X`009`009 (forward-paragraph 1) (point)))) X (forward-paragraph -1) X (if (>= (point) initial) X`009 (fill-region-as-paragraph (point) end justify-flag) X`009 (goto-char end)))))) X X(defun justify-current-line () X "Add spaces to line point is in, so it ends at fill-column." X (interactive) X (save-excursion X (save-restriction X (let (ncols beg) X (beginning-of-line) X;;; reported to bug-emacs 16-Aug-86 X;;; (skip-chars-forward " \t") X (forward-char (length fill-prefix)) X (setq beg (point)) X (end-of-line) X (narrow-to-region beg (point)) X (goto-char beg) X (while (re-search-forward " *" nil t) X`009(delete-region X`009 (+ (match-beginning 0) X`009 (if (save-excursion X`009`009 (skip-chars-backward " ])\"'") X`009`009 (memq (preceding-char) '(?. ?? ?!))) X`009`0092 1)) X`009 (match-end 0))) X (goto-char beg) X (while (re-search-forward "[.?!][])""']*\n" nil t) X`009(forward-char -1) X`009(insert ? )) X (goto-char (point-max)) X (setq ncols (- fill-column (current-column))) X (if (search-backward " " nil t) X`009 (while (> ncols 0) X`009 (let ((nmove (+ 3 (% (random) 3)))) X`009 (while (> nmove 0) X`009`009(or (search-backward " " nil t) X`009`009 (progn X`009`009 (goto-char (point-max)) X`009`009 (search-backward " "))) X`009`009(skip-chars-backward " ") X`009`009(setq nmove (1- nmove)))) X`009 (insert " ") X`009 (skip-chars-backward " ") X`009 (setq ncols (1- ncols)))))))) X`012 X(defun fill-individual-paragraphs (min max &optional justifyp mailp) X "Fill each paragraph in region according to its individual fill prefix. XCalling from a program, pass range to fill as first two arguments. XOptional third and fourth arguments JUSTIFY-FLAG and MAIL-FLAG: XJUSTIFY-FLAG to justify paragraphs (prefix arg), XMAIL-FLAG for a mail message, i. e. don't fill header lines." X (interactive "r\nP") X (let (fill-prefix) X (save-restriction X (save-excursion X`009(narrow-to-region min max) X`009(goto-char (point-min)) X`009(while (progn X`009`009 (skip-chars-forward " \t\n") X`009`009 (not (eobp))) V`009 (setq fill-prefix (buffer-substring (point) (progn (beginning-of-line) ( Xpoint)))) X`009 (let ((fin (save-excursion (forward-paragraph) (point))) X`009`009(start (point))) X`009 (if mailp X`009`009(while (re-search-forward "[ \t]*[`094 \t\n]*:" fin t) X`009`009 (forward-line 1))) X`009 (cond ((= start (point)) X`009`009 (fill-region-as-paragraph (point) fin justifyp) X`009`009 (goto-char fin))))))))) X $ GoSub Convert_File $ File_is="SITE-INIT.EL" $ Check_Sum_is=978797040 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY X;;; (load "rmail") X(load "shell") X(load "dabbrev") X;;; (load "sendmail") X;;; For Suntools version of emacs only X;;; (load "sun-mouse") X;;; (load "sun-fns") X(load "clsc") X X; Bind .for files to fortran mode X; (delq (assoc "\\.for$" auto-mode-alist) auto-mode-alist) X(setq auto-mode-alist X (cons (cons "\\.for$" 'fortran-mode) auto-mode-alist)) X X; Add mode for .ltx files if not there already X(if (not (assoc "\\.ltx$" auto-mode-alist)) X (setq auto-mode-alist X`009 (cons (cons "\\.ltx$" 'LaTeX-mode) auto-mode-alist))) X X; Now get rid of default autoloading to old latex mode, and reattach it X; to our new version X(fmakunbound 'latex-mode) X(fmakunbound 'LaTeX-mode) X(autoload 'LaTeX-mode "latex" X "\ XMajor editing mode for LaTeX, with tex-mode underneath. X XTo create a new LaTeX document, use M-X make-LaTeX-document (on X\\[make-LaTeX-document]). With an argument, it will provide some Xadditional helpful comments. It will prompt for document style and Xoptions. Type ? to see the standard ones; you can enter them with Xname completion. You can also enter your own, since it is possible to Xhave private styles and options unknown to make-LaTeX-document. X VThe most frequent LaTeX construct is the \\begin`123`125...\\end`123`125 group Xing; Xyou can generate it by LaTeX-begin-end-block (on X\\[LaTeX-begin-end-block]). With an argument, a helpful comment may Xbe printed. Type ? to see the standard environments, or enter your Xown. X XOther common constructs are the insertion of labels, citations, Xcross-references, index entries, and additional items in a list. The Xfunctions X X`009\\[LaTeX-cite]`009LaTeX-cite X`009\\[LaTeX-footnote]`009LaTeX-footnote X`009\\[LaTeX-index]`009LaTeX-index X`009\\[LaTeX-item]`009LaTeX-item X`009\\[LaTeX-label]`009LaTeX-label X`009\\[LaTeX-pageref]`009LaTeX-pageref X`009\\[LaTeX-ref]`009LaTeX-ref X Xprovide for these. X VYou can move over \\begin`123`125 ... \\end`123`125 groups with LaTeX-to-begin X (on X\\[LaTeX-to-begin]) and LaTeX-to-\\end (on \\[LaTeX-to-\\end]). X XInsertion of paired braces, braces, and parenthesis is provided by X X`009\\[LaTeX-insert-braces]`009LaTeX-insert-braces X`009\\[LaTeX-insert-brackets]`009LaTeX-insert-brackets X`009\\[LaTeX-insert-parentheses]`009LaTeX-insert-parentheses X XWith an argument, these insert backslash prefixes for literal braces, Xmath mode, and displaymath mode. X VMost other major LaTeX macros can be entered by LaTeX-macro (on \\[LaTeX-macro X]). XThis will supply the correct set of following braces, brackets, and Xparentheses, and with an argument, will insert a short comment about the Xexpected command arguments. X XYou can test for undefined labels with check-LaTeX-labels, and display Xthe labels and their line numbers with show-LaTeX-labels. X XEnvironment nesting errors can be caught by check-LaTeX-nesting. X XUnbalanced character pairs are found by X`009\\[LaTeX-check-brace-balance]`009LaTeX-check-brace-balance X`009\\[LaTeX-check-bracket-balance]`009LaTeX-check-bracket-balance X`009\\[LaTeX-check-parenthesis-balance]`009LaTeX-check-parenthesis-balance X VUse indent-LaTeX-\\begin`123`125-\\end`123`125-groups to get nested environmen Xts Xnested for improved visibility." X t) X X(garbage-collect) $ GoSub Convert_File $ File_is="VMS-PATCH.EL" $ Check_Sum_is=907820822 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY X;; Override parts of files.el for VMS. X;; Copyright (C) 1986 Free Software Foundation, Inc. X X;; This file is part of GNU Emacs. X X;; GNU Emacs is distributed in the hope that it will be useful, X;; but WITHOUT ANY WARRANTY. No author or distributor X;; accepts responsibility to anyone for the consequences of using it X;; or for whether it serves any particular purpose or works at all, X;; unless he says so in writing. Refer to the GNU Emacs General Public X;; License for full details. X X;; Everyone is granted permission to copy, modify and redistribute X;; GNU Emacs, but only under the conditions described in the X;; GNU Emacs General Public License. A copy of this license is X;; supposed to have been given to you along with GNU Emacs so you X;; can know your rights and responsibilities. It should be in a X;; file named COPYING. Among other things, the copyright notice X;; and this notice must be preserved on all copies. X X X;;; Functions that need redefinition X X;;; VMS file names are upper case, but buffer names are more X;;; convenient in lower case. X X(defun create-file-buffer (filename) X "Create a suitably named buffer for visiting FILENAME, and return it. XFILENAME (sans directory) is used unchanged if that name is free; Xotherwise a string <2> or <3> or ... is appended to get an unused name." X (generate-new-buffer (downcase (file-name-nondirectory filename)))) X X;;; Given a string FN, return a similar name which is a legal VMS filename. X;;; This is used to avoid invalid auto save file names. X(defun make-legal-file-name (fn) X (setq fn (copy-sequence fn)) X (let ((dot nil) (indx 0) (len (length fn)) chr) X (while (< indx len) X (setq chr (aref fn indx)) X (cond X ((eq chr ?.) (if dot (aset fn indx ?_) (setq dot t))) X ((not (or (and (>= chr ?a) (<= chr ?z)) (and (>= chr ?A) (<= chr ?Z)) X`009`009 (and (>= chr ?0) (<= chr ?9)) X`009`009 (eq chr ?$) (eq chr ?_) (and (eq chr ?-) (> indx 0)))) X`009(aset fn indx ?_))) X (setq indx (1+ indx)))) X fn) X X;;; Auto save filesnames start with _$ and end with $. X X(defun make-auto-save-file-name () X "Return file name to use for auto-saves of current buffer. XDoes not consider auto-save-visited-file-name; that is checked Xbefore calling this function. VThis is a separate function so your .emacs file or site-init.el can redefine i Xt. XSee also auto-save-file-name-p." X (if buffer-file-name X (concat (file-name-directory buffer-file-name) X`009 "_$" X`009 (file-name-nondirectory buffer-file-name) X`009 "$") V (expand-file-name (concat "_$_" (make-legal-file-name (buffer-name)) "$")) X)) X X(defun auto-save-file-name-p (filename) X "Return t if FILENAME can be yielded by make-auto-save-file-name. XFILENAME should lack slashes. VThis is a separate function so your .emacs file or site-init.el can redefine i Xt." X (string-match "`094_\\$.*\\$" filename)) X X(defun vms-suspend-resume-hook () X "When resuming suspended Emacs, check for file to be found. XIf the logical name ``EMACS_FILE_NAME' is defined, ``find-file' that file." X (let ((file (vms-system-info "LOGICAL" "EMACS_FILE_NAME"))) X (if file (find-file file)))) X X(setq suspend-resume-hook 'vms-suspend-resume-hook) X X(defun vms-suspend-hook () X "Don't allow suspending if logical name ``DONT_SUSPEND_EMACS' is defined." X (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS") X (error "Can't suspend this emacs")) X nil) X X(setq suspend-hook 'vms-suspend-hook) $ GoSub Convert_File $ File_is="VMSPROC.EL" $ Check_Sum_is=2034455447 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY X;; Run asynchronous VMS subprocesses under Emacs X;; Copyright (C) 1986 Free Software Foundation, Inc. X X;; This file is part of GNU Emacs. X X;; GNU Emacs is distributed in the hope that it will be useful, X;; but WITHOUT ANY WARRANTY. No author or distributor X;; accepts responsibility to anyone for the consequences of using it X;; or for whether it serves any particular purpose or works at all, X;; unless he says so in writing. Refer to the GNU Emacs General Public X;; License for full details. X X;; Everyone is granted permission to copy, modify and redistribute X;; GNU Emacs, but only under the conditions described in the X;; GNU Emacs General Public License. A copy of this license is X;; supposed to have been given to you along with GNU Emacs so you X;; can know your rights and responsibilities. It should be in a X;; file named COPYING. Among other things, the copyright notice X;; and this notice must be preserved on all copies. X X;; Written by Mukesh Prasad. X X(defvar display-subprocess-window nil X "If non-nil, the suprocess window is displayed whenever input is received.") X X(defvar command-prefix-string "$ " X "String to insert to distinguish commands entered by user.") X X(defvar subprocess-running nil) X(defvar command-mode-map nil) X X(if command-mode-map X nil X (setq command-mode-map (make-sparse-keymap)) X (define-key command-mode-map "\C-m" 'command-send-input) X (define-key command-mode-map "\C-u" 'command-kill-line)) X X(defun subprocess-input (name str) X "Handles input from a subprocess. Called by Emacs." X (if display-subprocess-window X (display-buffer subprocess-buf)) X (let ((old-buffer (current-buffer))) X (set-buffer subprocess-buf) X (goto-char (point-max)) X (insert str) X (insert ?\n) X (set-buffer old-buffer))) X X(defun subprocess-exit (name) X "Called by Emacs upon subprocess exit." X (setq subprocess-running nil)) X X(defun start-subprocess () X "Spawns an asynchronous subprocess with output redirected to Xthe buffer *COMMAND*. Within this buffer, use C-m to send Xthe last line to the subprocess or to bring another line to Xthe end." X (if subprocess-running X (return t)) X (setq subprocess-buf (get-buffer-create "*COMMAND*")) X (save-excursion X`009(set-buffer subprocess-buf) X`009(use-local-map command-mode-map)) X (setq subprocess-running (spawn-subprocess 1 'subprocess-input X 'subprocess-exit)) X ;; Initialize subprocess so it doesn't panic and die upon X ;; encountering the first error. X (and subprocess-running X (send-command-to-subprocess 1 "ON SEVERE_ERROR THEN CONTINUE"))) X X(defun subprocess-command-to-buffer (command buffer) X "Execute command and redirect output into buffer. X XBUGS: only the output up to the end of the first image activation is trapped." X (if (not subprocess-running)`032 X`009 (start-subprocess)) X (save-excursion X`009(set-buffer buffer) X`009(let ((output-filename (concat "SYS$SCRATCH:OUTPUT-FOR-" X`009`009`009`009`009`009`009`009 (getenv "USER") ".LISTING"))) X`009 (while (file-attributes output-filename) X`009`009(delete-file output-filename)) X`009 (send-command-to-subprocess 1`032 X`009`009`009`009(concat "DEFINE/USER SYS$OUTPUT " X`009`009`009`009`009`009output-filename "-NEW")) X`009 (send-command-to-subprocess 1 command) X`009 (send-command-to-subprocess 1 (concat X`009`009`009"RENAME " output-filename`032 X`009`009`009"-NEW " output-filename)) X`009 (while (not (file-attributes output-filename)) X`009`009(sleep-for 2)) X`009 (insert-file output-filename)))) X X(defun subprocess-command () X "Starts asynchronous subprocess if not running and switches to its window." X (interactive) X (if (not subprocess-running) X (start-subprocess)) X (and subprocess-running X (progn (pop-to-buffer subprocess-buf) (goto-char (point-max))))) X X(defun command-send-input () X "If at last line of buffer, sends the current line to X;the spawned subprocess. Otherwise brings back current Xline to the last line for resubmission." X (interactive) X (beginning-of-line) X (let ((current-line (buffer-substring (point) X (progn (end-of-line) (point))))) X (if (eobp) X (progn X (if (not subprocess-running) X (start-subprocess)) X (if subprocess-running X (progn X (beginning-of-line) X (send-command-to-subprocess 1 current-line) X (if command-prefix-string X (progn (beginning-of-line) (insert command-prefix-string))) X (next-line 1)))) X ;; else -- if not at last line in buffer X (end-of-buffer) X (backward-char) X (next-line 1) X (if (string-equal command-prefix-string X (substring current-line 0 (length command-prefix-string))) X`009 (insert (substring current-line (length command-prefix-string))) X (insert current-line))))) X X(defun command-kill-line() X "Kills the current line. Used in command mode." X (interactive) X (beginning-of-line) X (kill-line)) X X(define-key esc-map "$" 'subprocess-command) $ GoSub Convert_File $ Exit