all messages for Emacs-related lists mirrored at yhetil.org
 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

* Re: Bugs in org-cycle-internal-local?
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2012-12-18 15:06 UTC (permalink / raw)
  To: Rémi Vanicat; +Cc: emacs-orgmode

Hi Rémi,

Rémi Vanicat <vanicat@debian.org> writes:

> I've tried to use visibility cycling in outline minor mode[1] with ruby,

I tried your minor mode with the minimal snippet you gave and it works
well here.  Could it be the version of org-mode you're using?

-- 
 Bastien

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

* Re: Bugs in org-cycle-internal-local?
  2012-12-18 15:06 ` Bastien
@ 2012-12-18 18:57   ` Rémi Vanicat
  2012-12-25  3:21     ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Rémi Vanicat @ 2012-12-18 18:57 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Bastien <bzg@altern.org> writes:

> Hi Rémi,
>
> Rémi Vanicat <vanicat@debian.org> writes:
>
>> I've tried to use visibility cycling in outline minor mode[1] with ruby,
>
> I tried your minor mode with the minimal snippet you gave and it works
> well here.  

did you let the two space before the both def? Without those space,
every thing work find:

the full snipet is like

class XmmsInteract
  def get(info, attr, default=nil)
    info[attr].to_a[0][1]
  end

  def initialize
    @looking_for_medialib_list = []
  end
end

and the hide fail on the "  def get"

I admit that the importance of the space could be not obvious in my
first email.



> Could it be the version of org-mode you're using?

It's stock org-mode from Emacs

-- 
Rémi Vanicat

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

* Re: Bugs in org-cycle-internal-local?
  2012-12-18 18:57   ` Rémi Vanicat
@ 2012-12-25  3:21     ` Bastien
  2012-12-27 15:44       ` Rémi Vanicat
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2012-12-25  3:21 UTC (permalink / raw)
  To: Rémi Vanicat; +Cc: emacs-orgmode

Rémi Vanicat <vanicat@debian.org> writes:

> did you let the two space before the both def? Without those space,
> every thing work find:
>
> the full snipet is like
>
> class XmmsInteract
>   def get(info, attr, default=nil)
>     info[attr].to_a[0][1]
>   end
>
>   def initialize
>     @looking_for_medialib_list = []
>   end
> end
>
> and the hide fail on the "  def get"
>
> I admit that the importance of the space could be not obvious in my
> first email.

Well, it was, I just skipped it inadvertantly.
I can reproduce the problem, but don't have an easy fix
at hand.  If you find one, please let us know.

Thanks,

-- 
 Bastien

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

* Re: Bugs in org-cycle-internal-local?
  2012-12-25  3:21     ` Bastien
@ 2012-12-27 15:44       ` Rémi Vanicat
  2012-12-28 11:43         ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Rémi Vanicat @ 2012-12-27 15:44 UTC (permalink / raw)
  To: Bastien; +Cc: Rémi Vanicat, emacs-orgmode

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

Bastien <bzg@altern.org> writes:

> Rémi Vanicat <vanicat@debian.org> writes:
>

[...]

> Well, it was, I just skipped it inadvertantly.
> I can reproduce the problem, but don't have an easy fix
> at hand.  If you find one, please let us know.

This seem to do it


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: move to beggining of line for end of section --]
[-- Type: text/x-diff, Size: 937 bytes --]

From e7344cd512af57fc9c85205876d6e3bfed2e53fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Vanicat?= <vanicat@debian.org>
Date: Thu, 27 Dec 2012 16:41:28 +0100
Subject: [PATCH] Find end of section only at beginning of line when cycling

When hiding a section in non org-mode using outline-minor-mode, if the
next section begin with white space, its header line used to appeared
on the same line as the one we hide.
---
 lisp/org.el |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index ee4c70e..b1ffb8f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6399,7 +6399,8 @@ in special contexts.
 	(setq eos (save-excursion
 		    (org-end-of-subtree t)
 		    (unless (eobp)
-		      (skip-chars-forward " \t\n"))
+		      (skip-chars-forward " \t\n")
+		      (forward-line 0))
 		    (if (eobp) (point) (1- (point)))))
 	(setq has-children
 	      (or (save-excursion
-- 
1.7.10.4


[-- Attachment #3: Type: text/plain, Size: 26 bytes --]




-- 
Rémi Vanicat

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

* Re: Bugs in org-cycle-internal-local?
  2012-12-27 15:44       ` Rémi Vanicat
@ 2012-12-28 11:43         ` Bastien
  0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2012-12-28 11:43 UTC (permalink / raw)
  To: Rémi Vanicat; +Cc: emacs-orgmode

Hi Rémi,

Rémi Vanicat <vanicat@debian.org> writes:

> This seem to do it

Yes it does, but I implemented the fix another way.

I've taken the time to double-check the fix does not
slow down org-cycle, which is the main concern when
changing org-cycle-internal-* functions.

Thanks,

-- 
 Bastien

^ 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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.