Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-12 Thread Manish
On Wed, Feb 11, 2009 at 4:18 AM, Tom Breton (Tehom) wrote:
 With three choices for choosenness, it works as I expected (only one
 item in CHOSEN state at a time) but for more choices like:

 #+CHOOSE_TODO: REJECTED(r) NOT_CHOSEN(n,-) MAYBE(,0)
 LEANING_TOWARDS(l) CHOSEN(c,+)

 it allows multiple items to be in CHOSEN state. How do we interpret
 that?

 I couldn't reproduce this. Is this on the same test file as before?

Sorry for the delay in reply, Tom.  I reproduce the situation below:

First the test file.

--8---cut here---start-8---
#+CHOOSE_TODO: REJECTED(r) NOT_CHOSEN(n,-) MAYBE(,0)
LEANING_TOWARDS(l) CHOSEN(c,+)

* Which editor to use?
*** LEANING_TOWARDS Emacs
*** LEANING_TOWARDS Vim
*** LEANING_TOWARDS Textmate
*** REJECTED Gedit
*** REJECTED Textpad
--8---cut here---end---8---

0. I have latest org-choose loaded, org-mode restarted, and local
   setup refreshed.
1. S-right on the second item to switch it to CHOSEN state.  It works.
2. Now S-right on the first item to switch it to CHOSEN state.  Also
   works.

Both entries stay at CHOSEN state whereas I expected the second entry
to switch to a NON-CHOSEN state (possibly switching just one state
backwards not all the way back to REJECTED, but then I do not yet
understand it fully.)

Is this the right behaviour?  If yes, please help me understand this a
little.  Or could I be doing or have something wrong in my setup?

Regards,
-- 
Manish


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-12 Thread Nick Dokos
Tom Breton (Tehom) te...@panix.com wrote:

 
  On Feb 11, 2009, at 2:08 AM, Tom Breton (Tehom) wrote:
 
 
  (let*
((x 1))
(eval-after-load 'simple (setq x 2))
x)
 
  =3D 2
 
 
 
  (let*
((x 1))
(eval-after-load 'simple '(setq x 2))
x)
 
  =3D 1
 
  In fact, I am getting 2 in both cases!???
  Do you really get 1 for the second???
 
 Yes I do, but it's clear now that I was mistaken about why.  On closer
 inspection, it has to do with emacs not recognizing 'simple because it
 wants to see simple instead (string instead of symbol).
 

That's not correct: eval-after-load will happily accept a symbol instead
of a string, as long as the symbol is a feature provided by the library.
simple.el does that - the last form in it is

(provide 'simple)

Regards,
Nick


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-12 Thread Tom Breton (Tehom)
 On Wed, Feb 11, 2009 at 4:18 AM, Tom Breton (Tehom) wrote:
 [...]
 I couldn't reproduce this. Is this on the same test file as before?

 Sorry for the delay in reply, Tom.  I reproduce the situation below:

 First the test file.

 --8---cut here---start-8---
 #+CHOOSE_TODO: REJECTED(r) NOT_CHOSEN(n,-) MAYBE(,0)
 LEANING_TOWARDS(l) CHOSEN(c,+)

 * Which editor to use?
 *** LEANING_TOWARDS Emacs
 *** LEANING_TOWARDS Vim
 *** LEANING_TOWARDS Textmate
 *** REJECTED Gedit
 *** REJECTED Textpad
 --8---cut here---end---8---

 0. I have latest org-choose loaded, org-mode restarted, and local
setup refreshed.
 1. S-right on the second item to switch it to CHOSEN state.  It works.
 2. Now S-right on the first item to switch it to CHOSEN state.  Also
works.

 Both entries stay at CHOSEN state whereas I expected the second entry
 to switch to a NON-CHOSEN state (possibly switching just one state
 backwards not all the way back to REJECTED, but then I do not yet
 understand it fully.)

 Is this the right behaviour?  If yes, please help me understand this a
 little.  Or could I be doing or have something wrong in my setup?

That's not right the behavior, but again I can't seem to reproduce this. 
Using your test file and following your instructions, I get the correct
behavior.  Specifically, after S-right on second item:
[begin]
* Which editor to use?
*** NOT_CHOSEN Emacs
*** CHOSEN Vim
*** NOT_CHOSEN Textmate
*** REJECTED Gedit
*** REJECTED Textpad
[end]
Then after S-right on the first item, again correctly:
[begin]
* Which editor to use?
*** MAYBE Emacs
*** LEANING_TOWARDS Vim
*** NOT_CHOSEN Textmate
*** REJECTED Gedit
*** REJECTED Textpad
[end]

Now there's clearly something different between my setup and yours that it
causing a bug, but it's very difficult to diagnose and fix at a distance.

I have a theory that it's caused by an unloaded library whose absence makes
`org-map-entries' abort.

What I'm going to try is to add a require for org-agenda.  Will you try it
and tell me whether it fixes the bug?  Because I just can't see the bug in
my setup.

Tom Breton (Tehom)





___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-12 Thread Tom Breton (Tehom)
 Tom Breton (Tehom) te...@panix.com wrote:


  On Feb 11, 2009, at 2:08 AM, Tom Breton (Tehom) wrote:
 
 
  (let*
((x 1))
(eval-after-load 'simple (setq x 2))
x)
 
  =3D 2
 
 
 
  (let*
((x 1))
(eval-after-load 'simple '(setq x 2))
x)
 
  =3D 1
 
  In fact, I am getting 2 in both cases!???
  Do you really get 1 for the second???

 Yes I do, but it's clear now that I was mistaken about why.  On closer
 inspection, it has to do with emacs not recognizing 'simple because it
 wants to see simple instead (string instead of symbol).


 That's not correct: eval-after-load will happily accept a symbol instead
 of a string, as long as the symbol is a feature provided by the library.
 simple.el does that - the last form in it is

 (provide 'simple)

What version is this?  Because that's clearly not what it does on emacs
21.3.1. Here simple.el does not have (provide 'simple) in it.

I see no provision for accepting a symbol in eval-after-load.  The test it
uses is just:

(assoc file load-history)

The cars of load-history are all strings, so I can't see how it would find
a symbol among them.  And it continues to stubbornly return a 1 for that
example when I use 'simple.

Clearly something has changed across versions.

Tom Breton (Tehom)




___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Patch Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-12 Thread Tom Breton (Tehom)
Here is a patch that I hope will solve the problems people are having with
org-choose.el.  It contains two intended fixes:

 * `eval-after-load' gets a string argument.  Apparently some emacsen can
accept a symbol, but older ones can't.
 * org-agenda is required before `org-map-entries' is called.  This is  
 admittedly a quick and dirty fix, if it even works.

Tom Breton (Tehom)


org-choose.el.diff
Description: Binary data
___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-12 Thread Nick Dokos
Tom Breton (Tehom) te...@panix.com wrote:

 What version is this?  Because that's clearly not what it does on emacs
 21.3.1. Here simple.el does not have (provide 'simple) in it.
 
 I see no provision for accepting a symbol in eval-after-load.  The test it
 uses is just:
 
 (assoc file load-history)
 
 The cars of load-history are all strings, so I can't see how it would find
 a symbol among them.  And it continues to stubbornly return a 1 for that
 example when I use 'simple.

23.0.60, but I also checked 22.1 and that contains both the feature
and the smarter eval-after-load.

 
 Clearly something has changed across versions.
 

Clearly, but 21.3.1 is ancient: it was released March 24, 2003 (and the
emacs page also indicates that 21.4 was released to fix a security hole,
so one way or another, you should upgrade.)

Regards,
Nick


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-12 Thread Manish
On Fri, Feb 13, 2009 at 1:43 AM, Tom Breton (Tehom) wrote:
 On Wed, Feb 11, 2009 at 4:18 AM, Tom Breton (Tehom) wrote:
 [...]
 I couldn't reproduce this. Is this on the same test file as before?

 Sorry for the delay in reply, Tom. I reproduce the situation below:

 First the test file.

 --8---cut here---start-8---
 #+CHOOSE_TODO: REJECTED(r) NOT_CHOSEN(n,-) MAYBE(,0)
 LEANING_TOWARDS(l) CHOSEN(c,+)

 * Which editor to use?
 *** LEANING_TOWARDS Emacs
 *** LEANING_TOWARDS Vim
 *** LEANING_TOWARDS Textmate
 *** REJECTED Gedit
 *** REJECTED Textpad
 --8---cut here---end---8---

 0. I have latest org-choose loaded, org-mode restarted, and local
  setup refreshed.
 1. S-right on the second item to switch it to CHOSEN state. It works.
 2. Now S-right on the first item to switch it to CHOSEN state. Also
  works.

 Both entries stay at CHOSEN state whereas I expected the second entry
 to switch to a NON-CHOSEN state (possibly switching just one state
 backwards not all the way back to REJECTED, but then I do not yet
 understand it fully.)

 Is this the right behaviour? If yes, please help me understand this a
 little. Or could I be doing or have something wrong in my setup?

 That's not right the behavior, but again I can't seem to reproduce this.
 Using your test file and following your instructions, I get the correct
 behavior. Specifically, after S-right on second item:
 [begin]
 * Which editor to use?
 *** NOT_CHOSEN Emacs
 *** CHOSEN Vim
 *** NOT_CHOSEN Textmate
 *** REJECTED Gedit
 *** REJECTED Textpad
 [end]
 Then after S-right on the first item, again correctly:
 [begin]
 * Which editor to use?
 *** MAYBE Emacs
 *** LEANING_TOWARDS Vim
 *** NOT_CHOSEN Textmate
 *** REJECTED Gedit
 *** REJECTED Textpad
 [end]

 Now there's clearly something different between my setup and yours that it
 causing a bug, but it's very difficult to diagnose and fix at a distance.

 I have a theory that it's caused by an unloaded library whose absence makes
 `org-map-entries' abort.

 What I'm going to try is to add a require for org-agenda. Will you try it
 and tell me whether it fixes the bug? Because I just can't see the bug in
 my setup.

I didn't know if you meant to send me a patch or try something myself.
I do not know any elisp but I interpreted your statement to mean
something like the following patch and tried but without success.  This
is with GNU Emacs 22.3.1 (i386-mingw-nt5.1.2600) of 2008-09-06 on
SOFT-MJASON and latest Org-mode compiled from git with uncompiled
org-choose.el.

--8---cut here---start-8---
diff --git a/contrib/lisp/org-choose.el b/contrib/lisp/org-choose.el
index a5e8a19..1f54df6 100644
--- a/contrib/lisp/org-choose.el
+++ b/contrib/lisp/org-choose.el
@@ -65,6 +65,7 @@
 (require 'org)
 (eval-when-compile
(require 'cl))
+(require 'org-agenda)

 ;;;_. Body
 ;;;_ , The variables
--8---cut here---end---8---

I am sure you meant something more intelligent. :-/

Thanks for looking into it.
-- 
Manish


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: Patch Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-12 Thread Manish
On Fri, Feb 13, 2009 at 2:25 AM, Tom Breton (Tehom) wrote:
 Here is a patch that I hope will solve the problems people are having with
 org-choose.el. It contains two intended fixes:

 * `eval-after-load' gets a string argument. Apparently some emacsen can
 accept a symbol, but older ones can't.
 * org-agenda is required before `org-map-entries' is called. This is
 admittedly a quick and dirty fix, if it even works.

I saw this email just a moment after responding to the other thread.

No, it did not work.  I restarted Emacs and loaded org-choose.el both
using load-library and load-file (in case that makes a difference.)

Thanks
-- 
Manish


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-11 Thread Carsten Dominik


On Feb 11, 2009, at 2:08 AM, Tom Breton (Tehom) wrote:


On Tue, Feb 10, 2009 at 2:42 PM, Carsten Dominik wrote:


On Feb 10, 2009, at 9:46 AM, Manish wrote:


On Tue, Feb 10, 2009 at 8:44 AM, Tom Breton (Tehom) wrote:
[...]


OK, I've add comments, keywords, and some docstrings I forgot to
org-choose.el, and I wrote a standalone doc. Both are attached.


This is very intriguing functionality. I tried to follow your and
Casten's
earlier exchanges but could understand only a little. So I tried to
follow
your tutorial but I am getting stuck at switching the  
`choosenness' of

items.
I get following error when I try to switch to any state from no
state.
Once
I assign a state by typing it out manually (as opposed to using  
state

switching commands), I can then switch between states but the error
repeats
when I try to switch to MAYBE state.

,
| save-excursion: Symbol's function definition is void:
outline-up-heading-all
`


Hmm, not sure if I messed up there - so I fixed this bug. Tom,
please check if I did this right.


This issue is gone for me.  Thanks.

So far, my understaning is that only one item can be in YES  
state. If

I
try
to switch another item to YES then the existing YES will be  
demoted

to MAYBE. So for a two-state choosenness only one item can be in
CHOOSE
state while all others will switch to NOT_CHOOSEN state.. is that
understanding correct?


With three choices for choosenness, it works as I expected (only  
one item

in
CHOSEN state at a time) but for more choices like:

#+CHOOSE_TODO: REJECTED(r) NOT_CHOSEN(n,-) MAYBE(,0)
LEANING_TOWARDS(l) CHOSEN(c,+)

it allows multiple items to be in CHOSEN state.  How do we  
interpret that?


Having fetched and set up 6.22b, I can now reproduce it.

This bug is simple.  In Setting it all up at the end of org- 
choose.el,

in 6.22b a quote got introduced before progn.  That's all.  With that
quote, it evaluated a quoted form and did nothing.  I'd send a  
patch,

but ISTM it's easier to just press backspace once.  It's here:

(eval-after-load 'org
 '(progn
;;^--HERE.
(add-to-list 'org-todo-setup-filter-hook
  #'org-choose-setup-filter)
(add-to-list 'org-todo-get-default-hook
  #'org-choose-get-default-mark)
(add-to-list 'org-trigger-hook
  #'org-choose-keep-sensible)
(add-to-list 'org-todo-interpretation-widgets
  '(:tag Choose   (to record decisions) choose)
  'append)
  ))


Hi Tom,

I added the quote because without it, evaluating org-chose.el did error.
It was my understanding that such a form has to be quoted.  Am
I missing something here?


- Carsten___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-11 Thread Carsten Dominik


On Feb 11, 2009, at 12:19 AM, Tom Breton (Tehom) wrote:





Hmm, not sure if I messed up there - so I fixed this bug.  Tom,
please check if I did this right.

- Carsten



Hi, Carsten.  I just looked at org-6.22b

You caught a problem, but I think it's a different bug.  I think there
are these different things:

* What you saw, that it doesn't work at top level.  Good catch.  My
  code finds the groups of siblings via their parent.  If they have
  no parent, it doesn't work.  Doing that already generated an error
  deep in the guts of outline, but your way is better.  Let's keep
  your fix.


OK



* What Manish saw.  I can't reproduce this.



I could.  Your code was calling outline-up-heading-all, which
does not exist in the outline.el I have.  I replaced it
with org-up-heading-all, then the code did work.

- Carsten


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-11 Thread Carsten Dominik


On Feb 11, 2009, at 2:08 AM, Tom Breton (Tehom) wrote:


On Tue, Feb 10, 2009 at 2:42 PM, Carsten Dominik wrote:


On Feb 10, 2009, at 9:46 AM, Manish wrote:


On Tue, Feb 10, 2009 at 8:44 AM, Tom Breton (Tehom) wrote:
[...]


OK, I've add comments, keywords, and some docstrings I forgot to
org-choose.el, and I wrote a standalone doc. Both are attached.


This is very intriguing functionality. I tried to follow your and
Casten's
earlier exchanges but could understand only a little. So I tried to
follow
your tutorial but I am getting stuck at switching the  
`choosenness' of

items.
I get following error when I try to switch to any state from no
state.
Once
I assign a state by typing it out manually (as opposed to using  
state

switching commands), I can then switch between states but the error
repeats
when I try to switch to MAYBE state.

,
| save-excursion: Symbol's function definition is void:
outline-up-heading-all
`


Hmm, not sure if I messed up there - so I fixed this bug. Tom,
please check if I did this right.


This issue is gone for me.  Thanks.

So far, my understaning is that only one item can be in YES  
state. If

I
try
to switch another item to YES then the existing YES will be  
demoted

to MAYBE. So for a two-state choosenness only one item can be in
CHOOSE
state while all others will switch to NOT_CHOOSEN state.. is that
understanding correct?


With three choices for choosenness, it works as I expected (only  
one item

in
CHOSEN state at a time) but for more choices like:

#+CHOOSE_TODO: REJECTED(r) NOT_CHOSEN(n,-) MAYBE(,0)
LEANING_TOWARDS(l) CHOSEN(c,+)

it allows multiple items to be in CHOSEN state.  How do we  
interpret that?


Having fetched and set up 6.22b, I can now reproduce it.

This bug is simple.  In Setting it all up at the end of org- 
choose.el,

in 6.22b a quote got introduced before progn.  That's all.  With that
quote, it evaluated a quoted form and did nothing.  I'd send a  
patch,

but ISTM it's easier to just press backspace once.  It's here:

(eval-after-load 'org
 '(progn
;;^--HERE.
(add-to-list 'org-todo-setup-filter-hook
  #'org-choose-setup-filter)
(add-to-list 'org-todo-get-default-hook
  #'org-choose-get-default-mark)
(add-to-list 'org-trigger-hook
  #'org-choose-keep-sensible)
(add-to-list 'org-todo-interpretation-widgets
  '(:tag Choose   (to record decisions) choose)
  'append)
  ))



Hi Tom,

maybe you can educate me:  I have never understood what the # does
in code like the one you have here.  You are using it, so maybe you  
know?


- Carsten



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-11 Thread Daniel Clemente

Carsten Dominik domi...@science.uva.nl writes:
 Hi Tom,

 maybe you can educate me:  I have never understood what the # does
 in code like the one you have here.  You are using it, so maybe you know?


  Since I am always having questions like that, I keep writing here each new 
notation I find :-)
http://www.emacswiki.org/emacs/CategoryGlossary#toc1

-- Daniel



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-11 Thread Carsten Dominik

Useful resource!

Thanks.

- Carsten

On Feb 11, 2009, at 4:38 PM, Daniel Clemente wrote:



Carsten Dominik domi...@science.uva.nl writes:

Hi Tom,

maybe you can educate me:  I have never understood what the # does
in code like the one you have here.  You are using it, so maybe you  
know?




 Since I am always having questions like that, I keep writing here  
each new notation I find :-)

http://www.emacswiki.org/emacs/CategoryGlossary#toc1

-- Daniel





___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-11 Thread Tom Breton (Tehom)

 Hi Tom,

 maybe you can educate me:  I have never understood what the # does
 in code like the one you have here.  You are using it, so maybe you
 know?

 - Carsten



Here, it's   #'   that it of interest, not  #  alone.

At the most direct level, it quotes the symbol with `function' instead of
`quote'.  For example:

(format %s ' 'foo)  = (quote foo)
(format %s ' #'foo) = (function foo)

What it accomplishes:
 * In some contexts, it is needed to get a symbol's function binding
instead of its value binding.
 * It alerts the byte-compiler that it's seeing a function, so it can
perform certain optimizations (I don't know offhand exactly what).
 * Stylistically, it alerts the reader.

It's an imitation of Common Lisp's reader macro  #'  which does sort of
the same thing.

At the syntax level, it's really a combination of   #   which signals a
reader macro - though in emacs, it's all hard-coded and inextensible - and
 '  which stands for the function-quote reader macro.

FWIW, what I added to lread.c was an extension of the reader macro
facility at RMS' request, so you definitely asked the right guy.

Tom Breton (Tehom)




___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-11 Thread Tom Breton (Tehom)

 On Feb 11, 2009, at 2:08 AM, Tom Breton (Tehom) wrote:


 This bug is simple.  In Setting it all up at the end of org-
 choose.el,
 in 6.22b a quote got introduced before progn.  That's all.  With that
 quote, it evaluated a quoted form and did nothing.  I'd send a
 patch,
 but ISTM it's easier to just press backspace once.  It's here:

 (eval-after-load 'org
  '(progn
 ;;^--HERE.
 (add-to-list 'org-todo-setup-filter-hook
#'org-choose-setup-filter)
 (add-to-list 'org-todo-get-default-hook
#'org-choose-get-default-mark)
 (add-to-list 'org-trigger-hook
#'org-choose-keep-sensible)
 (add-to-list 'org-todo-interpretation-widgets
'(:tag Choose   (to record decisions) choose)
'append)
   ))

 Hi Tom,

 I added the quote because without it, evaluating org-chose.el did error.
 It was my understanding that such a form has to be quoted.  Am
 I missing something here?

What error did it give?  I didn't get one here.

Definitely the form should not be quoted.  Quoted, it does nothing.
Demonstration (with libary `simple' which is fairly basic in emacs so
probably loaded for everyone):

(let*
   ((x 1))
   (eval-after-load 'simple (setq x 2))
   x)

= 2



(let*
   ((x 1))
   (eval-after-load 'simple '(setq x 2))
   x)

= 1



Tom Breton (Tehom)





___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-11 Thread Carsten Dominik


On Feb 11, 2009, at 10:41 PM, Tom Breton (Tehom) wrote:



On Feb 11, 2009, at 2:08 AM, Tom Breton (Tehom) wrote:




This bug is simple.  In Setting it all up at the end of org-
choose.el,
in 6.22b a quote got introduced before progn.  That's all.  With  
that

quote, it evaluated a quoted form and did nothing.  I'd send a
patch,
but ISTM it's easier to just press backspace once.  It's here:

(eval-after-load 'org
'(progn
;;^--HERE.
   (add-to-list 'org-todo-setup-filter-hook
  #'org-choose-setup-filter)
   (add-to-list 'org-todo-get-default-hook
  #'org-choose-get-default-mark)
   (add-to-list 'org-trigger-hook
  #'org-choose-keep-sensible)
   (add-to-list 'org-todo-interpretation-widgets
  '(:tag Choose   (to record decisions) choose)
  'append)
 ))


Hi Tom,

I added the quote because without it, evaluating org-chose.el did  
error.

It was my understanding that such a form has to be quoted.  Am
I missing something here?


What error did it give?  I didn't get one here.


eval: Invalid function: (:tag Sequence (cycling hits every state)  
sequence)


I don't understand it either.




Definitely the form should not be quoted.  Quoted, it does nothing.
Demonstration (with libary `simple' which is fairly basic in emacs so
probably loaded for everyone):

(let*
  ((x 1))
  (eval-after-load 'simple (setq x 2))
  x)

= 2



(let*
  ((x 1))
  (eval-after-load 'simple '(setq x 2))
  x)

= 1


In fact, I am getting 2 in both cases!???
Do you really get 1 for the second???

eval-after-load is a function, not a macro, so FORM will
be evaluated *before* being passed to the function.  But the
idea, IIUC is, that the form will be added to after-load-alist,
and evaluated whenever appropriate.

I have a number of eval-after-loads in org.el, each time the
form is quotes and does the right thing.

- Carsten








Tom Breton (Tehom)







___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-11 Thread Carsten Dominik


On Feb 11, 2009, at 9:02 PM, Tom Breton (Tehom) wrote:



Hi Tom,

maybe you can educate me:  I have never understood what the # does
in code like the one you have here.  You are using it, so maybe you
know?

- Carsten




Here, it's   #'   that it of interest, not  #  alone.

At the most direct level, it quotes the symbol with `function'  
instead of

`quote'.  For example:

(format %s ' 'foo)  = (quote foo)
(format %s ' #'foo) = (function foo)

What it accomplishes:
* In some contexts, it is needed to get a symbol's function binding
instead of its value binding.
* It alerts the byte-compiler that it's seeing a function, so it can
perform certain optimizations (I don't know offhand exactly what).
* Stylistically, it alerts the reader.


OK, thanks a lot!




It's an imitation of Common Lisp's reader macro  #'  which does sort  
of

the same thing.

At the syntax level, it's really a combination of   #   which  
signals a
reader macro - though in emacs, it's all hard-coded and inextensible  
- and

'  which stands for the function-quote reader macro.

FWIW, what I added to lread.c was an extension of the reader macro
facility at RMS' request, so you definitely asked the right guy.



:-)  Thanks for the explanations.




Tom Breton (Tehom)






___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-11 Thread Tom Breton (Tehom)
nicholas.do...@hp.com wrote:
 Tom Breton (Tehom) te...@panix.com wrote:

 (let*
((x 1))
(eval-after-load 'simple (setq x 2))
x)

 =3D 2



 (let*
((x 1))
(eval-after-load 'simple '(setq x 2))
x)

 =3D 1


 Are you sure about this? My understanding of this differs from
 yours:

This is definitely a Boy is my face red moment.  You are completely
correct.  I had misunderstood `eval-after-load' as a macro.  Upon looking
at subr.el, it is obvious that you are right and I am wrong.

Thank you for pointing all that out.

 eval-after-load is an ordinary function (not a special form), and
 function evaluation in most LISPs (elisp in particular) evaluates
 arguments before the function is called on them. So if you give it an
 unquoted form, the form will be evaluated *before* eval-after-load gets
 its hands on it. That seems to me to defeat the purpose. I'd think that
 the thing to do is to give the quoted form as argument, then function
 evaluation evaluates the argument (i.e. unquotes the quoted form,
 giving back the form) which is then passed to eval-after-load for
 action. The semantics of eval-after-load imply that (depending on
 whether the library is already loaded or not) the form may be evaluated
 once. It is then squirrelled away and if the library is ever loaded
 again, it is evaluated (perhaps for the first time, perhaps for the
 nth), *after* the library is loaded.

 And I think your demonstration is misleading: after doing the
 eval-after-load, you need to reload simple to trigger the after-load
 evaluation, otherwise eval-after-load reduces to just plain eval (in
 this  particular case, since simple is, as you point out, already loaded -
 things would be different if you had chosen some obscure library that
 is not already loaded):

 (let*
 ((x 1))
 (eval-after-load 'simple (setq x 2))
 (load-library simple)
 x)
 2

 (let*
 ((x 1))
 (eval-after-load 'simple '(setq x 2))
 (load-library simple)
 x)
 2

 In the first case, (setq x 2) was evaluated, x was set to 2 and 2 was
 passed into eval-after-load. Assuming that simple is already loaded, the
 2 is evaluated: the result is 2 and it is just thrown away. After the
 library is loaded again, 2 is evaluated again and the result is 2 and it
 just thrown away. Since x was set to 2 before, the value of x is 2.

 In the second case, (quote (setq x 2)) is evaluated, so the form (setq x
 2) is passed to eval-after-load. Assuming that simple is already loaded,
 the form is evaluated, setting x to 2 and giving a result of 2 (which is
 thrown away). After the library is loaded, (setq x 2) is eval'led again,
 setting x to 2 again, and giving a result of 2 (which is thrown away).

 In both cases, the value of x (and therefore the value the let* form
 returns) is 2. But it seems to me that the second case is the useful
 one.

 Perhaps the most telling evidence that the quote should be there however
 is the following: if you look at eval-after-load instances in the emacs
 lisp directory, you'll see that the second argument in all of them is
 quoted or at least (when partial evaluation is required) backquoted --
 although I guess one could argue that they all originated by copying a
 badly constructed precursor - the programming version of original sin!-)

 Regards,
 Nick






___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-11 Thread Tom Breton (Tehom)

 On Feb 11, 2009, at 2:08 AM, Tom Breton (Tehom) wrote:


 (let*
   ((x 1))
   (eval-after-load 'simple (setq x 2))
   x)

 = 2



 (let*
   ((x 1))
   (eval-after-load 'simple '(setq x 2))
   x)

 = 1

 In fact, I am getting 2 in both cases!???
 Do you really get 1 for the second???

Yes I do, but it's clear now that I was mistaken about why.  On closer
inspection, it has to do with emacs not recognizing 'simple because it
wants to see simple instead (string instead of symbol).

;;As symbol
(let*
   ((x 1))
   (eval-after-load 'simple '(setq x 2))
   x)

= 1


;;As string
(let*
   ((x 1))
   (eval-after-load simple '(setq x 2))
   x)

= 2


Not sure why it's different for you.  I suspect it may have to do with a
difference between the emacs version I use and later versions.

 eval-after-load is a function, not a macro, so FORM will
 be evaluated *before* being passed to the function.  []

Yes, I see that now.

Tom Breton (Tehom)




___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-10 Thread Manish
On Tue, Feb 10, 2009 at 8:44 AM, Tom Breton (Tehom) wrote:
[...]
 OK, I've add comments, keywords, and some docstrings I forgot to
 org-choose.el, and I wrote a standalone doc. Both are attached.

This is very intriguing functionality.  I tried to follow your and Casten's
earlier exchanges but could understand only a little.  So I tried to follow
your tutorial but I am getting stuck at switching the `choosenness' of items.
I get following error when I try to switch to any state from no state.  Once
I assign a state by typing it out manually (as opposed to using state
switching commands), I can then switch between states but the error repeats
when I try to switch to MAYBE state.

,
| save-excursion: Symbol's function definition is void: outline-up-heading-all
`

And the test file:

--8---cut here---start-8---
#+CHOOSE_TODO: NO(n,-) MAYBE(m,0) YES(y,+)

* Which bike to buy?
*** Ducati
*** Honda
*** Kawasaki
--8---cut here---end---8---

So far, my understaning is that only one item can be in YES state.  If I try
to switch another item to YES then the existing YES will be demoted
to MAYBE.  So for a two-state choosenness only one item can be in CHOOSE
state while all others will switch to NOT_CHOOSEN state.. is that
understanding correct?

Thanks again.
-- 
Manish


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-10 Thread Manish
On Tue, Feb 10, 2009 at 2:42 PM, Carsten Dominik wrote:

 On Feb 10, 2009, at 9:46 AM, Manish wrote:

 On Tue, Feb 10, 2009 at 8:44 AM, Tom Breton (Tehom) wrote:
 [...]

 OK, I've add comments, keywords, and some docstrings I forgot to
 org-choose.el, and I wrote a standalone doc. Both are attached.

 This is very intriguing functionality. I tried to follow your and
 Casten's
 earlier exchanges but could understand only a little. So I tried to
 follow
 your tutorial but I am getting stuck at switching the `choosenness' of
 items.
 I get following error when I try to switch to any state from no state.
 Once
 I assign a state by typing it out manually (as opposed to using state
 switching commands), I can then switch between states but the error
 repeats
 when I try to switch to MAYBE state.

 ,
 | save-excursion: Symbol's function definition is void:
 outline-up-heading-all
 `

 Hmm, not sure if I messed up there - so I fixed this bug. Tom,
 please check if I did this right.

This issue is gone for me.  Thanks.

 So far, my understaning is that only one item can be in YES state. If I
 try
 to switch another item to YES then the existing YES will be demoted
 to MAYBE. So for a two-state choosenness only one item can be in CHOOSE
 state while all others will switch to NOT_CHOOSEN state.. is that
 understanding correct?

With three choices for choosenness, it works as I expected (only one item in
CHOSEN state at a time) but for more choices like:

#+CHOOSE_TODO: REJECTED(r) NOT_CHOSEN(n,-) MAYBE(,0)
LEANING_TOWARDS(l) CHOSEN(c,+)

it allows multiple items to be in CHOSEN state.  How do we interpret that?

-- 
Manish


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-10 Thread Tom Breton (Tehom)
 On Tue, Feb 10, 2009 at 8:44 AM, Tom Breton (Tehom) wrote:
 [...]
 OK, I've add comments, keywords, and some docstrings I forgot to
 org-choose.el, and I wrote a standalone doc. Both are attached.

 This is very intriguing functionality.  I tried to follow your and
 Casten's
 earlier exchanges but could understand only a little.  So I tried to
 follow
 your tutorial but I am getting stuck at switching the `choosenness' of
 items.
 I get following error when I try to switch to any state from no state.
 Once
 I assign a state by typing it out manually (as opposed to using state
 switching commands), I can then switch between states but the error
 repeats
 when I try to switch to MAYBE state.

 ,
 | save-excursion: Symbol's function definition is void:
 outline-up-heading-all
 `

I couldn't reproduce this bug with your test file.

It seemed to have to do with loading, so I restarted emacs without
pre-loading org (ie, I commented it out of my .emacs).  I only found a
dependency on org-agenda, and once that was loaded, no more error.  So I
couldn't reproduce it.


 So far, my understaning is that only one item can be in YES state.  If I
 try
 to switch another item to YES then the existing YES will be demoted
 to MAYBE.

Right.

 So for a two-state choosenness only one item can be in CHOOSE
 state while all others will switch to NOT_CHOOSEN state.. is that
 understanding correct?

Hm, I didn't look at sets with just two states.  Now that I look at it,
yes, that works but not in the best way it could.  Because I never
contemplated 0 and - being properties of the same mark, it has to be
speced as something like:

#+CHOOSE_TODO: NO(n,-) YES(y,0)

Tom Breton (Tehom)



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-10 Thread Tom Breton (Tehom)
 With three choices for choosenness, it works as I expected (only one item
 in
 CHOSEN state at a time) but for more choices like:

 #+CHOOSE_TODO: REJECTED(r) NOT_CHOSEN(n,-) MAYBE(,0)
 LEANING_TOWARDS(l) CHOSEN(c,+)

 it allows multiple items to be in CHOSEN state.  How do we interpret that?

I couldn't reproduce this.  Is this on the same test file as before?

Tom Breton (Tehom)




___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-10 Thread Tom Breton (Tehom)


 Hmm, not sure if I messed up there - so I fixed this bug.  Tom,
 please check if I did this right.

 - Carsten


Hi, Carsten.  I just looked at org-6.22b

You caught a problem, but I think it's a different bug.  I think there
are these different things:

 * What you saw, that it doesn't work at top level.  Good catch.  My
   code finds the groups of siblings via their parent.  If they have
   no parent, it doesn't work.  Doing that already generated an error
   deep in the guts of outline, but your way is better.  Let's keep
   your fix.
 * What Manish saw.  I can't reproduce this.  I suspect that it
   relates to outline somehow not being loaded, but org-choose
   requires org which requires outline.  I find a dependency on
   org-agenda from `org-map-entries' in org.el, and once I load that,
   it all works.

Tom Breton (Tehom)




___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-10 Thread Tom Breton (Tehom)
 On Tue, Feb 10, 2009 at 2:42 PM, Carsten Dominik wrote:

 On Feb 10, 2009, at 9:46 AM, Manish wrote:

 On Tue, Feb 10, 2009 at 8:44 AM, Tom Breton (Tehom) wrote:
 [...]

 OK, I've add comments, keywords, and some docstrings I forgot to
 org-choose.el, and I wrote a standalone doc. Both are attached.

 This is very intriguing functionality. I tried to follow your and
 Casten's
 earlier exchanges but could understand only a little. So I tried to
 follow
 your tutorial but I am getting stuck at switching the `choosenness' of
 items.
 I get following error when I try to switch to any state from no
 state.
 Once
 I assign a state by typing it out manually (as opposed to using state
 switching commands), I can then switch between states but the error
 repeats
 when I try to switch to MAYBE state.

 ,
 | save-excursion: Symbol's function definition is void:
 outline-up-heading-all
 `

 Hmm, not sure if I messed up there - so I fixed this bug. Tom,
 please check if I did this right.

 This issue is gone for me.  Thanks.

 So far, my understaning is that only one item can be in YES state. If
 I
 try
 to switch another item to YES then the existing YES will be demoted
 to MAYBE. So for a two-state choosenness only one item can be in
 CHOOSE
 state while all others will switch to NOT_CHOOSEN state.. is that
 understanding correct?

 With three choices for choosenness, it works as I expected (only one item
 in
 CHOSEN state at a time) but for more choices like:

 #+CHOOSE_TODO: REJECTED(r) NOT_CHOSEN(n,-) MAYBE(,0)
 LEANING_TOWARDS(l) CHOSEN(c,+)

 it allows multiple items to be in CHOSEN state.  How do we interpret that?

Having fetched and set up 6.22b, I can now reproduce it.

This bug is simple.  In Setting it all up at the end of org-choose.el,
in 6.22b a quote got introduced before progn.  That's all.  With that
quote, it evaluated a quoted form and did nothing.  I'd send a patch,
but ISTM it's easier to just press backspace once.  It's here:

(eval-after-load 'org
  '(progn
;;^--HERE.
 (add-to-list 'org-todo-setup-filter-hook
  #'org-choose-setup-filter)
 (add-to-list 'org-todo-get-default-hook
  #'org-choose-get-default-mark)
 (add-to-list 'org-trigger-hook
  #'org-choose-keep-sensible)
 (add-to-list 'org-todo-interpretation-widgets
  '(:tag Choose   (to record decisions) choose)
  'append)
   ))





Tom Breton (Tehom)








___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Docs submitted (Was Re: Advice sought on managing decision alternatives.)

2009-02-09 Thread Tom Breton (Tehom)
Hi, Carsten.

 Well, some ASCII documentation could be inserted into org-choose.el
 as a file commentary.  If you use a standard header with keywords
 for the finder (M-x finder-commentary and friends), that would be
 useful.

 Tutorials on Worg are usually written in Org, but you can upload
 any format you like (or send it it me) and we wil publish it there.

OK, I've add comments, keywords, and some docstrings I forgot to
org-choose.el, and I wrote a standalone doc.  Both are attached.

Tom Breton (Tehom)


docs.org-choose.el.diff
Description: Binary data


docs.org-choose-docs.org
Description: Binary data
___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode