Re: [ESS] ess, noweb and polymode

2023-11-15 Thread Tyler Smith via ESS-help
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@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] How can one tell rlang not to mess up R session in ESS ?

2023-11-15 Thread Dirk Eddelbuettel via ESS-help


For completeness, and without any time yet to dig into Lionel's nord
modification, and as a friend who saw thread asked: what I ended up doing was
following the hint about cli and NO_COLOR and now (conditionally) set

## No color from cli inside emacs
## 
https://cli.r-lib.org/reference/faq.html#how-do-i-turn-off-ansi-colors-and-styles-
if (Sys.getenv("INSIDE_EMACS") != "")
Sys.setenv(NO_COLOR="TRUE")

That preserves cli behavior on the command-line etc but now prevents it from
turning my R buffer under ESS in Emacs unreadable should I encounter an
error.  And that is good enough for now.

Thanks again,  Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


[ESS] ess, noweb and polymode

2023-11-15 Thread LaurentEss via ESS-help

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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help