emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thomas Morgan <tlm@ziiuu.com>
To: emacs-orgmode@gnu.org
Subject: Abbreviating filtered tags in mode line
Date: Wed, 14 May 2014 02:24:45 -0400	[thread overview]
Message-ID: <87k39o27yq.fsf@algol.ziiuu.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 345 bytes --]

Dear Org-mode hackers,

This patch defines a variable org-agenda-abbreviate-tag-filter;
when it is set, filtered tags indicated on the mode line are
abbreviated according to their fast selection letters.

For example, "-@home+@net" is abbreviated "-h.+n." if the fast
selection letters of @home and @net are h and n respectively.

Best,
Thomas


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Optionally-abbreviate-filtered-tags-in-mode-line.patch --]
[-- Type: text/x-diff, Size: 1938 bytes --]

From 3c12d4b5c6ad12d6f34fe34ecc94f7be54fe61b5 Mon Sep 17 00:00:00 2001
From: Thomas Morgan <tlm@ziiuu.com>
Date: Wed, 14 May 2014 01:54:17 -0400
Subject: [PATCH] Optionally abbreviate filtered tags in mode line.

* lisp/org-agenda.el (org-agenda-abbreviate-tag-filter): New variable.
  (org-agenda-set-mode-name): Abbreviate tag filter if option is set.
---
 lisp/org-agenda.el |   25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 428d31f..69c3d38 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -236,6 +236,12 @@ you can \"misuse\" it to also add other text to the header."
   :group 'org-agenda
   :type 'boolean)
 
+(defcustom org-agenda-abbreviate-tag-filter nil
+  "When set, abbreviate filtered tags indicated in mode line.
+Tags are abbreviated with their fast selection letters, as configured."
+  :group 'org-agenda
+  :type 'boolean)
+
 (defgroup org-agenda-custom-commands nil
   "Options concerning agenda views in Org-mode."
   :tag "Org Agenda Custom Commands"
@@ -8227,9 +8233,22 @@ When called with a prefix argument, include all archive files as well."
 			   (concat " {"
 				   (mapconcat
 				    'identity
-				    (append
-				     (get 'org-agenda-tag-filter :preset-filter)
-				     org-agenda-tag-filter)
+				    (mapcar
+				     (lambda (f)
+				       (if (and org-agenda-abbreviate-tag-filter
+						(string-match
+						 "^\\([+-]\\)\\(.+\\)" f))
+				       	   (let* ((dir (match-string 1 f))
+				       		  (f0 (match-string 2 f))
+						  (alist org-tag-alist-for-agenda)
+				       		  (a (assoc f0 alist)))
+				       	     (if a
+						 (format "%s%c." dir (cdr a))
+				       	       f))
+				       	 f))
+				     (append
+				      (get 'org-agenda-tag-filter :preset-filter)
+				      org-agenda-tag-filter))
 				    "")
 				   "}")
 			   'face 'org-agenda-filter-tags
-- 
1.7.10.4


             reply	other threads:[~2014-05-14  6:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14  6:24 Thomas Morgan [this message]
2014-05-15  9:17 ` Abbreviating filtered tags in mode line Bastien
2014-05-15 13:45   ` Thomas Morgan

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=87k39o27yq.fsf@algol.ziiuu.com \
    --to=tlm@ziiuu.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).