| 1 |
;ELC |
| 2 |
;;; Compiled |
| 3 |
;;; in Emacs version 27.1 |
| 4 |
;;; with all optimizations. |
| 5 |
|
| 6 |
;;; This file uses dynamic docstrings, first added in Emacs 19.29. |
| 7 |
|
| 8 |
;;; This file does not contain utf-8 non-ASCII characters, |
| 9 |
;;; and so can be loaded in Emacs versions earlier than 23. |
| 10 |
|
| 11 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 12 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 13 |
|
| 14 |
|
| 15 |
(custom-declare-group 'pander nil "ESS integration of pander R package" :group 'ess) |
| 16 |
#@25 Keymap for pander-mode. |
| 17 |
(defvar pander-mode-map (byte-code "\301 \302\303\304#\210\302\305\306#\210\302\307\310#\210)\207" [keymap make-sparse-keymap define-key "pb" pander-brew "pB" pander-brew-export "pe" pander-eval] 4) (#$ . 493)) |
| 18 |
#@91 Non-nil if Pander mode is enabled. |
| 19 |
Use the command `pander-mode' to change this variable. |
| 20 |
(defvar pander-mode nil (#$ . 742)) |
| 21 |
(make-variable-buffer-local 'pander-mode) |
| 22 |
#@477 Toggle pander mode. |
| 23 |
With no argument, this command toggles the mode. |
| 24 |
Non-null prefix argument turns on the mode. |
| 25 |
Null prefix argument turns off the mode. |
| 26 |
|
| 27 |
If called interactively, enable Pander mode if ARG is positive, |
| 28 |
and disable it if ARG is zero or negative. If called from Lisp, |
| 29 |
also enable the mode if ARG is omitted or nil, and toggle it if |
| 30 |
ARG is `toggle'; disable the mode otherwise. |
| 31 |
|
| 32 |
When pander mode is enabled, some keybindigs |
| 33 |
are activated for pander functions. |
| 34 |
(defalias 'pander-mode #[(&optional arg) "\304 \305=\203 \n?\202 \306 !\307V\310\311\n\203 \312\202 \313\"\210\314\315!\203D \304 \2033 \304 \232\203D \316\317\320\n\203? \321\202@ \322#\210))\323 \210\n\207" [#1=#:last-message arg pander-mode local current-message toggle prefix-numeric-value 0 run-hooks pander-mode-hook pander-mode-on-hook pander-mode-off-hook called-interactively-p any " in current buffer" message "Pander mode %sabled%s" "en" "dis" force-mode-line-update] 4 (#$ . 917) (list (or current-prefix-arg 'toggle))]) |
| 35 |
(defvar pander-mode-hook nil) |
| 36 |
(byte-code "\301\302N\204\f \303\301\302\304#\210\305\306\307\310\300!\205 \311\211%\210\312\313\311\314\315\316\317\320&\210\312\321\311\322\315\316\317\320&\207" [pander-mode-map pander-mode-hook variable-documentation put "Hook run after entering or leaving `pander-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" add-minor-mode pander-mode " pander" boundp nil custom-declare-variable pander-clipboard "If non-nil then the result of pander-* functions would be copied to clipboard." :type boolean :group pander pander-show-source "If non-nil then the source of R commands would also show up in generated documents while running 'pander-eval'. This would not affect 'brew' function ATM."] 8) |
| 37 |
#@68 Prettify results in *ess-output* and optionally copy to clipboard. |
| 38 |
(defalias 'pander-postprocess-output #[nil "\301q\210\302 \210\303\304\305 \306\\\307#\203 \310\311!\210\202 \205 \312ed\"\207" [pander-clipboard "*ess-output*" beginning-of-line re-search-forward "\\+ " point-at-eol 0 go replace-match "" clipboard-kill-ring-save] 4 (#$ . 2758)]) |
| 39 |
#@194 Run Pandoc.brew on current buffer or region (if mark is active), show results in *ess-output* and (optionally) copy results to clipboard while setting working directory to tempdir() temporary. |
| 40 |
(defalias 'pander-brew #[nil "\212\203 \303\304 \305 \"\306\307\310\311\312\313 #\"!\210)\202\" \306\307\314\n\"!\210\315 )\207" [mark-active selection buffer-file-name buffer-substring-no-properties region-beginning region-end ess-execute format "require(pander, quietly=T);wd<-getwd();setwd(tempdir());Pandoc.brew(text=\"%s\");setwd(wd)\n" replace-regexp-in-string "\"" "'" "require(pander, quietly=T);wd<-getwd();setwd(tempdir());Pandoc.brew(\"%s\");setwd(wd)\n" pander-postprocess-output] 7 (#$ . 3117) nil]) |
| 41 |
#@173 Run Pandoc.brew on current buffer or region (if mark is active) and export results to specified (auto-complete in minibuffer) format. Also tries to open exported document. |
| 42 |
(defalias 'pander-brew-export #[nil "\212\304\305\306\307\211\310% \203# \311\312 \313 \"\314\315\316\317\320\321\n##!)\202* \314\315\322#!*\207" [output-format mark-active selection buffer-file-name completing-read "Output format: " (("html" 1) ("pdf" 2) ("odt" 3) ("docx" 4)) nil "html" buffer-substring-no-properties region-beginning region-end ess-command format "require(pander, quietly=T);wd<-getwd();setwd(tempdir());Pandoc.brew(text=\"%s\",output=tempfile(),convert=\"%s\" );setwd(wd)\n" replace-regexp-in-string "\"" "'" "require(pander, quietly=T);wd<-getwd();setwd(tempdir());Pandoc.brew(\"%s\",output=tempfile(),convert=\"%s\");setwd(wd)\n"] 7 (#$ . 3833) nil]) |
| 43 |
#@314 Run pander on (automatically evaluated) region *or* current chunk (if marker is not set), show results (of last returned R object) in *ess-output* and (optionally) copy those to clipboard while setting working directory to tempdir() temporary. Chunk is recognized by opening '<%' or '<%=', and closing '%>' tags. |
| 44 |
(defalias 'pander-eval #[nil "\212\203 \306\202\n \307\n\2034 \310\311 \312 \"\211G\313U\203$ \314\315!\210\2020 \316\317\320\321\322\323# #!\210)\202d \324\211\325\324x\210`\326\324w\210`\310
\f\"\211G\313U\203W \314\327!\210\202c \316\317\320\321\322\323# #!\210+)\330 )\207" [pander-show-source show-src mark-active selection p2 p1 "TRUE" "FALSE" buffer-substring-no-properties region-beginning region-end 0 message "Nothing selected in region." ess-execute format "pander:::ess.pander.evals(\"%s\", show.src=%s)\n" replace-regexp-in-string "\"" "'" nil "^<%[=]+" "^%>" "Pointer is not inside a chunk!" pander-postprocess-output] 8 (#$ . 4691) nil]) |
| 45 |
(provide 'pander) |