emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* do not display certain TAGs in agenda
@ 2014-01-24 14:33 David Belohrad
  2014-01-24 21:21 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: David Belohrad @ 2014-01-24 14:33 UTC (permalink / raw)
  To: mailing-list-org-mode

Dear all,

here is the stuff:

I have lots of tags in particular todos. When displayed in the agenda,
they look e.g. as this one:

CPSupgrade: NEXT asssembly of the fbct bodies on the vacuum chambers :2013:MARS:#CPSUpgrade:REFILABLE::@Me:@John:


Now, tags MARS, 2013 and REFILABLE are 'common' tags I use when
filtering for them, but generally I don't want to see them in the
agenda. I'd like to see only tags starting with '#' or '@' as those
identify to me projects and people involved. If I would be able to do
it, my agenda view would become less messy.

Is this possible?

thanks
.d.

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

* Re: do not display certain TAGs in agenda
  2014-01-24 14:33 do not display certain TAGs in agenda David Belohrad
@ 2014-01-24 21:21 ` Bastien
  2014-01-28 22:09   ` David Belohrad
  0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2014-01-24 21:21 UTC (permalink / raw)
  To: David Belohrad; +Cc: mailing-list-org-mode

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

Hi David,

David Belohrad <david@belohrad.ch> writes:

> Now, tags MARS, 2013 and REFILABLE are 'common' tags I use when
> filtering for them, but generally I don't want to see them in the
> agenda. I'd like to see only tags starting with '#' or '@' as those
> identify to me projects and people involved. If I would be able to do
> it, my agenda view would become less messy.
>
> Is this possible?

See `org-agenda-hide-tags-regexp'.

If you want to hide "write" and "read",
you can set it like this

(setq org-agenda-hide-tags-regexp
   (regexp-opt '("write" "read")))

I also attach a patch that extends `org-agenda-remove-tags'
to accept a list of tags to remove.  This is a first step
in removing org-agenda-hide-tags-regexp, as I think both
options are somewhat redundant and we could make the users'
life easier here.

If other can test it and say if they use one of these options,
that'd be nice.

HTH,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-agenda-remove-tags.patch --]
[-- Type: text/x-diff, Size: 2074 bytes --]

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 84b2a76..15d776f 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1845,14 +1845,16 @@ Nil means don't hide any tags."
 	  (string :tag "Regexp   ")))
 
 (defcustom org-agenda-remove-tags nil
-  "Non-nil means remove the tags from the headline copy in the agenda.
+  "Non-nil means remove tags from the headline in the agenda.
 When this is the symbol `prefix', only remove tags when
-`org-agenda-prefix-format' contains a `%T' specifier."
+`org-agenda-prefix-format' contains a `%T' specifier.
+When this is a list, only remove the listed tags."
   :group 'org-agenda-line-format
   :type '(choice
 	  (const :tag "Always" t)
-	  (const :tag "Never" nil)
-	  (const :tag "When prefix format contains %T" prefix)))
+	  (repeat (string :tag "Remove this tag"))
+	  (const :tag "When prefix format contains %T" prefix)
+	  (const :tag "Never" nil)))
 
 (org-defvaralias 'org-agenda-remove-tags-when-in-prefix
   'org-agenda-remove-tags)
@@ -3705,7 +3707,9 @@ generating a new one."
 	  (while (org-activate-plain-links (point-max))
 	    (add-text-properties (match-beginning 0) (match-end 0)
 				 '(face org-link))))
-	(unless (eq org-agenda-remove-tags t)
+	(unless (or (eq org-agenda-remove-tags t)
+		    (and (listp org-agenda-remove-tags)
+			 (stringp (car org-agenda-remove-tags))))
 	  (org-agenda-align-tags))
 	(unless org-agenda-with-colors
 	  (remove-text-properties (point-min) (point-max) '(face nil)))
@@ -6529,8 +6533,13 @@ Any match of REMOVE-RE will be removed from TXT."
 			    txt)
 	  ;; Tags are in the string
 	  (if (or (eq org-agenda-remove-tags t)
+		  (and (symbolp org-agenda-remove-tags)
+		       org-prefix-has-tag)
 		  (and org-agenda-remove-tags
-		       org-prefix-has-tag))
+		       (let ((case-fold-search t))
+			 (save-match-data
+			   (string-match (regexp-opt org-agenda-remove-tags)
+					 (match-string 0 txt))))))
 	      (setq txt (replace-match "" t t txt))
 	    (setq txt (replace-match
 		       (concat (make-string (max (- 50 (length txt)) 1) ?\ )

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

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

* Re: do not display certain TAGs in agenda
  2014-01-24 21:21 ` Bastien
@ 2014-01-28 22:09   ` David Belohrad
  0 siblings, 0 replies; 3+ messages in thread
From: David Belohrad @ 2014-01-28 22:09 UTC (permalink / raw)
  To: Bastien; +Cc: mailing-list-org-mode

fantastic Bastien.
thanks, it works
.d.

Bastien <bzg@gnu.org> writes:

> Hi David,
>
> David Belohrad <david@belohrad.ch> writes:
>
>> Now, tags MARS, 2013 and REFILABLE are 'common' tags I use when
>> filtering for them, but generally I don't want to see them in the
>> agenda. I'd like to see only tags starting with '#' or '@' as those
>> identify to me projects and people involved. If I would be able to do
>> it, my agenda view would become less messy.
>>
>> Is this possible?
>
> See `org-agenda-hide-tags-regexp'.
>
> If you want to hide "write" and "read",
> you can set it like this
>
> (setq org-agenda-hide-tags-regexp
>    (regexp-opt '("write" "read")))
>
> I also attach a patch that extends `org-agenda-remove-tags'
> to accept a list of tags to remove.  This is a first step
> in removing org-agenda-hide-tags-regexp, as I think both
> options are somewhat redundant and we could make the users'
> life easier here.
>
> If other can test it and say if they use one of these options,
> that'd be nice.
>
> HTH,
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 84b2a76..15d776f 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -1845,14 +1845,16 @@ Nil means don't hide any tags."
>  	  (string :tag "Regexp   ")))
>  
>  (defcustom org-agenda-remove-tags nil
> -  "Non-nil means remove the tags from the headline copy in the agenda.
> +  "Non-nil means remove tags from the headline in the agenda.
>  When this is the symbol `prefix', only remove tags when
> -`org-agenda-prefix-format' contains a `%T' specifier."
> +`org-agenda-prefix-format' contains a `%T' specifier.
> +When this is a list, only remove the listed tags."
>    :group 'org-agenda-line-format
>    :type '(choice
>  	  (const :tag "Always" t)
> -	  (const :tag "Never" nil)
> -	  (const :tag "When prefix format contains %T" prefix)))
> +	  (repeat (string :tag "Remove this tag"))
> +	  (const :tag "When prefix format contains %T" prefix)
> +	  (const :tag "Never" nil)))
>  
>  (org-defvaralias 'org-agenda-remove-tags-when-in-prefix
>    'org-agenda-remove-tags)
> @@ -3705,7 +3707,9 @@ generating a new one."
>  	  (while (org-activate-plain-links (point-max))
>  	    (add-text-properties (match-beginning 0) (match-end 0)
>  				 '(face org-link))))
> -	(unless (eq org-agenda-remove-tags t)
> +	(unless (or (eq org-agenda-remove-tags t)
> +		    (and (listp org-agenda-remove-tags)
> +			 (stringp (car org-agenda-remove-tags))))
>  	  (org-agenda-align-tags))
>  	(unless org-agenda-with-colors
>  	  (remove-text-properties (point-min) (point-max) '(face nil)))
> @@ -6529,8 +6533,13 @@ Any match of REMOVE-RE will be removed from TXT."
>  			    txt)
>  	  ;; Tags are in the string
>  	  (if (or (eq org-agenda-remove-tags t)
> +		  (and (symbolp org-agenda-remove-tags)
> +		       org-prefix-has-tag)
>  		  (and org-agenda-remove-tags
> -		       org-prefix-has-tag))
> +		       (let ((case-fold-search t))
> +			 (save-match-data
> +			   (string-match (regexp-opt org-agenda-remove-tags)
> +					 (match-string 0 txt))))))
>  	      (setq txt (replace-match "" t t txt))
>  	    (setq txt (replace-match
>  		       (concat (make-string (max (- 50 (length txt)) 1) ?\ )
>
> -- 
>  Bastien

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

end of thread, other threads:[~2014-01-28 22:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-24 14:33 do not display certain TAGs in agenda David Belohrad
2014-01-24 21:21 ` Bastien
2014-01-28 22:09   ` David Belohrad

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).