home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!europa.asd.contel.com!paladin.american.edu!auvm!UNC.BITNET!UNCSM1
- Message-ID: <SAS-L%92082713413749@VTVM2.BITNET>
- Newsgroups: bit.listserv.sas-l
- Date: Thu, 27 Aug 1992 13:43:00 EDT
- Reply-To: Sally Muller <UNCSM1@UNC.BITNET>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Sally Muller <UNCSM1@UNC.BITNET>
- Subject: Syntax-Sensitive Editing for SAS Programs
- Lines: 105
-
- ----------------------------------------------------------------------
- SUMMARY: Mark Riggle's (original OBSERVATION's article) very nice
- SAS mode for emacs....here are some useful emacs functions
- to go with it.
- REL/PLTF: 6.06 MVS/ESA 6.06 VM/XA
- E-ADDR: uncsm1@unc.bitnet
- NAME: Sally Muller
- PH/ADDR: 919-962-6501 OIT CB#3455, UNC, Chapel Hill NC 27514
- ----------------------------------------------------------------------
- Ahhh yes.....the image is getting clearer now....I can almost see
- it....yes, yes....
-
- Re: Syntax-Sensitive Editing for SAS Programs
-
- It is possible to bring up the SAS system in line mode in an emacs
- shell and then conviently submit all or part of a file you are
- currently editing to run. This way you work interactively and have
- access to emacs sas-mode. Here are some emacs functions that submit
- SAS code. Typically, the submit functions should be bound to keys.
- I hope some of you find this helpful.
-
- ;;; Functions for submitting code from emacs to run in SAS line mode.
- ;;;
- ;;; sas-shell - creates a new shell named, *shell1*,
- ;;; *shell2*, *shell3*, .... Submit functions
- ;;; assume shell names of this form.
- ;;;
- ;;; sas-set-shell - sets the shell to which the submit functions
- ;;; send SAS code. By default, this is *shell1*.
- ;;;
- ;;; sas-set-step - sets the end of step for sas-submit-step.
- ;;; By default, submit until run;.*
- ;;;
- ;;; sas-submit-marked - submits a marked region.
- ;;;
- ;;; sas-submit-step - submits a step. End of step is set with
- ;;; the sas-set-step function.
- ;;;
- ;;; sas-submit-rest - submits the rest of the buffer.
- ;;;
- ;;; sas-submit-buffer - submits the entire buffer.
-
- (defvar sas-runshell "*shell1*" "default shell for submit functions.")
- (defvar sas-submit-step-end "run;.*" "default step end for sas-submit-step")
-
- (defun sas-shell ()
- "Create a new shell named, *shell1*, *shell2*, *shell3*, ....
- Numbers are reused as they become available."
- (interactive)
- (let ((shell-number 1))
- (while (get-buffer (format "*shell%d*" shell-number))
- (setq shell-number (+ shell-number 1)))
- (shell)
- (rename-buffer (format "*shell%d*" shell-number)))
- )
-
- (defun sas-set-shell ()
- "Set the shell for submit functions."
- (interactive)
- (setq sas-runshell
- (format "*shell%s*"
- (read-from-minibuffer "Enter shell number: " (substring sas-runshell 6
- 7))))
- (switch-to-buffer sas-runshell)
- )
-
- (defun sas-set-step (hold-string)
- "Set the end of the step for sas-submit-step command."
- (interactive (list (read-from-minibuffer "Enter step boundary: ")))
- (setq sas-submit-step-end hold-string)
- (message sas-submit-step-end)
- )
-
- (defun sas-submit-marked (beg end)
- "Submit marked region to sas-runshell with SAS %include statement."
- (interactive "r")
- (delete-file "~/.#junk-submit-text")
- (write-region beg end "~/.#junk-submit-text")
- (switch-to-buffer-other-window sas-runshell)
- (process-send-string sas-runshell "%include '~/.#junk-submit-text' /
- source;\n")
- )
-
- (defun sas-submit-step ()
- "Submit from point through step end to sas-runshell."
- (interactive)
- (push-mark (point))
- (let ((beg (point)))
- (if (re-search-forward sas-submit-step-end (point-max) t)
- (sas-submit-marked beg (point))
- ;else
- (message "Search for end of step failed.")))
- )
-
- (defun sas-submit-buffer ()
- "Submit this buffer to sas-runshell with SAS %include statement."
- (interactive)
- (sas-submit-marked (point-min) (point-max))
- )
-
- (defun sas-submit-rest ()
- "Submit from point through the end sas-runshell with SAS %include statement.
- (interactive)
- (sas-submit-marked (point) (point-max))
- )
-