[ESS] ess, noweb and polymode
Tyler Smith
ty|er @end|ng |rom p|@nt@rum@c@
Wed Nov 15 21:13:20 CET 2023
Hi Laurent,
I haven't used `ess-goto-chunk` before, but it sounds quite useful. I think you could get something similar with the `swiper` package. You can install `swiper` via `package-list-packages. It requires the `ivy` package, which should get installed automatically when you install `swiper`.
Then you can define your own custom 'swipe'. For Rmd chunks, something like this:
```
(defun my-list-chunks ()
(interactive)
(swiper "```{"))
(define-key polymode-map "g" #'my-list-chunks)
```
By default, `polymode-map` is bound to `M-n`, so this will call `my-list-chunks` when you hit `M-n g`.
This displays all the matches in the minibuffer, and you can scroll through them with `C-n` and `C-p`, and hitting `enter` will take you to that chunk header. In my tests, there's something wrong with the text colours, but I don't have time to debug just now.
Best,
Tyler
--
plantarum.ca
On Wed, Nov 15, 2023, at 2:42 PM, LaurentEss via ESS-help wrote:
> Dear ESS-list,
>
> Installing emacs to do literate programming, I have just
> discovered that noweb-mode doesn't exist anymore. It has been replaced
> by polymode if I well understood. So, I install from MELPA : ess,
> polymode, poly-R, poly-markdown, poly-noweb and I placed in my .emacs.el
> the following lines:
>
> -------------------------------------------------------
>
> (require 'poly-R)
> (require 'poly-markdown)
> (require 'poly-noweb)
>
>
> (add-to-list 'auto-mode-alist '("\\.[rR]nw" . poly-noweb+r-mode))
> (add-to-list 'auto-mode-alist '("\\.[rR]md" . poly-markdown+r-mode))
> (add-to-list 'auto-mode-alist '("\\.md$" . poly-markdown-mode))
>
> ;; Load ESS
> (load "ess-autoloads")
> ---------------------------------------------------------
>
> It seems to work but I don't find anymore some usefull ess-noweb
> shortcuts. For example, I liked M-n g (binded to ess-noweb-goto-chunk)
> which showed me all the chunks names in a ring buffer at the bottom of
> the frame (very convenient to move in large file). Also, with the old
> ess versions it was possible to put all the line of the begining of
> every chunk (<< >>=) in yellow (for example) and all the line of the end
> of the chunk (@) in blue thanks to the ess-noweb-font-lock-mode.el file
> which was very convenient.
>
> Here are my questions:
>
> 1. Could you tell me if I didn't forget to install some emacs packages
> to use polymode with noweb mode ?
>
> 2. If the two features described above really disappeared with yhe new
> new version of ess with polymode, could you please give me some pointers
> to try to get these two features in emacs ?
>
> Thank you for your advice
>
> Best regards
>
> Laurent
>
> ______________________________________________
> ESS-help using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
More information about the ESS-help
mailing list