[Top][All Lists]

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

Re: [O] Minor org mode for achieve code folding effects

From: David Rogoff
Subject: Re: [O] Minor org mode for achieve code folding effects
Date: Thu, 12 Jan 2012 14:58:07 -0800
User-agent: Postbox 3.0.2 (Macintosh/20111203)

Carlos Russo <mestre.adamastor <at> gmail.com> writes:
I have used both Carsten's and Eric's solution, as well as
hideshow-org (https://github.com/secelis/hideshow-org), which works
rather well and deserves a mention.

Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience
functions to set the outline minor mode regexps to correspond to the
current comment syntax.  Thus, if I'm (for instance) in shell-script
mode, # * and # ** become the outline level 1 and 2 markers.

I have all this working and it's great.  But...    This is using outline-minor-mode.  Like Giovanni, who started this thread,  I'm used to orgmode, which is a little different although it uses outline mode.  I tried hacking the code to use orgstruct-mode, which is the minor mode version of orgmode.  I got a little figured out, but got lost.  I would think all of Tassilo's code to automatically set up outline-regexp would still be valid, but I'm not doing something right. I saw Carsten's message to look at the visibility cycling and understand that, but the keymaps are not working right and the outline-regexp isn't being set right.  I've worked around the latter with a quick function I can call from the file buffer. However, I don't know what's going on with the keymap.  It looks right. For example, c-h k TAB gives this:

<tab> runs the command orgstruct-hijacker-command-102, which is an interactive Lisp function.
It is bound to <tab>.
(orgstruct-hijacker-command-102 ARG)
In Structure, run `org-cycle'.
Outside of structure, run the binding of `[(tab)]' or `    '.

However, it doesn't seem to recognize when it's in a structure. M-x org-cycle works as does M-x org-global-cycle.

I only need this for emacs-lisp-mode and verilog-mode so I simplified Tassilo's code like this:
(when (eq major-mode 'emacs-lisp-mode)
  (setq outline-regexp ";; [*]+ "))
(when (eq major-mode 'verilog-mode)
  (setq outline-regexp "\\s-*// [*]+ "))

Help Please!



reply via email to

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