Re: [O] Fix to property inheritance

2013-01-07 Thread Bill Wishon
Hi Bastien,

I'll edit the code and commit messages so they're  75 chars.

I'll check in again to see where the FSF process is at.

And yes this is about property inheritance with accumulation.

~Bill

On Jan 7, 2013, at 9:35 AM, Bastien b...@altern.org wrote:

 Hi Bill,
 
 sorry for the late (and probably disappointing) reply.
 
 Bill Wishon b...@wishon.org writes:
 
 This is my first major org-mode contribution, and I'm new to git, so
 if there is something I haven't got quite right in terms of how to
 contribute please advise.
 
 org-entry-get with inherit set didn't work for sub-heading additions
 or overrides to properties found in parent headings as of Org-mode
 version 7.9.2 (release_7.9.2-738-g442b2a-git @ org-loaddefs.el can
 not be found!).  
 
 An example test org-mode file is attached (modified from the testing/
 examples directory and also updated in my git repository).
 
 Thanks for providing such a file with tests and examples.  
 
 As far as I understand, problems are for cumulative properties, 
 right?  
 
 Eric, do you have time to check Bill's tests and see what's 
 wrong with cumulative properties and inheritance?  I'm not familiar
 enough with this part of the code to *enjoy* fixing this :)
 
 As for the patch themselves...
 
 1) I did not receive confirmation from the FSF copyright clerk that
   your assignment is processed -- let me know if it is;
 
 2) Please shrink commit messages and code lines to  75 characters
   when possible.  See org.el: we avoid long lines.  This is not only
   for code readability, but also - and importantly here - for patch
   readability...
 
 If I overlooked a bug about something else than cumulative props, 
 please let me know and let's have a separate fix for it.
 
 Thanks!
 
 -- 
 Bastien



Re: [O] Fix to property inheritance

2012-12-25 Thread Bill Wishon
While I'm figuring out how to create the patch and email it in the right
format (I don't think I can with gmail), I've tried to make my
bitbucket.orgrepository as public as possible.  Perhaps give it
another shot in the
meantime.

https://bitbucket.org/mrvwman/wishon-org-mode.git

~Bill

On Mon, Dec 24, 2012 at 7:28 PM, Bastien b...@altern.org wrote:

 Hi Bill,

 Bill Wishon b...@wishon.org writes:

  My public git repository info is: git clone g...@bitbucket.org:mrvwman
  /wishon-org-mode.git
  branch name: fix-property-inheritance

 I could not clone this repository, apparently I don't have enough
 rights.  Can you send a patch?

 Thanks,

 --
  Bastien



[O] LOGBOOK Drawer Position in Capture Templates

2012-12-19 Thread Bill Wishon
Hi,

If I have a capture template as follows:
(sm Start a meeting and clock entry (file ~/org/notes.org) * %c %U
** %? :clock-in t :clock-resume t)

What happens is that the sub-heading where the point is left is where the
LOGBOOK drawer is inserted. like this:

* Meeting Title [date]
** point is here
:LOGBOOK:
CLOCK [date]
:END:

I want the clock to be associated with the top level heading.  Is there a
way to construct the template so that it results in the LOGBOOK drawer
being part of the primary heading?  Like so:
* Meeting TItle [date]
:LOGBOOK:
CLOCK [date]
:END:
** point is here

Thanks,
~Bill


[O] Fix to property inheritance

2012-12-15 Thread Bill Wishon
This is my first major org-mode contribution, and I'm new to git, so if
there is something I haven't got quite right in terms of how to contribute
please advise.

org-entry-get with inherit set didn't work for sub-heading additions or
overrides to properties found in parent headings as of Org-mode version
7.9.2 (release_7.9.2-738-g442b2a-git @ org-loaddefs.el can not be found!).

An example test org-mode file is attached (modified from the
testing/examples directory and also updated in my git repository).

My public git repository info is: git clone g...@bitbucket.org:
mrvwman/wishon-org-mode.git
branch name: fix-property-inheritance

I've submitted my request to ass...@gnu.org, but have not yet received a
reply.

Best,
~Bill


my-property-inheritance.org
Description: Binary data


Re: [O] [PATCH] fix hook calling in org-export-remove-or-extract-drawers

2012-05-01 Thread Bill Wishon
Hi Bastien,

I'll try to find a different mail client next time.

On Tue, May 1, 2012 at 3:01 AM, Bastien b...@gnu.org wrote:

 I don't really understand why `run-hook-with-args-until-success' is
 needed here.  Or `org-export-format-drawer-function' returns a string,
 or it returns nil, in case we fall back on `org-export-format-drawer'.


My thought was that you could have multiple hooks in
org-export-format-drawer-function and each one could be checking for things
like is this html export, is the drawer name == PROPERTIES and could
decide to take action and return a string, or perhaps take no action,
return nil, and let another hook have a shot at the drawer.  The other
thing with funcall here is that if you use add-hook to add your function to
that hook it creates a list of functions, and when funcall is called on a
list of functions instead of an individual function it is an error.

Best,
~Bill


Re: [O] [PATCH] fix hook calling in org-export-remove-or-extract-drawers

2012-05-01 Thread Bill Wishon
On Tue, May 1, 2012 at 10:58 AM, Bastien b...@gnu.org wrote:

 We would need to rename `org-export-format-drawer-function' to
 suggest it can be a list of functions


Maybe this is a non-issue then.  I had assumed it was a hook because it was
on the page describing org-mode hooks, but your right that it doesn't end
in -hook and therefore I shouldn't have been using add-hook to add my
function to it but rather just set it to a single function.  Perhaps to
make it clearer the worg page on hooks could have a section for the
non-hook hooks.


Re: [O] [PATCH] fix hook calling in org-export-remove-or-extract-drawers

2012-05-01 Thread Bill Wishon
On Tue, May 1, 2012 at 11:18 AM, Nicolas Goaziou n.goaz...@gmail.comwrote:

 There are other, and more standard, ways to achieve the
 same result in the new export engine (filters being one).


What I was trying to achieve when I got into trying out the
org-export-format-drawer-function was to try and customize the look of the
properties drawers when they're exported to html.  By default they are
exported as pre formatted text with the class=example.  What would be the
right way to reformat this during output so that I could present this in
another format, say a table or bullet list?

~Bill


[O] [PATCH] fix hook calling in org-export-remove-or-extract-drawers

2012-04-30 Thread Bill Wishon
* lisp/org-exp.el (org-export-remove-or-extract-drawers): Changed funcall
to run-hook-with-args-until-success to properly run the
org-export-format-drawer-function hook.

The problem was that funcall was being executed on the hook (list of
functions) instead of running the hook with
run-hook-with-args-until-success, which tries to run potentially a list of
hooks until one returns non-nil.

~Bill


0001-Capture-Fix-call-to-org-export-format-drawer-functio.patch
Description: Binary data


Re: [O] Documentation vs. implementation for org-properties-postprocess-alist

2012-04-29 Thread Bill Wishon
Hi Bastien,

I just did a pull this morning against the latest in git and the code is
the same.

The definition of the variable org-property-postprocess-alist says that it
should be a list of lists where each inner list's car is a string and cdr
is a function.  I think the doc string for the variable sounds right.  But
if you look at the function org-set-property what it does is set fn to
(assoc property org-property-postprocses-alist), which is a list whose car
is property and cdr is the function.  Then later the function does (funcall
(cadr fn) value).  The cdr of fn is the (lambda () ...) function.  I'm not
sure what the car of a lambda function is, but it's not what should be
passed to funcall.

Instead what I think should happen is that fn should be set to the lambda
function itself initially by calling cdr on the result of assoc.  Now fn
has the lambda function as it's value, so that later on when the test for
non-nil fn is done you can then simply do (funcall fn value) without the
extra cadr.  Another fix would be to change the cadr of fn to just cdr of
fn.  But then the test says if the list is non-nil then call the function
which is the cdr of fn, but that could be nil at that point since it wasn't
checked.

Best,
~Bill

On Sun, Apr 29, 2012 at 2:43 AM, Bastien b...@gnu.org wrote:

 Hi Bill,

 Bill Wishon b...@wishon.org writes:

  While hacking around I read the doc for
  org-properties-postprocess-alist and I think it doesn't align with
  what the implementation of org-set-property does.

 I don't see anything wrong.  Can you double-check?  If there is a
 problem, please tell us what version of Org you are using.

 Thanks,

 --
  Bastien



Re: [O] Question about adding to inherited properties

2012-04-24 Thread Bill Wishon
I think I fixed the problem, but in reading up on how to contribute I
haven't gotten git setup yet or the FSF contribution form done.  Should I
do that first before sharing the patch with the group?

Meanwhile is there some sort of test suite to ensure contributions don't
break existing features?

~Bill

On Thu, Apr 19, 2012 at 9:08 PM, Nick Dokos nicholas.do...@hp.com wrote:

 Eric Schulte (cc:ed) implemented accumulating properties with commit
 3af89e696a32afcc39f2e3bdb6132ac588d530ae. The commit adds a function
 org-update-property-plist which takes care of the '+' case in property
 names. But as you observed, it does not seem to work. I don't really
 understand what should be happening: what I do know is that when
 org-entry-get calls the above function, the props parameter is nil,
 whereas the function expects it to contain the inherited sestting. So it
 may be that the function is expecting something that is not going to
 happen or org-entry-get passes it the wrong thing somehow. I don't know
 which
 one of these two is correct (or perhaps some other thing is wrong), but
 in any case there does seem to be a disconnect.

 Nick



[O] Documentation vs. implementation for org-properties-postprocess-alist

2012-04-22 Thread Bill Wishon
Hi,

While hacking around I read the doc for org-properties-postprocess-alist
and I think it doesn't align with what the implementation of
org-set-property does.

The example in the docstring says:

((Remaining (lambda(value)
  (let ((clocksum (org-clock-sum-current-item))
(effort (org-duration-string-to-minutes
  (org-entry-get (point) Effort
(org-minutes-to-hh:mm-string (- effort
clocksum))

But in order for this to work with the implementation I think it would need
to be :

((Remaining ((lambda(value)
  (let ((clocksum (org-clock-sum-current-item))
(effort (org-duration-string-to-minutes
  (org-entry-get (point) Effort
(org-minutes-to-hh:mm-string (- effort
clocksum)))

Adding extra parens around the lambda expression in the example to make it
a list.  Either that or the implementation of org-set-property should
change to :

$ diff org.el org.el.new
14593c14593
(fn (assoc property org-properties-postprocess-alist)))
---
(fn (cdr (assoc property org-properties-postprocess-alist
14596c14596
 (when fn (setq value (funcall (cadr fn) value)))
---
 (when fn (setq value (funcall fn value)))

What do you think?

~Bill


Re: [O] Question about adding to inherited properties

2012-04-19 Thread Bill Wishon
First, let me say that I'm only a novice elisp hacker...  That said after
spending some time debugging I think there may be a disconnect between the
example in the org-manual and the function org-entry-get-with-inheritance.
The manual shows an example in section 7.1 where a GENRES+ adds to a GENRES
property statement in a parent heading.   But the docs and code in the
org-entry-get-with-inheritance function seem to implement a model that only
looks up the outline if you don't find anything on the current heading,
even if it's a + property.

(defun org-entry-get-with-inheritance (property optional literal-nil)
  Get entry property, and search higher levels if not present.
The search will stop at the first ancestor which has the property defined.
If the value found is \nil\, return nil to show that the property
should be considered as undefined (this is the meaning of nil here).
However, if LITERAL-NIL is set, return the string value \nil\ instead.
  (move-marker org-entry-property-inherited-from nil)
  (let (tmp)
(unless (org-before-first-heading-p)
  (save-excursion
(save-restriction
  (widen)
  (catch 'ex
(while t
  (when (setq tmp (org-entry-get nil property nil 'literal-nil))

 In my previous example when we get here org-entry-get returns the value
of the property GENRES which is Baroque and executes the following three
functions including the throw, which stops the loop.
 Based on the documentation I would think that this function should
check to see if the current property is a GENRES+ vs. a GENRES property
and continue up the outline looking for more GENRES+ properties and only
stop when we find a plain GENRES or reach the top.  This looks like what
the (org-up-heading-safe) below is trying to do, but never gets executed
because org-entry-get returned a positive value of Baroque when searching
for GENRES on the current entry.

(org-back-to-heading t)
(move-marker org-entry-property-inherited-from (point))
(throw 'ex tmp))
  (or (org-up-heading-safe) (throw 'ex nil)))
(setq tmp (or tmp
  (cdr (assoc property org-file-properties))
  (cdr (assoc property org-global-properties))
  (cdr (assoc property org-global-properties-fixed
(if literal-nil tmp (org-not-nil tmp

Thoughts?

~Bill

On Wed, Apr 18, 2012 at 4:05 PM, Bill Wishon b...@wishon.org wrote:

 Hi Org-mode Community,

 I can't get the example in section 7.1 of the org-mode manual to work as I
 expect.  Perhaps someone can help me see what I'm doing wrong.

 I tried creating this buffer:

 * CD collection
 ** Classic
  :PROPERTIES:
  :GENRES: Classic
  :END:
 *** Goldberg Variations
  :PROPERTIES:
  :Title:Goldberg Variations
  :Composer: J.S. Bach
  :Artist:   Glen Gould
  :Publisher: Deutsche Grammophon
  :NDisks:   1
  :GENRES+:   Baroque
  :END:

 Then I set the org-use-property-inheritance variable to include GENRES.

 Then I wrote the following function

 (defun bill-test (property)
   print all inheirited properties
   (interactive MProperty: )
   (message (concat property  =  (org-entry-get (point) property t

 Which prints GENRES = Baroque when I run it with the point on Goldberg
 Variations, based on the manual I expected this to print GENRES = Classic
 Baroque”.

 While I think they should all do the same thing, I also tried the
 following ways of calling org-entry-get just in case all with the same
 result.
 (org-entry-get (point) property 'selective)
 (org-entry-get nil property t)
 (org-entry-get nil property 'selective)

 I'm using org-version 7.8.09 on Windows with emacs GNU Emacs 23.3.1
 (i386-mingw-nt6.1.7601) of 2011-03-10 on 3249CTO.

 Any pointers about what I'm doing wrong would be great.

 Thanks,
 ~Bill



[O] Question about adding to inherited properties

2012-04-18 Thread Bill Wishon
Hi Org-mode Community,

I can't get the example in section 7.1 of the org-mode manual to work as I
expect.  Perhaps someone can help me see what I'm doing wrong.

I tried creating this buffer:

* CD collection
** Classic
 :PROPERTIES:
 :GENRES: Classic
 :END:
*** Goldberg Variations
 :PROPERTIES:
 :Title:Goldberg Variations
 :Composer: J.S. Bach
 :Artist:   Glen Gould
 :Publisher: Deutsche Grammophon
 :NDisks:   1
 :GENRES+:   Baroque
 :END:

Then I set the org-use-property-inheritance variable to include GENRES.

Then I wrote the following function

(defun bill-test (property)
  print all inheirited properties
  (interactive MProperty: )
  (message (concat property  =  (org-entry-get (point) property t

Which prints GENRES = Baroque when I run it with the point on Goldberg
Variations, based on the manual I expected this to print GENRES = Classic
Baroque”.

While I think they should all do the same thing, I also tried the following
ways of calling org-entry-get just in case all with the same result.
(org-entry-get (point) property 'selective)
(org-entry-get nil property t)
(org-entry-get nil property 'selective)

I'm using org-version 7.8.09 on Windows with emacs GNU Emacs 23.3.1
(i386-mingw-nt6.1.7601) of 2011-03-10 on 3249CTO.

Any pointers about what I'm doing wrong would be great.

Thanks,
~Bill


[O] Org-mode for Product Requirements

2012-04-16 Thread Bill Wishon
Hi Org-mode Community,

I'm a product manager and I've been using org-mode for quite some time and
was recently thinking how Org-mode might be a good starting point for a
personal product requirements management system.  I've searched around a
bit and didn't find any discussions about such a topic, and before I start
down this path I figured I'd send a note to this group to:
a) See if anyone else uses org-mode for product requirements.  I'd like to
hear about that.
b) Get feedback on my approach from other org-mode users.  How I'm thinking
of using properties, tags, TODO state, hooks, etc...

I thought Org-mode would be a good place to start since, for me
requirements are a bit like TODO items, I come across them during meetings
with colleagues and customers and want to track them inline to the context
that I find them in.  I then want to take these requirement todo items
and add a bit of structure and collect them in a different document.

I'm leaning toward using a requirement tag on my TODO items since
semantically the item is still a todo item, and the tag indicates a special
way to handle that todo.  I suppose the other way would be to create a new
TODO state like REQ.  Any reason why one would be better than the other?

I'd probably start by hooking into org-after-todo-state-change-hook and
looking for DONE and the requirement tag.  And if I'm completing a TODO
requirement then :
1. Choose the destination, maybe try and leverage existing refiling logic.
2. Copy the headline into the requirements document leaving behind the
original completed headline and a link to the new requirement location.
3. Generate a file unique CUSTOM_ID like REQ-005 if this was the fifth
requirement.  This would allow for creating relationships between
requirements without regard to their names.
4. Create the mandatory properties, perhaps this is just some type of
template text for now, maybe a series of wizard like questions in the
future.

Then I'd also create a custom export option.  Two things come to mind here
in addition to what I already know about customizing html output.
i. Formatting the properties in a specific order and in a custom way,
emphasizing some properties over others.
ii. How to get links in properties to work during html export like they do
if you put a link in a text body.  eg: in emacs [[#REQ-001]] displays as a
link whether it's in a property or text body, but when exported as HTML
only the one in the body text is an html link, the link in the property is
just the original literal text [[#REQ-001]].

In the future I can see doing the following sorts of things:
* Generating different views (both in emacs and for export) eg: roadmap
view, filter by release, dependency tree view
* Computing statistics like the number of requirements per release, amount
of estimated engineering effort per release, etc...
* Validate requirements checking for entries missing required properties,
or entries that don't state something firm eg: has the words must or shall

I'm only just beginning on this and I'd appreciate any feedback and advice
the group may have.

Best,
~Bill

Here's a sample of what I'm thinking in org mode format:
* Introduction
* Use Cases
* Features
** Standard File Dialogs
:PROPERTIES:
:CUSTOM_ID: FEAT-001
:Topic: File IO
:SolvedBy: [[#REQ-001]] [[#REQ-002]]
:END:
The product shall have standard file Open, Save, Save As features
* Requirements
:PROPERTIES:
:Status_ALL: new reviewed approved assigned in development complete
:END:
** Save as
:PROPERTIES:
:CUSTOM_ID: REQ-001
:Topic: File IO
:Status: assigned
:Release: Astraeus
:Created: [2012-04-16 Mon]
:Author: Bill Wishon
:SolvedBy: [[#REQ-002]]
:END:
The product shall allow for users to save things to a different name.
** Save
:PROPERTIES:
:CUSTOM_ID: REQ-002
:Topic: File IO
:DependsOn: [[#REQ-001]]
:END:
The product shall allow for users to save their work.


Re: [O] create new files from capture

2011-04-20 Thread Bill Wishon
  (function function-finding-location)
 Most general way, write your own function to find both
 file and location

I just started trying to do this today myself when I found this thread.

From what I can tell the expectation is that this function places the point 
in the buffer/file at the location where you want to insert the captured 
template item.

I created to following which works for me to open a new file and puts the 
test template there:

(defun prompt-for-new-orgfile ()
  This function prompts for a file to save to

  (call-interactively 'find-file)
  (end-of-buffer))

(setq org-capture-templates
  '((t Todo entry (file+headline (concat org-directory /gtd.org)
Tasks)
 * TODO %?\n %i\n %a)
(m Meeting Notes entry (function prompt-for-new-orgfile) 
* %^{meetingtitle} :unnarrowed)))

What I'm trying to figure out now is how to read the template from a file.  
The documentation says that it can be done by using (file path/to/file) 
in place of the template text argument, but I haven't gotten that working yet.

~Bill




Re: [O] create new files from capture

2011-04-20 Thread Bill Wishon
Bill Wishon bill at wishon.org writes:

 What I'm trying to figure out now is how to read the template from a file.  
 The documentation says that it can be done by using (file path/to/file) 
 in place of the template text argument, but I haven't gotten that working yet.

Nevermind, my elisp skills are rusty (file path/to/template.org) works fine,
what I was trying to do required lisp code evaluation in that context and
therefore didn't work eg: (file (concat org-directory /template.org)) to do
that I'd have to use (function function-returning-the-template), but it's not
really worth it for what I was trying to do.

~Bill