On Tue, Feb 6, 2018 at 3:08 PM, Paul Johnson <pauljoh...@gmail.com> wrote: > On Tue, Feb 6, 2018 at 11:31 AM, Ista Zahn <istaz...@gmail.com> wrote: >> Hi Paul, >> >> Why do you expect polymode to provide an indention benefit? "All" it >> does in the .Rmd case is give you a buffer with markdown-mode parts >> and R-mode parts. Indentation in the R-mode parts is handled by ESS, >> and indentation in markdown-mode parts is handled by markdown-mode. >> >> Or are you trying to say that indentation in the markdown portion of a >> polymode buffer is different than indentation in a plain markdown-mode >> buffer? >> > > Ugh. I see. It is not a polymode problem. I just don't like > markdown-mode so much. > > If anybody has tips for working with Rmd files, I'm all ears at this point.
Just to be sure, do you actually have http://melpa.org/#/markdown-mode installed? I still prefer org-mode to .Rmd, but markdown support in Emacs is not bad IMO. Best, Ista > > Best > pj >> Best, >> Ista >> >> On Tue, Feb 6, 2018 at 11:24 AM, Paul Johnson <pauljoh...@gmail.com> wrote: >>> I wonder if I've got polymode set up correctly. I have Ubuntu 17.10 >>> Emacs 25.2 Ess 17.11, it works well to edit R files. Today I installed >>> polymode from melpa, >>> >>> When I open an Rmd file, I can visually see a difference. The code >>> chunks are likely shaded areas. Also, some keywords within the R >>> chunks are highlighted. "library" appears as light green, and the >>> quoted arguments within function calls are different colors. >>> >>> However, while editing the file, it seems like editing features don't >>> work correctly. In the chunks that are R code, indentation works as >>> expected. However, outside the chunks, polymode has no indentation >>> benefit. I expect things that should be flush left should stay there, >>> but tabbing causes indentation. For example, where a line starts with >>> >>> # R data import >>> >>> or >>> >>> ```{r} >>> >>> A tab in either line, at any point within the line, causes 4 spaces before >>> ```. >>> >>> Lately, I've been trying to get Emacs to work with python and that has >>> been a massive pain. Its possible I broke polymode by fiddingly with >>> that. So here's the init.el: >>> >>> (when (>= emacs-major-version 24) >>> (require 'package) >>> (package-initialize) >>> (add-to-list 'package-archives >>> '("melpa" . "http://melpa.milkbox.net/packages/") t) >>> (add-to-list 'package-archives >>> '("melpa-stable" . "https://stable.melpa.org/packages/"))) >>> >>> (package-initialize) >>> (elpy-enable) >>> >>> >>> ;; Org-mode with R doesn't work without this >>> ;; http://orgmode.org/worg/org-contrib/babel/how-to-use-Org-Babel-for-R.html >>> (custom-set-variables >>> ;; custom-set-variables was added by Custom. >>> ;; If you edit it by hand, you could mess it up, so be careful. >>> ;; Your init file should contain only one such instance. >>> ;; If there is more than one, they won't work right. >>> '(ansi-color-names-vector >>> ["#2e3436" "#a40000" "#4e9a06" "#c4a000" "#204a87" "#5c3566" >>> "#729fcf" "#eeeeec"]) >>> '(column-number-mode t) >>> '(cua-auto-tabify-rectangles nil) >>> '(cua-mode t nil (cua-base)) >>> '(custom-enabled-themes (quote (whiteboard))) >>> '(inferior-R-args "--no-restore-history --no-save") >>> '(org-babel-load-languages (quote ((emacs-lisp . t) (R . t)))) >>> '(org-confirm-babel-evaluate nil) >>> '(package-selected-packages (quote (polymode elpygen elpy))) >>> '(show-paren-mode t)) >>> >>> (setq default-tab-width 4) >>> >>> ;; Section II. Keyboard and mouse customization >>> ;; Mouse and cursor in the usual Mac/Windows way >>> (delete-selection-mode t) >>> ;; >>> http://stackoverflow.com/questions/13036155/how-to-to-combine-emacs-primary-clipboard-copy-and-paste-behavior-on-ms-windows >>> (setq select-active-regions t) >>> ;; Trying to make mouse middle-click only paste from primary >>> ;; X11 selection, not clipboard and kill ring: >>> (global-set-key [mouse-2] 'mouse-yank-primary) >>> ;; highlight does not alter Kill ring: >>> (setq mouse-drag-copy-region nil) >>> ;; windows style binding C-x, C-v, C-c, C-z: >>> (cua-mode t) >>> ;; Don't tabify after rectangle commands: >>> (setq cua-auto-tabify-rectangles nil) >>> >>> ;; Section III. Programming conveniences: >>> ;; light-up matching parens: >>> (show-paren-mode t) >>> ;; turn on syntax highlighting: >>> (global-font-lock-mode t) >>> ;; Auto fill is TRUE in text modes: >>> (setq text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify))) >>> >>> >>> ;; Section IV. ESS Emacs Statistics >>> >>> (require 'ess-site) >>> ;; soft require: no error if package not found >>> (require 'ess-smart-underscore nil 'noerror) >>> >>> (require 'poly-R) >>> (require 'poly-markdown) >>> >>> (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode)) >>> ;; start R in current working directory, don't let R ask user: >>> (setq ess-ask-for-ess-directory nil) >>> >>> ;; Change shortcut "run this line" to use Shift-Return >>> ;; Suggested by Vitalie Spinu 2013-09-30 to co-exist with Windows Emacs >>> (eval-after-load "ess-mode" >>> '(progn >>> (define-key ess-mode-map [(control return)] nil) >>> (define-key ess-mode-map [(shift return)] >>> 'ess-eval-region-or-line-and-step)) >>> ) >>> >>> ;; Help in frames? >>> (setq ess-help-own-frame 'one) >>> >>> ;; I want the *R* process in its own frame >>> (setq inferior-ess-own-frame t) >>> (setq inferior-ess-same-window nil) >>> >>> ;; Problem in Windows about menus not displaying >>> ;; https://stat.ethz.ch/pipermail/ess-help/2012-September/008207.html >>> ;;(if (eq system-type 'windows-nt) >>> (defun my-R-execute-options () >>> (ess-command "options(menu.graphics = FALSE)\n")) >>> (add-hook 'ess-R-post-run-hook 'my-R-execute-options) >>> ;;) >>> >>> ;; Put # flush left >>> ;; See gmail thread in ESS group, this from Ista >>> (add-hook 'ess-mode-hook >>> (lambda() >>> ;; don't indent comments >>> (setq ess-indent-with-fancy-comments nil) >>> ;; turn on outline mode >>> (setq-local outline-regexp "[# ]+") >>> (outline-minor-mode t))) >>> >>> ;; Section V. Frames oriented Emacs >>> >>> ;; Make files opened from the menu bar appear in their own >>> ;; frames. Adapted from Emacs menu-bar.el >>> (defun menu-find-existing () >>> "Edit the existing file FILENAME." >>> (interactive) >>> (let* ((mustmatch (not (and (fboundp 'x-uses-old-gtk-dialog) >>> (x-uses-old-gtk-dialog)))) >>> (filename (car (find-file-read-args "Find file: " mustmatch)))) >>> (if mustmatch >>> (find-file-other-frame filename) >>> (find-file filename)))) >>> (define-key menu-bar-file-menu [new-file] >>> '(menu-item "Open/Create" find-file-other-frame >>> :enable (menu-bar-non-minibuffer-window-p) >>> :help "Create a new file")) >>> (define-key menu-bar-file-menu [open-file] >>> '(menu-item ,(purecopy "Open File...") menu-find-existing >>> :enable (menu-bar-non-minibuffer-window-p) >>> :help ,(purecopy "Read an existing file into an Emacs >>> buffer"))) >>> >>> >>> ;; Open directory list in new frame. >>> (define-key menu-bar-file-menu [dired] >>> '(menu-item "Open Directory..." dired-other-frame >>> :help "Read a directory; operate on its files (Dired)" >>> :enable (not (window-minibuffer-p (frame-selected-window >>> menu-updating-frame))))) >>> >>> >>> >>> >>> ;; Section VI: Miscellaneous convenience >>> ;; Remove Emacs "splash screen" http://fuhm.livejournal.com/ >>> (defadvice command-line-normalize-file-name >>> (before kill-stupid-startup-screen activate) >>> (setq inhibit-startup-screen t)) >>> (setq inhibit-splash-screen t) >>> >>> ;; Show file name in title bar >>> ;; http://www.thetechrepo.com/main-articles/549 >>> (setq frame-title-format "%b - Emacs") >>> >>> ;; Make Emacs scroll smoothly with down arrow key. >>> ;; faq 5.45 >>> http://www.gnu.org/s/emacs/emacs-faq.html#Modifying-pull_002ddown-menus >>> (setq scroll-conservatively most-positive-fixnum) >>> >>> ;; Remember password when connected to remote sites via Tramp >>> ;; >>> http://stackoverflow.com/questions/840279/passwords-in-emacs-tramp-mode-editing >>> ;; Emacs "tramp" service (ssh connection) constantly >>> ;; asks for the log in password without this >>> (setq password-cache-expiry nil) >>> >>> >>> ;; Emacs shells work better >>> ;; http://snarfed.org/why_i_run_shells_inside_emacs >>> (setq ansi-color-for-comint-mode 'filter) >>> (setq comint-prompt-read-only t) >>> (setq comint-scroll-to-bottom-on-input t) >>> (setq comint-scroll-to-bottom-on-output t) >>> (setq comint-move-point-for-output t) >>> >>> >>> PJ >>> >>> -- >>> Paul E. Johnson http://pj.freefaculty.org >>> Director, Center for Research Methods and Data Analysis http://crmda.ku.edu >>> >>> To write to me directly, please address me at pauljohn at ku.edu. >>> >>> ______________________________________________ >>> ESS-help@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/ess-help > > > > -- > Paul E. Johnson http://pj.freefaculty.org > Director, Center for Research Methods and Data Analysis http://crmda.ku.edu > > To write to me directly, please address me at pauljohn at ku.edu. ______________________________________________ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help