Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
2701 views
1
;;; ess-sas-a.el --- clean-room implementation of many SAS-mode features
2
3
;; Copyright (C) 1997--2009 A.J. Rossini, Richard M. Heiberger, Martin
4
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
5
6
;; Author: Rodney A. Sparapani
7
;; Maintainer: [email protected]
8
;; Created: 17 November 1999
9
;; Keywords: languages
10
11
;; This file is part of ESS
12
13
;; This file is free software; you can redistribute it and/or modify
14
;; it under the terms of the GNU General Public License as published by
15
;; the Free Software Foundation; either version 2, or (at your option)
16
;; any later version.
17
;;
18
;; This file is distributed in the hope that it will be useful,
19
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
;; GNU General Public License for more details.
22
;;
23
;; A copy of the GNU General Public License is available at
24
;; http://www.r-project.org/Licenses/
25
26
;;; Code:
27
28
;;; Table of Contents
29
;;; Section 1: Variable Definitions
30
;;; Section 2: Function Definitions
31
;;; Section 3: Key Definitions
32
33
;;; Section 1: Variable Definitions
34
35
(defvar ess-sas-file-path "."
36
"Full path-name of the sas file to perform operations on.")
37
38
(defcustom ess-sas-data-view-libname " "
39
"*SAS code to define a library for `ess-sas-data-view-fsview'
40
or `ess-sas-data-view-insight'."
41
:group 'ess-sas
42
:type 'string)
43
44
(defcustom ess-sas-data-view-submit-options
45
(if ess-microsoft-p "-noenhancededitor -nosysin -log NUL:"
46
"-nodms -nosysin -log /dev/null -terminal")
47
"*The command-line options necessary for your OS with respect to
48
`ess-sas-data-view-fsview' and `ess-sas-data-view-insight'."
49
:group 'ess-sas
50
:type 'string)
51
52
(defcustom ess-sas-data-view-fsview-command "; proc fsview data="
53
"*SAS code to open a SAS dataset with `ess-sas-data-view-fsview'."
54
:group 'ess-sas
55
:type 'string)
56
57
(defcustom ess-sas-data-view-fsview-statement " "
58
"*SAS code to perform a PROC FSVIEW statement with `ess-sas-data-view-fsview'."
59
:group 'ess-sas
60
:type 'string)
61
62
(make-variable-buffer-local 'ess-sas-data-view-fsview-statement)
63
64
(defcustom ess-sas-data-view-insight-command "; proc insight data="
65
"*SAS code to open a SAS dataset with `ess-sas-data-view-insight'."
66
:group 'ess-sas
67
:type 'string)
68
69
(defcustom ess-sas-data-view-insight-statement " "
70
"*SAS code to perform a PROC FSVIEW statement with `ess-sas-data-view-insight'."
71
:group 'ess-sas
72
:type 'string)
73
74
(make-variable-buffer-local 'ess-sas-data-view-insight-statement)
75
76
(defcustom ess-sas-graph-view-suffix-regexp
77
"[.]\\([eE]?[pP][sS]\\|[pP][dD][fF]\\|[gG][iI][fF]\\|[jJ][pP][eE]?[gG]\\|[tT][iI][fF][fF]?\\)"
78
"*GSASFILE suffix regexp."
79
:group 'ess-sas
80
:type 'string)
81
82
(defcustom ess-sas-graph-view-viewer-alist
83
;;creates something like
84
;;'(("[pP][dD][fF]" . "/usr/local/bin/acroread") ("[eE]?[pP][sS]" . "/usr/local/bin/gv")))
85
(let ((ess-tmp-alist nil)
86
(ess-tmp-ps nil) (ess-tmp-pdf nil))
87
88
(setq ess-tmp-ps (executable-find (if ess-microsoft-p "gsview32" "gsview")))
89
90
(if (not ess-tmp-ps) (setq ess-tmp-ps (executable-find "gv")))
91
92
(if (not ess-tmp-ps) (setq ess-tmp-ps (executable-find "ghostview")))
93
94
(setq ess-tmp-pdf (executable-find "evince"))
95
96
(if (not ess-tmp-pdf) (setq ess-tmp-pdf (executable-find "xpdf")))
97
98
(if (not ess-tmp-pdf) (setq ess-tmp-pdf (if ess-microsoft-p "acrord32" "acroread")))
99
100
(if (and ess-tmp-ps ess-tmp-pdf)
101
(setq ess-tmp-alist (list (cons "[eE]?[pP][sS]" ess-tmp-ps)
102
(cons "[pP][dD][fF]" ess-tmp-pdf)))
103
104
(if ess-tmp-ps
105
(setq ess-tmp-alist (list (cons "[eE]?[pP][sS]" ess-tmp-ps)
106
(cons "[pP][dD][fF]" ess-tmp-ps))))))
107
108
"*Associate file name extensions with graphics image file viewers."
109
:group 'ess-sas
110
:type 'string)
111
112
;;(defcustom ess-sas-smart-back-tab nil
113
;; "*Set to t to make C-TAB insert an end/%end; statement to close a block."
114
;; :group 'ess-sas
115
;;)
116
117
(defcustom ess-sas-log-max 0
118
"*If >0 and .log file exceeds this many bytes, just \"refresh\" this many bytes."
119
:group 'ess-sas
120
:type 'integer)
121
122
(defcustom ess-sas-rtf-font-name "Bitstream Vera Sans Mono"
123
; (if (featurep 'xemacs) "Lucida Sans Typewriter" "Bitstream Vera Sans Mono")
124
"*Name of font to create MS RTF with"
125
:group 'ess-sas
126
:type 'string)
127
128
(defcustom ess-sas-shell-buffer "*shell*"
129
"*Name that you want to use for the shell buffer; buffer-local."
130
:group 'ess-sas
131
:type 'string)
132
133
(make-variable-buffer-local 'ess-sas-shell-buffer)
134
135
(defcustom ess-sas-shell-buffer-remote-host nil
136
"*Remote host that you want to open a shell on."
137
:group 'ess-sas
138
:type '(choice (const nil) string))
139
140
(make-variable-buffer-local 'ess-sas-shell-buffer-remote-host)
141
142
(defcustom ess-sas-shell-buffer-remote-init "ssh"
143
"*Command to open a shell on a remote host."
144
:group 'ess-sas
145
:type 'string)
146
147
(make-variable-buffer-local 'ess-sas-shell-buffer-remote-init)
148
149
(defcustom ess-sas-submit-mac-virtual-pc nil
150
"*Non-nil means that you want to run Windows SAS in a
151
Virtual PC emulator on your Mac; buffer-local."
152
:group 'ess-sas
153
:type 'boolean)
154
155
(make-variable-buffer-local 'ess-sas-submit-mac-virtual-pc)
156
157
(defcustom ess-sas-submit-command sas-program
158
"*Command to invoke SAS in batch; buffer-local."
159
:group 'ess-sas
160
:type 'string)
161
162
(make-variable-buffer-local 'ess-sas-submit-command)
163
164
(defcustom ess-sas-submit-command-options "-rsasuser"
165
"*Options to pass to SAS in batch; buffer-local."
166
:group 'ess-sas
167
:type 'string)
168
169
(make-variable-buffer-local 'ess-sas-submit-command-options)
170
171
(defvar ess-sas-submit-method
172
(if ess-microsoft-p
173
(if (w32-shell-dos-semantics) 'ms-dos 'sh)
174
(if (or (equal system-type 'Apple-Macintosh)
175
(and ess-sas-submit-mac-virtual-pc (equal system-type 'darwin)))
176
'apple-script 'sh))
177
"Method used by `ess-sas-submit'.
178
The default is based on the value of the emacs variable `system-type'
179
and, on Windows, the function `w32-shell-dos-semantics'.
180
'sh if *shell* runs sh, ksh, csh, tcsh or bash
181
'ms-dos if *shell* follows MS-DOS semantics
182
'apple-script *shell* unavailable in Mac Classic, use AppleScript,
183
also for Windows SAS in Virtual PC on Mac OS X
184
185
Unix users will get 'sh by default.
186
187
Windows users running bash in *shell* will get 'sh by default.
188
189
Windows users running MS-DOS in *shell* will get 'ms-dos by default.
190
191
Users accessing a remote machine with `telnet', `rlogin', `ssh', etc.,
192
should set this variable to 'sh regardless of their local shell
193
(since their remote shell is 'sh).")
194
195
(make-variable-buffer-local 'ess-sas-submit-method)
196
197
(defcustom ess-sas-graph-view-viewer-default
198
(if ess-microsoft-p "explorer"
199
(if (equal ess-sas-submit-method 'sh) "sdtimage"))
200
"*Default graphics image file viewer."
201
:group 'ess-sas
202
:type 'string)
203
204
(defcustom ess-sas-submit-post-command
205
(if (equal ess-sas-submit-method 'sh) "&"
206
(if ess-microsoft-p "-icon"))
207
"*Command-line statement to post-modify SAS invocation"
208
:group 'ess-sas
209
:type 'string)
210
211
(defcustom ess-sas-submit-pre-command ;;"nohup"
212
(if (equal ess-sas-submit-method 'sh)
213
;; nice is tricky, higher numbers give you lower priorities
214
;; if you are using csh/tcsh, the default priority is 4
215
;; if you are using most other shells, the default priority is 10,
216
;; and some implementations are higher, i.e. zsh unless you
217
;; specify "setopt no_bg_nice" in your ~/.zshrc
218
;; therefore, on the same machine, you can run at a higher or
219
;; lower priority by changing shells, although, the command
220
;; line is the same!
221
;; the following code should give you a priority of 10 regardless
222
;; of which shell is in use, but it will default to the old
223
;; behavior if csh or variant is not recognized
224
;; this should avoid the necessity of each user needing to set this
225
;; variable correctly based on the shell that they use and provide
226
;; an environment where all shells are treated equally
227
228
(let* ((temp-shell (getenv "SHELL"))
229
;; AJR: old CYGWIN versions return nil for (getenv
230
;; "SHELL"), so we need to deal with it 'cause I have to
231
(temp-char (if temp-shell
232
(string-match "/" temp-shell)
233
nil)))
234
(while temp-char
235
(setq temp-shell (substring temp-shell (+ 1 temp-char)))
236
(setq temp-char (string-match "/" temp-shell)))
237
238
(cond ((or (equal temp-shell "csh") (equal temp-shell "tcsh"))
239
"nohup nice +6")
240
(t "nohup nice")))
241
(if ess-microsoft-p "start"))
242
"*Command-line statement to precede SAS invocation, e.g. start or nohup"
243
:group 'ess-sas
244
:type 'string)
245
246
(defcustom ess-sas-suffix-1 "txt"
247
"*The first suffix to associate with SAS."
248
:group 'ess-sas
249
:type 'string)
250
251
(defcustom ess-sas-suffix-2 "csv"
252
"*The second suffix to associate with SAS."
253
:group 'ess-sas
254
:type 'string)
255
256
(defcustom ess-sas-suffix-regexp
257
(concat "[.]\\([sS][aA][sS]\\|[lL][oO][gG]\\|[lL][sS][tT]"
258
(if ess-sas-suffix-1 (concat
259
"\\|" (downcase ess-sas-suffix-1) "\\|" (upcase ess-sas-suffix-1)))
260
(if ess-sas-suffix-2 (concat
261
"\\|" (downcase ess-sas-suffix-2) "\\|" (upcase ess-sas-suffix-2)))
262
"\\)")
263
"*Regular expression for SAS suffixes."
264
:group 'ess-sas
265
:type 'string)
266
267
(defcustom ess-sas-tab-stop-list
268
'(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120)
269
"List of tab stop positions used by `tab-to-tab-stop' in ESS[SAS]."
270
:group 'ess-sas)
271
272
(defcustom ess-sas-temp-root "-temp"
273
"*Appended to root name of the temporary .sas file for `ess-sas-submit-region'."
274
:group 'ess-sas
275
:type 'string)
276
277
(defvar ess-sas-versions '("sas")
278
"List of partial strings for versions of SAS to access within ESS.
279
Each string specifies the start of a filename. If a filename
280
beginning with one of these strings is found on `exec-path', a M-x
281
command for that version of SAS is made available. For example, if the
282
file \"sas8\" is found and this variable includes the string
283
\"sas\", a function called `M-x SAS8' will be available to run that
284
version of SAS.
285
If duplicate versions of the same program are found (which happens if
286
the same path is listed on `exec-path' more than once), they are
287
ignored by calling `ess-uniq-list'.
288
If you set this variable, you need to restart Emacs (and set this variable
289
before ess-site is loaded) for it to take effect.")
290
291
292
;;; Section 2: Function Definitions
293
294
295
(defun ess-ebcdic-to-ascii-search-and-replace ()
296
"*Search and replace EBCDIC text with ASCII equivalents."
297
(interactive)
298
(let ((ess-tmp-dd (executable-find "dd")) (ess-tmp-recode (executable-find "recode"))
299
(ess-tmp-util nil) (ess-tmp-util-args nil))
300
301
(if ess-tmp-dd (progn
302
(setq ess-tmp-util ess-tmp-dd)
303
(setq ess-tmp-util-args "conv=ascii"))
304
305
(setq ess-tmp-util ess-tmp-recode)
306
(setq ess-tmp-util-args "EBCDIC..ISO-8859-1"))
307
308
(if ess-tmp-util
309
(while (search-forward-regexp "[^\f\t\n -~][^\f\t\n -?A-JQ-Yb-jp-y]*[^\f\t\n -~]?" nil t)
310
(call-process-region (match-beginning 0) (match-end 0)
311
ess-tmp-util t (list t nil) t ess-tmp-util-args)))))
312
313
314
(defun ess-exit-notify-sh (string)
315
"Detect completion or failure of submitted job and notify the user."
316
;(let* ((exit-done "\\[[0-9]+\\]\\ *\\+*\\ *\\(Exit\\|Done\\).*$")
317
(let* ((exit-done "\\[[0-9]+\\]\\ *\\+*\\ *\\(Exit\\|Done\\)[^\r\n]*") ; GNU Emacs needs this
318
(beg (string-match exit-done string)))
319
(if beg
320
(message (substring string beg (match-end 0))))))
321
322
323
(defun ess-sas-append-log ()
324
"Append ess-temp.log to the current .log file."
325
(interactive)
326
(ess-sas-goto "log" 'revert)
327
(goto-char (point-max))
328
(insert-file-contents (concat (ess-sas-temp-root) ".log"))
329
(save-buffer))
330
331
(defun ess-sas-append-lst ()
332
"Append ess-temp.lst to the current .lst file."
333
(interactive)
334
(ess-sas-goto "lst" 'revert)
335
(goto-char (point-max))
336
(insert-file-contents (concat (ess-sas-temp-root) ".lst"))
337
(save-buffer))
338
339
(defun ess-sas-backward-delete-tab ()
340
"Moves the cursor to the previous tab-stop, deleting any characters
341
on the way."
342
(interactive)
343
344
(let* (;; point of search
345
;;(ess-sas-search-point nil)
346
;; column of search
347
;;(ess-sas-search-column nil)
348
;; limit of search
349
;;(ess-sas-search-limit nil)
350
;; text to be inserted after a back-tab, if any
351
;;(ess-sas-end-text "end;")
352
;; current-column
353
(ess-sas-column (current-column))
354
;; remainder of current-column and sas-indent-width
355
(ess-sas-remainder (% ess-sas-column sas-indent-width)))
356
357
(if (not (= ess-sas-column 0))
358
(progn
359
(if (= ess-sas-remainder 0)
360
(setq ess-sas-remainder sas-indent-width))
361
362
(let ((backward-delete-char-untabify-method 'nil))
363
(backward-delete-char-untabify ess-sas-remainder t)
364
(setq ess-sas-column (- ess-sas-column ess-sas-remainder))
365
(move-to-column ess-sas-column)
366
(setq left-margin ess-sas-column))
367
))
368
))
369
370
;; this feature was far too complicated to perfect
371
;; (if ess-sas-smart-back-tab (progn
372
;; (save-excursion
373
;; (setq ess-sas-search-point
374
;; (search-backward-regexp "end" nil t))
375
376
;; (if (and ess-sas-search-point
377
;; (search-backward-regexp "%" (+ ess-sas-search-point -1) t))
378
;; (setq ess-sas-search-point (+ ess-sas-search-point -1))
379
;; )
380
381
;; (if (and ess-sas-search-point
382
;; (not (equal ess-sas-column (current-column))))
383
;; (setq ess-sas-search-point nil))
384
;; )
385
386
;; (save-excursion
387
;; (setq ess-sas-search-point
388
;; (search-backward-regexp "do\\|select"
389
;; ess-sas-search-point t))
390
391
;; (setq ess-sas-search-column (current-column))
392
393
;; (if ess-sas-search-point (progn
394
;; (save-excursion
395
;; (search-backward-regexp "^" nil t)
396
;; (setq ess-sas-search-limit (point))
397
;; )
398
399
;; (if (search-backward-regexp "if.*then\\|else" ess-sas-search-limit t)
400
;; (setq ess-sas-search-point (point)))
401
402
;; (if (search-backward-regexp "%" ess-sas-search-limit t) (progn
403
;; (setq ess-sas-end-text "%end;")
404
;; (setq ess-sas-search-point (point))
405
;; ))
406
407
;; (setq ess-sas-search-column (current-column))
408
409
;; (if (not (equal ess-sas-column ess-sas-search-column))
410
;; (setq ess-sas-search-point nil))
411
;; )))
412
413
;; (if ess-sas-search-point (insert ess-sas-end-text))
414
;; ))
415
416
(defun ess-sas-cd ()
417
"Change directory, taking into account various issues with respect to
418
`ess-sas-file-path'."
419
;(interactive)
420
(ess-sas-file-path)
421
(ess-sas-goto-shell t)
422
(comint-send-input)
423
(if (equal ess-sas-submit-method 'sh)
424
(insert "cd " (car (last (split-string (file-name-directory ess-sas-file-path)
425
"\\([a-zA-Z][a-zA-Z]:\\|]\\)"))))
426
(if (equal ess-sas-submit-method 'ms-dos) (progn
427
(if (string-equal ":" (substring ess-sas-file-path 1 2)) (progn
428
(insert (substring ess-sas-file-path 0 2))
429
(comint-send-input)))
430
(insert "cd \"" (convert-standard-filename
431
(file-name-directory ess-sas-file-path)) "\""))))
432
(comint-send-input))
433
434
(defun ess-sas-create-local-variables-alist (&optional file-or-buffer)
435
"Create an alist of local variables from file-or-buffer, use the
436
current buffer if nil."
437
438
(if file-or-buffer (set-buffer (ess-get-file-or-buffer file-or-buffer)))
439
440
(ess-change-alist 'ess-kermit-remote-directory ess-kermit-remote-directory nil))
441
442
(defun ess-sas-data-view-fsview (&optional ess-sas-data)
443
"Open a dataset for viewing with PROC FSVIEW."
444
(interactive)
445
(ess-save-and-set-local-variables)
446
447
(save-excursion (let ((ess-tmp-sas-data nil)
448
(ess-tmp-sas-data-view-fsview-statement ess-sas-data-view-fsview-statement)
449
(ess-search-regexp
450
"[ \t=]\\([a-zA-Z_][a-zA-Z_0-9]*[.][a-zA-Z_][a-zA-Z_0-9]*\\)\\(&.*\\)?[. ,()\t;/]")
451
(ess-search-except
452
"^\\([wW][oO][rR][kK]\\|[fF][iI][rR][sS][tT]\\|[lL][aA][sS][tT]\\)[.]"))
453
454
(if ess-sas-data nil (save-match-data
455
(search-backward-regexp "[ \t=]" nil t)
456
457
(save-excursion
458
(setq ess-tmp-sas-data
459
(ess-search-except ess-search-regexp ess-search-except)))
460
461
(if (not ess-tmp-sas-data)
462
(setq ess-tmp-sas-data
463
(ess-search-except ess-search-regexp ess-search-except t)))
464
465
(setq ess-sas-data (read-string "Permanent SAS Dataset: " ess-tmp-sas-data))
466
467
(ess-sas-goto-shell t)
468
(ess-sas-cd)
469
470
(insert (concat ess-sas-submit-pre-command " " ess-sas-submit-command
471
" -initstmt \"" ess-sas-data-view-libname ess-sas-data-view-fsview-command
472
ess-sas-data ";" ess-tmp-sas-data-view-fsview-statement "; run;\" "
473
ess-sas-submit-command-options " "
474
ess-sas-data-view-submit-options " " ess-sas-submit-post-command))
475
(comint-send-input)
476
)))))
477
478
(defun ess-sas-data-view-insight (&optional ess-sas-data)
479
"Open a dataset for viewing with PROC INSIGHT."
480
(interactive)
481
(ess-save-and-set-local-variables)
482
483
(save-excursion (let ((ess-tmp-sas-data nil)
484
(ess-tmp-sas-data-view-insight-statement ess-sas-data-view-insight-statement)
485
(ess-search-regexp
486
"[ \t=]\\([a-zA-Z_][a-zA-Z_0-9]*[.][a-zA-Z_][a-zA-Z_0-9]*\\)\\(&.*\\)?[. ,()\t;]")
487
(ess-search-except
488
"^\\([wW][oO][rR][kK]\\|[fF][iI][rR][sS][tT]\\|[lL][aA][sS][tT]\\)[.]"))
489
490
(if ess-sas-data nil (save-match-data
491
(search-backward-regexp "[ \t=]" nil t)
492
493
(save-excursion
494
(setq ess-tmp-sas-data
495
(ess-search-except ess-search-regexp ess-search-except)))
496
497
(if (not ess-tmp-sas-data)
498
(setq ess-tmp-sas-data
499
(ess-search-except ess-search-regexp ess-search-except t)))
500
501
(setq ess-sas-data (read-string "Permanent SAS Dataset: " ess-tmp-sas-data))
502
503
(ess-sas-goto-shell t)
504
(ess-sas-cd)
505
506
(insert (concat ess-sas-submit-pre-command " " ess-sas-submit-command
507
" -initstmt \"" ess-sas-data-view-libname ess-sas-data-view-insight-command
508
ess-sas-data ";" ess-tmp-sas-data-view-insight-statement "; run;\" "
509
ess-sas-data-view-submit-options " " ess-sas-submit-post-command))
510
(comint-send-input)
511
)))))
512
513
(defun ess-sas-graph-view ()
514
"Open a GSASFILE for viewing."
515
(interactive)
516
; (ess-sas-file-path)
517
(ess-sas-goto-log 'no-error-check)
518
519
(save-excursion (let (
520
(ess-tmp-length (length ess-sas-graph-view-viewer-alist))
521
(ess-tmp-counter 0)
522
(ess-tmp-graph nil)
523
(ess-tmp-graph-alist nil)
524
(ess-tmp-glyph nil)
525
(ess-tmp-graph-regexp
526
; (concat "[ ]RECORDS[ ]WRITTEN[ ]+TO[ ]\n?[ ]*\\(\\(\n\\|[^.]\\)*"
527
(concat "[ ][rR][eE][cC][oO][rR][dD][sS][ ][wW][rR][iI][tT][tT][eE][nN][ ]+[tT][oO][ ]\n?[ ]*\\(.*"
528
ess-sas-graph-view-suffix-regexp "\\)")))
529
; (concat "['\"]\\(.*" ess-sas-graph-suffix-regexp "\\)['\"]")))
530
531
(save-match-data
532
(search-backward-regexp "[ \t=]" nil t)
533
534
(save-excursion
535
(setq ess-tmp-graph (ess-search-except ess-tmp-graph-regexp)))
536
537
(if (not ess-tmp-graph)
538
(setq ess-tmp-graph (ess-search-except ess-tmp-graph-regexp nil t)))
539
540
(setq ess-tmp-graph (read-string "GSASFILE: "
541
(or ess-tmp-graph ess-sas-file-path)))
542
543
(if (fboundp 'ess-xemacs-insert-glyph) (progn
544
(if (string-match "[.][gG][iI][fF]" ess-tmp-graph)
545
(setq ess-tmp-glyph 'gif)
546
;;else
547
(if (string-match "[.][jJ][pP][eE]?[gG]" ess-tmp-graph)
548
(setq ess-tmp-glyph 'jpeg)))))
549
550
;;GNU Emacs graphics file image viewing mode loaded?
551
(if (and (boundp 'auto-image-file-mode) auto-image-file-mode
552
(string-match "[.][jJ][pP][eE]?[gG]" ess-tmp-graph))
553
(find-file ess-tmp-graph)
554
;;else XEmacs graphics file image viewing mode loaded?
555
(if (and (fboundp 'image-mode)
556
(string-match "[.]\\([jJ][pP][eE]?[gG]\\|[gG][iI][fF]\\)"
557
ess-tmp-graph))
558
(find-file ess-tmp-graph)
559
;;else XEmacs graphics file image viewing primitives loaded?
560
(if ess-tmp-glyph (progn
561
(switch-to-buffer (file-name-nondirectory ess-tmp-graph))
562
(ess-xemacs-insert-glyph
563
(make-glyph (vector ess-tmp-glyph :file ess-tmp-graph))))
564
565
;;else use the appropriate graphics file image viewer
566
(while (< ess-tmp-counter ess-tmp-length)
567
(setq ess-tmp-graph-alist
568
(nth ess-tmp-counter ess-sas-graph-view-viewer-alist))
569
(setq ess-tmp-graph-regexp (car ess-tmp-graph-alist))
570
571
(if (string-match
572
(concat "[.]" ess-tmp-graph-regexp) ess-tmp-graph)
573
(progn
574
(ess-sas-goto-shell t)
575
(insert ess-sas-submit-pre-command " "
576
(cdr ess-tmp-graph-alist) " " ess-tmp-graph
577
(if (equal ess-sas-submit-method 'sh) " &"))
578
(setq ess-tmp-glyph 'alist)
579
(setq ess-tmp-counter ess-tmp-length))
580
;;else
581
(setq ess-tmp-counter (+ ess-tmp-counter 1))))
582
583
(if (not ess-tmp-glyph) (progn
584
(ess-sas-goto-shell t)
585
(insert ess-sas-submit-pre-command " "
586
ess-sas-graph-view-viewer-default " " ess-tmp-graph
587
(if (equal ess-sas-submit-method 'sh) " &"))))
588
589
(comint-send-input))))))))
590
591
(defun ess-sas-file-path (&optional force)
592
"Define `ess-sas-file-path' to be the current buffer depending on suffix."
593
(interactive)
594
595
(save-match-data (let ((ess-sas-temp-file (expand-file-name (buffer-name))))
596
(if (or force (string-match ess-sas-suffix-regexp ess-sas-temp-file)) ;;(progn
597
(setq ess-sas-file-path
598
(nth 0 (split-string ess-sas-temp-file "[<]")))))))
599
;; (setq ess-directory (file-name-directory ess-sas-file-path)))))))
600
601
(defun ess-sas-file-path-remote-host ()
602
"Return the remote host, if any, associated with `ess-sas-file-path'."
603
(interactive)
604
605
(let* ((temp-colon-pos (string-match ":" ess-sas-file-path))
606
(temp-list
607
(if (or (not temp-colon-pos) (> temp-colon-pos 2))
608
(if (equal ess-sas-file-path ".") nil
609
(split-string (file-name-directory ess-sas-file-path)
610
"\\(@\\|:\\|]\\)"))
611
(list ess-sas-file-path)))
612
(temp-list-length (length temp-list)))
613
(if (= temp-list-length 1) (setq temp-list nil)
614
(if (= temp-list-length 2) (setq temp-list (car temp-list))
615
(setq temp-list (nth 1 temp-list))))
616
617
(if temp-list (setq temp-list
618
(car (last (split-string temp-list "/")))))
619
temp-list))
620
621
(defun ess-sas-goto (suffix &optional revert no-create)
622
"Find a file associated with a SAS file by suffix and revert if necessary."
623
; (interactive)
624
; (let ((ess-temp-regexp (concat ess-sas-suffix-regexp "[.]?[1-9]?\\'")))
625
; can we identify common nonsense extensions like .log.1 or .sas.2?
626
(let ((ess-temp-regexp (concat ess-sas-suffix-regexp "\\(@.+\\)?\\'")))
627
(save-match-data
628
(if (or (string-match ess-temp-regexp (expand-file-name (buffer-name)))
629
(string-match ess-temp-regexp ess-sas-file-path))
630
(progn
631
(ess-sas-file-path)
632
(let* (
633
(ess-sas-temp-file (replace-match (concat "." suffix) t t
634
ess-sas-file-path))
635
(ess-sas-temp-buff (find-buffer-visiting ess-sas-temp-file))
636
(ess-temp-kermit-remote-directory ess-kermit-remote-directory))
637
638
(if ess-sas-temp-buff (switch-to-buffer ess-sas-temp-buff)
639
;; else
640
(if no-create (setq revert nil)
641
(if (file-exists-p ess-sas-temp-file)
642
(find-file ess-sas-temp-file))))
643
;; else
644
;; (let* ((ess-sas-buffer-list (buffer-list))
645
;; (ess-sas-buffer-list-index 0)
646
;; (ess-sas-buffer-list-file nil)
647
;; (ess-sas-buffer-list-length (length ess-sas-buffer-list)))
648
;; (while (< ess-sas-buffer-list-index ess-sas-buffer-list-length)
649
;; (setq ess-sas-buffer-list-file
650
;; (buffer-file-name (nth ess-sas-buffer-list-index ess-sas-buffer-list)))
651
;; (if (and ess-sas-buffer-list-file
652
;; (string-match (concat "." suffix) ess-sas-buffer-list-file))
653
;; (switch-to-buffer (nth ess-sas-buffer-list-index ess-sas-buffer-list))
654
;; (setq ess-sas-buffer-list-index ess-sas-buffer-list-length)
655
;; )
656
;; (setq ess-sas-buffer-list-index (+ 1 ess-sas-buffer-list-index))
657
;; )))
658
659
(if (and (not no-create)
660
(or (string-equal suffix "log")
661
(string-equal suffix "lst")))
662
(ess-kermit-get (file-name-nondirectory ess-sas-temp-file)
663
ess-temp-kermit-remote-directory))
664
665
(if revert
666
(if (and (> ess-sas-log-max 0) (string-equal suffix "log")
667
(> (ess-num-or-zero (nth 7 (file-attributes ess-sas-temp-file)))
668
ess-sas-log-max))
669
(progn
670
(insert-file-contents ess-sas-temp-file nil 0
671
ess-sas-log-max t)
672
t)
673
674
(ess-revert-wisely)) nil)))))))
675
676
;;(defun ess-sas-file (suffix &optional revert)
677
;; "Please use `ess-sas-goto' instead."
678
;; (let* ((tail (downcase (car (split-string
679
;; (car (last (split-string (buffer-name) "[.]"))) "[<]"))))
680
;;(if (fboundp 'file-name-extension) (file-name-extension (buffer-name))
681
;; (substring (buffer-name) -3)))
682
;; (tail-in-tail-list (member tail (list "sas" "log" "lst"
683
;; ess-sas-suffix-1 ess-sas-suffix-2)))
684
;; (root (if tail-in-tail-list (expand-file-name (buffer-name))
685
;; ess-sas-file-path))
686
;; (ess-sas-arg (concat (file-name-sans-extension root) "." suffix))
687
;; (ess-sas-buf (find-buffer-visiting ess-sas-arg)))
688
;; (if (equal tail suffix) (if revert (ess-revert-wisely))
689
;; (if (not ess-sas-buf) (find-file ess-sas-arg)
690
;; (switch-to-buffer ess-sas-buf)
691
;; (if revert (ess-revert-wisely))))))
692
693
694
(defun ess-sas-goto-file-1 ()
695
"Switch to ess-sas-file-1 and revert from disk."
696
(interactive)
697
(ess-sas-goto ess-sas-suffix-1 'revert))
698
699
(defun ess-sas-goto-file-2 ()
700
"Switch to ess-sas-file-2 and revert from disk."
701
(interactive)
702
(ess-sas-goto ess-sas-suffix-2 'revert))
703
704
(defun ess-sas-goto-log (&optional ess-tmp-no-error-check)
705
"Switch to the .log file, revert from disk and search for error messages."
706
(interactive)
707
708
(let ((ess-sas-error (concat
709
"^ERROR [0-9]+-[0-9]+:\\|^ERROR:\\|_ERROR_=1 _N_=\\|_ERROR_=1[ ]?$"
710
"\\|NOTE: MERGE statement has more than one data set with repeats"
711
"\\|NOTE: Variable .* is uninitialized."
712
"\\|NOTE: SAS went to a new line when INPUT statement reached past"
713
"\\|NOTE 485-185: Informat .* was not found"
714
"\\|NOTE: Estimated G matrix is not positive definite."
715
"\\|NOTE: Compressing data set .* increased size by"
716
"\\|NOTE: ERROR DETECTED IN ANNOTATE="
717
"\\|WARNING: Apparent symbolic reference .* not resolved."
718
"\\|WARNING: Length of character variable has already been set."
719
"\\|WARNING: Not all variables in the list "
720
"\\|WARNING: RUN statement ignored due to previous errors."
721
"\\|WARNING: Values exist outside the axis range"
722
"\\|Bus Error In Task\\|Segmentation Violation In Task"))
723
(ess-sas-save-point nil)); (ess-sas-pop-mark nil))
724
725
(if (ess-sas-goto "log" 'revert) (progn
726
(setq ess-sas-save-point (point))
727
(goto-char (point-min)))
728
(setq ess-sas-save-point (point)))
729
730
;(if (number-char-or-marker-p ess-sas-save-point) (progn
731
(if ess-tmp-no-error-check (goto-char ess-sas-save-point)
732
(if (or (search-forward-regexp ess-sas-error nil t)
733
(and (goto-char (point-min))
734
(search-forward-regexp ess-sas-error nil t)))
735
t
736
; this feature never worked quite right (and was XEmacs only to boot)
737
; after highlighting an error message, moving point would cause an unwanted
738
; highlighting between point and mark; why god, why?!?
739
;
740
; (if (and (boundp 'zmacs-regions) zmacs-regions)
741
; (progn
742
; (if ess-sas-pop-mark (pop-mark)
743
; (setq ess-sas-pop-mark t))
744
; (push-mark (match-beginning 0) t)
745
; (zmacs-activate-region)))
746
(goto-char ess-sas-save-point)))))
747
748
(defun ess-sas-goto-lst ()
749
"Switch to the .lst file and revert from disk."
750
(interactive)
751
(ess-sas-goto "lst" 'revert))
752
753
(defun ess-sas-goto-sas (&optional revert)
754
"Switch to the .sas file."
755
(interactive)
756
(ess-sas-goto "sas" revert))
757
758
(defun ess-sas-goto-shell (&optional set-buffer)
759
"Set `ess-sas-file-path' and goto `ess-sas-shell-buffer'. If
760
optional argument is non-nil, then set-buffer rather than switch."
761
(interactive)
762
(ess-sas-file-path)
763
764
; The following let* block is an attempt to deal with remote directories.
765
(let* ((temp-shell-buffer-remote-host
766
(or ess-sas-shell-buffer-remote-host (ess-sas-file-path-remote-host)))
767
(temp-shell-buffer-remote-init ess-sas-shell-buffer-remote-init)
768
(temp-shell-buffer
769
(if temp-shell-buffer-remote-host
770
(concat "*" temp-shell-buffer-remote-host "*")
771
ess-sas-shell-buffer))
772
)
773
774
(if (get-buffer temp-shell-buffer)
775
(if set-buffer (set-buffer temp-shell-buffer)
776
(switch-to-buffer temp-shell-buffer))
777
(shell)
778
(rename-buffer temp-shell-buffer)
779
(ess-sleep) ; GNU Emacs needs this
780
781
(if temp-shell-buffer-remote-host (progn
782
(insert (concat
783
temp-shell-buffer-remote-init " " temp-shell-buffer-remote-host))
784
(comint-send-input))
785
)
786
787
(if (eq ess-sas-submit-method 'sh)
788
(add-hook 'comint-output-filter-functions 'ess-exit-notify-sh)) ;; 19.28
789
;; nil t) works for newer emacsen
790
)
791
)
792
793
(goto-char (point-max))
794
; (insert "cd " ess-temp-directory)
795
; (comint-send-input))
796
)
797
798
(defun ess-sas-interactive ()
799
"And now for something completely different."
800
(interactive)
801
(ess-sas-file-path)
802
(setq ess-customize-alist SAS-customize-alist)
803
(let ((ess-temp-sas-file
804
(nth 0 (split-string
805
(car (last (split-string ess-sas-file-path "\\([a-zA-Z][a-zA-Z]:\\|]\\)"))) "[.]"))))
806
;; (message "%s" ess-temp-sas-file)
807
(setq ess-sas-shell-buffer "*iESS[SAS]*")
808
(ess-sas-goto-shell)
809
(ess-add-ess-process)
810
(ess-setq-vars-local ess-customize-alist)
811
(inferior-ess-mode)
812
(ess-eval-linewise (concat ess-sas-submit-command " " ess-sas-submit-command-options
813
" -altlog " ess-temp-sas-file ".log -altprint "
814
ess-temp-sas-file ".lst -stdio"))
815
;;ess-temp-sas-file ".lst -stdio < /dev/tty"))
816
(ess-sas-goto-sas)
817
(setq ess-sas-submit-method 'iESS)
818
(setq ess-eval-visibly-p nil)
819
))
820
821
;;(defun ess-sas-interactive ()
822
;; (interactive)
823
;; (ess-sas-file-path)
824
;; (setq ess-sas-submit-method 'iESS)
825
;;
826
;; (let ((ess-temp-stderr " ") (ess-temp-stdout " ") (ess-temp-stdin " "))
827
;; (setq ess-sas-shell-buffer "*LOG*")
828
;; (ess-sas-goto-shell)
829
;; (insert "tty")
830
;; (comint-send-input)
831
;; (sleep-for ess-sleep-for)
832
;; (save-excursion (setq ess-temp-stderr (ess-search-except "\\(/dev/[a-z0-9/]+\\)" nil t)))
833
;; (setq ess-sas-shell-buffer "*OUTPUT*")
834
;; (ess-sas-goto-shell)
835
;; (insert "tty")
836
;; (comint-send-input)
837
;; (sleep-for ess-sleep-for)
838
;; (save-excursion (setq ess-temp-stdout (ess-search-except "\\(/dev/[a-z0-9/]+\\)" nil t)))
839
;; (setq ess-sas-shell-buffer "*PROGRAM*")
840
;; (ess-sas-goto-shell)
841
;;;; (insert "tty")
842
;; (comint-send-input)
843
;; (sleep-for ess-sleep-for)
844
;; (insert "sh")
845
;; (comint-send-input)
846
;; (sleep-for ess-sleep-for)
847
;; (save-excursion (setq ess-temp-stdin (ess-search-except "\\(/dev/[a-z0-9/]+\\)" nil t)))
848
;; (insert (concat ess-sas-submit-command " " ess-sas-submit-command-options " -stdio <"
849
;; ess-temp-stdin " >1 " ess-temp-stdout " >2 " ess-temp-stderr))
850
;; (comint-send-input)
851
;; (ess-add-ess-process)
852
;; (ess-sas-goto-sas)
853
;;))
854
855
(defun ess-sas-kill-buffers ()
856
"Kill all buffers related to a .sas file."
857
(interactive)
858
(ess-sas-file-path)
859
(ess-sas-goto "log" nil t)
860
(kill-buffer nil)
861
(ess-sas-goto "lst" nil t)
862
(kill-buffer nil)
863
(ess-sas-goto ess-sas-suffix-1 nil t)
864
(kill-buffer nil)
865
(ess-sas-goto ess-sas-suffix-2 nil t)
866
(kill-buffer nil)
867
(ess-sas-goto "sas" nil t)
868
(kill-buffer nil)
869
)
870
871
(if (featurep 'xemacs) (condition-case nil
872
(progn
873
(require 'rtf-support)
874
(when (featurep 'rtf-support)
875
876
(defun ess-sas-rtf-portrait (&optional ess-tmp-font-size)
877
"Creates an MS RTF portrait file from the current buffer."
878
(interactive)
879
(ess-sas-file-path t)
880
(ess-revert-wisely)
881
882
(if (equal ess-tmp-font-size nil)
883
(setq ess-tmp-font-size "21"))
884
885
(let
886
((ess-temp-rtf-file (replace-in-string ess-sas-file-path "[.][^.]*$" ".rtf")))
887
;(expand-file-name (buffer-name)) "[.][^.]*$" ".rtf")))
888
(rtf-export ess-temp-rtf-file)
889
(ess-sas-goto "rtf" t)
890
(goto-char (point-min))
891
(replace-regexp "\\\\fmodern .*;" (concat "\\\\fmodern " ess-sas-rtf-font-name ";"))
892
(goto-line 2)
893
(if (string-match ess-sas-suffix-regexp ess-sas-file-path)
894
(insert "\\margl720\\margr720\\margt720\\margb720\n"))
895
(goto-char (point-min))
896
897
(while (replace-regexp "\\\\fs[0-9]+" (concat "\\\\fs" ess-tmp-font-size)) nil)
898
899
(save-buffer)
900
(kill-buffer (current-buffer))))
901
))
902
(error nil))
903
; else
904
(defun ess-sas-rtf-portrait (&optional ess-tmp-font-size)
905
"Creates an MS RTF portrait file from the current buffer."
906
(interactive)
907
; (ess-sas-file-path t)
908
(ess-revert-wisely)
909
910
(set-visited-file-name (concat (buffer-name) ".rtf"))
911
; (ess-sas-goto "rtf" t)
912
(if 'buffer-read-only (setq buffer-read-only nil))
913
(ess-rtf-replace-chars)
914
915
(goto-char (point-min))
916
(insert (concat
917
"{\\rtf1\\ansi{\\fonttbl\\f1\\fmodern " ess-sas-rtf-font-name ";}\n"
918
"\\margl720\\margr720\\margt720\\margb720\n"
919
"{\\colortbl;\\red0\\green0\\blue0;\\red0\\green0\\blue255;\\red0\\green255\\blue255;\\red0\\green255\\blue0;\\red255\\green0\\blue255;\\red255\\green0\\blue0;\\red255\\green255\\blue0;\\red255\\green255\\blue255;\\red0\\green0\\blue128;\\red0\\green128\\blue128;\\red0\\green128\\blue0;\\red128\\green0\\blue128;\\red128\\green0\\blue0;\\red128\\green128\\blue0;\\red128\\green128\\blue128;\\red192\\green192\\blue192;}\n"
920
"{\\stylesheet{\\s15\\plain\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Text;}{\\*\\cs16 \\additive\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Base Style;}}\n"
921
"{\\plain\\s15{\\cs16\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024{\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024\n"))
922
923
(goto-char (point-max))
924
(insert "}}}}\n")
925
926
(save-buffer)
927
(kill-buffer (current-buffer)))
928
)
929
930
(defun ess-rtf-replace-chars ()
931
"Convert a text file to an MS RTF file."
932
(interactive)
933
(goto-char (point-min))
934
(while (re-search-forward "\n" nil t) (replace-match "\\par\n" nil t))
935
(goto-char (point-min))
936
(while (re-search-forward "\f" nil t) (replace-match "\\page\n" nil t))
937
(goto-char (point-min))
938
(while (re-search-forward "\t" nil t) (replace-match "\\tab" nil t)))
939
940
(defun ess-sas-rtf-landscape (&optional ess-tmp-font-size)
941
"Creates an MS RTF landscape file from the current buffer."
942
(interactive)
943
(ess-revert-wisely)
944
945
(set-visited-file-name (concat (buffer-name) ".rtf"))
946
947
(if 'buffer-read-only (setq buffer-read-only nil))
948
(ess-rtf-replace-chars)
949
950
(goto-char (point-min))
951
(insert (concat
952
"{\\rtf1\\ansi{\\fonttbl\\f1\\fmodern " ess-sas-rtf-font-name ";}\n"
953
"\\margl720\\margr720\\margt720\\margb720\n"
954
"{\\*\\pgdsctbl\n"
955
"{\\pgdsc0\\pgdscuse195\\lndscpsxn\\pgwsxn15840\\pghsxn12240\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\pgdscnxt0 Default;}}\n"
956
"\\landscape\\paperh12240\\paperw15840\\margl1800\\margr1800\\margt1440\\margb1440\\sectd\\sbknone\\lndscpsxn\\pgwsxn15840\\pghsxn12240\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\ftnbj\\ftnstart1\\ftnrstcont\\ftnnar\\aenddoc\\aftnrstcont\\aftnstart1\\aftnnrlc\n"
957
"{\\colortbl;\\red0\\green0\\blue0;\\red0\\green0\\blue255;\\red0\\green255\\blue255;\\red0\\green255\\blue0;\\red255\\green0\\blue255;\\red255\\green0\\blue0;\\red255\\green255\\blue0;\\red255\\green255\\blue255;\\red0\\green0\\blue128;\\red0\\green128\\blue128;\\red0\\green128\\blue0;\\red128\\green0\\blue128;\\red128\\green0\\blue0;\\red128\\green128\\blue0;\\red128\\green128\\blue128;\\red192\\green192\\blue192;}\n"
958
"{\\stylesheet{\\s15\\plain\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Text;}{\\*\\cs16 \\additive\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Base Style;}}\n"
959
"{\\plain\\s15{\\cs16\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024{\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024\n"))
960
961
(goto-char (point-max))
962
(insert "}}}}\n")
963
964
(save-buffer)
965
(kill-buffer (current-buffer)))
966
967
(defun ess-sas-rtf-us-landscape ()
968
"Creates an MS RTF US landscape file from the current buffer."
969
(interactive)
970
(ess-sas-rtf-portrait "16")
971
(ess-sas-goto "rtf" t)
972
(goto-char (point-min))
973
(forward-line 3)
974
(insert (concat "{\\*\\pgdsctbl\n"
975
"{\\pgdsc0\\pgdscuse195\\lndscpsxn\\pgwsxn15840\\pghsxn12240\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\pgdscnxt0 Default;}}\n"
976
"\\landscape\\paperh12240\\paperw15840\\margl1800\\margr1800\\margt1440\\margb1440\\sectd\\sbknone\\lndscpsxn\\pgwsxn15840\\pghsxn12240\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\ftnbj\\ftnstart1\\ftnrstcont\\ftnnar\\aenddoc\\aftnrstcont\\aftnstart1\\aftnnrlc\n"))
977
(save-buffer)
978
(kill-buffer (current-buffer)))
979
980
(defun ess-sas-rtf-a4-landscape ()
981
"Creates an MS RTF A4 landscape file from the current buffer."
982
(interactive)
983
(ess-sas-rtf-portrait "16")
984
(ess-sas-goto "rtf" t)
985
(goto-char (point-min))
986
(forward-line 3)
987
(insert (concat "{\\*\\pgdsctbl\n"
988
"{\\pgdsc0\\pgdscuse195\\lndscpsxn\\pgwsxn16837\\pghsxn11905\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\pgdscnxt0 Default;}}\n"
989
"\\landscape\\paperh11905\\paperw16837\\margl1800\\margr1800\\margt1440\\margb1440\\sectd\\sbknone\\lndscpsxn\\pgwsxn16837\\pghsxn11905\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\ftnbj\\ftnstart1\\ftnrstcont\\ftnnar\\aenddoc\\aftnrstcont\\aftnstart1\\aftnnrlc\n"))
990
(save-buffer)
991
(kill-buffer (current-buffer)))
992
993
(defun ess-sas-submit ()
994
"Save the .sas file and submit to shell using a function that
995
depends on the value of `ess-sas-submit-method'"
996
(interactive)
997
(ess-sas-file-path)
998
(ess-sas-goto-sas)
999
(save-buffer)
1000
(hack-local-variables)
1001
;(ess-save-and-set-local-variables)
1002
1003
(cond
1004
((eq ess-sas-submit-method 'apple-script)
1005
(ess-sas-submit-mac ess-sas-submit-command
1006
ess-sas-submit-command-options))
1007
((eq ess-sas-submit-method 'ms-dos)
1008
(ess-sas-submit-windows ess-sas-submit-command
1009
ess-sas-submit-command-options))
1010
((eq ess-sas-submit-method 'iESS)
1011
(ess-sas-submit-iESS ess-sas-submit-command
1012
ess-sas-submit-command-options))
1013
((eq ess-sas-submit-method 'sh)
1014
(ess-sas-submit-sh ess-sas-submit-command
1015
ess-sas-submit-command-options))
1016
(t (ess-sas-submit-sh ess-sas-submit-command
1017
ess-sas-submit-command-options)))
1018
; (ess-sas-goto-sas)
1019
)
1020
1021
(defun ess-sas-submit-iESS (arg1 arg2)
1022
"iESS
1023
Submit a batch job in an inferior-ESS buffer. The buffer should
1024
(1) have telnet access and be running a shell on a remote machine
1025
or
1026
(2) be running a shell on the local machine.
1027
1028
The user can telnet to the remote computer and then declare the
1029
*telnet-buffer* to be an inferior ESS buffer with the `ess-add-ess-process'
1030
command. When using a remote computer, the .sas file must live on the
1031
remote computer and be accessed through `ange-ftp'. When
1032
`ess-sas-submit' saves a file, it is therefore saved on the remote
1033
computer. The various functions such as `ess-sas-goto-lst' retrieve
1034
their files from the remote computer. Local copies of the .sas .lst
1035
.log and others may be made manually with `write-buffer'."
1036
;; (ess-eval-linewise (concat "cd default-directory))
1037
(ess-force-buffer-current "Process to load into: ")
1038
(ess-eval-linewise
1039
(concat "cd " (car (last
1040
(split-string (file-name-directory ess-sas-file-path) "\\(:\\|]\\)")))))
1041
(ess-eval-linewise (concat arg1 " " arg2 " " (buffer-name) " &")))
1042
1043
(defun ess-sas-submit-mac (arg1 arg2)
1044
"If you are using Mac SAS, then arg1, `ess-sas-submit-command', should be
1045
the AppleScript command \"invoke SAS using program file\", and, if necessary,
1046
arg2, `ess-sas-submit-command-options', is a string of the form
1047
\"with options { \\\"option-1\\\", \\\"option-2\\\", etc.}\". If you are
1048
using Windows SAS with the PC emulator Virtual PC, then `ess-sas-submit-command'
1049
should be ..."
1050
;(ess-save-and-set-local-variables)
1051
1052
(do-applescript (concat arg1 " \""
1053
(if (not ess-sas-submit-mac-virtual-pc)
1054
(unix-filename-to-mac default-directory))
1055
(buffer-name) "\"" arg2)))
1056
1057
(defun ess-sas-submit-region ()
1058
"Write region to temporary file, and submit to SAS."
1059
(interactive)
1060
(ess-sas-file-path)
1061
(hack-local-variables t)
1062
(write-region (region-beginning) (region-end)
1063
(concat (ess-sas-temp-root) ".sas"))
1064
1065
(let ((arg1 ess-sas-submit-command)
1066
(arg2 ess-sas-submit-command-options))
1067
(save-excursion
1068
(ess-sas-goto-shell t)
1069
1070
(if (and (w32-shell-dos-semantics)
1071
(string-equal ":" (substring ess-sas-file-path 1 2)))
1072
(progn
1073
(insert (substring ess-sas-file-path 0 2))
1074
(comint-send-input)
1075
))
1076
1077
(insert "cd \"" (convert-standard-filename
1078
(file-name-directory ess-sas-file-path)) "\"")
1079
(comint-send-input)
1080
1081
(insert (concat ess-sas-submit-pre-command " " arg1
1082
" " arg2
1083
" " (ess-sas-temp-root) " " ess-sas-submit-post-command))
1084
(comint-send-input)
1085
))
1086
)
1087
1088
(defun ess-sas-submit-sh (arg1 arg2)
1089
"Unix or bash in the *shell* buffer.
1090
Multiple processing is supported on this platform.
1091
SAS may not be found in your PATH. You can alter your PATH to include
1092
SAS or you can specify the PATHNAME (PATHNAME can NOT contain spaces),
1093
i.e. let arg1 be your local equivalent of
1094
\"/usr/local/sas612/sas\"."
1095
(if (string-equal (substring
1096
(file-name-nondirectory ess-sas-file-path) 0 1) ess-kermit-prefix)
1097
(progn
1098
(ess-kermit-send)
1099
(ess-sas-goto-shell t)
1100
(insert ess-sas-submit-pre-command " " arg1 " "
1101
(substring (file-name-sans-extension
1102
(file-name-nondirectory ess-sas-file-path)) 1)
1103
" " arg2 " " ess-sas-submit-post-command)
1104
(comint-send-input))
1105
;;else
1106
(ess-sas-goto-shell t)
1107
(ess-sas-cd)
1108
; (insert "cd " (car (last (split-string (file-name-directory ess-sas-file-path)
1109
;"\\([a-zA-Z][a-zA-Z]:\\|]\\)"))))
1110
; (comint-send-input)
1111
(insert ess-sas-submit-pre-command " " arg1 " "
1112
(file-name-sans-extension (file-name-nondirectory ess-sas-file-path))
1113
" " arg2 " " ess-sas-submit-post-command))
1114
; (ess-sleep)
1115
(comint-send-input))
1116
1117
(defun ess-sas-submit-windows (arg1 arg2)
1118
"Windows using MS-DOS prompt in the *shell* buffer.
1119
Multiple processing is supported on this platform.
1120
On most Windows installations, SAS will not be found in your
1121
PATH so you should alter your PATH to include SAS, i.e.
1122
1123
SET PATH=%PATH%;C:\\Program Files\\SAS
1124
1125
Or you can specify the PATHNAME directly (you must escape
1126
spaces by enclosing the string in \\\"'s), i.e. let
1127
`ess-sas-submit-command' be \"\\\"C:\\Program Files\\SAS\\sas.exe\\\"\".
1128
Keep in mind that the maximum command line length in MS-DOS is
1129
127 characters so altering your PATH is preferable."
1130
;(ess-save-and-set-local-variables)
1131
(ess-sas-goto-shell t)
1132
(if (string-equal ":" (substring ess-sas-file-path 1 2))
1133
(progn
1134
(insert (substring ess-sas-file-path 0 2))
1135
(comint-send-input)
1136
)
1137
)
1138
(insert "cd \"" (convert-standard-filename
1139
(file-name-directory ess-sas-file-path)) "\"")
1140
(comint-send-input)
1141
(insert ess-sas-submit-pre-command " " arg1 " -sysin \""
1142
(file-name-sans-extension (file-name-nondirectory ess-sas-file-path)) "\" "
1143
arg2 " " ess-sas-submit-post-command)
1144
(comint-send-input))
1145
1146
(defun ess-sas-tab-to-tab-stop ()
1147
"Tab to next tab-stop and set left margin."
1148
(interactive)
1149
(tab-to-tab-stop)
1150
(setq left-margin (current-column))
1151
)
1152
1153
(defun ess-sas-temp-root ()
1154
"Return `ess-sas-file-path' sans extension with `ess-sas-temp-root' appended."
1155
(concat (file-name-sans-extension ess-sas-file-path) ess-sas-temp-root))
1156
1157
(defun ess-sas-transcript (&optional strip)
1158
"Comment .log messages to create a .sas program; use C-u to strip."
1159
(interactive "P")
1160
(save-excursion
1161
(goto-char (point-min))
1162
1163
(while (search-forward-regexp (concat
1164
"^\\(\\(1[ \t]+The SAS System\\| \\|NOTE\\|WARNING\\|ERROR\\|"
1165
"[ \t]+\\(\\(real\\|cpu\\) time\\|Licensed to\\|Engine:\\|"
1166
"Physical Name:\\|File Name=\\|Owner Name=\\|Group Name=\\|"
1167
"Access Permission=\\|File Size (bytes)=\\|Pipe command=\\|"
1168
"RECFM=[DFNPV],LRECL=\\|[0-9]+:[0-9]+[ /t]+[0-9]+:[0-9]+\\|"
1169
"[1-9][0-9]* at [0-9]+:[0-9]+[ /t]+[1-9][0-9]* at [0-9]+:[0-9]+\\)\\).*$"
1170
"\\|[0-9]+\\([ \t]+!\\)?\\|MPRINT([_A-Z]+):\\|"
1171
"[ \t]+\\(values at the places given by: (Line):(Column).\\|"
1172
"The m\\(in\\|ax\\)imum record length was [1-9][0-9]*.\\|"
1173
"One or more lines were truncated.\\|"
1174
"Each place is given by: (Number of times) at (Line):(Column).\\|"
1175
"[0-9][0-9]:[0-9][0-9] [MTWFS][aeioudhnrst]+day, [JFMASOND]"
1176
"[aeiouybcghlmnprstv]+ [1-9][0-9]?, 20[0-9][0-9]\\)\\)")
1177
nil t) (replace-match (if strip " " "/*\\&*/") t))
1178
))
1179
1180
(defun ess-sas-toggle-sas-listing-mode (&optional force)
1181
"Toggle SAS-listing-mode for .lst files."
1182
(interactive)
1183
(ess-sas-goto-lst)
1184
1185
(if (equal (cdr (assoc "\\.[lL][sS][tT]\\'" auto-mode-alist)) 'SAS-listing-mode) (progn
1186
(setq auto-mode-alist (delete '("\\.[lL][sS][tT]\\'" . SAS-listing-mode) auto-mode-alist))
1187
(setq buffer-read-only nil)
1188
(ess-listing-minor-mode 0))
1189
(setq auto-mode-alist (append '(("\\.[lL][sS][tT]\\'" . SAS-listing-mode)) auto-mode-alist))
1190
(setq buffer-read-only t)
1191
(ess-listing-minor-mode 1)))
1192
1193
(defun ess-sas-toggle-sas-log-mode ()
1194
"Toggle SAS-log-mode for .log files."
1195
(interactive)
1196
1197
(ess-sas-goto-log)
1198
(kill-buffer nil)
1199
1200
; (if (equal (cdr (assoc "\\.[lL][oO][gG]\\'" auto-mode-alist)) 'SAS-log-mode) (progn
1201
; (setq auto-mode-alist (delete '("\\.[lL][oO][gG]\\'" . SAS-log-mode) auto-mode-alist))
1202
; (setq buffer-read-only nil)
1203
; (ess-transcript-minor-mode 0)
1204
; (font-lock-mode 0))
1205
; (setq auto-mode-alist (append '(("\\.[lL][oO][gG]\\'" . SAS-log-mode)) auto-mode-alist))
1206
; (setq buffer-read-only t)
1207
; (ess-transcript-minor-mode 1)
1208
; (font-lock-mode 1)
1209
; (font-lock-fontify-buffer))
1210
1211
(if (equal (cdr (assoc "\\.[lL][oO][gG]\\'" auto-mode-alist)) 'SAS-log-mode)
1212
(setq auto-mode-alist (delete '("\\.[lL][oO][gG]\\'" . SAS-log-mode) auto-mode-alist))
1213
(setq auto-mode-alist (append '(("\\.[lL][oO][gG]\\'" . SAS-log-mode)) auto-mode-alist)))
1214
(ess-sas-goto-log))
1215
1216
(defun ess-sas-versions-create ()
1217
"Generate the `M-x SASV' functions for starting other versions of SAS.
1218
See `ess-sas-versions' for strings that determine which functions are created.
1219
1220
The local variable `ess-sas-versions-created' is used to return list of
1221
the new SAS defuns, if any, that were created. The defuns will normally
1222
be placed on the menubar upon ESS initialisation."
1223
1224
;; This works by creating a temp buffer where the template function is
1225
;; edited so that V is replaced by the version number
1226
(let ((template "")
1227
(beg)
1228
(versions)
1229
(version)
1230
(eval-buf (get-buffer-create "*ess-temp-sas-evals*"))
1231
(ess-sas-versions-created)
1232
)
1233
;;
1234
;; This is the template function used for creating M-x SASV.
1235
(setq template "(defun SASV (&optional start-args)
1236
\"Call SASV, i.e., the SAS version 'SASV' using ESS.
1237
This function was generated by `ess-sas-versions-create'.\"
1238
(interactive \"P\")
1239
(let ((inferior-SAS-program-name \"SASV\"))
1240
(SAS start-args)))
1241
1242
")
1243
(save-excursion
1244
(set-buffer eval-buf)
1245
;; clear the buffer.
1246
(delete-region (point-min) (point-max))
1247
1248
;; Find which versions of SAS we want. Remove the pathname, leaving just
1249
;; the name of the executable.
1250
(setq versions
1251
(ess-uniq-list
1252
(mapcar 'file-name-nondirectory
1253
(apply 'nconc
1254
(mapcar 'ess-find-exec-completions
1255
ess-sas-versions)))))
1256
(ess-write-to-dribble-buffer
1257
(format "(SAS): ess-sas-versions-create making M-x defuns for %s"
1258
(mapconcat 'identity versions " ")))
1259
(setq ess-sas-versions-created versions) ;keep copy for returning at end.
1260
;; Iterate over each string in VERSIONS, creating a new defun each time.
1261
(while versions
1262
(setq version (car versions)
1263
versions (cdr versions))
1264
(setq beg (point))
1265
(insert template)
1266
(goto-char beg)
1267
(while (search-forward "SASV" nil t)
1268
(replace-match version t t))
1269
(goto-char (point-max))
1270
)
1271
;; buffer has now been created with defuns, so eval them!
1272
(eval-buffer)
1273
(kill-buffer eval-buf)
1274
)
1275
ess-sas-versions-created))
1276
1277
1278
;;; Section 3: Key Definitions
1279
1280
1281
(defun ess-sas-edit-keys-set (&optional arg)
1282
"Set TAB/RET key in `SAS-mode'.
1283
If arg is nil
1284
TAB is `sas-indent-line' and
1285
RET is `newline-and-indent'.
1286
Else
1287
TAB is `ess-sas-tab-to-tab-stop',
1288
C-TAB is `ess-sas-backward-delete-tab' and
1289
RET is `newline'."
1290
(interactive)
1291
1292
(if arg
1293
(progn
1294
(if (and (equal emacs-major-version 19) (equal emacs-minor-version 28))
1295
(define-key sas-mode-local-map [C-tab] 'ess-sas-backward-delete-tab)
1296
;;else
1297
(define-key sas-mode-local-map [(control tab)] 'ess-sas-backward-delete-tab))
1298
(define-key sas-mode-local-map [return] 'newline)
1299
(define-key sas-mode-local-map "\t" 'ess-sas-tab-to-tab-stop))
1300
;;else
1301
(define-key sas-mode-local-map [return] 'newline-and-indent)
1302
(define-key sas-mode-local-map "\t" 'sas-indent-line)))
1303
1304
(defvar ess-sas-edit-keys-toggle nil
1305
"Toggle TAB/RET key in `SAS-mode'.
1306
nil binds TAB to `sas-indent-line' and RET to `newline-and-indent'.
1307
Non-nil binds TAB to `ess-sas-tab-to-tab-stop',
1308
C-TAB to `ess-sas-backward-delete-tab', and RET to `newline'.")
1309
1310
(defun ess-sas-edit-keys-toggle (&optional arg)
1311
"Toggle `ess-sas-edit-keys-toggle'. Optional arg is still
1312
accepted for backward compatibility, however, arg is ignored."
1313
(interactive)
1314
1315
(setq ess-sas-edit-keys-toggle (not ess-sas-edit-keys-toggle))
1316
(ess-sas-edit-keys-set ess-sas-edit-keys-toggle)
1317
)
1318
1319
(defvar ess-sas-global-pc-keys nil
1320
"Non-nil if function keys use PC-like SAS key definitions in all modes.")
1321
1322
(defun ess-sas-global-pc-keys ()
1323
"PC-like SAS key definitions"
1324
(interactive)
1325
(when (or (not (featurep 'xemacs)) (featurep 'rtf-support))
1326
(global-set-key [(control f1)] 'ess-sas-rtf-portrait)
1327
(global-set-key [(control f2)] 'ess-sas-rtf-landscape))
1328
(global-set-key (quote [f2]) 'ess-revert-wisely)
1329
(global-set-key (quote [f3]) 'ess-sas-goto-shell)
1330
(global-set-key (quote [f4]) 'ess-sas-goto-file-1)
1331
(global-set-key (quote [f5]) 'ess-sas-goto-sas)
1332
(global-set-key (quote [f6]) 'ess-sas-goto-log)
1333
(global-set-key [(control f6)] 'ess-sas-append-log)
1334
(global-set-key (quote [f7]) 'ess-sas-goto-lst)
1335
(global-set-key [(control f7)] 'ess-sas-append-lst)
1336
(global-set-key (quote [f8]) 'ess-sas-submit)
1337
(global-set-key [(control f8)] 'ess-sas-submit-region)
1338
(global-set-key (quote [f9]) 'ess-sas-data-view-fsview)
1339
(global-set-key [(control f9)] 'ess-sas-data-view-insight)
1340
(global-set-key (quote [f10]) 'ess-sas-toggle-sas-log-mode)
1341
(global-set-key [(control f10)] 'ess-sas-toggle-sas-listing-mode)
1342
(global-set-key (quote [f11]) 'ess-sas-goto-file-2)
1343
(global-set-key [(control f11)] 'ess-ebcdic-to-ascii-search-and-replace)
1344
(global-set-key (quote [f12]) 'ess-sas-graph-view)
1345
(if (and ess-sas-edit-keys-toggle
1346
(equal emacs-major-version 19) (equal emacs-minor-version 28))
1347
(global-set-key [C-tab] 'ess-sas-backward-delete-tab)
1348
;else
1349
(global-set-key [(control tab)] 'ess-sas-backward-delete-tab))
1350
;(define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path)
1351
(setq ess-sas-global-pc-keys t)
1352
(setq ess-sas-global-unix-keys nil)
1353
(setq ess-sas-local-pc-keys nil)
1354
(setq ess-sas-local-unix-keys nil)
1355
)
1356
1357
(defvar ess-sas-global-unix-keys nil
1358
"Non-nil if function keys use Unix-like SAS key definitions in all modes.")
1359
1360
(defun ess-sas-global-unix-keys ()
1361
"Unix/Mainframe-like SAS key definitions"
1362
(interactive)
1363
(when (or (not (featurep 'xemacs)) (featurep 'rtf-support))
1364
(global-set-key [(control f1)] 'ess-sas-rtf-portrait)
1365
(global-set-key [(control f2)] 'ess-sas-rtf-landscape))
1366
(global-set-key (quote [f2]) 'ess-revert-wisely)
1367
(global-set-key (quote [f3]) 'ess-sas-submit)
1368
(global-set-key [(control f3)] 'ess-sas-submit-region)
1369
(global-set-key (quote [f4]) 'ess-sas-goto-sas)
1370
(global-set-key (quote [f5]) 'ess-sas-goto-log)
1371
(global-set-key [(control f5)] 'ess-sas-append-log)
1372
(global-set-key (quote [f6]) 'ess-sas-goto-lst)
1373
(global-set-key [(control f6)] 'ess-sas-append-lst)
1374
(global-set-key (quote [f7]) 'ess-sas-goto-file-1)
1375
(global-set-key (quote [f8]) 'ess-sas-goto-shell)
1376
(global-set-key (quote [f9]) 'ess-sas-data-view-fsview)
1377
(global-set-key [(control f9)] 'ess-sas-data-view-insight)
1378
(global-set-key (quote [f10]) 'ess-sas-toggle-sas-log-mode)
1379
(global-set-key [(control f10)] 'ess-sas-toggle-sas-listing-mode)
1380
(global-set-key (quote [f11]) 'ess-sas-goto-file-2)
1381
(global-set-key [(control f11)] 'ess-ebcdic-to-ascii-search-and-replace)
1382
(global-set-key (quote [f12]) 'ess-sas-graph-view)
1383
(if (and ess-sas-edit-keys-toggle
1384
(equal emacs-major-version 19) (equal emacs-minor-version 28))
1385
(global-set-key [C-tab] 'ess-sas-backward-delete-tab)
1386
;else
1387
(global-set-key [(control tab)] 'ess-sas-backward-delete-tab))
1388
;(define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path)
1389
(setq ess-sas-global-pc-keys nil)
1390
(setq ess-sas-global-unix-keys t)
1391
(setq ess-sas-local-pc-keys nil)
1392
(setq ess-sas-local-unix-keys nil)
1393
)
1394
1395
(defvar ess-sas-local-pc-keys nil
1396
"Non-nil if function keys use PC-like SAS key definitions
1397
in SAS-mode and related modes.")
1398
1399
(defun ess-sas-local-pc-keys ()
1400
"PC-like SAS key definitions."
1401
(interactive)
1402
(when (or (not (featurep 'xemacs)) (featurep 'rtf-support))
1403
(define-key sas-mode-local-map [(control f1)] 'ess-sas-rtf-portrait)
1404
(define-key sas-mode-local-map [(control f2)] 'ess-sas-rtf-landscape))
1405
(define-key sas-mode-local-map (quote [f2]) 'ess-revert-wisely)
1406
(define-key sas-mode-local-map (quote [f3]) 'ess-sas-goto-shell)
1407
(define-key sas-mode-local-map (quote [f4]) 'ess-sas-goto-file-1)
1408
(define-key sas-mode-local-map (quote [f5]) 'ess-sas-goto-sas)
1409
(define-key sas-mode-local-map (quote [f6]) 'ess-sas-goto-log)
1410
(define-key sas-mode-local-map [(control f6)] 'ess-sas-append-log)
1411
(define-key sas-mode-local-map (quote [f7]) 'ess-sas-goto-lst)
1412
(define-key sas-mode-local-map [(control f7)] 'ess-sas-append-lst)
1413
(define-key sas-mode-local-map (quote [f8]) 'ess-sas-submit)
1414
(define-key sas-mode-local-map [(control f8)] 'ess-sas-submit-region)
1415
(define-key sas-mode-local-map (quote [f9]) 'ess-sas-data-view-fsview)
1416
(define-key sas-mode-local-map [(control f9)] 'ess-sas-data-view-insight)
1417
(define-key sas-mode-local-map (quote [f10]) 'ess-sas-toggle-sas-log-mode)
1418
(define-key sas-mode-local-map [(control f10)] 'ess-sas-toggle-sas-listing-mode)
1419
(define-key sas-mode-local-map (quote [f11]) 'ess-sas-goto-file-2)
1420
(define-key sas-mode-local-map [(control f11)] 'ess-ebcdic-to-ascii-search-and-replace)
1421
(define-key sas-mode-local-map (quote [f12]) 'ess-sas-graph-view)
1422
;(define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path)
1423
(setq ess-sas-global-pc-keys nil)
1424
(setq ess-sas-global-unix-keys nil)
1425
(setq ess-sas-local-pc-keys t)
1426
(setq ess-sas-local-unix-keys nil)
1427
)
1428
1429
(defvar ess-sas-local-unix-keys nil
1430
"Non-nil if function keys use Unix-like SAS key definitions
1431
in SAS-mode and related modes.")
1432
1433
(defun ess-sas-local-unix-keys ()
1434
"Unix/Mainframe-like SAS key definitions"
1435
(interactive)
1436
(when (or (not (featurep 'xemacs)) (featurep 'rtf-support))
1437
(define-key sas-mode-local-map [(control f1)] 'ess-sas-rtf-portrait)
1438
(define-key sas-mode-local-map [(control f2)] 'ess-sas-rtf-landscape))
1439
(define-key sas-mode-local-map (quote [f2]) 'ess-revert-wisely)
1440
(define-key sas-mode-local-map (quote [f3]) 'ess-sas-submit)
1441
(define-key sas-mode-local-map [(control f3)] 'ess-sas-submit-region)
1442
(define-key sas-mode-local-map (quote [f4]) 'ess-sas-goto-sas)
1443
(define-key sas-mode-local-map (quote [f5]) 'ess-sas-goto-log)
1444
(define-key sas-mode-local-map [(control f5)] 'ess-sas-append-log)
1445
(define-key sas-mode-local-map (quote [f6]) 'ess-sas-goto-lst)
1446
(define-key sas-mode-local-map [(control f6)] 'ess-sas-append-lst)
1447
(define-key sas-mode-local-map (quote [f7]) 'ess-sas-goto-file-1)
1448
(define-key sas-mode-local-map (quote [f8]) 'ess-sas-goto-shell)
1449
(define-key sas-mode-local-map (quote [f9]) 'ess-sas-data-view-fsview)
1450
(define-key sas-mode-local-map [(control f9)] 'ess-sas-data-view-insight)
1451
(define-key sas-mode-local-map (quote [f10]) 'ess-sas-toggle-sas-log-mode)
1452
(define-key sas-mode-local-map [(control f10)] 'ess-sas-toggle-sas-listing-mode)
1453
(define-key sas-mode-local-map (quote [f11]) 'ess-sas-goto-file-2)
1454
(define-key sas-mode-local-map [(control f11)] 'ess-ebcdic-to-ascii-search-and-replace)
1455
(define-key sas-mode-local-map (quote [f12]) 'ess-sas-graph-view)
1456
;(define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path)
1457
(setq ess-sas-global-pc-keys nil)
1458
(setq ess-sas-global-unix-keys nil)
1459
(setq ess-sas-local-pc-keys nil)
1460
(setq ess-sas-local-unix-keys t)
1461
)
1462
1463
(provide 'ess-sas-a)
1464
1465
; Local variables section
1466
1467
;;; This file is automatically placed in Outline minor mode.
1468
;;; The file is structured as follows:
1469
;;; Chapters: ^L ;
1470
;;; Sections: ;;*;;
1471
;;; Subsections: ;;;*;;;
1472
;;; Components: defuns, defvars, defconsts
1473
;;; Random code beginning with a ;;;;* comment
1474
1475
;;; Local variables:
1476
;;; mode: emacs-lisp
1477
;;; outline-minor-mode: nil
1478
;;; mode: outline-minor
1479
;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"
1480
;;; End:
1481
1482
;;; ess-sas-a.el ends here
1483
1484