[ESS] fill-paragraph on documentation in ESS/julia

Tamas Papp tkp@pp @end|ng |rom gm@||@com
Fri Apr 8 12:19:40 CEST 2016


Hi Lionel,

Thanks. I got this far:

(defun julia-fill-string ()
  (interactive)
  (let* ((p (point))
         (s (syntax-ppss)))
    (when (fourth s)                     ; inside a string
      (let ((start (ninth s))
            (end (MISSING PIECE)))
        (ess-blink-region start end)
        (fill-region start end nil nil nil)))))

but I don't know what's the simple way of finding the end of a string,
preferably using the syntax table (MISSING PIECE in the code above). I
could, of course, go to the beginning, determine if it is """ or ", then
find it later on, but I am wondering if there is a better way.

Best,

Tamas

On Thu, Apr 07 2016, Lionel Henry wrote:

> Hi Tamas,
>
> There has been some work to make fill-paragraph work better within
> ROxygen commands and with R code (it can reorganise arguments list of
> function and expressions separated by operators).
>
> It's currently activated in a dodgy advice. See
>
> https://github.com/emacs-ess/ESS/blob/08d9d7c05a72c739297bfccd13a0f586e8d6ba87/lisp/ess-roxy.el#L766-L829
>
> I think we should make a key substitution for "M-q" in ess-mode.el.
> This would call `ess-fill-paragraph`, which would dispatch to a
> `ess-fill-paragraph-function` that could be defined in each language.
>
> This way you'll be able to implement your own modifications for Julia
> mode. If you manage to write such a function, please send a pull
> request and we'll set up the dispatching mechanism.
>
> Lionel




More information about the ESS-help mailing list