all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Abbreviating filtered tags in mode line
@ 2014-05-14  6:24 Thomas Morgan
  2014-05-15  9:17 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Morgan @ 2014-05-14  6:24 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-15 13:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-14  6:24 Abbreviating filtered tags in mode line Thomas Morgan
2014-05-15  9:17 ` Bastien
2014-05-15 13:45   ` Thomas Morgan

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.