[ESS] [EXTERNAL] Re: How to Duplicate Previous Functionality/Workflow

Sebastian Meyer @eb@meyer @end|ng |rom |@u@de
Wed Sep 27 09:08:02 CEST 2023


I don't regularly use polymode exporters as I usually have a Makefile, 
but when I tried last time I came up with the following ad-hoc 
customizations in my .emacs to be able to quickly render Rnw and Rmd 
documents via "\C-c\C-c".

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'poly-R)
(setq polymode-weaver-output-file-format "%s"    ; without "-woven"
       polymode-exporter-output-file-format "%s"  ; without "-exported"
       )

;; render Rnw documents via R CMD Sweave --pdf
(defvar poly-r-buildVignette-exporter
   (pm-shell-exporter :name "buildVignette"
                      :from
                      '(("Rnw" "\\.[rR]nw\\'" "Build Vignette" "R CMD 
Sweave --pdf --clean %i"))
                      :to
                      '(("pdf"   "pdf"  "PDF" ""))
                      :quote t)
   "Export via R CMD Sweave --pdf --clean.")
(polymode-register-exporter poly-r-buildVignette-exporter t 
poly-noweb+r-polymode)

;; quick export
(defun polymode-export-default ()
   "Export current (vignette) source file. Works for both Rnw and Rmd."
   (interactive)
   (if (bound-and-true-p poly-noweb+r-mode)
       (polymode-export)  ; there is only one variant, so won't ask
     (oset pm/polymode :exporter 'poly-r-markdown-exporter)
     (setq-local browse-url-browser-function
                 #'(lambda (URL &optional NEW-WINDOW)
                     (other-window 1) (eww-open-file URL) (other-window 
-1)))
     (polymode-export nil "default")))

;; bind it to C-c C-c ("compile" as in LaTeX mode) when in polymode
(define-key poly-markdown+r-mode-map "\C-c\C-c" 'polymode-export-default)
(define-key poly-noweb+r-mode-map "\C-c\C-c" 'polymode-export-default)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Hope this helps.
Best regards,

	Sebastian Meyer


Am 26.09.23 um 20:38 schrieb Bassett Jr,Roland L via ESS-help:
> Thanks to everyone for their responses - you've definitely helped with most of my questions.  One still remains, though:
> 
> How can I customize the weaver and the exporter so that it doesn't ask each time?  It seems as though there should be a way to customize each of these, but I can't figure out what it is.
> 
> Roland Bassett
> Principal Biostatistician
> Department of Biostatistics - Unit 1411
> Faculty Center Tower FCT4.6071
> The University of Texas M. D. Anderson Cancer Center
> P.O. Box 301402
> Houston, TX 77230
> 
> Phone: 713-563-4272
> Fax: 713-563-4242
> Email: rlbasset using mdanderson.org
> 
> -----Original Message-----
> From: ESS-help <ess-help-bounces using r-project.org> On Behalf Of Tyler Smith via ESS-help
> Sent: Saturday, September 23, 2023 10:38 AM
> To: Stephen J. Eglen <sje30 using cam.ac.uk>
> Cc: ESS-help <ess-help using r-project.org>
> Subject: [EXTERNAL] Re: [ESS] How to Duplicate Previous Functionality/Workflow
> 
> THIS EMAIL IS A PHISHING RISK
>   Do you trust the sender?
>      The email address is: ess-help-bounces using r-project.org
>      While this email has passed our filters, we need you to review with caution before taking any action.
>      If the email looks at all suspicious, click the Report a Phish button.
> 
> On Fri, Sep 22, 2023, at 2:04 AM, Stephen J. Eglen wrote:
>>> (You probably didn't do this, because Docview isn't great for pdfs.
>>> The now abandoned package pdf-tools was a great option for reading
>>> pdfs inside Emacs).
>>
>> just to add a couple of comments:
>>
>> 1. pdf-tools was forked about 1-2 years ago, and now active at:
>>
>> https://urldefense.com/v3/__https://github.com/vedang/pdf-tools__;!!Pf
>> beBCCAmug!hJB8MImjmlLQXcAB-LAswXJZi7hbkrS4q5t30Qi2hgkPBMiYQFEMW4gXbr-6
>> hVAcqLnnAh9bX0OFHLbHRmIz8Hs$
>>
>> It can be a bit fussy to install compared to most Emacs packages,
>> because of dependencies and the binaries it creates.  However, I like
>> it and use it regularly.
>>
> 
> Thanks, that's great news!  pdf-tools was my preferred pdf viewer when it was active. I'll definitely check out the new fork
> 
> ty
> 
> ______________________________________________
> ESS-help using r-project.org mailing list
> https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/ess-help__;!!PfbeBCCAmug!hJB8MImjmlLQXcAB-LAswXJZi7hbkrS4q5t30Qi2hgkPBMiYQFEMW4gXbr-6hVAcqLnnAh9bX0OFHLbH1kUWylg$
> 
> The information contained in this e-mail message may be ...{{dropped:11}}
> 
> ______________________________________________
> ESS-help using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list