emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* bug: org-narrow-to-subtree
@ 2010-11-01 13:32 Puneeth
  2010-11-01 18:30 ` David Maus
  2010-11-01 19:52 ` Carsten Dominik
  0 siblings, 2 replies; 4+ messages in thread
From: Puneeth @ 2010-11-01 13:32 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,

I hit a minor bug with the function org-narrow-to-subtree.

When I narrow to a headline (subtree with just the headline) present
at the end of a file, the last character of the headline isn't present
in the narrowed region. [file1.org and file2.org shown at the end of
the message are examples]

I am attaching a possible patch for the same, but I don't think that
is the "cleanest" way to handle it. Hope it'll help some one else to
fix it in a better way.

Thanks,
Puneeth

file1.org
-----------------
* Hello
* World
* TestEOF
-----------------

file2.org
------------------
* Test
*** World
*** Hello 1EOF
------------------

[-- Attachment #2: org-narrow.patch.txt --]
[-- Type: text/plain, Size: 465 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index 59caf41..06b9f9e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7501,7 +7501,7 @@ If yes, remember the marker and the distance to BEG."
       (narrow-to-region
        (progn (org-back-to-heading t) (point))
        (progn (org-end-of-subtree t t)
-	      (if (org-on-heading-p) (backward-char 1))
+	      (if (and (org-on-heading-p) (org-at-regexp-p "*")) (backward-char 1))
 	      (point))))))
 
 (eval-when-compile

[-- 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] 4+ messages in thread

* Re: bug: org-narrow-to-subtree
  2010-11-01 13:32 bug: org-narrow-to-subtree Puneeth
@ 2010-11-01 18:30 ` David Maus
  2010-11-01 19:52 ` Carsten Dominik
  1 sibling, 0 replies; 4+ messages in thread
From: David Maus @ 2010-11-01 18:30 UTC (permalink / raw)
  To: Puneeth; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 784 bytes --]

At Mon, 1 Nov 2010 19:02:53 +0530,
Puneeth wrote:
>
> Hi,
>
> I hit a minor bug with the function org-narrow-to-subtree.
>
> When I narrow to a headline (subtree with just the headline) present
> at the end of a file, the last character of the headline isn't present
> in the narrowed region. [file1.org and file2.org shown at the end of
> the message are examples]
>
> I am attaching a possible patch for the same, but I don't think that
> is the "cleanest" way to handle it. Hope it'll help some one else to
> fix it in a better way.

Confirmed and fixed in master.  Different solution to the problem:
Don't move point one character back if point is at end of buffer
(eobp).

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: 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	[flat|nested] 4+ messages in thread

* Re: bug: org-narrow-to-subtree
  2010-11-01 13:32 bug: org-narrow-to-subtree Puneeth
  2010-11-01 18:30 ` David Maus
@ 2010-11-01 19:52 ` Carsten Dominik
  2010-11-02  3:28   ` Puneeth
  1 sibling, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2010-11-01 19:52 UTC (permalink / raw)
  To: Puneeth; +Cc: emacs-orgmode

Hi Puneeth,

I am unable to reproduce this problem....

Greetings

- Carsten

On Nov 1, 2010, at 2:32 PM, Puneeth wrote:

> Hi,
>
> I hit a minor bug with the function org-narrow-to-subtree.
>
> When I narrow to a headline (subtree with just the headline) present
> at the end of a file, the last character of the headline isn't present
> in the narrowed region. [file1.org and file2.org shown at the end of
> the message are examples]
>
> I am attaching a possible patch for the same, but I don't think that
> is the "cleanest" way to handle it. Hope it'll help some one else to
> fix it in a better way.
>
> Thanks,
> Puneeth
>
> file1.org
> -----------------
> * Hello
> * World
> * TestEOF
> -----------------
>
> file2.org
> ------------------
> * Test
> *** World
> *** Hello 1EOF
> ------------------
> <org-narrow.patch.txt>_______________________________________________
> 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	[flat|nested] 4+ messages in thread

* Re: bug: org-narrow-to-subtree
  2010-11-01 19:52 ` Carsten Dominik
@ 2010-11-02  3:28   ` Puneeth
  0 siblings, 0 replies; 4+ messages in thread
From: Puneeth @ 2010-11-02  3:28 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Hi Carsten,

On Tue, Nov 2, 2010 at 1:22 AM, Carsten Dominik
<carsten.dominik@gmail.com> wrote:
> Hi Puneeth,
>
> I am unable to reproduce this problem....

Is it because David has already fixed the problem? :)

Thanks,
Puneeth

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

end of thread, other threads:[~2010-11-02  3:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-01 13:32 bug: org-narrow-to-subtree Puneeth
2010-11-01 18:30 ` David Maus
2010-11-01 19:52 ` Carsten Dominik
2010-11-02  3:28   ` Puneeth

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