emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Hotkeys defined in org-tag-alist repeated in agenda filter dispatcher
@ 2013-04-22  1:50 Viktor Rosenfeld
  2013-04-22  9:26 ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Viktor Rosenfeld @ 2013-04-22  1:50 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I have the following tags defined in my initialization code:

#+BEGIN_SRC emacs-lisp
(setq org-tag-alist '((:startgroup . nil)
                      ("@home" . ?h)
                      ("@comp" . ?c)
                      ("@otg" . ?o)
                      ("@fon" . ?f)
                      ("@agenda" . ?a) 
                      ("@read" . ?r)
                      ("@write" . ?w)
                      (:endgroup . nil)
                      (:startgroup . nil)
                      ("IMPORTANT" . ?*)
                      ("SOMEDAY" . ??)
                      (:endgroup . nil)))
#+END_SRC

If I hit the =/= key in the agenda to filter the agenda by tag, the
hotkeys defined in the list above are repeated multiple times. That
is, the string in the Emacs minibuffer reads:

#+BEGIN_EXAMPLE
Narrow by tag [hcofarw*?hcofarw*?hcofarw*?hcofarw*?hcofarw*?hcofarw*?hcofarw*?hcofarw*?hcofarw*? ], [TAB], ...
#+END_EXAMPLE

This only happens if =org-agenda-files= is set to a directory (or list
of directories), e.g.:

#+BEGIN_SRC emacs-lisp
(setq org-agenda-files '( "~/org" ))
#+END_SRC

If =org-agenda-files= is set to a list of files the hotkeys are not
repeated. E.g.:

#+BEGIN_SRC emacs-lisp
(setq org-agenda-files '( "~/org/openloops.org" 
                          "~/org/dokumente.org"))
#+END_SRC

With the setting above the string in the Emacs minibuffer reads, as
expected:

#+BEGIN_EXAMPLE
Narrow by tag [hcofarw*? ], [TAB], ...
#+END_EXAMPLE

git bisect reveals the following commit as the culprit:
http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=575c9f16c3a1dc6660dd1aebdd560ec7caa1365e

However, before this commit, none of the hotkeys appear in the
minibuffer, which is another bug. Apparently, the last commit where
everything works as expected is:
http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=a9880a7710415218d3940e380968a9ed56367880 

I am on Ubuntu 12.04.2 with a backported Emacs 24.3.1.

Cheers,
Viktor

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

* Re: [BUG] Hotkeys defined in org-tag-alist repeated in agenda filter dispatcher
  2013-04-22  1:50 [BUG] Hotkeys defined in org-tag-alist repeated in agenda filter dispatcher Viktor Rosenfeld
@ 2013-04-22  9:26 ` Bastien
  2013-04-22 12:01   ` Viktor Rosenfeld
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2013-04-22  9:26 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode

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

Hi Viktor,

Viktor Rosenfeld <listuser36@gmail.com> writes:

> If I hit the =/= key in the agenda to filter the agenda by tag, the
> hotkeys defined in the list above are repeated multiple times.

Can you test this patch against latest maint or master branch?

Thanks,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-org-agenda-prepare-buffers-Fix-setting-of-org.patch --]
[-- Type: text/x-patch, Size: 1145 bytes --]

From 4c5a5d0fd1433f82e66344d2038f735c09643e3f Mon Sep 17 00:00:00 2001
From: Bastien Guerry <bzg@altern.org>
Date: Mon, 22 Apr 2013 11:25:39 +0200
Subject: [PATCH] org.el (org-agenda-prepare-buffers): Fix setting of
 `org-tag-alist'

* org.el (org-agenda-prepare-buffers): Don't append tags to
`org-tag-alist-for-agenda' when `org-tag-alist-for-agenda' is
not initially set.

Thanks to Viktor Rosenfeld for reporting this.
---
 lisp/org.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 70bee87..2f04f1c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17974,7 +17974,8 @@ When a buffer is unmodified, it is just killed.  When modified, it is saved
 		  (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
 	    (setq org-drawers-for-agenda
 		  (append org-drawers-for-agenda org-drawers))
-	    (unless (equal org-tag-alist-for-agenda org-tag-alist)
+	    (unless (and org-tag-alist-for-agenda
+			 (equal org-tag-alist-for-agenda org-tag-alist))
 	      (setq org-tag-alist-for-agenda
 		    (append org-tag-alist-for-agenda org-tag-alist)))
 	    (if org-group-tags
-- 
1.8.2


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


-- 
 Bastien

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

* Re: [BUG] Hotkeys defined in org-tag-alist repeated in agenda filter dispatcher
  2013-04-22  9:26 ` Bastien
@ 2013-04-22 12:01   ` Viktor Rosenfeld
  2013-04-24  9:46     ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Viktor Rosenfeld @ 2013-04-22 12:01 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hi Bastian,

Bastien wrote:

> Hi Viktor,
> 
> Viktor Rosenfeld <listuser36@gmail.com> writes:
> 
> > If I hit the =/= key in the agenda to filter the agenda by tag, the
> > hotkeys defined in the list above are repeated multiple times.
> 
> Can you test this patch against latest maint or master branch?

The problem still remains with the patch. However, I was able to narrow
the problem to a specific line and can provide a minimal example:

Consider the following configuration (which is loaded in init.el via
org-babel-load-file):

#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "<f12>") 'org-agenda)

(setq org-agenda-files '(
                          "~/org/dokumente.org"
                          "~/org/openloops.org"
                          "~/org/routine.org"
			  "~/org/arbeit.org"
                         ))

(setq org-tag-alist '((:startgroup . nil)
                                 ("@home" . ?h)
                                 ("@comp" . ?c)
                                 ("@otg" . ?o)
                                 ("@fon" . ?f)
                                 ("@agenda" . ?a) 
                                 ("@read" . ?r)
                                 ("@write" . ?w)
                                 (:endgroup . nil)
                                 (:startgroup . nil)
                                 ("IMPORTANT" . ?*)
                                 ("SOMEDAY" . ??)
                                 (:endgroup . nil)))
#+END_SRC

The four agenda files are as follows: The first file, "dokumente.org"
caontains a single headline and a #+TAGS: definition:

#+BEGIN_SRC org :tangle dokumente.org
#+TAGS: foo

* 1996
#+END_SRC

The other three files only contain a heading and no #+TAGS: definition:

#+BEGIN_SRC org :tangle openloops.org
* Inbox
#+END_SRC

#+BEGIN_SRC org :tangle routine.org
* Review
#+END_SRC

#+BEGIN_SRC org :tangle arbeit.org
* 1996
#+END_SRC

With this setup the tag hotkeys are repeated three times, one time for
each file with no tags definition. If I remove the #+TAGS definition in
dokumente.org, the bug disappears. If I add a #+TAGS definition to every
other file, then no tag hotkeys are printed, which is another unexpected
behavior. In other words, the presence of #+TAGS in a file causes the
tag hotkeys to repeated once for every file which does not have a #+TAGS
definition. To achieve the correct behavior, either no #+TAGS:
definition must appear anywhere or there must be exactly one file
without a #+TAGS definition.

Note that the number of repetions also depends on where the file with
the #+TAGS definition is located in the org-agenda-files list. Using the
four files above, if I move the file dokumente.org with the #+TAGS
definition to the end of the list then there are no repetitions.

Cheers,
Viktor

> 
> Thanks,
> 

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

* Re: [BUG] Hotkeys defined in org-tag-alist repeated in agenda filter dispatcher
  2013-04-22 12:01   ` Viktor Rosenfeld
@ 2013-04-24  9:46     ` Bastien
  2013-04-24 12:29       ` Viktor Rosenfeld
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2013-04-24  9:46 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode

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

Hi Viktor,

thanks for the patient and detailed debugging.

I don't have time to test the attached patch myself, but given your
description it should be okay.

Can you test it and report?  Otherwise I will test this myself later
on.

Thanks!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org.el.patch --]
[-- Type: text/x-patch, Size: 716 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index c76ddd0..d75f6c2 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17985,9 +17985,8 @@ When a buffer is unmodified, it is just killed.  When modified, it is saved
 		  (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
 	    (setq org-drawers-for-agenda
 		  (append org-drawers-for-agenda org-drawers))
-	    (unless (equal org-tag-alist-for-agenda org-tag-alist)
-	      (setq org-tag-alist-for-agenda
-		    (append org-tag-alist-for-agenda org-tag-alist)))
+	    (setq org-tag-alist-for-agenda
+		  (org-uniquify (append org-tag-alist-for-agenda org-tag-alist)))
 	    (if org-group-tags
 		(setq org-tag-groups-alist-for-agenda
 		      (org-uniquify-alist

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


-- 
 Bastien

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

* Re: [BUG] Hotkeys defined in org-tag-alist repeated in agenda filter dispatcher
  2013-04-24  9:46     ` Bastien
@ 2013-04-24 12:29       ` Viktor Rosenfeld
  2013-04-24 13:44         ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Viktor Rosenfeld @ 2013-04-24 12:29 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hi Bastien,

with this patch, everything works as expected.

Thanks!

Cheers,
Viktor

Bastien wrote:

> Hi Viktor,
> 
> thanks for the patient and detailed debugging.
> 
> I don't have time to test the attached patch myself, but given your
> description it should be okay.
> 
> Can you test it and report?  Otherwise I will test this myself later
> on.
> 
> Thanks!
> 

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

* Re: [BUG] Hotkeys defined in org-tag-alist repeated in agenda filter dispatcher
  2013-04-24 12:29       ` Viktor Rosenfeld
@ 2013-04-24 13:44         ` Bastien
  0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2013-04-24 13:44 UTC (permalink / raw)
  To: Viktor Rosenfeld; +Cc: emacs-orgmode

Hi Viktor,

Viktor Rosenfeld <listuser36@gmail.com> writes:

> with this patch, everything works as expected.

Applied, thanks for checking!

-- 
 Bastien

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

end of thread, other threads:[~2013-04-24 13:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-22  1:50 [BUG] Hotkeys defined in org-tag-alist repeated in agenda filter dispatcher Viktor Rosenfeld
2013-04-22  9:26 ` Bastien
2013-04-22 12:01   ` Viktor Rosenfeld
2013-04-24  9:46     ` Bastien
2013-04-24 12:29       ` Viktor Rosenfeld
2013-04-24 13:44         ` Bastien

Code repositories for project(s) associated with this 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).