[O] Re: [Orgmode] [PATCH] Preserve trailing blank lines

2011-03-09 Thread Bastien
Hi Jason,

I finally had a chance to better understand what your patch does and
fix.  I've applied it now -- thanks for it and for your patience!

-- 
 Bastien



Re: [Orgmode] [PATCH] Preserve trailing blank lines

2011-02-15 Thread Jason Dunsmore
Bastien bastien.gue...@wikimedia.fr writes:

 However, with your patch, I get a weird behavior.

 Config:

 ,
 | (setq org-blank-before-new-entry '((heading . nil)
 |(plain-list-item . nil)))
 `

 Test file:

 ,
 | * Section
 | 
 | ** Subsection 1
 | Body
 | 
 | ** Subsection 2
 | Body
 `

 Trying to move Subsection 1 down (with org-metadown):

 ,
 | * Section
 | Body   ??
 | 
 | ** Subsection 2
 | 
 | ** Subsection 1
 | Body
 `

 Are you able to reproduce this?  

I finally had a chance to test this out with the latest Org from git and
a vanilla Emacs config, and I was unable to reproduce the behavior you
saw.  Here is what I did:


$ git clone git://orgmode.org/org-mode.git

$ emacs23 -Q 

(Edit org.el to re-introduce patch.)

$ cd org-mode/

$ git diff
diff --git a/lisp/org.el b/lisp/org.el
index 164081c..4329def 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18507,10 +18507,10 @@ Taken from `count' in cl-seq.el with all keyword argum
   Move backwards over whitespace, to the beginning of the first empty line.
 Returns the number of empty lines passed.
   (let ((pos (point)))
-(skip-chars-backward  \t\n\r)
-;; (if (cdr (assoc 'heading org-blank-before-new-entry))
-;;(skip-chars-backward  \t\n\r)
-;;   (forward-line -1))
+;;(skip-chars-backward  \t\n\r)
+(if (cdr (assoc 'heading org-blank-before-new-entry))
+   (skip-chars-backward  \t\n\r)
+  (forward-line -1))
 (beginning-of-line 2)
 (goto-char (min (point) pos))
 (count-lines (point) pos)))


Then I evaluated the following in Emacs:


(delete /usr/share/emacs/23.2/lisp/org/ load-path)
(add-to-list 'load-path ~/tmp/org-mode/lisp)
(require 'org-install)
(setq org-blank-before-new-entry '((heading . nil)
   (plain-list-item . nil)))


You can see what happened on my screen with the following:


wget http://98.129.169.48/tmp/emacs-testing.time
wget http://98.129.169.48/tmp/emacs-testing.script
scriptreplay emacs-testing.time emacs-testing.script


Would you mind testing it out again?

Regards,
Jason

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] [PATCH] Preserve trailing blank lines

2011-02-07 Thread Bastien
Hi Jason,

Jason Dunsmore emacs-orgm...@dunsmor.com writes:

 Convention 1: Newline above headings
 Convention 2: Newline after bodies

 I just tested these configurations and Org examples out with the patch
 and it seems to work well.  I've been using the patch on my systems for
 a while now and haven't noticed any bad side-effects.

I'm back to this patch -- thanks for the clear explanations.

However, with your patch, I get a weird behavior.

Config:

,
| (setq org-blank-before-new-entry '((heading . nil)
|(plain-list-item . nil)))
`

Test file:

,
| * Section
| 
| ** Subsection 1
| Body
| 
| ** Subsection 2
| Body
`

Trying to move Subsection 1 down (with org-metadown):

,
| * Section
| Body   ??
| 
| ** Subsection 2
| 
| ** Subsection 1
| Body
`

Are you able to reproduce this?  

-- 
 Bastien

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] [PATCH] Preserve trailing blank lines

2011-01-26 Thread Jason Dunsmore
Bastien bastien.gue...@wikimedia.fr writes:

 Jason Dunsmore ja...@dunsmor.com writes:

 I now understand this is a formatting convention issue.  

 I'm trying to figure out when this patch is useful.  I understand this
 is when `org-blank-before-new-entry' doesn't set heading to t or auto, 
 but I don't understand what it the difference the patch introduces then.

 Could you send a _visual_ example, with useless empty lines that you
 want to get rid off when org-metaup etc ?

Convention 1: Newline above headings

This seems to be used more often when the body does not have delimiting
newlines.

Configuration:

--8---cut here---start-8---
(setq org-blank-before-new-entry '((heading . t)
   (plain-list-item . t)))
--8---cut here---end---8---

Org example:

--8---cut here---start-8---

* Section

** Subsection 1
Body

** Subsection 2
Body
--8---cut here---end---8---


Convention 2: Newline after bodies

This seems to be used more often when the body does have delimiting
newlines.

Configuration:

--8---cut here---start-8---
(setq org-blank-before-new-entry '((heading . nil)
   (plain-list-item . nil)))
--8---cut here---end---8---

Org example:

--8---cut here---start-8---
* Section
** Subsection 1

Body

** Subsection 2

Body

--8---cut here---end---8---

I've seen both conventions in use on Worg and in Org-mode tutorials.

I just tested these configurations and Org examples out with the patch
and it seems to work well.  I've been using the patch on my systems for
a while now and haven't noticed any bad side-effects.

Let me know if you need any other information.

Regards,
Jason

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] [PATCH] Preserve trailing blank lines

2011-01-17 Thread Bastien
Jason Dunsmore ja...@dunsmor.com writes:

 I now understand this is a formatting convention issue.  

I'm trying to figure out when this patch is useful.  I understand this
is when `org-blank-before-new-entry' doesn't set heading to t or auto, 
but I don't understand what it the difference the patch introduces then.

Could you send a _visual_ example, with useless empty lines that you
want to get rid off when org-metaup etc ?

Thanks!

-- 
 Bastien

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] [PATCH] Preserve trailing blank lines

2011-01-11 Thread Jason Dunsmore
Carsten Dominik carsten.domi...@gmail.com writes:

 On Jan 5, 2011, at 2:24 AM, Jason Dunsmore wrote:

 I like to leave a blank line at the end of items that have bodies,
 but I
 found functions like org-metaup, org-metadown, and org-refile were
 leaving that blank line behind.

 These commands treat empty lines as belonging to the entry
 below the empty line - which is, I think, the right convention here.

I now understand this is a formatting convention issue.  Here is an
updated patch that looks at the setting for `heading' in the variable
org-blank-before-new-entry:

diff --git a/lisp/org.el b/lisp/org.el
index 98c85d0..ee3f873 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18477,7 +18477,9 @@ Taken from `count' in cl-seq.el with all keyword
argumen
   Move backwards over whitespace, to the beginning of the first empty
   line.
 Returns the number of empty lines passed.
   (let ((pos (point)))
-(skip-chars-backward  \t\n\r)
+(if (cdr (assoc 'heading org-blank-before-new-entry))
+   (skip-chars-backward  \t\n\r)
+  (forward-line -1))
 (beginning-of-line 2)
 (goto-char (min (point) pos))
 (count-lines (point) pos)))

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] [PATCH] Preserve trailing blank lines

2011-01-08 Thread Carsten Dominik


On Jan 5, 2011, at 2:24 AM, Jason Dunsmore wrote:

I like to leave a blank line at the end of items that have bodies,  
but I

found functions like org-metaup, org-metadown, and org-refile were
leaving that blank line behind.


These commands treat empty lines as belonging to the entry
below the empty line - which is, I think, the right convention here.

- Carsten



 Here's a patch to fix that:

--8---cut here---start-8---
diff --git a/lisp/org.el b/lisp/org.el
index 5eb0bc8..e3d71b7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18448,7 +18448,7 @@ Taken from `count' in cl-seq.el with all  
keyword arguments
  Move backwards over whitespace, to the beginning of the first  
empty line.

Returns the number of empty lines passed.
  (let ((pos (point)))
-(skip-chars-backward  \t\n\r)
+(forward-line -1)
(beginning-of-line 2)
(goto-char (min (point) pos))
(count-lines (point) pos)))
--8---cut here---end---8---

I can't think of a reason you would want to leave trailing blank lines
behind, but in case some people rely on that behavior, here's an
alternate patch that creates an option called
org-preserve-trailing-blank-lines:

--8---cut here---start-8---
diff --git a/lisp/org.el b/lisp/org.el
index 5eb0bc8..e90798c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1098,6 +1098,11 @@ breaking the list structure.
   (const :tag Always t)
   (const :tag Auto auto)

+(defcustom org-preserve-trailing-blank-lines t
+  Non-nil means preserve blank lines at the end of an item.
+  :group 'org-edit-structure
+  :type 'boolean)
+
(defcustom org-insert-heading-hook nil
  Hook being run after inserting a new heading.
  :group 'org-edit-structure
@@ -18448,7 +18453,9 @@ Taken from `count' in cl-seq.el with all  
keyword arguments
  Move backwards over whitespace, to the beginning of the first  
empty line.

Returns the number of empty lines passed.
  (let ((pos (point)))
-(skip-chars-backward  \t\n\r)
+(if org-preserve-trailing-blank-lines
+   (forward-line -1)
+  (skip-chars-backward  \t\n\r))
(beginning-of-line 2)
(goto-char (min (point) pos))
(count-lines (point) pos)))
--8---cut here---end---8---

If this is accepted, perhaps the function org-back-over-empty-lines
should be renamed to org-back-over-lines.

Regards,
Jason

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode