* [PATCH] fast tag selection interface
@ 2009-02-16 0:15 Christopher Suckling
2009-02-17 21:00 ` Carsten Dominik
[not found] ` <B2AEFB22-36E9-4FF0-A8F8-F360718FF11E@uva.nl>
0 siblings, 2 replies; 4+ messages in thread
From: Christopher Suckling @ 2009-02-16 0:15 UTC (permalink / raw
To: org-mode mailing list
As a result of the 40 variables thread and assorted worg tutorials,
I'm getting a little carried away with customising my workflow.
Consequently, my tag list have grown to the extent that the fast tags
selection interface is looking rather messy.
The small patch below adds the capability to create arbitrary new
lines, either by adding "\n" (backslash n, not a newline!) to your #
+TAGS: or by adding "(:newline . nil)" to org-tag-alist.
So I can have something like:
-----
[a] @assorted [g] @gtd [c] @contexts
[o] other [r] relevant [t] tags
[m] more [f] for [d] different [p] projects
-----
The patch is a very hacky cut and paste job with little understanding
of the surrounding code, but I don't seem to have broken anything in
my setup yet...
Best wishes,
Christopher
-----
Modified lisp/org.el
diff --git a/lisp/org.el b/lisp/org.el
index c4cfacd..484df30 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2066,7 +2066,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.
@@ -3398,6 +3399,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)))
@@ -3534,6 +3536,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)
@@ -8866,6 +8869,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)))
@@ -10316,6 +10321,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)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fast tag selection interface
2009-02-16 0:15 [PATCH] fast tag selection interface Christopher Suckling
@ 2009-02-17 21:00 ` Carsten Dominik
2009-02-18 22:50 ` Christopher Suckling
[not found] ` <B2AEFB22-36E9-4FF0-A8F8-F360718FF11E@uva.nl>
1 sibling, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2009-02-17 21:00 UTC (permalink / raw
To: Christopher Suckling; +Cc: org-mode mailing list
On Feb 16, 2009, at 1:15 AM, Christopher Suckling wrote:
> As a result of the 40 variables thread and assorted worg tutorials,
> I'm getting a little carried away with customising my workflow.
> Consequently, my tag list have grown to the extent that the fast
> tags selection interface is looking rather messy.
>
> The small patch below adds the capability to create arbitrary new
> lines, either by adding "\n" (backslash n, not a newline!) to your #
> +TAGS: or by adding "(:newline . nil)" to org-tag-alist.
>
> So I can have something like:
>
> -----
> [a] @assorted [g] @gtd [c] @contexts
>
> [o] other [r] relevant [t] tags
>
> [m] more [f] for [d] different [p] projects
> -----
I am not convinced that this helps a lot. Do ou really think
it is much better?
The patch looks good and complete! Do you have a copyright
assignment with the FSF? Not absolutely necessary for
this small a patch, but still...
- Carsten
>
>
> The patch is a very hacky cut and paste job with little
> understanding of the surrounding code, but I don't seem to have
> broken anything in my setup yet...
>
> Best wishes,
>
> Christopher
>
> -----
>
> Modified lisp/org.el
> diff --git a/lisp/org.el b/lisp/org.el
> index c4cfacd..484df30 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -2066,7 +2066,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.
> @@ -3398,6 +3399,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)))
> @@ -3534,6 +3536,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)
> @@ -8866,6 +8869,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)))
> @@ -10316,6 +10321,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)
>
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fast tag selection interface
2009-02-17 21:00 ` Carsten Dominik
@ 2009-02-18 22:50 ` Christopher Suckling
0 siblings, 0 replies; 4+ messages in thread
From: Christopher Suckling @ 2009-02-18 22:50 UTC (permalink / raw
To: Carsten Dominik; +Cc: org-mode mailing list, Christopher Suckling
On 17 Feb 2009, at 21:00, Carsten Dominik wrote:
>
> On Feb 16, 2009, at 1:15 AM, Christopher Suckling wrote:
>
>> As a result of the 40 variables thread and assorted worg tutorials,
>> I'm getting a little carried away with customising my workflow.
>> Consequently, my tag list have grown to the extent that the fast
>> tags selection interface is looking rather messy.
>>
>> The small patch below adds the capability to create arbitrary new
>> lines, either by adding "\n" (backslash n, not a newline!) to your #
>> +TAGS: or by adding "(:newline . nil)" to org-tag-alist.
>>
>> So I can have something like:
>>
>> -----
>> [a] @assorted [g] @gtd [c] @contexts
>>
>> [o] other [r] relevant [t] tags
>>
>> [m] more [f] for [d] different [p] projects
>> -----
>
> I am not convinced that this helps a lot. Do ou really think
> it is much better?
It's a tiny thing; my tags setup had got messy so I added it! I don't
think it's much better, but it works for my situation (perhaps I
should change my workflow than the tool...)
> The patch looks good and complete! Do you have a copyright
> assignment with the FSF? Not absolutely necessary for
> this small a patch, but still...
Assignment form requested...
Best wishes,
Christopher
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fast tag selection interface
[not found] ` <B2AEFB22-36E9-4FF0-A8F8-F360718FF11E@uva.nl>
@ 2009-02-27 18:40 ` Christopher Suckling
0 siblings, 0 replies; 4+ messages in thread
From: Christopher Suckling @ 2009-02-27 18:40 UTC (permalink / raw
To: Carsten Dominik; +Cc: org-mode mailing list
On 19 Feb 2009, at 09:22, Carsten Dominik wrote:
> Hi Christopher,
>
> ok, I have applied your patch, with one addition:
>
> When you write
>
> #+TAGS: a b c
> #+TAGS: d e f
>
> instead of
>
> #+TAGS: a b c d e f
>
> then a newline is implied after "c".
>
> Also, I noticed, that you can do
>
> #+TAGS: a b c \n \n d e f
>
> and it will nicely give you an empty line.
>
> Thanks!
>
> - Carsten
Hi Carsten,
Unfortunately, my patch was a bit crude and caused some rather
unpredictable formatting.
Here's an improvement which fixes that; I had forgotten to reset cnt
to 0 whenever a new line occurred, so all sorts of strange line breaks
were happening.
I've also added a new variable, org-tag-persistent-alist, which is a
list of tags that will always appear in all Org-mode files, in
addition to any in buffer settings or customizations of org-tag-alist.
As with line breaks, this may be a tiny personal convenience (I store
all my GTD contexts in them so I don't have to re-enter them in every
new org file), but in case anyone else finds it useful...
Best wishes,
Christopher
-----
Modified lisp/org.el
diff --git a/lisp/org.el b/lisp/org.el
index abb9395..66654f5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2097,6 +2097,22 @@ 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, 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."
+ :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'
@@ -8976,7 +8992,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))
+ (cond
+ ((equal e '(:newline))
+ (insert "\n")))))
(t
(setq tg (car e) c (cdr e))
(if ingroup (push tg (car groups)))
@@ -10227,7 +10249,7 @@ With prefix ARG, realign all tags in headings
in the current buffer."
(setq tags current)
;; Get a new set of tags from the user
(save-excursion
- (setq table (or org-tag-alist (org-get-buffer-tags))
+ (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 +10456,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))
+ (cond
+ ((equal e '(:newline))
+ (insert "\n")))))
(t
(setq tg (car e) c2 nil)
(if (cdr e)
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-27 18:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-16 0:15 [PATCH] fast tag selection interface Christopher Suckling
2009-02-17 21:00 ` Carsten Dominik
2009-02-18 22:50 ` Christopher Suckling
[not found] ` <B2AEFB22-36E9-4FF0-A8F8-F360718FF11E@uva.nl>
2009-02-27 18:40 ` Christopher Suckling
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).