summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Wahl <marcowahlsoft@gmail.com>2019-01-05 13:16:31 +0100
committerMarco Wahl <marcowahlsoft@gmail.com>2019-01-05 13:16:31 +0100
commit2862bea69b7c69fbf3c0fb9dc54b48ab17d3b314 (patch)
tree77d0afaf36f8d0de69e5607584d23e2f141d20b4
parent99f0c5341886b36262ebbb3ffd66e74fae3eb110 (diff)
downloadorg-mode-2862bea69b7c69fbf3c0fb9dc54b48ab17d3b314.tar.gz
org: Option for user to force non fast tag selection interface
* lisp/org.el (org-set-tags-command): Disable the fast tag selection interface when the command is prefixed by C-u C-u.
-rw-r--r--etc/ORG-NEWS6
-rw-r--r--lisp/org.el106
2 files changed, 62 insertions, 50 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 51d6a07..e06d0c0 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -123,6 +123,12 @@ It was unused throughout the code base.
** Miscellaneous
*** Org Table reads numbers starting with 0 as strings
+*** Disable fast tag selection interface via prefix arg
+
+A call of ~org-set-tags-command~ with prefix argument C-u C-u avoids
+the fast tag selection interface and instead offers the plain
+interface.
+
* Version 9.2
** Incompatible changes
*** Removal of OrgStruct mode mode and radio lists
diff --git a/lisp/org.el b/lisp/org.el
index 970542e..38e4218 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14165,60 +14165,66 @@ tags."
When called with `\\[universal-argument]' prefix argument ARG, \
realign all tags
-in the current buffer. If a region is active, set tags for
-all headlines in the region.
+in the current buffer.
+
+When called with `\\[universal-argument] \\[universal-argument]' prefix argument, \
+unconditionally do not
+offer the fast tag selection interface.
+
+If a region is active, set tags in the region according to the
+setting of `org-loop-over-headlines-in-active-region'.
This function is for interactive use only;
in Lisp code use `org-set-tags' instead."
(interactive "P")
- (cond
- (arg (org-align-tags t))
- ((and (org-region-active-p) org-loop-over-headlines-in-active-region)
- ;; Disable `org-loop-over-headlines-in-active-region' for
- ;; successive calls.
- (let (org-loop-over-headlines-in-active-region)
- (org-map-entries
- #'org-set-tags-command
- nil
- (if (eq org-loop-over-headlines-in-active-region 'start-level)
- 'region-start-level
- 'region)
- (lambda () (when (org-invisible-p) (org-end-of-subtree nil t))))))
- (t
- (save-excursion
- (org-back-to-heading)
- (let* ((all-tags (org-get-tags))
- (table (setq org-last-tags-completion-table
- (org--tag-add-to-alist
- (and org-complete-tags-always-offer-all-agenda-tags
- (org-global-tags-completion-table
- (org-agenda-files)))
- (or org-current-tag-alist (org-get-buffer-tags)))))
- (current-tags
- (cl-remove-if (lambda (tag) (get-text-property 0 'inherited tag))
- all-tags))
- (inherited-tags
- (cl-remove-if-not (lambda (tag) (get-text-property 0 'inherited tag))
- all-tags))
- (tags
- (replace-regexp-in-string
- ;; Ignore all forbidden characters in tags.
- "[^[:alnum:]_@#%]+" ":"
- (if (or (eq t org-use-fast-tag-selection)
- (and org-use-fast-tag-selection
- (delq nil (mapcar #'cdr table))))
- (org-fast-tag-selection
- current-tags
- inherited-tags
- table
- (and org-fast-tag-selection-include-todo org-todo-key-alist))
- (let ((org-add-colon-after-tag-completion (< 1 (length table))))
- (org-trim (completing-read
- "Tags: "
- #'org-tags-completion-function
- nil nil (org-make-tag-string current-tags)
- 'org-tags-history)))))))
- (org-set-tags tags))))))
+ (let ((org-use-fast-tag-selection
+ (unless (equal '(16) arg) org-use-fast-tag-selection)))
+ (cond
+ ((equal '(4) arg) (org-align-tags t))
+ ((and (org-region-active-p) org-loop-over-headlines-in-active-region)
+ (let (org-loop-over-headlines-in-active-region) ; hint: infinite recursion.
+ (org-map-entries
+ #'org-set-tags-command
+ nil
+ (if (eq org-loop-over-headlines-in-active-region 'start-level)
+ 'region-start-level
+ 'region)
+ (lambda () (when (org-invisible-p) (org-end-of-subtree nil t))))))
+ (t
+ (save-excursion
+ (org-back-to-heading)
+ (let* ((all-tags (org-get-tags))
+ (table (setq org-last-tags-completion-table
+ (org--tag-add-to-alist
+ (and org-complete-tags-always-offer-all-agenda-tags
+ (org-global-tags-completion-table
+ (org-agenda-files)))
+ (or org-current-tag-alist (org-get-buffer-tags)))))
+ (current-tags
+ (cl-remove-if (lambda (tag) (get-text-property 0 'inherited tag))
+ all-tags))
+ (inherited-tags
+ (cl-remove-if-not (lambda (tag) (get-text-property 0 'inherited tag))
+ all-tags))
+ (tags
+ (replace-regexp-in-string
+ ;; Ignore all forbidden characters in tags.
+ "[^[:alnum:]_@#%]+" ":"
+ (if (or (eq t org-use-fast-tag-selection)
+ (and org-use-fast-tag-selection
+ (delq nil (mapcar #'cdr table))))
+ (org-fast-tag-selection
+ current-tags
+ inherited-tags
+ table
+ (and org-fast-tag-selection-include-todo org-todo-key-alist))
+ (let ((org-add-colon-after-tag-completion (< 1 (length table))))
+ (org-trim (completing-read
+ "Tags: "
+ #'org-tags-completion-function
+ nil nil (org-make-tag-string current-tags)
+ 'org-tags-history)))))))
+ (org-set-tags tags)))))))
(defun org-align-tags (&optional all)
"Align tags in current entry.