emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Rogoff <david@therogoffs.com>
To: emacs-orgmode@gnu.org
Subject: Re: Minor org mode for achieve code folding effects
Date: Tue, 10 Jan 2012 17:21:40 -0800	[thread overview]
Message-ID: <4F0CE424.7020409@therogoffs.com> (raw)
In-Reply-To: <4F0CD92F.9030004@therogoffs.com>

[-- Attachment #1: Type: text/plain, Size: 1913 bytes --]



> David Rogoff <mailto:david@therogoffs.com>
> January 10, 2012 4:34 PM
> 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.
>
> This is great info! I was just looking for this in the last couple of 
> days and appreciate everyone's code since it's way beyond my elisp 
> abilities.
> I like this a lot more than the folding.el I had been using since I 
> already use orgmode.  However, I've got a question:
>
> I'm using this with verilog-mode which uses "// " to start comments.  
> The problem is that when I indent my file, the comments indent too and 
> it seems that output-minor-mode (and, I assume, orgmode) only 
> recognize headings that start in column 0.  How/where can I change 
> this so it will recognize any line that is whitepace followed by the 
> comment-start?
>
This works, but is probably not the best way to do it:

(defun th-outline-regexp ()
   "Calculate the outline regexp for the current mode."
   (let ((comment-starter (replace-regexp-in-string
                           "[[:space:]]+" "" comment-start)))
     (when (string= comment-starter ";")
       (setq comment-starter ";;"))
     (when (string= comment-starter "#")
       (setq comment-starter "##"))
     (when (eq major-mode 'verilog-mode)
       (setq comment-starter "\\s-*//"))     ;; for verilog-mode, define 
comment-starter as any amount of whitespace followed by "//". This 
allows indented comments as outline levels
     (concat comment-starter " [*]+ ")))

[-- Attachment #2.1: Type: text/html, Size: 3730 bytes --]

[-- Attachment #2.2: postbox-contact.jpg --]
[-- Type: image/jpeg, Size: 1189 bytes --]

  reply	other threads:[~2012-01-11  1:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  0:34 Minor org mode for achieve code folding effects David Rogoff
2012-01-11  1:21 ` David Rogoff [this message]
2012-01-11  6:23   ` Leo Alekseyev
2012-01-11  7:43     ` Tassilo Horn
2012-01-12 22:58 ` David Rogoff
2012-01-16 18:19   ` David Rogoff
  -- strict thread matches above, loose matches on Subject: below --
2012-01-09 15:14 Giovanni Giorgi
2012-01-09 15:23 ` Carsten Dominik
2012-01-10 21:08 ` Eric S Fraga
2012-01-10 22:47   ` Leo Alekseyev
2012-01-11 14:56 ` Eric S Fraga
2012-01-12  2:12   ` Leo Alekseyev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F0CE424.7020409@therogoffs.com \
    --to=david@therogoffs.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).