emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Not on a heading error while setting priorities
@ 2009-08-02  0:18 Bernt Hansen
  2009-08-02 14:58 ` [PATCH] Fix "Not on a heading" error when setting priority inside a task Bernt Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: Bernt Hansen @ 2009-08-02  0:18 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I noticed the following error while playing with task priorities.  If
you are in an org-file and use C-c , on a headline it works fine.

If you try this after the headline (anywhere in the body of the task)
you get a "Not on a heading" error but it still seems to work (it puts
the appropriate priority in the heading of the task.)

I like the idea of allowing the task priority to change while anywhere
in the task and other than signalling the error this seems to work fine.

I've attached the debug backtrace.  A patch to fix this is in the
following email.

-Bernt

Debugger entered--Lisp error: (error "Not on a heading")
  signal(error ("Not on a heading"))
  error("Not on a heading")
  (if (org-on-heading-p t) nil (error "Not on a heading"))
  (unless (org-on-heading-p t) (error "Not on a heading"))
  org-get-tags-string()
  (let* ((re ...) (current ...) (col ...) (org-setting-tags t) table current-tags inherited-tags tags p0 c0 c1 rpl) (if arg (save-excursion ... ... ...) (if just-align ... ... ...) (if org-tags-sort-function ...) (if ... ... ... ...) (beginning-of-line 1) (cond ... ... ...) (org-move-to-column col) (unless just-align ...)))
  org-set-tags(nil align)
  (progn (org-set-tags nil (quote align)))
  (unwind-protect (progn (org-set-tags nil ...)) (goto-line _line) (org-move-to-column _col))
  (let ((_line ...) (_col ...)) (unwind-protect (progn ...) (goto-line _line) (org-move-to-column _col)))
  (org-preserve-lc (org-set-tags nil (quote align)))
  (let (current new news have remove) (save-excursion (org-back-to-heading t) (if ... ... ...) (cond ... ... ... ...) (if ... ...) (setq news ...) (if have ... ...)) (org-preserve-lc (org-set-tags nil ...)) (if remove (message "Priority removed") (message "Priority of current item set to %s" news)))
  org-priority()
  call-interactively(org-priority)

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

* [PATCH] Fix "Not on a heading" error when setting priority inside a task
  2009-08-02  0:18 Not on a heading error while setting priorities Bernt Hansen
@ 2009-08-02 14:58 ` Bernt Hansen
  2009-08-02 19:03   ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Bernt Hansen @ 2009-08-02 14:58 UTC (permalink / raw)
  To: emacs-orgmode

Changing the priority of a task when the point is after the heading
(anywhere inside the task) worked but aligning the tags failed with
a not on a heading error due to the save-excursion not including
the tag alignment.  This change moves back to the heading and
includes that during tag alignment to remove the error text.
---
This patch is available at git://git.norang.ca/org-mode.git for-carsten

-Bernt

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

diff --git a/lisp/org.el b/lisp/org.el
index 119311a..942be39 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10294,13 +10294,12 @@ ACTION can be `set', `up', `down', or a character."
 		(goto-char (match-end 2))
 		(insert " [#" news "]"))
 	    (goto-char (match-beginning 3))
-	    (insert "[#" news "] ")))))
-    (org-preserve-lc (org-set-tags nil 'align))
+	    (insert "[#" news "] "))))
+      (org-preserve-lc (org-set-tags nil 'align)))
     (if remove
 	(message "Priority removed")
       (message "Priority of current item set to %s" news))))
 
-
 (defun org-get-priority (s)
   "Find priority cookie and return priority."
   (save-match-data
-- 
1.6.2.rc1.1002.g6345

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

* Re: [PATCH] Fix "Not on a heading" error when setting priority inside a task
  2009-08-02 14:58 ` [PATCH] Fix "Not on a heading" error when setting priority inside a task Bernt Hansen
@ 2009-08-02 19:03   ` Bastien
  0 siblings, 0 replies; 3+ messages in thread
From: Bastien @ 2009-08-02 19:03 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:

> Changing the priority of a task when the point is after the heading
> (anywhere inside the task) worked but aligning the tags failed with
> a not on a heading error due to the save-excursion not including
> the tag alignment.  This change moves back to the heading and
> includes that during tag alignment to remove the error text.
> ---
> This patch is available at git://git.norang.ca/org-mode.git
> for-carsten

Applied, thanks!

-- 
 Bastien

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

end of thread, other threads:[~2009-08-02 19:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-02  0:18 Not on a heading error while setting priorities Bernt Hansen
2009-08-02 14:58 ` [PATCH] Fix "Not on a heading" error when setting priority inside a task Bernt Hansen
2009-08-02 19:03   ` Bastien

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