emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Rémi Vanicat" <vanicat@debian.org>
To: emacs-orgmode@gnu.org
Subject: Bugs in org-cycle-internal-local?
Date: Mon, 17 Dec 2012 22:43:52 +0100	[thread overview]
Message-ID: <8738z4bbhj.fsf@debian.org> (raw)

Hello,

I've tried to use visibility cycling in outline minor mode[1] with ruby,
and I've a problem with when hiding some subtree: when the next subtree
on the same level begin with space char, its heading is put on the same
line than the current one:

Something like:

  def get(info, attr, default=nil)

  end

  def initialize

become

  def get(info, attr, default=nil)... def initialize

when I expect
  def get(info, attr, default=nil)...
  def initialize

The problem seem to come from the org-cycle-internal-local function that
wrongly put the end of the subtree in the middle of a line, if the
beginning of this line is all white character.






Here is the code I use to setup ruby-mode for interesting integration
with outline-minor-mode and org cycling facilities:

#+begin_src emacs-lisp
  (defvar my-ruby-outline-regexp "### \\| *def\\>\\| *module\\>\\| *class\\>")

  (defun my-ruby-outline-level ()
    "compute the level of a outline for ruby"
    (save-match-data
     (cond
       ((looking-at "###") 1)
       ((looking-at "\\( *\\)")
        (+ 2 (length (match-string 1)))))))

  (defun define-ruby-outline ()
    (make-local-variable 'outline-regexp)
    (setq outline-regexp my-ruby-outline-regexp)
    (make-local-variable 'outline-level)
    (setq outline-level #'my-ruby-outline-level)
    (outline-minor-mode))

  (add-hook 'ruby-mode-hook 'define-ruby-outline)

  (eval-after-load 'outline
    '(progn
      (define-key outline-minor-mode-map [(control tab)] 'org-cycle)
      (define-key outline-minor-mode-map [(backtab)] 'org-global-cycle)))
#+end_src



[1]:http://orgmode.org/worg/org-faq.html#use-visibility-cycling-in-outline-mode

-- 
Rémi Vanicat

             reply	other threads:[~2012-12-17 21:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 21:43 Rémi Vanicat [this message]
2012-12-18 15:06 ` Bugs in org-cycle-internal-local? Bastien
2012-12-18 18:57   ` Rémi Vanicat
2012-12-25  3:21     ` Bastien
2012-12-27 15:44       ` Rémi Vanicat
2012-12-28 11:43         ` Bastien

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=8738z4bbhj.fsf@debian.org \
    --to=vanicat@debian.org \
    --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).