* [PATCH] org-narrow-to-subtree: prevent prepending text to the next headline while narrowed
@ 2010-01-18 11:13 Jan Böcker
2010-01-22 10:30 ` Carsten Dominik
0 siblings, 1 reply; 6+ messages in thread
From: Jan Böcker @ 2010-01-18 11:13 UTC (permalink / raw)
To: Org Mode
[-- Attachment #1: Type: text/plain, Size: 349 bytes --]
Consider the following situation:
* A
Some text.
* B
- Place the cursor on A, press C-x n w (org-narrow-to-subtree).
- Go to the very end of the buffer and insert "xyz".
- C-x n w (widen).
You end up with:
* A
Some Text
xyz* B
The attached one-line patch fixes this by passing `nil' for the
`to-heading' parameter of `org-end-of-subtree'.
[-- Attachment #2: 0001-org-narrow-to-subtree-prevent-prepending-text-to-the.patch --]
[-- Type: text/plain, Size: 1384 bytes --]
From 688a42315caf5840c9db5ab957670c33d1921e92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20B=C3=B6cker?= <jan.boecker@jboecker.de>
Date: Mon, 18 Jan 2010 11:54:00 +0100
Subject: [PATCH] org-narrow-to-subtree: prevent prepending text to the next headline while narrowed
---
lisp/ChangeLog | 6 ++++++
lisp/org.el | 2 +-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b85a716..cb6ebe9 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-18 Jan Böcker <jan.boecker@jboecker.de>
+
+ * org.el (org-narrow-to-subtree): Position the end of the narrowed
+ region before the line with the next heading, to prevent the user
+ from prepending text to the next headline.
+
2010-01-18 Carsten Dominik <carsten.dominik@gmail.com>
* org-ctags.el (org-ctags-enable): Change order of functions.
diff --git a/lisp/org.el b/lisp/org.el
index 626720f..a4755a2 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6829,7 +6829,7 @@ If yes, remember the marker and the distance to BEG."
(save-match-data
(narrow-to-region
(progn (org-back-to-heading t) (point))
- (progn (org-end-of-subtree t t) (point))))))
+ (progn (org-end-of-subtree t nil) (point))))))
(defun org-clone-subtree-with-time-shift (n &optional shift)
"Clone the task (subtree) at point N times.
--
1.6.6
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] org-narrow-to-subtree: prevent prepending text to the next headline while narrowed
2010-01-18 11:13 [PATCH] org-narrow-to-subtree: prevent prepending text to the next headline while narrowed Jan Böcker
@ 2010-01-22 10:30 ` Carsten Dominik
2010-01-22 16:50 ` Samuel Wales
0 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2010-01-22 10:30 UTC (permalink / raw)
To: Jan Böcker; +Cc: Org Mode
Applied (but not yet pushed because of hardware upgrade at
repo.or.cz), thanks.
I had implemented it the other way round because that would avoid
making new empty lines by accident, but I do agree that swallowing a
headline is by fare the more severe problem.
Thanks.
- Carsten
On Jan 18, 2010, at 12:13 PM, Jan Böcker wrote:
> Consider the following situation:
>
> * A
> Some text.
> * B
>
> - Place the cursor on A, press C-x n w (org-narrow-to-subtree).
> - Go to the very end of the buffer and insert "xyz".
> - C-x n w (widen).
>
> You end up with:
>
> * A
> Some Text
> xyz* B
>
>
> The attached one-line patch fixes this by passing `nil' for the
> `to-heading' parameter of `org-end-of-subtree'.
> <0001-org-narrow-to-subtree-prevent-prepending-text-to-
> the.patch>_______________________________________________
> 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
- Carsten
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] org-narrow-to-subtree: prevent prepending text to the next headline while narrowed
2010-01-22 10:30 ` Carsten Dominik
@ 2010-01-22 16:50 ` Samuel Wales
2010-02-01 8:11 ` Carsten Dominik
0 siblings, 1 reply; 6+ messages in thread
From: Samuel Wales @ 2010-01-22 16:50 UTC (permalink / raw)
To: Carsten Dominik; +Cc: Org Mode
I'm not so sure about this patch.
Are you sure this will work with sorting headlines? Swallowed
headlines occur if end of narrowed region is at eol. What about other
operations, including user-written commands? Can we be sure that they
will not to swallowed headlines?
IMO the behavior described as a bug by the OP is correct -- the user
should insert a newline after xyz (or org could detect that and insert
a newline depending on mode-require-final-newline or
require-final-newline).
I think opinions might vary on this.
--
Q: How many CDC "scientists" does it take to change a lightbulb?
A: "You only think it's dark." [CDC has denied a deadly disease for 25 years]
==========
Retrovirus: http://www.wpinstitute.org/xmrv/index.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] org-narrow-to-subtree: prevent prepending text to the next headline while narrowed
2010-01-22 16:50 ` Samuel Wales
@ 2010-02-01 8:11 ` Carsten Dominik
2010-02-01 17:26 ` Samuel Wales
0 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2010-02-01 8:11 UTC (permalink / raw)
To: Samuel Wales; +Cc: Org Mode
Hi Samuel,
this remains a contriversial issue. However, since I made the change,
I have not received any concrete reports of problems - so I guess it
is working pretty well the way it is now.
Case closed - until the next bug report :-)
- Carsten
On Jan 22, 2010, at 5:50 PM, Samuel Wales wrote:
> I'm not so sure about this patch.
>
> Are you sure this will work with sorting headlines? Swallowed
> headlines occur if end of narrowed region is at eol. What about other
> operations, including user-written commands? Can we be sure that they
> will not to swallowed headlines?
>
> IMO the behavior described as a bug by the OP is correct -- the user
> should insert a newline after xyz (or org could detect that and insert
> a newline depending on mode-require-final-newline or
> require-final-newline).
>
> I think opinions might vary on this.
>
> --
> Q: How many CDC "scientists" does it take to change a lightbulb?
> A: "You only think it's dark." [CDC has denied a deadly disease for
> 25 years]
> ==========
> Retrovirus: http://www.wpinstitute.org/xmrv/index.html
- Carsten
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] org-narrow-to-subtree: prevent prepending text to the next headline while narrowed
2010-02-01 8:11 ` Carsten Dominik
@ 2010-02-01 17:26 ` Samuel Wales
2010-02-02 6:17 ` Carsten Dominik
0 siblings, 1 reply; 6+ messages in thread
From: Samuel Wales @ 2010-02-01 17:26 UTC (permalink / raw)
To: Carsten Dominik; +Cc: Org Mode
Hi Carsten,
On 2010-02-01, Carsten Dominik <carsten.dominik@gmail.com> wrote:
> Hi Samuel,
>
> this remains a contriversial issue. However, since I made the change,
> I have not received any concrete reports of problems - so I guess it
> is working pretty well the way it is now.
>
> Case closed - until the next bug report :-)
Challenge accepted.
Sorting creates a blank line.
:)
--
Q: How many CDC "scientists" does it take to change a lightbulb?
A: "You only think it's dark." [CDC has denied ME/"CFS" for 25 years]
==========
Retrovirus: http://www.wpinstitute.org/xmrv/index.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] org-narrow-to-subtree: prevent prepending text to the next headline while narrowed
2010-02-01 17:26 ` Samuel Wales
@ 2010-02-02 6:17 ` Carsten Dominik
0 siblings, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2010-02-02 6:17 UTC (permalink / raw)
To: Samuel Wales; +Cc: Org Mode
On Feb 1, 2010, at 6:26 PM, Samuel Wales wrote:
> Hi Carsten,
>
> On 2010-02-01, Carsten Dominik <carsten.dominik@gmail.com> wrote:
>> Hi Samuel,
>>
>> this remains a contriversial issue. However, since I made the
>> change,
>> I have not received any concrete reports of problems - so I guess it
>> is working pretty well the way it is now.
>>
>> Case closed - until the next bug report :-)
>
> Challenge accepted.
>
> Sorting creates a blank line.
Hi Samuel,
You mean, narrowing to a subtree, then sorting, then widening
does create an empty line?
That is *much* more acceptable that swallowing a headline, don't you
agree?
And if you sort without narrowing, nothing will happen, I think.
- Carsten
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-02-02 7:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-18 11:13 [PATCH] org-narrow-to-subtree: prevent prepending text to the next headline while narrowed Jan Böcker
2010-01-22 10:30 ` Carsten Dominik
2010-01-22 16:50 ` Samuel Wales
2010-02-01 8:11 ` Carsten Dominik
2010-02-01 17:26 ` Samuel Wales
2010-02-02 6:17 ` Carsten Dominik
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).