Re: [O] Remove redundant tags of headlines

2014-03-14 Thread Sebastien Vauban
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




Re: [O] Remove redundant tags of headlines

2014-03-14 Thread Nicolas Richard


Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@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.




Re: [O] Remove redundant tags of headlines

2014-03-14 Thread Bastien


Hi Sébastien,

Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@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




Re: [O] Remove redundant tags of headlines

2014-03-14 Thread Bastien


Hi Nicolas,

Nicolas Richard theonewiththeevill...@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




Re: [O] Remove redundant tags of headlines

2014-03-14 Thread Sebastien Vauban
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




Re: [O] Remove redundant tags of headlines

2014-03-14 Thread Bastien


Hi Sébastien,

Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@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




Re: [O] Remove redundant tags of headlines

2014-03-14 Thread Sebastien Vauban


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




[O] Remove redundant tags of headlines

2014-03-13 Thread Sebastien Vauban
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




Re: [O] Remove redundant tags of headlines

2014-03-13 Thread Bastien


Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@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