Browse Source

org.el: Make ̀C-u C-c C-q' do the right thing even when point is before the first heading.

* org.el (org-set-tags-command, org-set-tags): Make ̀C-u C-c
C-q' do the right thing even when point is before the first
heading.

Thanks to François Pinard for mentioning this.
Bastien Guerry 14 years ago
parent
commit
d447fe8792
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lisp/org.el

+ 2 - 2
lisp/org.el

@@ -13273,7 +13273,7 @@ If ONOFF is `on' or `off', don't toggle but set to this state."
 (defun org-set-tags-command (&optional arg just-align)
 (defun org-set-tags-command (&optional arg just-align)
   "Call the set-tags command for the current entry."
   "Call the set-tags command for the current entry."
   (interactive "P")
   (interactive "P")
-  (if (org-at-heading-p)
+  (if (or (org-at-heading-p) (and arg (org-before-first-heading-p)))
       (org-set-tags arg just-align)
       (org-set-tags arg just-align)
     (save-excursion
     (save-excursion
       (org-back-to-heading t)
       (org-back-to-heading t)
@@ -13327,7 +13327,7 @@ If DATA is nil or the empty string, any tags will be removed."
 With prefix ARG, realign all tags in headings in the current buffer."
 With prefix ARG, realign all tags in headings in the current buffer."
   (interactive "P")
   (interactive "P")
   (let* ((re org-outline-regexp-bol)
   (let* ((re org-outline-regexp-bol)
-	 (current (org-get-tags-string))
+	 (current (unless arg (org-get-tags-string)))
 	 (col (current-column))
 	 (col (current-column))
 	 (org-setting-tags t)
 	 (org-setting-tags t)
 	 table current-tags inherited-tags ; computed below when needed
 	 table current-tags inherited-tags ; computed below when needed