From: Christopher Suckling <suckling.list@googlemail.com>
To: Carsten Dominik <dominik@science.uva.nl>
Cc: org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] fast tag selection interface
Date: Fri, 27 Feb 2009 18:40:58 +0000 [thread overview]
Message-ID: <521CAEF3-952B-4086-9BCD-DC6120B1DB24@gmail.com> (raw)
In-Reply-To: <B2AEFB22-36E9-4FF0-A8F8-F360718FF11E@uva.nl>
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)
prev parent reply other threads:[~2009-02-27 18:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=521CAEF3-952B-4086-9BCD-DC6120B1DB24@gmail.com \
--to=suckling.list@googlemail.com \
--cc=dominik@science.uva.nl \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).