Re: ESS code-folding?
Karlo Guidoni Martins via ESS-help <[email protected]> Wed, 16 Aug 2023 11:01:54 -0700
| Newsgroups | gmane.emacs.ess.general |
|---|---|
| Message-ID | <CANJyiGSUQy8NKK4KG+9gccE-GHwR-HvBa2Y68fDqtxQZ0rSagA@mail.gmail.com> |
hi!
this works fine for me:
;;; BEG
;;; outline-(minor)-mode
(setq outline-minor-mode-highlight 'override) ; emacs28
(setq outline-minor-mode-cycle t)
;;; outline for ess-mode
(add-hook 'ess-mode-hook
#'(lambda ()
(outline-minor-mode)
(setq-local outline-regexp "\\(^#\\{3,7\\}
\\)\\|\\(^[a-zA-Z0-9_\.]+ ?<- ?function(.*{\\)")
(setq-local outline-regexp "\\(^#\\{3,7\\} \\)")
(defun outline-level ()
;; ## continues only as a comment.
(cond ((looking-at "^### ") 1) ; first level
((looking-at "^#### ") 2) ; second level
((looking-at "^##### ") 3) ; and so on...
((looking-at "^###### ") 4)
((looking-at "^####### ") 5)
((looking-at "^######## ") 6)
((looking-at "^[a-zA-Z0-9_\.]+ ?<- ?function(.*{") 3)
(t 1000)))
(outline-hide-body)))
;;; force outline height
(custom-set-faces
'(outline-1 ((t (:height 1.100 :weight bold))))
'(outline-2 ((t (:height 1.075 :weight bold))))
'(outline-3 ((t (:height 1.050 :weight bold))))
'(outline-4 ((t (:height 1.025 :weight bold))))
'(outline-5 ((t (:height 1.000 :weight bold))))
'(outline-6 ((t (:height 1.000 :weight bold))))
'(outline-7 ((t (:height 1.000 :weight bold))))
'(outline-8 ((t (:height 1.000 :weight bold))))
)
;;; END
On 16 Aug 2023 14:30:02, "Sparapani, Rodney via ESS-help" <
[email protected]> wrote:
> Hi Gang:
>
> One of my student’s asked this question.
>
> Any resources/knowledge on code folding? in RStudio ‘####’ creates a
> collapsible section. Came across hideshow-org<
> https://urldefense.com/v3/__https:/melpa.org/*/hideshow-org__;Iw!!H8mHWRdzp34!5RPr9v2ZhWFZvGqgU1l_SCB3m8RiGAGo3z3tOZJeYnGOEM1PJSipOO32pr70Qd7JRbtycMb_EwhMdNuJ$>
> but I don’t want to only be able to use it in org mode.
>
> Something like
>
> Without code folding
> #### test ####
> test = c(1, 2)
> ####
>
> With code folding
> #### test ####
> ####
>
> Any ideas?
> --
> Rodney Sparapani, Associate Professor of Biostatistics, He/Him/His
> Vice President, Wisconsin Chapter of the American Statistical Association
> Institute for Health and Equity, Division of Biostatistics
> Medical College of Wisconsin, Milwaukee Campus
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help