emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: emacs-orgmode@dunsmor.com
To: emacs-orgmode@gnu.org
Subject: [PATCH] Stable key assignment for org-fast-tag-selection
Date: Wed, 12 Jan 2011 14:34:36 -0600	[thread overview]
Message-ID: <8739oxc143.fsf@riotblast.dunsmor.com> (raw)

I noticed that the code to "automatically assign a character" in the
org-fast-tag-selection function assigns a different character depending
on whether or not the tag exists in the current heading.

To see the problem, do the following steps:

- Eval (setq org-use-fast-tag-selection t)
- Eval (setq org-fast-tag-selection-single-key "expert")
- Create a heading with tags :a1:a2:
- Create another heading with tags :a1:a2:
- Type "C-c a", "C-c a", "C-c a", "C-c a"
- Notice how it changes from a1 to a2

Below is a patch to make the character assignment stable, given that all
of the same tags exist in the file each time it's run.

(The tabs messed up the indentation in the git-diff output.)

Regards,
Jason


diff --git a/lisp/org.el b/lisp/org.el
index b2b08ae..fd49f3e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12947,7 +12947,8 @@ possibly with grouping information.  TODO-TABLE is a similar table with
 TODO keywords, should these have keys assigned to them.
 If the keys are nil, a-z are automatically assigned.
 Returns the new tags string, or nil to not change the current settings."
-  (let* ((fulltable (append table todo-table))
+  (let* ((table (sort table (lambda (a b) (string< (car a) (car b)))))
+        (fulltable (append table todo-table))
         (maxlen (apply 'max (mapcar
                              (lambda (x)
                                (if (stringp (car x)) (string-width (car x)) 0))

             reply	other threads:[~2011-01-12 20:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-12 20:34 emacs-orgmode [this message]
2011-01-18  0:56 ` [PATCH] Stable key assignment for org-fast-tag-selection Bastien
2011-01-20 20:06   ` Matt Lundin
2011-01-21  2:27     ` Jason Dunsmore

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=8739oxc143.fsf@riotblast.dunsmor.com \
    --to=emacs-orgmode@dunsmor.com \
    --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).