Coder Social home page Coder Social logo

polymode's Introduction

License GPL 3 MELPA

Polymode Logo

Polymode is a framework for multiple major modes (MMM) inside a single Emacs buffer. It is fast and has a simple but flexible object oriented design. Creating new polymodes normally takes a few lines of code.

Installation instructions and the full documentation are available at https://polymode.github.io/.

polymode's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

polymode's Issues

Hanging when editing in cloud

I'm using polymode with Emacs 24.3.1. When editing R markdown files locally on my computer, everything works smoothly. However, if I try to edit them on a remote server (I'm in a work environment where code doesn't normally sit on our local machines), Emacs slows to an unusable crawl with polymode enabled.

There error messages that spam the buffer seems to point to jit-lock-function (where somefile is a filepath on the server):

Error during redisplay: (jit-lock-function 1074) signaled (error "IO error reading /somefile: Is a directory")

What is it trying to read that it can't find? Is there a workaround? Let me know if there's more info I can provide. Thanks!

-Sharon

Invalid function: with-silent-modifications

I recently updated ESS on emacs 24.3 on Mac to version 13.09-1. Now, opening a .Rmd file that had been fine running ESS-13.05 now results in errors in the .Rmd buffer:

polymode error: Invalid function: with-silent-modifications

This is with or without an R interpreter running. Any suggestions?

implementation of polymode-mark-or-extend-chunk

I apologize for not submitting this as a PR, it's so miniscule ...

This is a simple implementation of what I believe polymode-mark-or-extend-chunk is intended to do (or at least polymode-mark-chunk). It works with Rmd, and I think it will work with Rnw, though since I don't use it I have not tested it extensively.

The regexps are decent but it is certainly possible to improve them. For instance, if the user is currently not in a code chunk, this doesn't behave as one would expect, so it might be better instead to check to make sure that there isn't a chunk-end in between the point and chunk-begin (and vice versa).

--- polymode.el.orig    2014-12-04 09:34:43.564938900 -0800
+++ polymode.el 2014-12-04 09:34:46.890744900 -0800
@@ -235,8 +235,13 @@
       (_ (pm/narrow-to-span)))))

 (defun polymode-mark-or-extend-chunk ()
+  "Put point at the beginning of this chunk (assuming we are in a chunk), mark at the end. The chunk marked is the one that contains the point."
   (interactive)
-  (error "Not implemented yet"))
+  (re-search-forward "^\\(```\\|@\\)\\s-*$")
+  (move-beginning-of-line nil)
+  (push-mark nil t t)
+  (re-search-backward "^\\(```\\|<<\\)")
+  (move-beginning-of-line 2))

 (defun polymode-insert-new-chunk ()
   (interactive)

Hide implementation buffers from buffer switching

I use Ido for buffer switching. If I open a file with my self-defined multimode, Ido shows three buffers for that file:

  • file.jsp
  • file.jsp[js]
  • file.jsp[fundamental]

This makes switching to other buffers with similar name more complicated, because minibuffer is full of stuff I don't care about (i.e. when typing 'fi' I don't want to see 'file.jsp[js]' or 'file.jsp[fundamental] because it is implementation details, instead I'd like to see 'file2.jsp', for example).

I'm not sure if it is possible to generally hide buffers from Ido or other buffer switching at all. If it is not possible at the moment, it would help to at least name them in such a way I would not see them.

Wrong number of arguments?

I may be using this completely incorrectly, but I tried exporting my Rmd to LaTeX:

Title
====================================

Here's some test!

\```{r md-cars-scatter, message=FALSE, fig.width=7, fig.height=5}
library(ggplot2)
qplot(hp, mpg, data=mtcars)+geom_smooth() 
\```

Then M-n e as I understood this to be sort of the evaluate keystroke.

Got an error in my buffer that I had the wrong number of arguments...

wrongnumberofarguments

I'm using the polymode from the MELPA repositories.

poly-markdown+r-mode doesn't like ESS evaluation commands?

Open an .Rmd file and type in

testing...

```R
x <- function() {
  1
}
```

Position cursor in the function and type C-c C-c, C-c C-p, or such. It tries to evaluate the lines with the backticks along with the lines belonging to the function.

variable is void: -auto-chunkmodes

I'm getting the following message in emacs' *Messages*:

polymode error: Symbol's value as variable is void: -auto-chunkmodes

Most emacs commands fail inside of code ("```") blocks, including (but not limited to) emacs' transient-mark-mode. (Outside of the code block, `transient-mark-mode` and others appear to be working just fine.)

(Win7 x64, emacs 24.3.1 (i386-mingw-nt6.1.7601), polymode installed from git, current as of April 14.)

start with poly-markdown-mode not markdown-mode

I've found that switching from markdown-mode to poly-markdown-mode confuses the font lock system on simple sample files. It seems better to start with poly-markdown-mode straight away.

{"awesome":true}

CAnnot open load file: color

Hi,

I am trying to get polymode to syntax-highlight my Rmd files, but it's complaining about a 'color' load file:

cd ~/.emacs.d
git clone https://github.com/vitoshka/polymode.git

In my .emacs file:

(add-to-list 'load-path "/home/avilella/.emacs.d/polymode/")
(add-to-list 'load-path "/home/avilella/.emacs.d/polymode/modes/")

;; Require any polymode bundles that you are interested in:

(require 'poly-R)
(require 'poly-markdown)

eval-buffer:
Cannot open load file: color

Detect polymode is on

Is there an easy way to detect polymode is on? I want to turn off some minor mode, such as flycheck in polymode, which works well in AUCTeX and ESS, but useless in polymode.

I'm not quite sure whether it's the right place for seeking help. Please let me know if there is a better place such as mailing list or forum. Thanks!

polymode font-lock error: End of buffer (beg:

When I type in chunk of Rmd file, there was a error of “polymode font-lock error: End of buffer (beg: 109 end: 120)” , one type one error, and the responded speed become very slow. When I typing, I could not see what I typed and what I deleted, there is a delay of typing.
who can tell me the reason about this problem?

Interaction with version control, read-only status

Hi Vitalie, I noticed a problem with polymode and RCS; if I check in (C-x v v) my file when in the markdown/text section of a buffer, the buffer then becomes read-only (as it should). However, when I move from text to go into a code chunk, the code buffer is not read-only, and I can continue editing the chunk. This then causes problems when I checkout the file again from the text buffer.

I can see simpler behaviour when doing the following

emacs

Create a new buffer "b.Rmd" with contents

some text

```{r}
x = 1
```

Move to line 1 and do C-x C-q to make buffer read only.

But then when I move within the code chunk, then of course the code chunk is still editable.

polymode font-lock error

I'm getting this error from polymode:

polymode font-lock error: Lisp nesting exceeds `max-lisp-eval-depth' (beg: 1 end: 126)
polymode font-lock error: Lisp nesting exceeds `max-lisp-eval-depth' (beg: 126 end: 633)
polymode font-lock error: Lisp nesting exceeds `max-lisp-eval-depth' (beg: 633 end: 1159

In conjunction with this error, the LaTeX is not getting highlighted.

Unfortunately I cannot attach the file; it contains private information. I tried expurgating the private information, but I am unable to duplicate the error with the expurgated file.

I installed polymode from MELPA and I appear to have version 20141204.2346. I'm running emacs 24.3.1.

Polymode on org file with code blocks makes emacs unresponsive

Running poly-mode on an org file with code blocks causes emacs to become unresponsive under high cpu load. Here a description of the problem that allows me to reproduce it.

test.org file:
https://gist.githubusercontent.com/julian-gehring/aafc645da45a6e95dac4/raw/bb6a6ec1002048d6577752cdc022a0ffee1f71f5/test-polymode.org

  1. Open the file: 'emacs test.org'
  2. Unfold the section tree: 'M-TAB'
  3. Place the cursor in line 6 (between heading and code block)
  4. Call 'M-x poly-org-mode'
  5. Place the cursor in the code block (arrow down)
    -> Emacs is unresponsive with high CPU load

Versions:

  • emacs 24.3.1 with standard config and .emacs
  • org: 8.2.6 (20140609)
  • polymode: 20140524.208

Void-function error in format-spec

I can reproduce this with an Rmd file with just "# Hello"

Here's the backtrace:

Debugger entered--Lisp error: (void-function format-spec)
signal(void-function (format-spec))
byte-code("\303�\304 #\210\305\n@\nA"\207" [weaver sentinel1 err eieio-oset :sentinel signal] 4)
pm-shell-weaver([object pm-shell-weaver "knitr" unbound (("latex" ".(tex|rnw)'" "tex" "LaTeX" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("html" ".x?html?'" "html" "HTML" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("markdown" ".r?md'" "md" "Markdown" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("rst" ".rst" "rst" "ReStructuredText" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("brew" ".r?brew'" "brew" "Brew" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("asciidoc" ".asciidoc'" "txt" "AsciiDoc" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("textile" ".textile'" "textile" "Textile" "Rscript -e "library(knitr); knit('%i', output='%o')"")) pm-default-shell-weave-function pm-default-shell-weave-sentinel] "markdown" ("markdown" . "html5"))
apply(pm-shell-weaver ([object pm-shell-weaver "knitr" unbound (("latex" ".(tex|rnw)'" "tex" "LaTeX" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("html" ".x?html?'" "html" "HTML" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("markdown" ".r?md'" "md" "Markdown" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("rst" ".rst" "rst" "ReStructuredText" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("brew" ".r?brew'" "brew" "Brew" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("asciidoc" ".asciidoc'" "txt" "AsciiDoc" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("textile" ".textile'" "textile" "Textile" "Rscript -e "library(knitr); knit('%i', output='%o')"")) pm-default-shell-weave-function pm-default-shell-weave-sentinel] "markdown" ("markdown" . "html5")))
eieio-generic-call-primary-only(pm-weave ([object pm-shell-weaver "knitr" unbound (("latex" ".(tex|rnw)'" "tex" "LaTeX" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("html" ".x?html?'" "html" "HTML" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("markdown" ".r?md'" "md" "Markdown" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("rst" ".rst" "rst" "ReStructuredText" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("brew" ".r?brew'" "brew" "Brew" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("asciidoc" ".asciidoc'" "txt" "AsciiDoc" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("textile" ".textile'" "textile" "Textile" "Rscript -e "library(knitr); knit('%i', output='%o')"")) pm-default-shell-weave-function pm-default-shell-weave-sentinel] "markdown" ("markdown" . "html5")))
pm-weave([object pm-shell-weaver "knitr" unbound (("latex" ".(tex|rnw)'" "tex" "LaTeX" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("html" ".x?html?'" "html" "HTML" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("markdown" ".r?md'" "md" "Markdown" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("rst" ".rst" "rst" "ReStructuredText" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("brew" ".r?brew'" "brew" "Brew" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("asciidoc" ".asciidoc'" "txt" "AsciiDoc" "Rscript -e "library(knitr); knit('%i', output='%o')"") ("textile" ".textile'" "textile" "Textile" "Rscript -e "library(knitr); knit('%i', output='%o')"")) pm-default-shell-weave-function pm-default-shell-weave-sentinel] "markdown" ("markdown" . "html5"))
polymode-export(nil)
call-interactively(polymode-export record nil)
command-execute(polymode-export record)
execute-extended-command(nil "polymode-export")
call-interactively(execute-extended-command nil nil)

Org as inner mode does not support headings

I'm currently working as an Android programmer, and have implemented poly-java+org-mode (attached)

Most of it works, but I couldn't add headings.
Attached are screenshots of the problem.
Here are the lines to add to init.el for the poly-java+org-mode
This is the code for the polymode:

(require 'org-src)
(require 'polymode)

(defcustom pm-host/java+org
  (pm-bchunkmode "Java+Org mode"
               :mode 'java-mode
           :font-lock-narrow nil)
  "Java+Org host innermode"
  :group 'hostmodes
  :type 'object)

(defcustom  pm-inner/java+org
  (pm-hbtchunkmode "java+org"
                   :mode 'org-mode
                   :head-reg "[/][*]Org"
                   :tail-reg "[*][/]"
           :head-mode 'host
           :tail-mode 'host
           :adjust-face '(:inherit 'fixed-pitch))
  "Java comment as Org-Mode."
  :group 'innermodes
  :type 'object)

(defcustom pm-poly/java+org
  (pm-polymode-one "java+org"
                        :hostmode 'pm-host/java+org
                        :innermode 'pm-inner/java+org
            :init-functions '(poly-java+org-remove-hooks))
  "Java with Org mode in comments"
  :group 'polymodes
  :type 'object)

;;;###autoload  (autoload 'poly-java+org-mode "poly-java")
(define-polymode poly-java+org-mode pm-poly/java+org)

(defun poly-java+org-remove-hooks ()
  ;; get rid of awfull hooks
  (remove-hook 'text-mode-hook 'variable-pitch-mode))

(provide 'poly-java)

And this is the java code for testing

package com.example


/*Org
* When I am writing it it works, but when I load the file again and try to move down
 */

public class example {
}

At the beginning it seems to work:
beginning
But after I save the file, load it again and move down until I hit the org chunk it gets a bug:
bug

Strange files on save

Maybe it's related to #11, in short: whenever I edit an R or YAML chunk in a rapport file, some strange files appear in the same directory. E.g. if I edit ANOVA.rapport, then .#ANOVA.rapport is created. This only happens if I edit something in an R or YAML chunk, but does not happen if I edit the main body (markdown).

I suppose this might be some temporary file for the multiple modes, but shouldn't it be deleted after saving the main file? Maybe I miss something here, can anyone reproduce this?

Demo rapport file to try: https://github.com/Rapporter/rapport/blob/master/inst/templates/ANOVA.rapport

Slow when typing?

The mode is great! But it became very slow when typing (not when I move the cursor around).

Is it normal?

polymode and comments in R Markdown files

With the most recent polymode and ess from git, there seems to be some sort of conflict between Markdown sections (#, ##, ...) and R comments in a chunk (with the same characters). For instance, with the simple test example below:

% Test example
% Mathieu Basille
% September 11, 2013


# First section

## And a sub-section

```{r sum}
2+2
```

Some text...


## Second sub-section

Some more text, and the faulty chunk with comments:

```{r comments}
2+2
## Wait, still 4?
```

And text you will never see again!


# Second section

More text...

Now you can open the file, go to the first section, and hit Tab to fold it. Everything works as expected. However, if you try to unfold it (Tab again), the R comment interferes:

[...]

# First section

## And a sub-section
## Second sub-section
## Wait, still 4?
# Second section

[...]

And everything that is below the comment until the next section is hidden forever, hitting Tab anywhere is unable to unfold the rest of the sub-section (the only solution I could find was to close and reopen the file).

Mathieu.

emacs-version: GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.4) of 2013-09-05 on dex, modified by Debian
ess-version: 13.09 [git: 800ab28f4c55d714a8be7d80cc19636215837bc5]
polymode version: commit 087dee76da2d01099f752529bced7cbcb165e093 (Jul 22 2013)

Polymode with evil-mode conflict

It looks like polymode is conflicting somehow with navigation in evil-mode. For example, if I create a simple test.Rmd file, with the following it it:

```{r}

```

and go to the bottom of the buffer (add in some extra newlines), and then navigate upwards with k in evil-mode, the following happens:

`k``{r}

k```

There's also something funky going on with typing:

```{r

where entering the final } moves the cursor (?).

Auto mode detection in poly-markdown breaks for emacs-lisp

Poly-markdown will automatically detects the mode to be used in a fenced code block and this works great for something like

```python
...
```

However it won't work for modes which are more than one word, e.g., emacs-lisp. So typing

```emacs-lisp
...
```

will not enter emacs-lisp-mode. I assume this is because of the following lines in poly-markdown.el:

:head-reg "^[ \t]*```[{ \t]*\\w.*$"
:tail-reg "^[ \t]*```[ \t]*$"
:retriever-regexp "```[ \t]*{?\\(\\w+\\)"

I think the solution to this would be to change :retriever-regexp to something like "```[ \t]*{?\\(\\w+[-\\w]*\\)"?

polymode, ess-R-smart-operators, and indention

Dear Vitalie,

many thanks for an extremely useful package!

There is only one smallish annoyance when editing in R-chunks in Rnw files (poly+noweb+r-mode) with ess-R-smart-operators set to t.

Suppose you are at the position indicated by | in the below R-chunk:

\documentclass{article}
\usepackage{Sweave}
\begin{document}

vjghh flflh.
<<>>==
a <- c(1|
@
bla.
\end{document}

Then, inserting a "," re-indents the surrounding expression. This is, of course, how it should be (and it works as it should in ess-r-mode). But in the R chunk it leads to an indention like this:

<<>>==
a <- c(1, |
@

You can reproduce the behaviour by calling "emacs -Q -l miniinit.el test.Rnw" with the following minimal init file:

;; -- Mode: Emacs-Lisp --
(let ((default-directory "/usr/share/emacs/site-lisp/"))
(normal-top-level-add-subdirs-to-load-path))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Auc-TeX
(load "auctex.el" nil t t)
(load "auctex-autoloads")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ESS
(load "ess-site")
(setq-default ess-R-smart-operators t
ess-swv-plug-into-AUCTeX-p t
ess-swv-pdflatex-commands "pdflatex")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Polymode
(load "polymode-autoloads")
(load "poly-R")
(add-to-list 'auto-mode-alist '(".Rnw" . poly-noweb+r-mode))

This must have to do with the indent-line-function called. But I am unable to spot the location where this happens.

Thank you very much,
Uli Poetter

P.S.: This is with emacs 24.3 and all packages last updated from (m)elpa just yesterday.

General polymode documentation

I've been using polymode for a while now, with great pleasure!

However, there are a few things that do not behave exactly as I wish, and I feel like it's mostly because I don't understand them, and how to tweak them. I was thus wondering whether there existed some detailed documentation on how to customize functions such as polymode-weave or polymode-export?

For instance, polymode-weave currently weave a file toto.Rmd into toto[weaved].md, and I'd like it to be simply toto.md. And I'm still unsure how to use polymode-export at all...

Thank you!
Mathieu.

Invalid slot name

Hi,

with the latest commit (6cc28b3) I'm getting this message:

Invalid slot name: #<pm-config-multi-auto markdown>, :auto-submode-name

from the *Warnings* buffer. Polymode and even ESS aren't working anymore. I could not figure out what might be wrong.

I can post the full message from emacs --debug-init if you need.

Thanks.

Melpa Install Doesn't Include modes Directory

Just tried a fresh install from the melpa repository using emacs 24.3 on MacOS 10.9.5. It seems that no modes/ directory is installed, so obviously no modes are working.

Anyone installed on this combination recently?

Polymode with color themes

I have adopted polymode as my standard ESS/R editing mode--works great so far. Recently, I tried using some of the color themes that ship with Emacs 24 and noticed that none of them work out-of-the-box with polymode/r-markdown because the code sections show up as highlighted, making text nearly unreadable. Any suggestions on how to alter behavior so that the color themes work better? I can (and have) set the color themes myself, but wondered about making things more compatible with the standard themes.

I realize this is probably not a polymode problem, but thought I would ask experienced users what they are doing.

Markdown mode will not install correctly on Mac OS 10.9.4

Using MELPA as suggest in the README, I cannot get polymode to install correctly. It seems to fail on the markdown-mode part (see below).

Any advice on getting this to install correctly? The package looks really useful and I'm keen to use it.

Compiling file /Users/davismcc/.emacs.d/elpa/polymode-20140614.1301/poly-R.el at Tue Jul 22 14:43:24 2014
Entering directory `/Users/davismcc/.emacs.d/elpa/polymode-20140614.1301/'
poly-R.el:64:1:Error: Cannot open load file: markdown-mode
Compiling file /Users/davismcc/.emacs.d/elpa/polymode-20140614.1301/poly-base.el at Tue Jul 22 14:43:24 2014
Compiling file /Users/davismcc/.emacs.d/elpa/polymode-20140614.1301/poly-markdown.el at Tue Jul 22 14:43:24 2014
poly-markdown.el:33:1:Error: Cannot open load file: markdown-mode

polymode for org mode files?

Hi Vitalie

This looks really nice.

Do you have any plans to add support for org-mode to polymode?

I really think it would be great to be able to edit R code in an org-mode file inline and have all the ESS beauty.

Cheers,

Rainer

emacs 24.2 installs correctly but cannot see highlighting difference

emacs --version
GNU Emacs 24.2.1

  1. Polymode installed correctly

cd ~/.emacs.d
git clone https://github.com/vitoshka/polymode.git

In my .emacs file:

(add-to-list 'load-path "/home/avilella/.emacs.d/polymode/")
(add-to-list 'load-path "/home/avilella/.emacs.d/polymode/modes/")

;; Require any polymode bundles that you are interested in:

(require 'poly-R)
(require 'poly-markdown)

Open a Rmd file, M-x polymode-minor-mode, no change to the syntax highlighting.

Anything else I need to do?

Following installation with markdown fails with error.

I'm on 24.3.1, and I've also tried with the latest pretest.

  1. emacs -Q
  2. load markdown
  3. load polymode
  4. open "readme.md"
  5. goto "lisp" code region
  6. M-m C-t
  7. press

I get: polymode error: Search failed: "```[ ]*{?\\(\\(\\w\\|\\s_\\)*\\)"

ESS mode for chunk headers

I'm not sure if this is a feature request for polymode or ess-noweb-mode:

When editing a .Rnw document, would it be possible to have polymode switch to ess-mode after the header line? That would make it possible to have a mode for filling in the chunk header options, then switch to ess-mode only after you've left the <<>>= line.

Thanks,

Tyler

conflict with org-capture

I'm sorry I don't have time to look into the details further, but it seems that polymode prevents org-capture from working correctly. After entering the indirect buffer, the normal C-c C-c to complete the capture doesn't work. Disabling polymode for .org files resolves this issue.

Syntax highlighting weirdness

Using markdown+R mode, anything inside double square brackets seems to be highlighted as an error.

For example, the file:

 ```{r}
 y[[1]]
 `` `

(There should be no space between the three backquotes but I had trouble getting the markdown to parse correctly here without it.)

has [[1]] highlighted as an error, even though it is not an error and is not highlighted as such in a raw R file using ESS mode.

(get-char-property (point) 'face) over the relevant text gives (font-lock-type-face . markdown-missing-link-face). This is odd because the modeline shows ESS[S] [none] Rmd, so I wouldn't expect interference from the markdown mode here.

retriever-function not actually implemented

After looking through the code, it would appear that although you can define :retriever-function in pm-hbtchunkmode-auto, that function is never executed. Only :retriever-regexp actually works. The :retriever-function should be called instead if :retriever-regexp is nil, but this does not appear to be the case. If the latter is left undefined, it produces the error "polymode error: Wrong type argument: stringp, nil" and breaks the whole process.

R+stan mode attempt, rest of file treated as a string

I tried defining a mode that would allow editing Stan model definitions in an R file using stan-mode. Model definitions are strings, an example file looks like this:

## descriptive statistics
hist(logw)
hist(logz)
hist(logz/logw)
hist(usual_hours)
hist(income)

## first model: we fit to non-employed individuals
model1 <- stan_model(model_code =
"// begin_stan
data {
  int<lower=0> N;
  real<lower=0> obs_edwm[N];
  int<lower=0> obs_lhm[N, 3];           // leisure, home, market
}
parameters {
  // cross-sectional parameters
  real<lower=0, upper=1> alpha;
  real<lower=0, upper=1-alpha> beta;
  // individual-specific parameters

}
transformed parameters {
  r_edwm_threshold <- alpha/(1-alpha);
  l_constrained <- (1-alpha-beta)/(1-alpha);
  h_constrained <- beta/(1-alpha)
}
model {
}
// end_stan")

stan_data1 <- list(N_individuals = length(income),
                   N_time_observations = nrow(blocks),
                   I_time_observations = assignment,
                   usual_hours = usual_hours,
                   income = income,
                   time_observations = blocks,
                   edwm_observations = exp(logz))

Stan code is between begin_stan and end_stan. I defined the polymode with the following code:

(defcustom pm-inner/stan
  (pm-hbtchunkmode "stan"
                   :head-reg "[ \t]*//[ \t]*begin_stan"
                   :tail-reg "[ \t]*//[ \t]*end_stan")
  "Stan typical chunk."
  :group 'innermodes
  :type 'object)

(defcustom pm-poly/R+stan
  (pm-polymode-one "R+stan"
                   :hostmode 'pm-host/R
                   :innermode 'pm-inner/stan)
  "R+stan polymode."
  :group 'polymodes
  :type 'object)

(define-polymode poly-R+stan-mode pm-poly/R+stan)

The issue is that the " after the // end_stan is treated as the start of a string, and the R code in the rest of the buffer is interpreted accordingly. I wonder if this can be fixed somehow.

indentation error in java chunks

in java chunk in test.org

Debugger entered--Lisp error: (args-out-of-range #<buffer test.org[java]> 1 845)
  parse-partial-sexp(1 845)
  c-determine-limit(500)
  c-guess-basic-syntax()
  c-indent-line()
  funcall(c-indent-line)
  (save-restriction (pm--comment-region 1 (nth 1 span)) (pm/narrow-to-span span) (funcall pm--indent-line-function-original))
  (unwind-protect (save-restriction (pm--comment-region 1 (nth 1 span)) (pm/narrow-to-span span) (funcall pm--indent-line-function-original)) (pm--uncomment-region 1 (nth 1 span)))
  pm--indent-line((body 845 987 [object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[    ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])]))
  (cond ((or (eq (quote head) (car span)) (eq (quote tail) (car span))) (back-to-indentation) (setq delta (- pos (point))) (backward-char) (let ((parent-span (pm/get-innermost-span))) (pm/select-buffer (car (last parent-span)) parent-span) (forward-char) (pm--indent-line parent-span) (if (eq (quote tail) (car span)) (progn (setq shift (pm--get-head-shift parent-span)) (indent-to (+ shift (- ... ...)))))) (if (> delta 0) (goto-char (+ (point) delta)))) (t (setq shift (pm--get-head-shift span)) (pm--indent-line span) (if (= (current-column) 0) (progn (setq shift (+ shift (eieio-oref submode (quote :indent-offset)))))) (setq delta (- (point) (point-at-bol))) (beginning-of-line) (indent-to shift) (goto-char (+ (point) delta))))
  (let ((pos (point)) shift delta) (cond ((or (eq (quote head) (car span)) (eq (quote tail) (car span))) (back-to-indentation) (setq delta (- pos (point))) (backward-char) (let ((parent-span (pm/get-innermost-span))) (pm/select-buffer (car (last parent-span)) parent-span) (forward-char) (pm--indent-line parent-span) (if (eq (quote tail) (car span)) (progn (setq shift (pm--get-head-shift parent-span)) (indent-to (+ shift ...))))) (if (> delta 0) (goto-char (+ (point) delta)))) (t (setq shift (pm--get-head-shift span)) (pm--indent-line span) (if (= (current-column) 0) (progn (setq shift (+ shift (eieio-oref submode ...))))) (setq delta (- (point) (point-at-bol))) (beginning-of-line) (indent-to shift) (goto-char (+ (point) delta)))))
  pm-chunkmode([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[    ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] (body 845 987 [object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[   ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])]))
  apply(pm-chunkmode ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[     ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] (body 845 987 [object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[   ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])])))
  eieio-generic-call(pm/indent-line ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] (body 845 987 [object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[   ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])])))
  pm/indent-line([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] (body 845 987 [object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[   ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])]))
  pm-config-multi-auto([object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[     ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])] (body 845 987 [object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[     ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])]))
  apply(pm-config-multi-auto ([object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])] (body 845 987 [object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[     ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])])))
  eieio-generic-call(pm/indent-line ([object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[   ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])] (body 845 987 [object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[     ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])])))
  pm/indent-line([object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[   ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])] (body 845 987 [object pm-config-multi-auto "org-1" [object pm-config-multi-auto "org" unbound pm-base/org polymode-minor-mode " PM" (pm-exporter/pandoc) nil nil nil polymode-mode-map nil unbound nil nil nil nil pm-chunk/org nil] unbound poly-org-mode unbound unbound unbound unbound unbound unbound unbound [object pm-basemode "Org mode-1" [object pm-basemode "Org mode" unbound org-mode t 0 t nil nil] unbound unbound unbound unbound #<buffer test.org> unbound] nil (#<buffer test.org[java]> #<buffer test.org[emacs-lisp]> #<buffer test.org[org]> #<buffer test.org>) unbound unbound unbound ([object pm-chunkmode-auto "auto-chunkmode:java" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[     ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] java-mode unbound unbound unbound #<buffer test.org[java]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound] [object pm-chunkmode-auto "auto-chunkmode:emacs-lisp" [object pm-chunkmode-auto "org" unbound nil t 0 t nil 2 base nil base nil "^[  ]*#\\+begin_src .*$" "^[    ]*#\\+end_src" font-lock-type-face nil "#\\+begin_src +\\(\\(\\w\\|\\s_\\)+\\)" 1 nil] emacs-lisp-mode unbound unbound unbound #<buffer test.org[emacs-lisp]> unbound unbound #<buffer test.org[org]> unbound #<buffer test.org[org]> unbound unbound unbound unbound unbound unbound unbound])]))
  (let ((span (pm/get-innermost-span))) (pm/indent-line (car (last span)) span))
  (lambda nil "Indent line dispatcher" (let ((span (pm/get-innermost-span))) (pm/indent-line (car (last span)) span)))()
  apply((lambda nil "Indent line dispatcher" (let ((span (pm/get-innermost-span))) (pm/indent-line (car (last span)) span))) nil)
  eieio-generic-call(pm/indent-line nil)
  pm/indent-line()
  #[0 "\301\302 !\210�\303>\203;

May you please create a tag for release?

Good evening,

Tonight I am writing to humbly put in a request for you to tag this project.

The reason is that a lot of users want to rely on the most "stable" release, by
the most broad definition of the term. For me, it is really simple, I am setting
up a "stable" Emacs configuration of my system here https://github.com/grettke/home/blob/master/.emacs.el
and I would like to rely 100% upon MELPA Stable http://stable.melpa.org/#/ .

I've used your package for a long time, love it, and so do many, many others.
This is a way to get that project out to the other thousands and thousands of
users who also rely upon MELPA stable.

All it takes is for you to create a tag, and within hours, it will show up on
MELPA stable.

Can't wait to hear about what you think and whether or not a tag is in this
project's future!

Kind regards,

Grant Rettke

P.S.

I use polymode for R knitr stuff, and it is sweet. It is usable now and it would be great even to
have a 0.000000N release, whatever makes sense to you. Making it available to folks on stable,
will open the door to many, many others.

multiple inner modes

Sorry for such lame question, but I would be interested in defining a base mode with two inner modes (e.g. markdown is the main mode but we also find YAML and R code chunks with separate tags). Is it possible? If so, could you please point my attention to a working demo? Thanks, Gergely

Add weaver for new rmarkdown

The knit->rmarkdown pipeline has changed recently, as rmarkdown is now a frontend intended to call knit and pandoc behind the scenes. So rmarkdown is not strictly weaving but going all the way through html. Anyway I feel it's more appropriate to provide this "weaver" at the polymode level than at the markdown-mode level. What do you think?

Invalid function: eieio--object-name

Does anyone know of a reason why a fresh checkout of polymode would give me the error in the subject line when trying to export? I'm wondering if it might be because of pandoc, but I also get it with M-n w after setting my weaver to knitR-ESS.

At the end of the day I'm trying to use Rmarkdown with ESS and knitr.

Has anyone got this combination working?

Cheers,
- Steve

Indentation issue: Args out of range

Indentation stops working with error message "Args out of range"

  • Download files
    pm-02.el and
    pm-02.nw
  • Run emacs --no-splash --no-site-file --no-init-file -l pm-02.el
  • Go to the last line of the buffer containing "end"
  • Press "TAB"

After pressing "TAB" the keyword "end" should get indented correctly. But instead of indenting this line, emacs says: "Args out of range".

Remark: If I remove just one character in this file indentation works as expected.

Emacs crash with polymode and lua-mode

I experience crashes of emacs related to polymode and lua-mode, mostly when hitting delete-key (delete-forward-char). Here is a description of how to replicate this crash:

  1. emacs --no-splash --no-site-file --no-init-file -l foo.el
  2. hit delete-key twice

I'm running Emacs 24.3.1. Testing the same with Emacs 25.0.50.2 I experience the same crash, but now the crash is not restricted to the delete-key but happens with other keys as well, e.g. hitting `a' twice.

With Emacs 25.0.50.2 I get theses failed assertions:

  1. Pressing delete-key twice:
    xdisp.c:18439: Emacs fatal error: assertion failed: MATRIX_ROW_DISPLAYS_TEXT_P (last_row)
  2. Pressing a'-key twice: xdisp.c:17524: Emacs fatal error: assertion failed: row->enabled_p`
  • File: foo.el
(add-to-list 'load-path "~/.emacs.d/elpa/polymode-20141204.2346/")
(add-to-list 'load-path "~/.emacs.d/elpa/lua-mode-20141025.1746/")
(require 'lua-mode)
(require 'poly-noweb)

(defcustom pm-poly/noweb+foobar
  (pm-polymode-multi "noweb"
                     :hostmode 'pm-host/latex
                     :innermodes '(pm-inner/noweb+lua)
                     :exporters '(pm-exporter/latexmk pm-exporter/pdflatex)
                     :map '(("<" . poly-noweb-electric-<))
                     )
  "Noweb typical configuration"
  :group 'polymodes
  :type 'object)

(defcustom pm-inner/noweb+lua
  (pm-hbtchunkmode "noweb+lua"
                   :mode 'lua-mode
                   :head-reg  "<<\\(.*\\)>>="
                   :tail-reg    "\\(@ +%def .*\\)$\\|\\(@[ \n]\\)")
  "Noweb innermode for Lua"
  :group 'innermodes
  :type 'object)

(define-polymode poly-noweb+foobar-mode pm-poly/noweb+foobar
  :lighter "PM-Lua")


(find-file "foo.nw")
(poly-noweb+foobar-mode)
(next-line)
(next-line)
(next-line)
(next-line)
  • File: foo.nw
@
<<test>>=
function foobar ()
   if true then

      foo()
   end
end
@

Andreas

Polymode on a text file with Python chunks crashes Emacs

I'm trying to define a polymode to edit a text file with some Python chunks. When I edit the text file with this mode, Emacs crashes.

Here are the steps to reproduce the problem:

  1. Open test-mode.el file from this gist and run M-x eval-buffer
  2. Open the test.txt file (also in the gist) and run M-x poly-test-mode
  3. Go to the 3rd line (just after the begin block and type Ctrl-k to delete a line. Move around with the arrow keys. Emacs crashes.

I use Emacs 24.3 from MacPorts ([email protected] port) on MacOS 10.9.4, and polymode 20140614.1301 from MELPA.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.