emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix before first heading check
@ 2010-12-19 21:32 Bernt Hansen
  2010-12-20 13:05 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Bernt Hansen @ 2010-12-19 21:32 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bernt Hansen

* lisp/org.el (org-before-first-heading-p): If point is on an org-mode heading line then we are not before the first heading

If point is anywhere on the first line of the first heading then we
are not before the first heading.  This makes
org-before-first-heading-p returns t instead of nil when on the '*' or
blank of the first level 1 heading in an org file.

This was noticed when the first heading has an encryption
tag :crypt:. C-c C-r would not decrypt this entry if point is at the
beginning of the line since it was considered before the first
heading.
---
This patch is available at git://git.norang.ca/org-mode.git fix-before-first-heading-check

-Bernt

 lisp/org.el |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 53039e4..b2f32fc 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19167,6 +19167,7 @@ This version does not only check the character property, but also
 (defun org-before-first-heading-p ()
   "Before first heading?"
   (save-excursion
+    (end-of-line)
     (null (re-search-backward "^\\*+ " nil t))))
 
 (defun org-on-heading-p (&optional ignored)
-- 
1.7.3.3.464.gf80b6

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

* Re: [PATCH] Fix before first heading check
  2010-12-19 21:32 [PATCH] Fix before first heading check Bernt Hansen
@ 2010-12-20 13:05 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2010-12-20 13:05 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Applied, thanks.

- Carsten

On Dec 19, 2010, at 10:32 PM, Bernt Hansen wrote:

> * lisp/org.el (org-before-first-heading-p): If point is on an org- 
> mode heading line then we are not before the first heading
>
> If point is anywhere on the first line of the first heading then we
> are not before the first heading.  This makes
> org-before-first-heading-p returns t instead of nil when on the '*' or
> blank of the first level 1 heading in an org file.
>
> This was noticed when the first heading has an encryption
> tag :crypt:. C-c C-r would not decrypt this entry if point is at the
> beginning of the line since it was considered before the first
> heading.
> ---
> This patch is available at git://git.norang.ca/org-mode.git fix- 
> before-first-heading-check
>
> -Bernt
>
> lisp/org.el |    1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 53039e4..b2f32fc 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -19167,6 +19167,7 @@ This version does not only check the  
> character property, but also
> (defun org-before-first-heading-p ()
>   "Before first heading?"
>   (save-excursion
> +    (end-of-line)
>     (null (re-search-backward "^\\*+ " nil t))))
>
> (defun org-on-heading-p (&optional ignored)
> -- 
> 1.7.3.3.464.gf80b6
>
>
> _______________________________________________
> 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] 2+ messages in thread

end of thread, other threads:[~2010-12-20 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-19 21:32 [PATCH] Fix before first heading check Bernt Hansen
2010-12-20 13:05 ` 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).