Browse Source

Tags: Implement newlines for fast tag interface

This commit makes it possible to force new lines and even empty lines
in the fast tag selection interface, either by splitting tags
definition into several lines, or by inserting "\n" into the tags
list, or by inserting (:newline) into the tags alist.

This is largely a patch from Christopher Suckling
Carsten Dominik 16 years ago
parent
commit
8b31b5e798
4 changed files with 35 additions and 3 deletions
  1. 2 0
      doc/ChangeLog
  2. 17 1
      doc/org.texi
  3. 6 0
      lisp/ChangeLog
  4. 10 2
      lisp/org.el

+ 2 - 0
doc/ChangeLog

@@ -1,5 +1,7 @@
 2009-02-19  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.texi (Setting tags): Document newline option.
+
 	* orgcard.tex: Document `C-c C-x o'.
 
 	* org.texi (TODO dependencies, Checkboxes): Document

+ 17 - 1
doc/org.texi

@@ -3887,6 +3887,21 @@ can, instead, set the TAGS option line as:
 #+TAGS: @@work(w)  @@home(h)  @@tennisclub(t)  laptop(l)  pc(p)
 @end example
 
+@noindent The tags interface will show the available tags in a splash
+window.  If you would to start a new line after a specific tag, insert
+@samp{\n} into the tag list
+
+@example
+#+TAGS: @@work(w)  @@home(h)  @@tennisclub(t) \n laptop(l)  pc(p)
+@end example
+
+@noindent or write them in two lines:
+
+@example
+#+TAGS: @@work(w)  @@home(h)  @@tennisclub(t)
+#+TAGS: laptop(l)  pc(p)
+@end example
+
 @noindent
 You can also group together tags that are mutually exclusive.  By using
 braces, as in:
@@ -3904,7 +3919,8 @@ these lines to activate any changes.
 @noindent
 To set these mutually exclusive groups in the variable @code{org-tags-alist}
 you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead
-of the braces.  The previous example would be set globally by the following
+of the braces.  Similarly, you can use @code{:newline} to indicate a line
+break.  The previous example would be set globally by the following
 configuration:
 
 @lisp

+ 6 - 0
lisp/ChangeLog

@@ -3,6 +3,12 @@
 	* org.el (org-track-ordered-property-with-tag): New option.
 	(org-toggle-ordered-property): Honor
 	`org-track-ordered-property-with-tag'.
+	(org-tag-alist): Add newline options.
+	(org-set-regexps-and-options): Separate option lines imply a
+	newline.
+	(org-set-regexps-and-options, org-assign-fast-keys)
+	(org-fast-todo-selection, org-fast-tag-selection): Handle newline
+	option.
 
 	* org-list.el (org-checkbox-blocked-p): New function.
 	(org-toggle-checkbox): Check for blocking.

+ 10 - 2
lisp/org.el

@@ -2067,7 +2067,8 @@ See the manual for details."
 	   (cons   (string    :tag "Tag name")
 		   (character :tag "Access char"))
 	   (const :tag "Start radio group" (:startgroup))
-	   (const :tag "End radio group" (:endgroup)))))
+	   (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.
@@ -3268,7 +3269,8 @@ means to push this value onto the list in the variable.")
  	      (push (cons (intern (downcase (match-string 1 key)))
 			  (org-split-string value splitre)) kwds))
 	     ((equal key "TAGS")
-	      (setq tags (append tags (org-split-string value splitre))))
+	      (setq tags (append tags (if tags '("\\n") nil)
+				 (org-split-string value splitre))))
 	     ((equal key "COLUMNS")
 	      (org-set-local 'org-columns-default-format value))
 	     ((equal key "LINK")
@@ -3399,6 +3401,7 @@ means to push this value onto the list in the variable.")
 	    (cond
 	     ((equal e "{") (push '(:startgroup) tgs))
 	     ((equal e "}") (push '(:endgroup) tgs))
+	     ((equal e "\\n") (push '(:newline) tgs))
 	     ((string-match (org-re "^\\([[:alnum:]_@]+\\)(\\(.\\))$") e)
 	      (push (cons (match-string 1 e)
 			  (string-to-char (match-string 2 e)))
@@ -3535,6 +3538,7 @@ Respect keys that are already there."
       (cond
        ((equal e '(:startgroup)) (push e new))
        ((equal e '(:endgroup)) (push e new))
+       ((equal e '(:newline)) (push e new))
        (t
 	(setq k (car e) c2 nil)
 	(if (cdr e)
@@ -8897,6 +8901,8 @@ Returns the new TODO keyword, or nil if no state change should occur."
 	   ((equal e '(:endgroup))
 	    (setq ingroup nil cnt 0)
 	    (insert "}\n"))
+	   ((equal e '(:newline))
+	    (insert "\n  "))
 	   (t
 	    (setq tg (car e) c (cdr e))
 	    (if ingroup (push tg (car groups)))
@@ -10348,6 +10354,8 @@ Returns the new tags string, or nil to not change the current settings."
 	 ((equal e '(:endgroup))
 	  (setq ingroup nil cnt 0)
 	  (insert "}\n"))
+	 ((equal e '(:newline))
+	  (insert "\n  "))
 	 (t
 	  (setq tg (car e) c2 nil)
 	  (if (cdr e)