Browse Source

Fix "Not on a heading" error when setting priority inside a task

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.

Patch by Bernt Hansen.
Bastien Guerry 15 years ago
parent
commit
47994f66d2
2 changed files with 4 additions and 3 deletions
  1. 2 0
      lisp/ChangeLog
  2. 2 3
      lisp/org.el

+ 2 - 0
lisp/ChangeLog

@@ -2,6 +2,8 @@
 
 	* org.el (org-adapt-indentation): Slightly improve the docstring.
 	(org-occur): Sends an error when the user inputs an empty string.
+	(org-priority): Bugfix: the tag alignement should happen within
+	save-excursion.
 
 	* org-exp.el (org-export-as-org): Use file-source.org format
 	instead of file.org-source.

+ 2 - 3
lisp/org.el

@@ -10307,13 +10307,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