emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bugs in org-cycle-internal-local?
@ 2012-12-17 21:43 Rémi Vanicat
  2012-12-18 15:06 ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Rémi Vanicat @ 2012-12-17 21:43 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-28 17:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-17 21:43 Bugs in org-cycle-internal-local? Rémi Vanicat
2012-12-18 15:06 ` 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

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).