[ESS] github flavor

Tyler Smith ty|er @end|ng |rom p|@nt@rum@c@
Mon Feb 14 22:18:10 CET 2022


Hi Stephen,

What does `C-h f poly-gfm+r-mode` tell you?

For me, it reports "poly-gfm+r-mode is an interactive Lisp closure 
in ‘poly-R.el’."

I wonder if your version of poly-R.el doesn't include this? If 
you've installed from melpa stable (i.e., 
"https://stable.melpa.org/packages/"), you'll have the version of 
poly-R from March 2020, which doesn't include the gfm flavour. The 
melpa version from "https://melpa.org/packages/" should work.

Best,

Tyler

On Mon, Feb 14 2022, Stephen Bond wrote:

> Tyler,
>
> I tried adding 
>
> ```
> (require 'poly-R)
> ```
>
> and get exactly the same error. the error is reported in 
> Messages and
> the end effect is that opening .Rmd puts me in fundamental.
> if I comment out the gfm statement then opening .Rmd puts me in
> Markdown PM-Rmd.
>
> I can live with the standard flavor, will send another question 
> that is
> more important.
> Cheers
> S.
>
> On Sun, 2022-02-13 at 22:35 -0500, Tyler Smith wrote:
>> Hi Stephen,
>> 
>> As far as I understand it, the variable 
>> `package-selected-packages` is used in installing packages, not 
>> loading them? I'm not sure.
>> 
>> Regardless, assuming your version of `poly-R` is reasonably 
>> recent, the error you get suggests it's not being loaded prior 
>> to 
>> you trying to call the functions it contains. If you add the 
>> `require` command somewhere near the beginning of your config, 
>> it 
>> will tell us one of three things:
>> 
>> - it will solve your problem, confirming that `poly-R` was not 
>>   being loaded for some reason with your current config (we may 
>>   then want to figure out why this is the case)
>> 
>> - it will generate an error to the effect that it can't load 
>>   `poly-R`, indicating that `poly-R` isn't properly installed
>> 
>> - it will not generate any new errors or solve your problem, 
>>   suggesting that your version of `poly-R` is old or corrupt
>> 
>> It's possible there is another problem I haven't thought of, 
>> but 
>> we can at least rule out these three possibilities if you try 
>> my 
>> suggestion.
>> 
>> Best,
>> 
>> Tyler
>> 
>> On Mon, Feb 14 2022, Stephen Bond wrote:
>> 
>> > Hi Tyler,
>> > 
>> > did you see I have 
>> > 
>> > '(package-selected-packages
>> > '(markdown-mode markdown-toc brightscript-mode use-package 
>> > org 
>> > ess-view ess poly-R poly-markdown poly-org
>> > polymode))
>> > which was added when I installed from melpa. I think that 
>> > statement replaces the old style 
>> > 
>> > (require 'packagename)
>> > 
>> > my lisp is rudimentary, please, comment.
>> > Thanks
>> > S. 
>> > On Sunday, February 13, 2022, 09:02:52 PM EST, Tyler Smith 
>> > <tyler using plantarum.ca> wrote: 
>> > 
>> > Hello Stephen,
>> > 
>> > The function `poly-gfm+r-mode` is defined in the `poly-R` 
>> > library. 
>> > It needs to be loaded before you can call it. The following 
>> > addition to your code should do it:
>> > 
>> > ```
>> > (require 'poly-R)
>> > 
>> > (add-to-list 'auto-mode-alist
>> >             '("\\.[rR]md\\'" . poly-gfm+r-mode))
>> > ```
>> > 
>> > As long as the `(require 'poly-R)` line comes before you 
>> > actually 
>> > try to open an Rmarkdown file, the specific location doesn't 
>> > really matter.
>> > 
>> > I'll update the tutorial. Whether or not (and when) the 
>> > `require` 
>> > command is needed does depend on how you have installed 
>> > `polymode`. I think when I originally wrote this I had set up 
>> > the 
>> > package system to load it automatically, which is why I don't 
>> > provide instructions to do it explicitly in the tutorial.
>> > 
>> > Best,
>> > 
>> > Tyler
>> > 
>> > On Sat, Feb 12 2022, Stephen Bond via ESS-help wrote:
>> > 
>> > > Hello,
>> > > 
>> > > I am trying to activate the github flavor by:
>> > > 
>> > > (add-to-list 'auto-mode-alist
>> > >              '("\\.[rR]md\\'" . poly-gfm+r-mode))
>> > > 
>> > > as described in 
>> > > https://plantarum.ca/2021/10/03/emacs-tutorial-rmarkdown/
>> > > 
>> > > and get an error:
>> > > File mode specification error: (void-function 
>> > > poly-gfm+r-mode)
>> > > 
>> > > I have the following in my .emacs
>> > > 
>> > > (defun rmd-mode ()
>> > >  "ESS Markdown mode for rmd files"
>> > >  (interactive)
>> > >  ;; (setq load-path
>> > >  ;;  (append (list "path/to/polymode/" 
>> > >  "path/to/polymode/modes/")
>> > >  ;;      load-path))
>> > >  (require 'poly-R)
>> > >  (require 'poly-markdown)    
>> > >  (poly-markdown+r-mode))
>> > > (add-to-list 'auto-mode-alist '("\\.md" . 
>> > > poly-markdown-mode))
>> > > (add-to-list 'auto-mode-alist '("\\.Snw" . 
>> > > poly-noweb+r-mode))
>> > > (add-to-list 'auto-mode-alist '("\\.Rnw" . 
>> > > poly-noweb+r-mode))
>> > > ;; I commented out to emable gfm, markdown+r works
>> > > ;;(add-to-list 'auto-mode-alist '("\\.Rmd" . 
>> > > poly-markdown+r-mode))
>> > > ;; associate the new polymode to Rmd files:
>> > > (add-to-list 'auto-mode-alist
>> > >              '("\\.[rR]md\\'" . poly-gfm+r-mode))
>> > > 
>> > > (custom-set-variables
>> > > '(markdown-command
>> > >    (concat "pandoc" " --from=markdown --to=html" " 
>> > >    --standalone 
>> > >    --
>> > > mathjax --highlight-style=pygments"))
>> > >  '(org-agenda-files '("~/1.org"))
>> > >  '(package-selected-packages '(markdown-mode poly-R 
>> > >  poly-markdown poly-
>> > > org polymode ess))
>> > >  '(poly-pandoc-exporter
>> > >    #s(pm-shell-exporter unbound "pandoc" nil nil nil 
>> > >    pm-default-shell-
>> > > export-function pm-default-shell-export-sentinel nil)))
>> > > 
>> > > I am afraid there is a conflict somewhere.
>> > > Please, advise how to cleanup my setup.
>> > > Thanks
>> > > Stephen
>> > > 
>> > > ______________________________________________
>> > > ESS-help using r-project.org mailing list
>> > > https://stat.ethz.ch/mailman/listinfo/ess-help
>> 
>> 


-- 
plantarum.ca



More information about the ESS-help mailing list