emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* problems while editing in org-columns mode
@ 2013-11-22 19:30 andrea.rossetti
  2013-11-26 12:19 ` Carsten Dominik
  0 siblings, 1 reply; 6+ messages in thread
From: andrea.rossetti @ 2013-11-22 19:30 UTC (permalink / raw)
  To: emacs-orgmode


Hello everyone,

  I get some unexpected behaviour in org-column mode on my
workstation (Emacs 24.3, org-version 8.2.2, Win 7 64 bit).
May I ask support in order to understand:

- if this is reproducible for you as well
- if it is actually a bug, or a mess on my local installation,
  or if I misunderstood how to use org-column properly

  Thanks in advance to anyone patient enough to read this
and give it a try. Kindest regards, Andrea.




HOW TO REPRODUCE PROBLEM A:

1) create an example Org file like this:

* myproject
** mytask1
** mytask2

2) click on the word "myproject", C-c C-x C-c to enable
column view

3) M-S-<right>, then answer the wizard questions:
property=cost, title=cost, width=8, summary=add_numbers

4) now click on the word "myproject", type q to leave
org-columns mode

5) you will see that in the first row of the buffer
a new line appears:

#+COLUMNS: %25ITEM %8cost %TODO %3PRIORITY %TAGS

  I expected "%8cost{+}" instead of "%8cost". Even
if f I change manually "%8cost" to "%8cost{+}" the
automatic sums (cost of myproject sums cost of
mytask1+mytask2) still don't work.

  The sums work properly if I remove the entire
#+COLUMNS statement and add to the :PROPERTIES: of
row "myproject" the following property:

:COLUMNS: %25ITEM %8cost{+} %TODO %3PRIORITY %TAGS



HOW TO REPRODUCE PROBLEM B:

1, 2, 3) same steps than problem A

4) go on row "mytask1" column "cost", type "e" to edit
the value, set it to 1234, type RET

5) type "e" and change the proposed value 1234 into
the empty string, then type RET 

6) type "e" and set the value to 3456, then type RET

7) go on row "mytask1", type TAB to see the properties:
you will see that the properties are now:

   :PROPERTIES:
   :cost: 
   :cost:     3456
   :END:

(I did not expect that empty :cost: column)

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

* Re: problems while editing in org-columns mode
  2013-11-22 19:30 problems while editing in org-columns mode andrea.rossetti
@ 2013-11-26 12:19 ` Carsten Dominik
  2014-04-24 13:12   ` Andrea Rossetti
  0 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2013-11-26 12:19 UTC (permalink / raw)
  To: andrea.rossetti; +Cc: emacs-orgmode

Hi Andrea,

I have fixed problem A.  Problem B has to do with the fact that the property search function does not find a property with an empty value.  I need to look into this some more.

- Carsten
On Nov 22, 2013, at 8:30 PM, andrea.rossetti@gmail.com wrote:

> 
> Hello everyone,
> 
>  I get some unexpected behaviour in org-column mode on my
> workstation (Emacs 24.3, org-version 8.2.2, Win 7 64 bit).
> May I ask support in order to understand:
> 
> - if this is reproducible for you as well
> - if it is actually a bug, or a mess on my local installation,
>  or if I misunderstood how to use org-column properly
> 
>  Thanks in advance to anyone patient enough to read this
> and give it a try. Kindest regards, Andrea.
> 
> 
> 
> 
> HOW TO REPRODUCE PROBLEM A:
> 
> 1) create an example Org file like this:
> 
> * myproject
> ** mytask1
> ** mytask2
> 
> 2) click on the word "myproject", C-c C-x C-c to enable
> column view
> 
> 3) M-S-<right>, then answer the wizard questions:
> property=cost, title=cost, width=8, summary=add_numbers
> 
> 4) now click on the word "myproject", type q to leave
> org-columns mode
> 
> 5) you will see that in the first row of the buffer
> a new line appears:
> 
> #+COLUMNS: %25ITEM %8cost %TODO %3PRIORITY %TAGS
> 
>  I expected "%8cost{+}" instead of "%8cost". Even
> if f I change manually "%8cost" to "%8cost{+}" the
> automatic sums (cost of myproject sums cost of
> mytask1+mytask2) still don't work.
> 
>  The sums work properly if I remove the entire
> #+COLUMNS statement and add to the :PROPERTIES: of
> row "myproject" the following property:
> 
> :COLUMNS: %25ITEM %8cost{+} %TODO %3PRIORITY %TAGS
> 
> 
> 
> HOW TO REPRODUCE PROBLEM B:
> 
> 1, 2, 3) same steps than problem A
> 
> 4) go on row "mytask1" column "cost", type "e" to edit
> the value, set it to 1234, type RET
> 
> 5) type "e" and change the proposed value 1234 into
> the empty string, then type RET 
> 
> 6) type "e" and set the value to 3456, then type RET
> 
> 7) go on row "mytask1", type TAB to see the properties:
> you will see that the properties are now:
> 
>   :PROPERTIES:
>   :cost: 
>   :cost:     3456
>   :END:
> 
> (I did not expect that empty :cost: column)
> 

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

* Re: problems while editing in org-columns mode
  2013-11-26 12:19 ` Carsten Dominik
@ 2014-04-24 13:12   ` Andrea Rossetti
  2014-05-30  7:16     ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Andrea Rossetti @ 2014-04-24 13:12 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

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


Hello Carsten and everyone else reading,

  yesterday I re-stumbled into the "problem B" described
below, and had a look at the Org sources. I think the solution
could be: if user sets a non-special property to "" or nil,
then remove the property. 

  An example of a possible (non-bulletproof, test-only-intended)
patch for "org-entry-put" follows.


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

*** c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140422/org.el	Wed Apr 23 22:15:51 2014
--- c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140422/org.new.el	Thu Apr 24 12:40:49 2014
***************
*** 15557,15562 ****
--- 15557,15563 ----
         ((member property org-special-properties)
  	(error "The %s property can not yet be set with `org-entry-put'"
  	       property))
+        ((equal value "") (org-delete-property property))
         (t ; a non-special property
  	(let ((buffer-invisibility-spec (org-inhibit-invisibility))) ; Emacs 21
  	  (setq range (org-get-property-block beg end 'force))

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


  Does it make sense for you too? Kindest regards,

  Andrea



Carsten Dominik <carsten.dominik@gmail.com> writes:

> Hi Andrea,
>
> I have fixed problem A.  Problem B has to do with the fact that the
> property search function does not find a property with an empty value.
> I need to look into this some more.
>
> - Carsten
> On Nov 22, 2013, at 8:30 PM, andrea.rossetti@gmail.com wrote:
>
.......
>> 
>> HOW TO REPRODUCE PROBLEM A:
>> 
>> 1) create an example Org file like this:
>> 
>> * myproject
>> ** mytask1
>> ** mytask2
>> 
>> 2) click on the word "myproject", C-c C-x C-c to enable
>> column view
>> 
>> 3) M-S-<right>, then answer the wizard questions:
>> property=cost, title=cost, width=8, summary=add_numbers
>> 
>> 4) now click on the word "myproject", type q to leave
>> org-columns mode
>> 
>> 5) you will see that in the first row of the buffer
>> a new line appears:
>> 
>> #+COLUMNS: %25ITEM %8cost %TODO %3PRIORITY %TAGS
>> 
>>  I expected "%8cost{+}" instead of "%8cost". Even
>> if f I change manually "%8cost" to "%8cost{+}" the
>> automatic sums (cost of myproject sums cost of
>> mytask1+mytask2) still don't work.
>> 
>>  The sums work properly if I remove the entire
>> #+COLUMNS statement and add to the :PROPERTIES: of
>> row "myproject" the following property:
>> 
>> :COLUMNS: %25ITEM %8cost{+} %TODO %3PRIORITY %TAGS
>> 
>> 
>> 
>> HOW TO REPRODUCE PROBLEM B:
>> 
>> 1, 2, 3) same steps than problem A
>> 
>> 4) go on row "mytask1" column "cost", type "e" to edit
>> the value, set it to 1234, type RET
>> 
>> 5) type "e" and change the proposed value 1234 into
>> the empty string, then type RET 
>> 
>> 6) type "e" and set the value to 3456, then type RET
>> 
>> 7) go on row "mytask1", type TAB to see the properties:
>> you will see that the properties are now:
>> 
>>   :PROPERTIES:
>>   :cost: 
>>   :cost:     3456
>>   :END:
>> 
>> (I did not expect that empty :cost: column)
>> 

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

* Re: problems while editing in org-columns mode
  2014-04-24 13:12   ` Andrea Rossetti
@ 2014-05-30  7:16     ` Bastien
  2014-05-31 14:35       ` Andrea Rossetti
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2014-05-30  7:16 UTC (permalink / raw)
  To: Andrea Rossetti; +Cc: emacs-orgmode, Carsten Dominik

Hi Andrea,

I pushed another fix for the second problem you reported,
something along the lines of what you suggested.

Let me know if it works for you, and thanks for reporting this,

-- 
 Bastien

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

* Re: problems while editing in org-columns mode
  2014-05-30  7:16     ` Bastien
@ 2014-05-31 14:35       ` Andrea Rossetti
  2014-06-02 17:38         ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Andrea Rossetti @ 2014-05-31 14:35 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Carsten Dominik

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

Bastien <bzg@gnu.org> writes:

> Let me know if it works for you, 

  Hi! I tried a recent git snapshot (Fri May 30 19:28:04
2014 +0200) and performed some manual tests (1 to 5, see
below).

- in org-columns mode ("C-c C-x C-c"):

  - 1) PASS: org-columns-edit-value ("e") updates correctly the
    empty/whitespace string

- in normal org-mode (i.e. not org-columns mode):

  - 2) PASS: org-set-property ("C-c C-x p") and
       org-set-property-and-value ("C-c C-x P") update
       correctly the empty/whitespace string

  - 3) FAIL: when using org-set-property or org-set-property-and-value
       interactively, tab autocompletion for the "Property: " prompt
       can't find the name of property X if the old value of X was an
       empty/whitespace string
          
  - 4) FAIL: org-delete-property ("M-x org-delete-property") commands
       skips/ignores a property name if the value is empty/whitespace string

  I think that commit 822dcfc881a5df3249fcecf4b7bc71ee9c321b92 addressed
the tests 1) and 2) and they pass, so I'd say the commit is OK.

  The tests 3) and 4) pass if I use the following (naive,
demonstrative-only, just-to-give-the-idea) patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: naive-patch-for-org-delete-property.diff --]
[-- Type: text/x-patch, Size: 890 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index d645897..a772743 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15530,7 +15530,7 @@ things up because then unnecessary parsing is avoided."
 	   (setq range (org-get-property-block beg end))
 	   (when range
 	     (goto-char (car range))
-	     (while (re-search-forward org-property-re
+	     (while (re-search-forward (org-re-property ".*?" 'literal t)
 				       (cdr range) t)
 	       (setq key (org-match-string-no-properties 2)
 		     value (org-trim (or (org-match-string-no-properties 3) "")))
@@ -15619,7 +15619,7 @@ If yes, return this value.  If not, return the current value of the variable."
 	(if (and range
 		 (goto-char (car range))
 		 (re-search-forward
-		  (org-re-property property)
+		  (org-re-property property nil t)
 		  (cdr range) t))
 	    (progn
 	      (delete-region (match-beginning 0) (1+ (point-at-eol)))

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


  For curiosity I also tested a wrong-syntax input:

  - 5) if the user edits manually the :PROPERTIES: block and
       adds an empty-valued property (example: :prop1:) and he forgets
       to add at least one whitespace character after :prop1: then
       the tests 1)-2)-3)-4) fail

  I'd say: 5) is acceptable behaviour, but special care must
be taken by users that hand-edit empty-valued properties, as it's
easy to miss a whitespace while typing.

> and thanks for reporting this,

Thanks to you for your work on this one. Cheers,

  Andrea

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

* Re: problems while editing in org-columns mode
  2014-05-31 14:35       ` Andrea Rossetti
@ 2014-06-02 17:38         ` Bastien
  0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2014-06-02 17:38 UTC (permalink / raw)
  To: Andrea Rossetti; +Cc: emacs-orgmode, Carsten Dominik

Hi Andrea,

Andrea Rossetti <andrea.rossetti@gmail.com> writes:

> Bastien <bzg@gnu.org> writes:
>
>> Let me know if it works for you, 
>
>   - 3) FAIL: when using org-set-property or org-set-property-and-value
>        interactively, tab autocompletion for the "Property: " prompt
>        can't find the name of property X if the old value of X was an
>        empty/whitespace string
>           
>   - 4) FAIL: org-delete-property ("M-x org-delete-property") commands
>        skips/ignores a property name if the value is
>        empty/whitespace string

This should be fixed now in maint, thanks for the detailed tests and
the suggested fix!

-- 
 Bastien

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

end of thread, other threads:[~2014-06-02 17:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-22 19:30 problems while editing in org-columns mode andrea.rossetti
2013-11-26 12:19 ` Carsten Dominik
2014-04-24 13:12   ` Andrea Rossetti
2014-05-30  7:16     ` Bastien
2014-05-31 14:35       ` Andrea Rossetti
2014-06-02 17:38         ` Bastien

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