* Remove redundant tags of headlines
@ 2014-03-13 15:36 Sebastien Vauban
2014-03-13 15:54 ` Bastien
2014-03-14 12:05 ` Nicolas Richard
0 siblings, 2 replies; 9+ messages in thread
From: Sebastien Vauban @ 2014-03-13 15:36 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hello,
FYI, the code to "Remove redundant tags of headlines" (see
http://orgmode.org/worg/org-hacks.html#sec-1-8-1) is not functioning
anymore.
--8<---------------cut here---------------start------------->8---
(defun dmj/org-remove-redundant-tags ()
"Remove redundant tags of headlines in current buffer.
A tag is considered redundant if it is local to a headline and
inherited by a parent headline."
(interactive)
(when (eq major-mode 'org-mode)
(save-excursion
(org-map-entries
'(lambda ()
(let ((alltags (split-string (or (org-entry-get (point) "ALLTAGS") "") ":"))
local inherited tag)
(dolist (tag alltags)
(if (get-text-property 0 'inherited tag)
(push tag inherited) (push tag local)))
(dolist (tag local)
(if (member tag inherited) (org-toggle-tag tag 'off)))))
t nil))))
--8<---------------cut here---------------end--------------->8---
The problem seems to be that `org-map-entries' return a sequence of
`nil'.
I tried Edebugging it, but Edebug does not jump into the execution of
the anonymous function...
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Remove redundant tags of headlines
2014-03-13 15:36 Remove redundant tags of headlines Sebastien Vauban
@ 2014-03-13 15:54 ` Bastien
2014-03-14 11:31 ` Sebastien Vauban
2014-03-14 12:05 ` Nicolas Richard
1 sibling, 1 reply; 9+ messages in thread
From: Bastien @ 2014-03-13 15:54 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ
Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
writes:
> I tried Edebugging it, but Edebug does not jump into the execution of
> the anonymous function...
Just give a name to the anonymous function... and you're back on
edebugging. :)
--
Bastien
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Remove redundant tags of headlines
2014-03-13 15:54 ` Bastien
@ 2014-03-14 11:31 ` Sebastien Vauban
2014-03-14 14:49 ` Bastien
0 siblings, 1 reply; 9+ messages in thread
From: Sebastien Vauban @ 2014-03-14 11:31 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Bastien wrote:
>> I tried Edebugging it, but Edebug does not jump into the execution of
>> the anonymous function...
>
> Just give a name to the anonymous function... and you're back on
> edebugging. :)
OK, of course! Thanks for the tip.
Back to the problem... The root cause is that, with the following
example:
--8<---------------cut here---------------start------------->8---
#+TITLE: ECM Inherited tags
#+FILETAGS: :org:
* Test
** TODO Vérifier pourquoi les tags redondants ne sont plus effacés :FLAGGED:
Lorsqu'ils correspondent à un tag hérité.
*** TODO Test :FLAGGED:
--8<---------------cut here---------------end--------------->8---
when point is somewhere on the outline-3 heading "TODO Test", the
following expression:
(org-entry-get (point) "ALLTAGS")
returns
#(":org:FLAGGED:" 1 4 (inherited t))
IOW, "FLAGGED" is not shown as inherited! Hence, all the mechanics
which follows never removes it!
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Remove redundant tags of headlines
2014-03-13 15:36 Remove redundant tags of headlines Sebastien Vauban
2014-03-13 15:54 ` Bastien
@ 2014-03-14 12:05 ` Nicolas Richard
2014-03-14 14:53 ` Bastien
1 sibling, 1 reply; 9+ messages in thread
From: Nicolas Richard @ 2014-03-14 12:05 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ
Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
> I tried Edebugging it, but Edebug does not jump into the execution of
> the anonymous function...
edebug can only jump to the anonymous function if it knows that it is a
function, which means : don't quote the lambda (or quote using #'). I
fixed it on worg.
(btw, I noticed that worg says
remote: No such file: "/home/emacs/git/worg/org-tutorials/"../code/awk/ical2org.awk" src awk"
when I push to it. I *guess* it comes from
org-tutorials/org-google-sync.org which tries to #+INCLUDE the above,
but I'm unsure how to fix it. I didn't touch that file.)
--
Nico.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Remove redundant tags of headlines
2014-03-14 11:31 ` Sebastien Vauban
@ 2014-03-14 14:49 ` Bastien
2014-03-14 15:03 ` Sebastien Vauban
0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2014-03-14 14:49 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ
Hi Sébastien,
Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
writes:
> #(":org:FLAGGED:" 1 4 (inherited t))
>
> IOW, "FLAGGED" is not shown as inherited!
Because it is not inherited, it is present in the headline.
Am I missing something?
> Hence, all the mechanics which follows never removes it!
You mean the mechanics of the function on Worg?
Or is there any real Org bug hidden somewhere here?
--
Bastien
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Remove redundant tags of headlines
2014-03-14 12:05 ` Nicolas Richard
@ 2014-03-14 14:53 ` Bastien
0 siblings, 0 replies; 9+ messages in thread
From: Bastien @ 2014-03-14 14:53 UTC (permalink / raw)
To: Nicolas Richard; +Cc: public-emacs-orgmode-mXXj517/zsQ, Sebastien Vauban
Hi Nicolas,
Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:
> (btw, I noticed that worg says
> remote: No such file: "/home/emacs/git/worg/org-tutorials/"../code/awk/ical2org.awk" src awk"
> when I push to it. I *guess* it comes from
> org-tutorials/org-google-sync.org which tries to #+INCLUDE the above,
> but I'm unsure how to fix it. I didn't touch that file.)
I've created a link to ical2org.awk, including such a big file
looks wrong. This does not fix the problem, it only circumvent
it.
--
Bastien
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Remove redundant tags of headlines
2014-03-14 14:49 ` Bastien
@ 2014-03-14 15:03 ` Sebastien Vauban
2014-03-14 15:28 ` Bastien
0 siblings, 1 reply; 9+ messages in thread
From: Sebastien Vauban @ 2014-03-14 15:03 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Bastien,
Bastien wrote:
> Sebastien Vauban writes:
>
>> #(":org:FLAGGED:" 1 4 (inherited t))
>>
>> IOW, "FLAGGED" is not shown as inherited!
>
> Because it is not inherited, it is present in the headline.
>
> Am I missing something?
From my point of view and the point of that function (IIUC), yes.
Look again:
--8<---------------cut here---------------start------------->8---
#+FILETAGS: :org:
* List of projects
** TODO Project A :FLAGGED:
*** TODO Task 1 :FLAGGED:
--8<---------------cut here---------------end--------------->8---
Of course, "FLAGGED" is present in the headline but, at the same time,
it is inherited.
IIUC, the goal of the function written by David was to remove redundant
tags. In the above case, "FLAGGED" should be removed from "Task 1"
because it is superfluous (redundant with its parent entry).
>> Hence, all the mechanics which follows never removes it!
>
> You mean the mechanics of the function on Worg?
Yes, as explicited above.
> Or is there any real Org bug hidden somewhere here?
I'd think that asking for all tags of "Task 1" should output both
a local "FLAGGED" tag and an inherited "FLAGGED" one.
Am I wrong?
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Remove redundant tags of headlines
2014-03-14 15:03 ` Sebastien Vauban
@ 2014-03-14 15:28 ` Bastien
[not found] ` <87bnx8re93.fsf-E3UqQZAQFPqWIDz0JBNUog@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2014-03-14 15:28 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ
Hi Sébastien,
Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
writes:
> ** TODO Project A :FLAGGED:
> *** TODO Task 1 :FLAGGED:
>
> Of course, "FLAGGED" is present in the headline but, at the same time,
> it is inherited.
It means Org favors explicit tags over inherited ones when presenting
them through `org-entry-get'.
> IIUC, the goal of the function written by David was to remove redundant
> tags. In the above case, "FLAGGED" should be removed from "Task 1"
> because it is superfluous (redundant with its parent entry).
Can you find when David's function was still functional for you?
> I'd think that asking for all tags of "Task 1" should output both
> a local "FLAGGED" tag and an inherited "FLAGGED" one.
Well, ALLTAGS means all distinct tags for me, and I don't see how
outputting all duplicate tags would be useful. You'll have to find
another use-case than just David's function to convince me :)
--
Bastien
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Remove redundant tags of headlines
[not found] ` <87bnx8re93.fsf-E3UqQZAQFPqWIDz0JBNUog@public.gmane.org>
@ 2014-03-14 16:17 ` Sebastien Vauban
0 siblings, 0 replies; 9+ messages in thread
From: Sebastien Vauban @ 2014-03-14 16:17 UTC (permalink / raw)
To: Bastien; +Cc: David Maus,
public-emacs-orgmode-mXXj517/zsQ-wOFGN7rlS/M9smdsby/KFg
Hi Bastien,
>> ** TODO Project A :FLAGGED:
>> *** TODO Task 1 :FLAGGED:
>>
>> Of course, "FLAGGED" is present in the headline but, at the same time,
>> it is inherited.
>
> It means Org favors explicit tags over inherited ones when presenting
> them through `org-entry-get'.
Yes, that's what I thought. That makes sense.
>> IIUC, the goal of the function written by David was to remove redundant
>> tags. In the above case, "FLAGGED" should be removed from "Task 1"
>> because it is superfluous (redundant with its parent entry).
>
> Can you find when David's function was still functional for you?
No, and, honestly, I won't try, because I remember seeing that not
functioning for a very long time, certainly well above 1 year. And so
many things changed in my config (Emacs, Org mode) and in Org mode, that
I'm not sure at all to come back to a previously working state -- if it
did [1].
>> I'd think that asking for all tags of "Task 1" should output both
>> a local "FLAGGED" tag and an inherited "FLAGGED" one.
>
> Well, ALLTAGS means all distinct tags for me, and I don't see how
> outputting all duplicate tags would be useful.
Well, here, it would be useful that ALLTAGS would really report ALL
TAGS... (even if it wasn't its default behavior)
> You'll have to find another use-case than just David's function to
> convince me :)
Then, I won't. But such a cleaning (in `before-save-hook') is not
possible, then?
Best regards,
Seb
[1] I can't exclude that my mind would play me tricks.
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-03-14 16:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-13 15:36 Remove redundant tags of headlines Sebastien Vauban
2014-03-13 15:54 ` Bastien
2014-03-14 11:31 ` Sebastien Vauban
2014-03-14 14:49 ` Bastien
2014-03-14 15:03 ` Sebastien Vauban
2014-03-14 15:28 ` Bastien
[not found] ` <87bnx8re93.fsf-E3UqQZAQFPqWIDz0JBNUog@public.gmane.org>
2014-03-14 16:17 ` Sebastien Vauban
2014-03-14 12:05 ` Nicolas Richard
2014-03-14 14:53 ` Bastien
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.