[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: program outlining

From: Kaushal Modi
Subject: Re: program outlining
Date: Mon, 11 Jul 2016 14:59:00 +0000

On Mon, Jul 11, 2016 at 10:19 AM Rusi <address@hidden> wrote:

> How does it work?

That's a very broad question. Here's an attempt to quickly explain this.
outshine mode works by piggybacking on outline-minor-mode. So you enable
outline-minor-mode where you want outshine to work.

> Which modes?

I already have that in my posted outshine config:

    (defvar modi/outline-minor-mode-hooks '(verilog-mode-hook
                                            conf-space-mode-hook) ; for
      "List of hooks of major modes in which `outline-minor-mode' should be

> I can load this file alright

Loading just this file will *not* work. There are dependencies in it on my
minor mode, and probably other things too. It's part of my whole config. So
I wouldn't expect it to work independently.

> But thereafter outshine is so undocumented that I dont know what next

I found the documentation here to be adequate:

You need to pose specific questions.. Check for yourself if the outshine
mode is getting enabled when it should (when you enable outline-minor-mode
in any major mode)

On a different note does outshine understand programming language syntax?

It uses a major-mode's comment syntax to detect headlines.

For emacs-lisp-mode,

;;; heading level 1
;;;; heading level 2
;;;;; heading level 3

For all other modes, it detects org-like heading syntax with that
major-mode's comment chars as prefix.

For verilog-mode,

// * heading level 1
// ** heading level 2
// *** heading level 3

For shell-script-mode,

# * heading level 1
# ** heading level 2
# *** heading level 3

> Or does it need addition of org-style 'cookies'?

(as explained above)

> Because if latter its not much use for arbitrary codebases

Yes, outshine does need adding special syntax headings as shown above. If
you are able to add those, and others in your team do not mind it, do it.
Because for everyone not using emacs/outshine, they are as good as regular
comments and it will not affect the code's functionality.

> (which hideshow seems to handle at least somewhat)

This boils down to personal preference. I like outshine syntax because it
brings in many more org-like commands (not just visibility cycling). I can
even promote/demote sections, move them up/down, mark/comment whole
sections, etc. Also I can automatically parse a file and auto-generate a
contents section (like this:

If all you need is code folding, then outshine is most likely an overkill.

I have experimented with a lot of code folding methods. For pure code
folding, I end up using a hybrid of fold-this (3rd party package),
set-selective-display (inbuilt) and yafolding (3rd party package) wrapped
in my modi/fold-dwim command (config:

Ignoring all that, the simply thing to try would be to try just the
fold-this package.


Kaushal Modi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]