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.
This commit is contained in:
Bastien Guerry 2009-08-03 03:03:43 +08:00
parent 052f6e334d
commit 47994f66d2
2 changed files with 4 additions and 3 deletions

View File

@ -2,6 +2,8 @@
* org.el (org-adapt-indentation): Slightly improve the docstring. * org.el (org-adapt-indentation): Slightly improve the docstring.
(org-occur): Sends an error when the user inputs an empty string. (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 * org-exp.el (org-export-as-org): Use file-source.org format
instead of file.org-source. instead of file.org-source.

View File

@ -10307,13 +10307,12 @@ ACTION can be `set', `up', `down', or a character."
(goto-char (match-end 2)) (goto-char (match-end 2))
(insert " [#" news "]")) (insert " [#" news "]"))
(goto-char (match-beginning 3)) (goto-char (match-beginning 3))
(insert "[#" news "] "))))) (insert "[#" news "] "))))
(org-preserve-lc (org-set-tags nil 'align)) (org-preserve-lc (org-set-tags nil 'align)))
(if remove (if remove
(message "Priority removed") (message "Priority removed")
(message "Priority of current item set to %s" news)))) (message "Priority of current item set to %s" news))))
(defun org-get-priority (s) (defun org-get-priority (s)
"Find priority cookie and return priority." "Find priority cookie and return priority."
(save-match-data (save-match-data