~ubuntu-branches/ubuntu/wily/ess/wily-proposed

« back to all changes in this revision

Viewing changes to lisp/ess-s-l.el

  • Committer: Package Import Robot
  • Author(s): Dirk Eddelbuettel
  • Date: 2013-09-27 18:41:32 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: package-import@ubuntu.com-20130927184132-dxa7ufsry9hjd9dc
Tags: upstream-13.09
ImportĀ upstreamĀ versionĀ 13.09

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
    (ess-imenu-generic-expression  . ess-imenu-S-generic-expression)
129
129
    (comment-add                  . 1)
130
130
    (comment-start-skip           . "#+ *")
131
 
    (comment-use-syntax           . nil) ;; regexp based, probably faster than syntax based
 
131
    (comment-use-syntax           . t)  ; see log for bug report 2013-06-07
132
132
    (comment-column               . 40)
133
133
    (ess-no-skip-regexp           . (concat "^ *@\\|" (default-value 'ess-no-skip-regexp)))
134
134
    ;; inferior-ess-prompt is used by comint for navigation, only if
245
245
(defconst ess-help-S+-sec-regex "^[A-Z. ---]+:$"
246
246
  "Reg(ular) Ex(pression) of section headers in help file.")
247
247
 
248
 
(defconst ess-help-R-sec-regex "^[A-Z][a-z].+:$"
 
248
(defconst ess-help-R-sec-regex "^[A-Z][A-Za-z].+:$"
249
249
  "Reg(ular) Ex(pression) of section headers in help file.")
250
250
 
251
251
;;; S-mode extras of Martin Maechler, Statistik, ETH Zurich.
600
600
  "Fix Miscellaneous S/R `ill-formation's from current \\[point].
601
601
 Particularly use \"<-\"and put spaces around operators."
602
602
  (interactive "d\nP"); Defaults: point and prefix (C-u)
 
603
  ;; activate by (setq ess-verbose t)
 
604
  (ess-if-verbose-write
 
605
   (format "ess-fix-misc begin (from = %s, verbose = %s)\n" from verbose))
603
606
  (save-excursion
604
607
 
605
608
    (if (string= ess-dialect "R")
607
610
          (require 'ess-r-d)
608
611
          (R-fix-T-F from (not verbose))))
609
612
 
 
613
    ;; activate by (setq ess-verbose t)
 
614
    (ess-if-verbose-write "ess-fix-misc: after fix-T-F\n");___D___
 
615
 
610
616
    ;; former C and matlab programmers leave trailing  ";" :
611
 
    (goto-char from) (ess-rep-regexp "; *$" "" nil 'literal verbose)
 
617
    ;; (goto-char from) (ess-rep-regexp "; *$" "" nil 'literal verbose)
 
618
    ;; (ess-if-verbose-write "ess-fix-misc: after trailing ';'\n");___D___
612
619
    (goto-char from) (ess-rep-regexp ";\\( *\\)#" "\\1#" nil nil verbose)
 
620
    (ess-if-verbose-write "ess-fix-misc: after ';' before #\n");___D___
613
621
 
614
622
    ;;from R 1.9.x "_" is valid in names; here assume no initial / trailing '_'
615
623
    (goto-char from) (ess-rep-regexp " +_ *" " <- " nil 'literal verbose)
616
624
    (goto-char from) (ess-rep-regexp   "_ +" " <- " nil 'literal verbose)
617
625
 
 
626
    (ess-if-verbose-write "ess-fix-misc: before 'around \"<-\"' :\n");___D___
618
627
    ;; ensure space around  "<-"  ---- but only replace if necessary:
619
628
    (goto-char from)
620
629
    (ess-rep-regexp "\\([^< \t\n]\\)\\(<<?-\\)" "\\1 \\2" nil nil verbose)
628
637
    (goto-char from)
629
638
    (ess-rep-regexp "\\(<=?\\)\\([^-<= \t\n]\\)" "\\1 \\2" nil nil t)
630
639
 
 
640
    (ess-if-verbose-write "ess-fix-misc: before \"=\" \"==\" .. :\n");___D___
631
641
    ;; -- ensure space around "=", "==", "!=" :
632
642
    (goto-char from) ;; --> " ="
633
643
    (ess-rep-regexp "\\([^=!<> ]\\)\\([=!]?\\)=" "\\1 \\2=" nil nil verbose)
640
650
    (ess-rep-regexp "\\([A-Za-z0-9()]\\)}" "\\1 }" 'fix nil verbose)
641
651
    (ess-space-around "else" from verbose)
642
652
 
 
653
    (ess-if-verbose-write "ess-fix-misc: after \"{ ... }\" :\n");___D___
643
654
    (goto-char from) ;; add a space inside "){"
644
655
    (ess-rep-regexp "){" ") {" 'fix nil verbose)
645
656
 
649
660
    (goto-char from)
650
661
    (ess-rep-regexp "^\\([^#{\n]*[^#{ \t\n]+[ \t]*\\)}[ \t]*$"
651
662
                    "\\1\n}" 'fix nil verbose)
 
663
    (ess-if-verbose-write "ess-fix-misc __end__\n");___D___
652
664
    ))
653
665
 
654
666
;; This is by Seth Falcon, modeled after ess-toggle-underscore (see below).
694
706
    (ignore-errors
695
707
      (when (and (eq major-mode 'inferior-ess-mode)
696
708
                 (> (point) (process-mark (get-buffer-process (current-buffer)))))
697
 
        (narrow-to-region (process-mark (get-ess-process)) (point-max)))
 
709
        (narrow-to-region (process-mark (ess-get-process)) (point-max)))
698
710
      (and ess-noweb-mode
699
711
           (ess-noweb-in-code-chunk)
700
712
           (ess-noweb-narrow-to-chunk))