348
344
(let* (;; point of search
349
;;(ess-sas-search-point nil)
351
;;(ess-sas-search-column nil)
353
;;(ess-sas-search-limit nil)
354
;; text to be inserted after a back-tab, if any
355
;;(ess-sas-end-text "end;")
357
(ess-sas-column (current-column))
358
;; remainder of current-column and sas-indent-width
359
(ess-sas-remainder (% ess-sas-column sas-indent-width)))
345
;;(ess-sas-search-point nil)
347
;;(ess-sas-search-column nil)
349
;;(ess-sas-search-limit nil)
350
;; text to be inserted after a back-tab, if any
351
;;(ess-sas-end-text "end;")
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)))
361
357
(if (not (= ess-sas-column 0))
363
(if (= ess-sas-remainder 0)
364
(setq ess-sas-remainder sas-indent-width))
359
(if (= ess-sas-remainder 0)
360
(setq ess-sas-remainder sas-indent-width))
366
(let ((backward-delete-char-untabify-method 'nil))
367
(backward-delete-char-untabify ess-sas-remainder t)
368
(setq ess-sas-column (- ess-sas-column ess-sas-remainder))
369
(move-to-column ess-sas-column)
370
(setq left-margin ess-sas-column))
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))
374
370
;; this feature was far too complicated to perfect
375
371
;; (if ess-sas-smart-back-tab (progn
377
;; (setq ess-sas-search-point
378
;; (search-backward-regexp "end" nil t))
380
;; (if (and ess-sas-search-point
381
;; (search-backward-regexp "%" (+ ess-sas-search-point -1) t))
382
;; (setq ess-sas-search-point (+ ess-sas-search-point -1))
385
;; (if (and ess-sas-search-point
386
;; (not (equal ess-sas-column (current-column))))
387
;; (setq ess-sas-search-point nil))
391
;; (setq ess-sas-search-point
392
;; (search-backward-regexp "do\\|select"
393
;; ess-sas-search-point t))
395
;; (setq ess-sas-search-column (current-column))
397
;; (if ess-sas-search-point (progn
399
;; (search-backward-regexp "^" nil t)
400
;; (setq ess-sas-search-limit (point))
403
;; (if (search-backward-regexp "if.*then\\|else" ess-sas-search-limit t)
404
;; (setq ess-sas-search-point (point)))
406
;; (if (search-backward-regexp "%" ess-sas-search-limit t) (progn
407
;; (setq ess-sas-end-text "%end;")
408
;; (setq ess-sas-search-point (point))
411
;; (setq ess-sas-search-column (current-column))
413
;; (if (not (equal ess-sas-column ess-sas-search-column))
414
;; (setq ess-sas-search-point nil))
417
;; (if ess-sas-search-point (insert ess-sas-end-text))
373
;; (setq ess-sas-search-point
374
;; (search-backward-regexp "end" nil t))
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))
381
;; (if (and ess-sas-search-point
382
;; (not (equal ess-sas-column (current-column))))
383
;; (setq ess-sas-search-point nil))
387
;; (setq ess-sas-search-point
388
;; (search-backward-regexp "do\\|select"
389
;; ess-sas-search-point t))
391
;; (setq ess-sas-search-column (current-column))
393
;; (if ess-sas-search-point (progn
395
;; (search-backward-regexp "^" nil t)
396
;; (setq ess-sas-search-limit (point))
399
;; (if (search-backward-regexp "if.*then\\|else" ess-sas-search-limit t)
400
;; (setq ess-sas-search-point (point)))
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))
407
;; (setq ess-sas-search-column (current-column))
409
;; (if (not (equal ess-sas-column ess-sas-search-column))
410
;; (setq ess-sas-search-point nil))
413
;; (if ess-sas-search-point (insert ess-sas-end-text))
420
416
(defun ess-sas-cd ()
421
"Change directory, taking into account various issues with respect to
417
"Change directory, taking into account various issues with respect to
422
418
`ess-sas-file-path'."
425
(ess-sas-goto-shell t)
427
(if (equal ess-sas-submit-method 'sh)
421
(ess-sas-goto-shell t)
423
(if (equal ess-sas-submit-method 'sh)
428
424
(insert "cd " (car (last (split-string (file-name-directory ess-sas-file-path)
429
"\\([a-zA-Z][a-zA-Z]:\\|]\\)"))))
430
(if (equal ess-sas-submit-method 'ms-dos) (progn
431
(if (string-equal ":" (substring ess-sas-file-path 1 2)) (progn
432
(insert (substring ess-sas-file-path 0 2))
433
(comint-send-input)))
434
(insert "cd \"" (convert-standard-filename
435
(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)) "\""))))
438
434
(defun ess-sas-create-local-variables-alist (&optional file-or-buffer)
439
"Create an alist of local variables from file-or-buffer, use the
435
"Create an alist of local variables from file-or-buffer, use the
440
436
current buffer if nil."
442
(if file-or-buffer (set-buffer (ess-get-file-or-buffer file-or-buffer)))
438
(if file-or-buffer (set-buffer (ess-get-file-or-buffer file-or-buffer)))
444
(ess-change-alist 'ess-kermit-remote-directory ess-kermit-remote-directory nil))
440
(ess-change-alist 'ess-kermit-remote-directory ess-kermit-remote-directory nil))
446
442
(defun ess-sas-data-view-fsview (&optional ess-sas-data)
447
443
"Open a dataset for viewing with PROC FSVIEW."
449
(ess-save-and-set-local-variables)
451
(save-excursion (let ((ess-tmp-sas-data nil)
452
(ess-tmp-sas-data-view-fsview-statement ess-sas-data-view-fsview-statement)
454
"[ \t=]\\([a-zA-Z_][a-zA-Z_0-9]*[.][a-zA-Z_][a-zA-Z_0-9]*\\)\\(&.*\\)?[. ,()\t;/]")
456
"^\\([wW][oO][rR][kK]\\|[fF][iI][rR][sS][tT]\\|[lL][aA][sS][tT]\\)[.]"))
458
(if ess-sas-data nil (save-match-data
459
(search-backward-regexp "[ \t=]" nil t)
462
(setq ess-tmp-sas-data
463
(ess-search-except ess-search-regexp ess-search-except)))
465
(if (not ess-tmp-sas-data)
466
(setq ess-tmp-sas-data
467
(ess-search-except ess-search-regexp ess-search-except t)))
469
(setq ess-sas-data (read-string "Permanent SAS Dataset: " ess-tmp-sas-data))
471
(ess-sas-goto-shell t)
474
(insert (concat ess-sas-submit-pre-command " " ess-sas-submit-command
475
" -initstmt \"" ess-sas-data-view-libname ess-sas-data-view-fsview-command
476
ess-sas-data ";" ess-tmp-sas-data-view-fsview-statement "; run;\" "
477
ess-sas-submit-command-options " "
478
ess-sas-data-view-submit-options " " ess-sas-submit-post-command))
445
(ess-save-and-set-local-variables)
447
(save-excursion (let ((ess-tmp-sas-data nil)
448
(ess-tmp-sas-data-view-fsview-statement ess-sas-data-view-fsview-statement)
450
"[ \t=]\\([a-zA-Z_][a-zA-Z_0-9]*[.][a-zA-Z_][a-zA-Z_0-9]*\\)\\(&.*\\)?[. ,()\t;/]")
452
"^\\([wW][oO][rR][kK]\\|[fF][iI][rR][sS][tT]\\|[lL][aA][sS][tT]\\)[.]"))
454
(if ess-sas-data nil (save-match-data
455
(search-backward-regexp "[ \t=]" nil t)
458
(setq ess-tmp-sas-data
459
(ess-search-except ess-search-regexp ess-search-except)))
461
(if (not ess-tmp-sas-data)
462
(setq ess-tmp-sas-data
463
(ess-search-except ess-search-regexp ess-search-except t)))
465
(setq ess-sas-data (read-string "Permanent SAS Dataset: " ess-tmp-sas-data))
467
(ess-sas-goto-shell t)
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))
482
478
(defun ess-sas-data-view-insight (&optional ess-sas-data)
483
479
"Open a dataset for viewing with PROC INSIGHT."
485
(ess-save-and-set-local-variables)
487
(save-excursion (let ((ess-tmp-sas-data nil)
488
(ess-tmp-sas-data-view-insight-statement ess-sas-data-view-insight-statement)
490
"[ \t=]\\([a-zA-Z_][a-zA-Z_0-9]*[.][a-zA-Z_][a-zA-Z_0-9]*\\)\\(&.*\\)?[. ,()\t;]")
492
"^\\([wW][oO][rR][kK]\\|[fF][iI][rR][sS][tT]\\|[lL][aA][sS][tT]\\)[.]"))
494
(if ess-sas-data nil (save-match-data
495
(search-backward-regexp "[ \t=]" nil t)
498
(setq ess-tmp-sas-data
499
(ess-search-except ess-search-regexp ess-search-except)))
501
(if (not ess-tmp-sas-data)
502
(setq ess-tmp-sas-data
503
(ess-search-except ess-search-regexp ess-search-except t)))
505
(setq ess-sas-data (read-string "Permanent SAS Dataset: " ess-tmp-sas-data))
507
(ess-sas-goto-shell t)
510
(insert (concat ess-sas-submit-pre-command " " ess-sas-submit-command
511
" -initstmt \"" ess-sas-data-view-libname ess-sas-data-view-insight-command
512
ess-sas-data ";" ess-tmp-sas-data-view-insight-statement "; run;\" "
513
ess-sas-data-view-submit-options " " ess-sas-submit-post-command))
481
(ess-save-and-set-local-variables)
483
(save-excursion (let ((ess-tmp-sas-data nil)
484
(ess-tmp-sas-data-view-insight-statement ess-sas-data-view-insight-statement)
486
"[ \t=]\\([a-zA-Z_][a-zA-Z_0-9]*[.][a-zA-Z_][a-zA-Z_0-9]*\\)\\(&.*\\)?[. ,()\t;]")
488
"^\\([wW][oO][rR][kK]\\|[fF][iI][rR][sS][tT]\\|[lL][aA][sS][tT]\\)[.]"))
490
(if ess-sas-data nil (save-match-data
491
(search-backward-regexp "[ \t=]" nil t)
494
(setq ess-tmp-sas-data
495
(ess-search-except ess-search-regexp ess-search-except)))
497
(if (not ess-tmp-sas-data)
498
(setq ess-tmp-sas-data
499
(ess-search-except ess-search-regexp ess-search-except t)))
501
(setq ess-sas-data (read-string "Permanent SAS Dataset: " ess-tmp-sas-data))
503
(ess-sas-goto-shell t)
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))
517
513
(defun ess-sas-graph-view ()
518
514
"Open a GSASFILE for viewing."
520
; (ess-sas-file-path)
516
; (ess-sas-file-path)
521
517
(ess-sas-goto-log 'no-error-check)
523
519
(save-excursion (let (
524
(ess-tmp-length (length ess-sas-graph-view-viewer-alist))
527
(ess-tmp-graph-alist nil)
529
(ess-tmp-graph-regexp
530
; (concat "[ ]RECORDS[ ]WRITTEN[ ]+TO[ ]\n?[ ]*\\(\\(\n\\|[^.]\\)*"
531
(concat "[ ][rR][eE][cC][oO][rR][dD][sS][ ][wW][rR][iI][tT][tT][eE][nN][ ]+[tT][oO][ ]\n?[ ]*\\(.*"
532
ess-sas-graph-view-suffix-regexp "\\)")))
533
; (concat "['\"]\\(.*" ess-sas-graph-suffix-regexp "\\)['\"]")))
536
(search-backward-regexp "[ \t=]" nil t)
539
(setq ess-tmp-graph (ess-search-except ess-tmp-graph-regexp)))
541
(if (not ess-tmp-graph)
542
(setq ess-tmp-graph (ess-search-except ess-tmp-graph-regexp nil t)))
544
(setq ess-tmp-graph (read-string "GSASFILE: "
545
(or ess-tmp-graph ess-sas-file-path)))
547
(if (fboundp 'ess-xemacs-insert-glyph) (progn
548
(if (string-match "[.][gG][iI][fF]" ess-tmp-graph)
549
(setq ess-tmp-glyph 'gif)
551
(if (string-match "[.][jJ][pP][eE]?[gG]" ess-tmp-graph)
552
(setq ess-tmp-glyph 'jpeg)))))
554
;;GNU Emacs graphics file image viewing mode loaded?
555
(if (and (boundp 'auto-image-file-mode) auto-image-file-mode
556
(string-match "[.][jJ][pP][eE]?[gG]" ess-tmp-graph))
557
(find-file ess-tmp-graph)
558
;;else XEmacs graphics file image viewing mode loaded?
559
(if (and (fboundp 'image-mode)
560
(string-match "[.]\\([jJ][pP][eE]?[gG]\\|[gG][iI][fF]\\)"
562
(find-file ess-tmp-graph)
563
;;else XEmacs graphics file image viewing primitives loaded?
564
(if ess-tmp-glyph (progn
565
(switch-to-buffer (file-name-nondirectory ess-tmp-graph))
566
(ess-xemacs-insert-glyph
567
(make-glyph (vector ess-tmp-glyph :file ess-tmp-graph))))
569
;;else use the appropriate graphics file image viewer
570
(while (< ess-tmp-counter ess-tmp-length)
571
(setq ess-tmp-graph-alist
572
(nth ess-tmp-counter ess-sas-graph-view-viewer-alist))
573
(setq ess-tmp-graph-regexp (car ess-tmp-graph-alist))
576
(concat "[.]" ess-tmp-graph-regexp) ess-tmp-graph)
578
(ess-sas-goto-shell t)
579
(insert ess-sas-submit-pre-command " "
580
(cdr ess-tmp-graph-alist) " " ess-tmp-graph
581
(if (equal ess-sas-submit-method 'sh) " &"))
582
(setq ess-tmp-glyph 'alist)
583
(setq ess-tmp-counter ess-tmp-length))
585
(setq ess-tmp-counter (+ ess-tmp-counter 1))))
587
(if (not ess-tmp-glyph) (progn
588
(ess-sas-goto-shell t)
589
(insert ess-sas-submit-pre-command " "
590
ess-sas-graph-view-viewer-default " " ess-tmp-graph
591
(if (equal ess-sas-submit-method 'sh) " &"))))
593
(comint-send-input))))))))
520
(ess-tmp-length (length ess-sas-graph-view-viewer-alist))
523
(ess-tmp-graph-alist 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 "\\)['\"]")))
532
(search-backward-regexp "[ \t=]" nil t)
535
(setq ess-tmp-graph (ess-search-except ess-tmp-graph-regexp)))
537
(if (not ess-tmp-graph)
538
(setq ess-tmp-graph (ess-search-except ess-tmp-graph-regexp nil t)))
540
(setq ess-tmp-graph (read-string "GSASFILE: "
541
(or ess-tmp-graph ess-sas-file-path)))
543
(if (fboundp 'ess-xemacs-insert-glyph) (progn
544
(if (string-match "[.][gG][iI][fF]" ess-tmp-graph)
545
(setq ess-tmp-glyph 'gif)
547
(if (string-match "[.][jJ][pP][eE]?[gG]" ess-tmp-graph)
548
(setq ess-tmp-glyph 'jpeg)))))
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]\\)"
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))))
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))
572
(concat "[.]" ess-tmp-graph-regexp) ess-tmp-graph)
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))
581
(setq ess-tmp-counter (+ ess-tmp-counter 1))))
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) " &"))))
589
(comint-send-input))))))))
595
591
(defun ess-sas-file-path (&optional force)
596
"Define `ess-sas-file-path' to be the current buffer depending on suffix."
592
"Define `ess-sas-file-path' to be the current buffer depending on suffix."
599
595
(save-match-data (let ((ess-sas-temp-file (expand-file-name (buffer-name))))
600
(if (or force (string-match ess-sas-suffix-regexp ess-sas-temp-file)) ;;(progn
601
(setq ess-sas-file-path
602
(nth 0 (split-string ess-sas-temp-file "[<]")))))))
603
;; (setq ess-directory (file-name-directory ess-sas-file-path)))))))
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)))))))
605
601
(defun ess-sas-file-path-remote-host ()
606
"Return the remote host, if any, associated with `ess-sas-file-path'."
602
"Return the remote host, if any, associated with `ess-sas-file-path'."
609
(let* ((temp-colon-pos (string-match ":" ess-sas-file-path))
611
(if (or (not temp-colon-pos) (> temp-colon-pos 2))
612
(if (equal ess-sas-file-path ".") nil
613
(split-string (file-name-directory ess-sas-file-path)
615
(list ess-sas-file-path)))
616
(temp-list-length (length temp-list)))
605
(let* ((temp-colon-pos (string-match ":" ess-sas-file-path))
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)
611
(list ess-sas-file-path)))
612
(temp-list-length (length temp-list)))
617
613
(if (= temp-list-length 1) (setq temp-list nil)
618
(if (= temp-list-length 2) (setq temp-list (car temp-list))
619
(setq temp-list (nth 1 temp-list))))
614
(if (= temp-list-length 2) (setq temp-list (car temp-list))
615
(setq temp-list (nth 1 temp-list))))
621
617
(if temp-list (setq temp-list
622
(car (last (split-string temp-list "/")))))
618
(car (last (split-string temp-list "/")))))
625
621
(defun ess-sas-goto (suffix &optional revert no-create)
627
623
(let ((ess-temp-regexp (concat ess-sas-suffix-regexp "\\(@.+\\)?")))
629
625
(if (or (string-match ess-temp-regexp (expand-file-name (buffer-name)))
630
(string-match ess-temp-regexp ess-sas-file-path))
634
(ess-sas-temp-file (replace-match (concat "." suffix) t t
636
(ess-sas-temp-buff (find-buffer-visiting ess-sas-temp-file))
637
(ess-temp-kermit-remote-directory ess-kermit-remote-directory))
639
(if ess-sas-temp-buff (switch-to-buffer ess-sas-temp-buff)
641
(if no-create (setq revert nil)
642
(if (file-exists-p ess-sas-temp-file)
643
(find-file ess-sas-temp-file))))
645
;; (let* ((ess-sas-buffer-list (buffer-list))
646
;; (ess-sas-buffer-list-index 0)
647
;; (ess-sas-buffer-list-file nil)
648
;; (ess-sas-buffer-list-length (length ess-sas-buffer-list)))
649
;; (while (< ess-sas-buffer-list-index ess-sas-buffer-list-length)
650
;; (setq ess-sas-buffer-list-file
651
;; (buffer-file-name (nth ess-sas-buffer-list-index ess-sas-buffer-list)))
652
;; (if (and ess-sas-buffer-list-file
653
;; (string-match (concat "." suffix) ess-sas-buffer-list-file))
654
;; (switch-to-buffer (nth ess-sas-buffer-list-index ess-sas-buffer-list))
655
;; (setq ess-sas-buffer-list-index ess-sas-buffer-list-length)
657
;; (setq ess-sas-buffer-list-index (+ 1 ess-sas-buffer-list-index))
660
(if (and (not no-create)
661
(or (string-equal suffix "log")
662
(string-equal suffix "lst")))
663
(ess-kermit-get (file-name-nondirectory ess-sas-temp-file)
664
ess-temp-kermit-remote-directory))
667
(if (and (> ess-sas-log-max 0) (string-equal suffix "log")
668
(> (ess-num-or-zero (nth 7 (file-attributes ess-sas-temp-file)))
671
(insert-file-contents ess-sas-temp-file nil 0
675
(ess-revert-wisely)) nil)))))))
626
(string-match ess-temp-regexp ess-sas-file-path))
630
(ess-sas-temp-file (replace-match (concat "." suffix) t t
632
(ess-sas-temp-buff (find-buffer-visiting ess-sas-temp-file))
633
(ess-temp-kermit-remote-directory ess-kermit-remote-directory))
635
(if ess-sas-temp-buff (switch-to-buffer ess-sas-temp-buff)
637
(if no-create (setq revert nil)
638
(if (file-exists-p ess-sas-temp-file)
639
(find-file ess-sas-temp-file))))
641
;; (let* ((ess-sas-buffer-list (buffer-list))
642
;; (ess-sas-buffer-list-index 0)
643
;; (ess-sas-buffer-list-file nil)
644
;; (ess-sas-buffer-list-length (length ess-sas-buffer-list)))
645
;; (while (< ess-sas-buffer-list-index ess-sas-buffer-list-length)
646
;; (setq ess-sas-buffer-list-file
647
;; (buffer-file-name (nth ess-sas-buffer-list-index ess-sas-buffer-list)))
648
;; (if (and ess-sas-buffer-list-file
649
;; (string-match (concat "." suffix) ess-sas-buffer-list-file))
650
;; (switch-to-buffer (nth ess-sas-buffer-list-index ess-sas-buffer-list))
651
;; (setq ess-sas-buffer-list-index ess-sas-buffer-list-length)
653
;; (setq ess-sas-buffer-list-index (+ 1 ess-sas-buffer-list-index))
656
(if (and (not no-create)
657
(or (string-equal suffix "log")
658
(string-equal suffix "lst")))
659
(ess-kermit-get (file-name-nondirectory ess-sas-temp-file)
660
ess-temp-kermit-remote-directory))
663
(if (and (> ess-sas-log-max 0) (string-equal suffix "log")
664
(> (ess-num-or-zero (nth 7 (file-attributes ess-sas-temp-file)))
667
(insert-file-contents ess-sas-temp-file nil 0
671
(ess-revert-wisely)) nil)))))))
677
673
;;(defun ess-sas-file (suffix &optional revert)
678
674
;; "Please use `ess-sas-goto' instead."
679
675
;; (let* ((tail (downcase (car (split-string
680
;; (car (last (split-string (buffer-name) "[.]"))) "[<]"))))
681
;;(if (fboundp 'file-name-extension) (file-name-extension (buffer-name))
682
;; (substring (buffer-name) -3)))
683
;; (tail-in-tail-list (member tail (list "sas" "log" "lst"
684
;; ess-sas-suffix-1 ess-sas-suffix-2)))
685
;; (root (if tail-in-tail-list (expand-file-name (buffer-name))
686
;; ess-sas-file-path))
687
;; (ess-sas-arg (concat (file-name-sans-extension root) "." suffix))
688
;; (ess-sas-buf (find-buffer-visiting ess-sas-arg)))
676
;; (car (last (split-string (buffer-name) "[.]"))) "[<]"))))
677
;;(if (fboundp 'file-name-extension) (file-name-extension (buffer-name))
678
;; (substring (buffer-name) -3)))
679
;; (tail-in-tail-list (member tail (list "sas" "log" "lst"
680
;; ess-sas-suffix-1 ess-sas-suffix-2)))
681
;; (root (if tail-in-tail-list (expand-file-name (buffer-name))
682
;; ess-sas-file-path))
683
;; (ess-sas-arg (concat (file-name-sans-extension root) "." suffix))
684
;; (ess-sas-buf (find-buffer-visiting ess-sas-arg)))
689
685
;; (if (equal tail suffix) (if revert (ess-revert-wisely))
690
;; (if (not ess-sas-buf) (find-file ess-sas-arg)
691
;; (switch-to-buffer ess-sas-buf)
692
;; (if revert (ess-revert-wisely))))))
686
;; (if (not ess-sas-buf) (find-file ess-sas-arg)
687
;; (switch-to-buffer ess-sas-buf)
688
;; (if revert (ess-revert-wisely))))))
695
691
(defun ess-sas-goto-file-1 ()
709
705
(let ((ess-sas-error (concat
710
"^ERROR [0-9]+-[0-9]+:\\|^ERROR:\\|_ERROR_=1 _N_=\\|_ERROR_=1[ ]?$"
711
"\\|NOTE: MERGE statement has more than one data set with repeats"
712
"\\|NOTE: Variable .* is uninitialized."
713
"\\|NOTE: SAS went to a new line when INPUT statement reached past"
714
"\\|NOTE 485-185: Informat .* was not found"
715
"\\|NOTE: Estimated G matrix is not positive definite."
716
"\\|NOTE: Compressing data set .* increased size by"
717
"\\|NOTE: ERROR DETECTED IN ANNOTATE="
718
"\\|WARNING: Apparent symbolic reference .* not resolved."
719
"\\|WARNING: Length of character variable has already been set."
720
"\\|WARNING: Not all variables in the list "
721
"\\|WARNING: RUN statement ignored due to previous errors."
722
"\\|WARNING: Values exist outside the axis range"
723
"\\|Bus Error In Task\\|Segmentation Violation In Task"))
724
(ess-sas-save-point nil)); (ess-sas-pop-mark nil))
726
(if (ess-sas-goto "log" 'revert) (progn
727
(setq ess-sas-save-point (point))
728
(goto-char (point-min)))
729
(setq ess-sas-save-point (point)))
731
;(if (number-char-or-marker-p ess-sas-save-point) (progn
732
(if ess-tmp-no-error-check (goto-char ess-sas-save-point)
733
(if (or (search-forward-regexp ess-sas-error nil t)
734
(and (goto-char (point-min))
735
(search-forward-regexp ess-sas-error nil t)))
737
; this feature never worked quite right (and was XEmacs only to boot)
738
; after highlighting an error message, moving point would cause an unwanted
739
; highlighting between point and mark; why god, why?!?
741
; (if (and (boundp 'zmacs-regions) zmacs-regions)
743
; (if ess-sas-pop-mark (pop-mark)
744
; (setq ess-sas-pop-mark t))
745
; (push-mark (match-beginning 0) t)
746
; (zmacs-activate-region)))
747
(goto-char ess-sas-save-point)))))
706
"^ERROR [0-9]+-[0-9]+:\\|^ERROR:\\|_ERROR_=1 _N_=\\|_ERROR_=1[ ]?$"
707
"\\|NOTE: MERGE statement has more than one data set with repeats"
708
"\\|NOTE: Variable .* is uninitialized."
709
"\\|NOTE: SAS went to a new line when INPUT statement reached past"
710
"\\|NOTE 485-185: Informat .* was not found"
711
"\\|NOTE: Estimated G matrix is not positive definite."
712
"\\|NOTE: Compressing data set .* increased size by"
713
"\\|NOTE: ERROR DETECTED IN ANNOTATE="
714
"\\|WARNING: Apparent symbolic reference .* not resolved."
715
"\\|WARNING: Length of character variable has already been set."
716
"\\|WARNING: Not all variables in the list "
717
"\\|WARNING: RUN statement ignored due to previous errors."
718
"\\|WARNING: Values exist outside the axis range"
719
"\\|Bus Error In Task\\|Segmentation Violation In Task"))
720
(ess-sas-save-point nil)); (ess-sas-pop-mark nil))
722
(if (ess-sas-goto "log" 'revert) (progn
723
(setq ess-sas-save-point (point))
724
(goto-char (point-min)))
725
(setq ess-sas-save-point (point)))
727
;(if (number-char-or-marker-p ess-sas-save-point) (progn
728
(if ess-tmp-no-error-check (goto-char ess-sas-save-point)
729
(if (or (search-forward-regexp ess-sas-error nil t)
730
(and (goto-char (point-min))
731
(search-forward-regexp ess-sas-error nil t)))
733
; this feature never worked quite right (and was XEmacs only to boot)
734
; after highlighting an error message, moving point would cause an unwanted
735
; highlighting between point and mark; why god, why?!?
737
; (if (and (boundp 'zmacs-regions) zmacs-regions)
739
; (if ess-sas-pop-mark (pop-mark)
740
; (setq ess-sas-pop-mark t))
741
; (push-mark (match-beginning 0) t)
742
; (zmacs-activate-region)))
743
(goto-char ess-sas-save-point)))))
749
745
(defun ess-sas-goto-lst ()
750
746
"Switch to the .lst file and revert from disk."
882
878
(while (re-search-forward "\t" nil t) (replace-match "\\tab" nil t)))
884
880
(defun ess-sas-rtf-portrait (&optional ess-tmp-font-size)
885
"Creates an MS RTF portrait file from the current buffer."
887
(ess-sas-file-path t)
890
; (if (equal ess-tmp-font-size nil)
891
; (setq ess-tmp-font-size "21"))
895
(replace-regexp-in-string "[.][^.]*$" ".rtf" ess-sas-file-path)))
896
;(rtf-export ess-temp-rtf-file)
897
(copy-file ess-sas-file-path ess-temp-rtf-file t)
898
(ess-sas-goto "rtf" t)
899
(ess-rtf-replace-chars)
900
;(goto-char (point-min))
901
;;(replace-regexp "\\\\fmodern .*;" (concat "\\\\fmodern " ess-sas-rtf-font-name ";"))
902
;(if (re-search-forward "\\\\fmodern .*;" nil t)
903
; (replace-match (concat "\\\\fmodern " ess-sas-rtf-font-name ";") nil nil))
905
(goto-char (point-min))
907
"{\\rtf1\\ansi{\\fonttbl\\f1\\fmodern " ess-sas-rtf-font-name ";}\n"
908
"\\margl720\\margr720\\margt720\\margb720\n"
909
"{\\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"
910
"{\\stylesheet{\\s15\\plain\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Text;}{\\*\\cs16 \\additive\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Base Style;}}\n"
911
"{\\plain\\s15{\\cs16\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024{\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024\n"))
913
(goto-char (point-max))
915
;(goto-char (point-min))
916
;;(while (replace-regexp "\\\\fs[0-9]+" (concat "\\\\fs" ess-tmp-font-size)) nil)
917
;(while (re-search-forward "\\\\fs[0-9]+" nil t)
918
; (replace-match (concat "\\\\fs" ess-tmp-font-size) nil nil))
920
(kill-buffer (current-buffer))))
881
"Creates an MS RTF portrait file from the current buffer."
883
(ess-sas-file-path t)
886
; (if (equal ess-tmp-font-size nil)
887
; (setq ess-tmp-font-size "21"))
891
(replace-regexp-in-string "[.][^.]*$" ".rtf" ess-sas-file-path)))
892
;(rtf-export ess-temp-rtf-file)
893
(copy-file ess-sas-file-path ess-temp-rtf-file t)
894
(ess-sas-goto "rtf" t)
895
(ess-rtf-replace-chars)
896
;(goto-char (point-min))
897
;;(replace-regexp "\\\\fmodern .*;" (concat "\\\\fmodern " ess-sas-rtf-font-name ";"))
898
;(if (re-search-forward "\\\\fmodern .*;" nil t)
899
; (replace-match (concat "\\\\fmodern " ess-sas-rtf-font-name ";") nil nil))
901
(goto-char (point-min))
903
"{\\rtf1\\ansi{\\fonttbl\\f1\\fmodern " ess-sas-rtf-font-name ";}\n"
904
"\\margl720\\margr720\\margt720\\margb720\n"
905
"{\\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"
906
"{\\stylesheet{\\s15\\plain\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Text;}{\\*\\cs16 \\additive\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Base Style;}}\n"
907
"{\\plain\\s15{\\cs16\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024{\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024\n"))
909
(goto-char (point-max))
911
;(goto-char (point-min))
912
;;(while (replace-regexp "\\\\fs[0-9]+" (concat "\\\\fs" ess-tmp-font-size)) nil)
913
;(while (re-search-forward "\\\\fs[0-9]+" nil t)
914
; (replace-match (concat "\\\\fs" ess-tmp-font-size) nil nil))
916
(kill-buffer (current-buffer))))
922
918
(defun ess-sas-rtf-us-landscape ()
923
"Creates an MS RTF US landscape file from the current buffer."
925
(ess-sas-rtf-portrait "16")
926
(ess-sas-goto "rtf" t)
927
(goto-char (point-min))
929
(insert (concat "{\\*\\pgdsctbl\n"
930
"{\\pgdsc0\\pgdscuse195\\lndscpsxn\\pgwsxn15840\\pghsxn12240\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\pgdscnxt0 Default;}}\n"
931
"\\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"))
933
(kill-buffer (current-buffer)))
919
"Creates an MS RTF US landscape file from the current buffer."
921
(ess-sas-rtf-portrait "16")
922
(ess-sas-goto "rtf" t)
923
(goto-char (point-min))
925
(insert (concat "{\\*\\pgdsctbl\n"
926
"{\\pgdsc0\\pgdscuse195\\lndscpsxn\\pgwsxn15840\\pghsxn12240\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\pgdscnxt0 Default;}}\n"
927
"\\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"))
929
(kill-buffer (current-buffer)))
935
931
(defun ess-sas-rtf-a4-landscape ()
936
"Creates an MS RTF A4 landscape file from the current buffer."
938
(ess-sas-rtf-portrait "16")
939
(ess-sas-goto "rtf" t)
940
(goto-char (point-min))
942
(insert (concat "{\\*\\pgdsctbl\n"
943
"{\\pgdsc0\\pgdscuse195\\lndscpsxn\\pgwsxn16837\\pghsxn11905\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\pgdscnxt0 Default;}}\n"
944
"\\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"))
946
(kill-buffer (current-buffer)))
932
"Creates an MS RTF A4 landscape file from the current buffer."
934
(ess-sas-rtf-portrait "16")
935
(ess-sas-goto "rtf" t)
936
(goto-char (point-min))
938
(insert (concat "{\\*\\pgdsctbl\n"
939
"{\\pgdsc0\\pgdscuse195\\lndscpsxn\\pgwsxn16837\\pghsxn11905\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\pgdscnxt0 Default;}}\n"
940
"\\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"))
942
(kill-buffer (current-buffer)))
950
946
(defun ess-sas-submit ()
951
947
"Save the .sas file and submit to shell using a function that
991
987
their files from the remote computer. Local copies of the .sas .lst
992
988
.log and others may be made manually with `write-buffer'."
993
989
;; (ess-eval-linewise (concat "cd default-directory))
994
(ess-force-buffer-current "Process to load into: ")
996
(concat "cd " (car (last
997
(split-string (file-name-directory ess-sas-file-path) "\\(:\\|]\\)")))))
998
(ess-eval-linewise (concat arg1 " " arg2 " " (buffer-name) " &")))
990
(ess-force-buffer-current "Process to load into: ")
992
(concat "cd " (car (last
993
(split-string (file-name-directory ess-sas-file-path) "\\(:\\|]\\)")))))
994
(ess-eval-linewise (concat arg1 " " arg2 " " (buffer-name) " &")))
1000
996
(defun ess-sas-submit-mac (arg1 arg2)
1001
"If you are using Mac SAS, then arg1, `ess-sas-submit-command', should be
997
"If you are using Mac SAS, then arg1, `ess-sas-submit-command', should be
1002
998
the AppleScript command \"invoke SAS using program file\", and, if necessary,
1003
999
arg2, `ess-sas-submit-command-options', is a string of the form
1004
1000
\"with options { \\\"option-1\\\", \\\"option-2\\\", etc.}\". If you are
1005
1001
using Windows SAS with the PC emulator Virtual PC, then `ess-sas-submit-command'
1007
;(ess-save-and-set-local-variables)
1003
;(ess-save-and-set-local-variables)
1009
1005
(do-applescript (concat arg1 " \""
1010
(if (not ess-sas-submit-mac-virtual-pc)
1011
(unix-filename-to-mac default-directory))
1012
(buffer-name) "\"" arg2)))
1006
(if (not ess-sas-submit-mac-virtual-pc)
1007
(unix-filename-to-mac default-directory))
1008
(buffer-name) "\"" arg2)))
1014
1010
(defun ess-sas-submit-region ()
1015
"Write region to temporary file, and submit to SAS."
1018
(hack-local-variables t)
1019
(write-region (region-beginning) (region-end)
1020
(concat (ess-sas-temp-root) ".sas"))
1011
"Write region to temporary file, and submit to SAS."
1014
(hack-local-variables t)
1015
(write-region (region-beginning) (region-end)
1016
(concat (ess-sas-temp-root) ".sas"))
1022
(let ((arg1 ess-sas-submit-command)
1023
(arg2 ess-sas-submit-command-options))
1018
(let ((arg1 ess-sas-submit-command)
1019
(arg2 ess-sas-submit-command-options))
1024
1020
(save-excursion
1025
1021
(ess-sas-goto-shell t)
1027
(if (and (w32-shell-dos-semantics)
1028
(string-equal ":" (substring ess-sas-file-path 1 2)))
1030
(insert (substring ess-sas-file-path 0 2))
1034
(insert "cd \"" (convert-standard-filename
1035
(file-name-directory ess-sas-file-path)) "\"")
1038
(insert (concat ess-sas-submit-pre-command " " arg1
1040
" " (ess-sas-temp-root) " " ess-sas-submit-post-command))
1023
(if (and (w32-shell-dos-semantics)
1024
(string-equal ":" (substring ess-sas-file-path 1 2)))
1026
(insert (substring ess-sas-file-path 0 2))
1030
(insert "cd \"" (convert-standard-filename
1031
(file-name-directory ess-sas-file-path)) "\"")
1034
(insert (concat ess-sas-submit-pre-command " " arg1
1036
" " (ess-sas-temp-root) " " ess-sas-submit-post-command))
1045
1041
(defun ess-sas-submit-sh (arg1 arg2)
1046
1042
"Unix or bash in the *shell* buffer.
1084
1080
`ess-sas-submit-command' be \"\\\"C:\\Program Files\\SAS\\sas.exe\\\"\".
1085
1081
Keep in mind that the maximum command line length in MS-DOS is
1086
1082
127 characters so altering your PATH is preferable."
1087
;(ess-save-and-set-local-variables)
1088
(ess-sas-goto-shell t)
1089
(if (string-equal ":" (substring ess-sas-file-path 1 2))
1091
(insert (substring ess-sas-file-path 0 2))
1083
;(ess-save-and-set-local-variables)
1084
(ess-sas-goto-shell t)
1085
(if (string-equal ":" (substring ess-sas-file-path 1 2))
1087
(insert (substring ess-sas-file-path 0 2))
1095
(insert "cd \"" (convert-standard-filename
1096
(file-name-directory ess-sas-file-path)) "\"")
1098
(insert ess-sas-submit-pre-command " " arg1 " -sysin \""
1099
(file-name-sans-extension (file-name-nondirectory ess-sas-file-path)) "\" "
1100
arg2 " " ess-sas-submit-post-command)
1101
(comint-send-input))
1091
(insert "cd \"" (convert-standard-filename
1092
(file-name-directory ess-sas-file-path)) "\"")
1094
(insert ess-sas-submit-pre-command " " arg1 " -sysin \""
1095
(file-name-sans-extension (file-name-nondirectory ess-sas-file-path)) "\" "
1096
arg2 " " ess-sas-submit-post-command)
1097
(comint-send-input))
1103
1099
(defun ess-sas-tab-to-tab-stop ()
1104
1100
"Tab to next tab-stop and set left margin."
1106
1102
(tab-to-tab-stop)
1107
1103
(setq left-margin (current-column))
1110
1106
(defun ess-sas-temp-root ()
1111
"Return `ess-sas-file-path' sans extension with `ess-sas-temp-root' appended."
1112
(concat (file-name-sans-extension ess-sas-file-path) ess-sas-temp-root))
1107
"Return `ess-sas-file-path' sans extension with `ess-sas-temp-root' appended."
1108
(concat (file-name-sans-extension ess-sas-file-path) ess-sas-temp-root))
1114
1110
(defun ess-sas-transcript (&optional strip)
1115
"Comment .log messages to create a .sas program; use C-u to strip."
1111
"Comment .log messages to create a .sas program; use C-u to strip."
1118
1114
(goto-char (point-min))
1120
1116
(while (search-forward-regexp (concat
1121
"^\\(\\(1[ \t]+The SAS System\\|\\|NOTE\\|WARNING\\|ERROR\\|"
1122
"[ \t]+\\(\\(real\\|cpu\\) time\\|Licensed to\\|Engine:\\|"
1123
"Physical Name:\\|File Name=\\|Owner Name=\\|Group Name=\\|"
1124
"Access Permission=\\|File Size (bytes)=\\|Pipe command=\\|"
1125
"RECFM=[DFNPV],LRECL=\\|[0-9]+:[0-9]+[ /t]+[0-9]+:[0-9]+\\|"
1126
"[1-9][0-9]* at [0-9]+:[0-9]+[ /t]+[1-9][0-9]* at [0-9]+:[0-9]+\\)\\).*$"
1127
"\\|[0-9]+\\([ \t]+!\\)?\\|MPRINT([_A-Z]+):\\|"
1128
"[ \t]+\\(values at the places given by: (Line):(Column).\\|"
1129
"The m\\(in\\|ax\\)imum record length was [1-9][0-9]*.\\|"
1130
"One or more lines were truncated.\\|"
1131
"Each place is given by: (Number of times) at (Line):(Column).\\|"
1132
"[0-9][0-9]:[0-9][0-9] [MTWFS][aeioudhnrst]+day, [JFMASOND]"
1133
"[aeiouybcghlmnprstv]+ [1-9][0-9]?, 20[0-9][0-9]\\)\\)")
1134
nil t) (replace-match (if strip " " "/*\\&*/") t))
1117
"^\\(\\(1[ \t]+The SAS System\\|\\|NOTE\\|WARNING\\|ERROR\\|"
1118
"[ \t]+\\(\\(real\\|cpu\\) time\\|Licensed to\\|Engine:\\|"
1119
"Physical Name:\\|File Name=\\|Owner Name=\\|Group Name=\\|"
1120
"Access Permission=\\|File Size (bytes)=\\|Pipe command=\\|"
1121
"RECFM=[DFNPV],LRECL=\\|[0-9]+:[0-9]+[ /t]+[0-9]+:[0-9]+\\|"
1122
"[1-9][0-9]* at [0-9]+:[0-9]+[ /t]+[1-9][0-9]* at [0-9]+:[0-9]+\\)\\).*$"
1123
"\\|[0-9]+\\([ \t]+!\\)?\\|MPRINT([_A-Z]+):\\|"
1124
"[ \t]+\\(values at the places given by: (Line):(Column).\\|"
1125
"The m\\(in\\|ax\\)imum record length was [1-9][0-9]*.\\|"
1126
"One or more lines were truncated.\\|"
1127
"Each place is given by: (Number of times) at (Line):(Column).\\|"
1128
"[0-9][0-9]:[0-9][0-9] [MTWFS][aeioudhnrst]+day, [JFMASOND]"
1129
"[aeiouybcghlmnprstv]+ [1-9][0-9]?, 20[0-9][0-9]\\)\\)")
1130
nil t) (replace-match (if strip " " "/*\\&*/") t))
1137
1133
(defun ess-sas-toggle-sas-listing-mode (&optional force)
1138
1134
"Toggle SAS-listing-mode for .lst files."
1140
1136
(ess-sas-goto-lst)
1142
(if (equal (cdr (assoc "\\.[lL][sS][tT]\\'" auto-mode-alist)) 'SAS-listing-mode) (progn
1143
(setq auto-mode-alist (delete '("\\.[lL][sS][tT]\\'" . SAS-listing-mode) auto-mode-alist))
1144
(setq buffer-read-only nil)
1145
(ess-listing-minor-mode 0))
1146
(setq auto-mode-alist (append '(("\\.[lL][sS][tT]\\'" . SAS-listing-mode)) auto-mode-alist))
1147
(setq buffer-read-only t)
1148
(ess-listing-minor-mode 1)))
1138
(if (equal (cdr (assoc "\\.[lL][sS][tT]\\'" auto-mode-alist)) 'SAS-listing-mode) (progn
1139
(setq auto-mode-alist (delete '("\\.[lL][sS][tT]\\'" . SAS-listing-mode) auto-mode-alist))
1140
(setq buffer-read-only nil)
1141
(ess-listing-minor-mode 0))
1142
(setq auto-mode-alist (append '(("\\.[lL][sS][tT]\\'" . SAS-listing-mode)) auto-mode-alist))
1143
(setq buffer-read-only t)
1144
(ess-listing-minor-mode 1)))
1150
1146
(defun ess-sas-toggle-sas-log-mode ()
1151
1147
"Toggle SAS-log-mode for .log files."