From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Sun, 17 Apr 2016 12:04:06 -0700 From: Endre Bakken Stovner Reply-To: kyleam/snakemake-mode Message-ID: In-Reply-To: References: Subject: Re: Support R syntax highlighting in R("""-blocks (#6) Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_5713de26e51be_3d8d3ff2934412c02310c3"; charset=UTF-8 Content-Transfer-Encoding: 7bit List-ID: kyleam/snakemake-mode List-Archive: https://github.com/kyleam/snakemake-mode List-Post: List-Unsubscribe: , To: kyleam/snakemake-mode Cc: Kyle Meyer ----==_mimepart_5713de26e51be_3d8d3ff2934412c02310c3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit I will open this as a separate PR if you accept the changes: ```elisp ;;;;;;;;;;;;; Will be added to snakemake-mode.el ;;; Embedded language syntax-highlighting (defun snakemake-mode-setup-mmm () "Call this function in your startup-file to automatically highlight embedded R-code. You must have the R-strings either within a R(''' ''') function call or a code block delimited with '''#r and '''." (if (require 'mmm-mode nil 'noerror) (progn (require 'mmm-mode) (setq mmm-global-mode 'maybe) (mmm-add-classes '((snakemake-R-call-double :submode R-mode :front ".*R\(\"\"\"" :back ".*\"\"\"\)"))) (mmm-add-classes '((snakemake-R-call-regular :submode R-mode :front ".*R\('''" :back ".*'''\)"))) (mmm-add-classes '((snakemake-R-string-double :submode R-mode :front ".*\"\"\" * # *[rR]" :back ".*\"\"\""))) (mmm-add-classes '((snakemake-R-string-regular :submode R-mode :front ".*''' * # *[rR]" :back ".*'''"))) (mmm-add-mode-ext-class 'snakemake-mode nil 'snakemake-R-call-double) (mmm-add-mode-ext-class 'snakemake-mode nil 'snakemake-R-call-regular) (mmm-add-mode-ext-class 'snakemake-mode nil 'snakemake-R-string-double) (mmm-add-mode-ext-class 'snakemake-mode nil 'snakemake-R-string-regular)) (error "You need to install mmm-mode"))) (snakemake-mode-setup-mmm) ``` I guess this should be documented, but it would be strange to document this when most of the package is not documented (in any README/FAQ file). Most users probably do not read the code. --- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/kyleam/snakemake-mode/pull/6#issuecomment-211084302 ----==_mimepart_5713de26e51be_3d8d3ff2934412c02310c3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

I will open this as a separate PR if you accept the changes:

;;;;;;;;;;;;; Will be added to snakemake-mode.el

;;; Embedded language syntax-highlighting

(defun snakemake-mode-setup-mmm ()
  "Call this function in your startup-file to automatically highlight embedded R-code.

You must have the R-strings either within a R(''' ''') function call or a code block delimited with '''#r and '''."

  (if (require 'mmm-mode nil 'noerror)
      (progn (require 'mmm-mode)
             (setq mmm-global-mode 'maybe)

             (mmm-add-classes
              '((snakemake-R-call-double
                 :submode R-mode
                 :front ".*R\(\"\"\""
                 :back ".*\"\"\"\)")))

             (mmm-add-classes
              '((snakemake-R-call-regular
                 :submode R-mode
                 :front ".*R\('''"
                 :back ".*'''\)")))

             (mmm-add-classes
              '((snakemake-R-string-double
                 :submode R-mode
                 :front ".*\"\"\" * # *[rR]"
                 :back ".*\"\"\"")))

             (mmm-add-classes
              '((snakemake-R-string-regular
                 :submode R-mode
                 :front ".*''' * # *[rR]"
                 :back ".*'''")))

             (mmm-add-mode-ext-class 'snakemake-mode nil 'snakemake-R-call-double)
             (mmm-add-mode-ext-class 'snakemake-mode nil 'snakemake-R-call-regular)
             (mmm-add-mode-ext-class 'snakemake-mode nil 'snakemake-R-string-double)
             (mmm-add-mode-ext-class 'snakemake-mode nil 'snakemake-R-string-regular))
    (error "You need to install mmm-mode")))

(snakemake-mode-setup-mmm)

I guess this should be documented, but it would be strange to document this when most of the package is not documented (in any README/FAQ file). Most users probably do not read the code.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub

----==_mimepart_5713de26e51be_3d8d3ff2934412c02310c3--