From 89e0d3608daa551e2b97e7e1c3bb2b0f77ded674 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 1 Mar 2009 13:56:48 +0100 Subject: [PATCH] Tags: Fix implementation of line breaks in fast tag interface Patch by Christopher Suckling --- doc/ChangeLog | 4 ++++ doc/org.texi | 11 +++++++++++ lisp/ChangeLog | 8 ++++++++ lisp/org.el | 44 +++++++++++++++++++++++++++++++++++++++----- 4 files changed, 62 insertions(+), 5 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index ad9318ae9..86ed4f0b5 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2009-03-01 Carsten Dominik + + * org.texi (Setting tags): Document `org-tag-persistent-alist'. + 2009-02-27 Carsten Dominik * org.texi (Weekly/daily agenda): New section. diff --git a/doc/org.texi b/doc/org.texi index 74f5dea8d..0a7a8449a 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -3868,6 +3868,17 @@ in a specific file, add an empty TAGS option line to that file: #+TAGS: @end example +@vindex org-tag-persistent-alist +If you have a preferred set of tags that you would like to use in every file, +in addition to those defined on a per file basis by TAGS option lines, then +you may specify a list of tags with the variable +@code{org-tag-persistent-alist}. You may turn this off on a per file basis +by adding a STARTUP option line to that file: + +@example +#+STARTUP: noptag +@end example + By default Org mode uses the standard minibuffer completion facilities for entering tags. However, it also implements another, quicker, tag selection method called @emph{fast tag selection}. This allows you to select and diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 847459c06..d463ba319 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2009-03-01 Carsten Dominik + + * org.el (org-tag-persistent-alist): New option. + (org-startup-options): Add keyword `noptag'. + (org-fast-todo-selection): Handle :newline correctly. + (org-set-tags): Handle :newline correctly. + (org-fast-tag-selection): Handle :newline correctly. + 2009-02-28 Carsten Dominik * org-exp.el (org-export-as-ascii): Reverse link buffer before diff --git a/lisp/org.el b/lisp/org.el index abb939545..85f4ec5d9 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -2097,6 +2097,26 @@ See the manual for details." (const :tag "End radio group" (:endgroup)) (const :tag "New line" (:newline))))) +(defcustom org-tag-persistent-alist nil + "List of tags that will always appear in all Org-mode files. +This is in addition to any in buffer settings or customizations +of `org-tag-alist'. +When this list is nil, Org-mode will base TAG input on `org-tag-alist'. +The value of this variable is an alist, the car of each entry must be a +keyword as a string, the cdr may be a character that is used to select +that tag through the fast-tag-selection interface. +See the manual for details. +To disable these tags on a per-file basis, insert anywhere in the file: + #+STARTUP: noptag" + :group 'org-tags + :type '(repeat + (choice + (cons (string :tag "Tag name") + (character :tag "Access char")) + (const :tag "Start radio group" (:startgroup)) + (const :tag "End radio group" (:endgroup)) + (const :tag "New line" (:newline))))) + (defvar org-file-tags nil "List of tags that can be inherited by all entries in the file. The tags will be inherited if the variable `org-use-tag-inheritance' @@ -3255,7 +3275,8 @@ After a match, the following groups carry important information: ("fnconfirm" org-footnote-auto-label confirm) ("fnplain" org-footnote-auto-label plain) ("constcgs" constants-unit-system cgs) - ("constSI" constants-unit-system SI)) + ("constSI" constants-unit-system SI) + ("noptag" org-tag-persistent-alist nil)) "Variable associated with STARTUP options for org-mode. Each element is a list of three items: The startup options as written in the #+STARTUP line, the corresponding variable, and the value to @@ -8976,7 +8997,13 @@ Returns the new TODO keyword, or nil if no state change should occur." (setq ingroup nil cnt 0) (insert "}\n")) ((equal e '(:newline)) - (insert "\n ")) + (when (not (= cnt 0)) + (setq cnt 0) + (insert "\n") + (setq e (car tbl)) + (while (equal (car tbl) '(:newline)) + (insert "\n") + (setq tbl (cdr tbl))))) (t (setq tg (car e) c (cdr e)) (if ingroup (push tg (car groups))) @@ -10226,8 +10253,9 @@ With prefix ARG, realign all tags in headings in the current buffer." (if just-align (setq tags current) ;; Get a new set of tags from the user - (save-excursion - (setq table (or org-tag-alist (org-get-buffer-tags)) + (save-excursion + (setq table (append org-tag-persistent-alist + (or org-tag-alist (org-get-buffer-tags))) org-last-tags-completion-table table current-tags (org-split-string current ":") inherited-tags (nreverse @@ -10434,7 +10462,13 @@ Returns the new tags string, or nil to not change the current settings." (setq ingroup nil cnt 0) (insert "}\n")) ((equal e '(:newline)) - (insert "\n ")) + (when (not (= cnt 0)) + (setq cnt 0) + (insert "\n") + (setq e (car tbl)) + (while (equal (car tbl) '(:newline)) + (insert "\n") + (setq tbl (cdr tbl))))) (t (setq tg (car e) c2 nil) (if (cdr e) -- 2.11.4.GIT