christopherjwhite / org-toodledo

Emacs enhancement for syncing org-mode tasks with Toodledlo
83 stars 16 forks source link

Astethics of Hash property drawer -- Hash includes spaces from org-indent-line. #30

Closed lawlist closed 10 years ago

lawlist commented 10 years ago

While this issue does not affect the functionality, it would be nice if the Hash property drawer did not have several extra spaces before the Hash. The spaces are being picked up from org-indent-line.

For lack of a better solution, I have removed the functionality of org-indent-line and am using lawlist-org-cleanup at the end of the synchronization as mentioned in Issue # 29:

(defalias 'org-indent-line 'lawlist-org-indent-line)
(defun lawlist-org-indent-line ())

(defalias 'org-indent-to-column 'lawlist-org-indent-to-column)
(defun lawlist-org-indent-to-column (column &optional minimum buffer) )
christopherjwhite commented 10 years ago

This seems like a suggestion for org-mode, right? org-toodledo is not doing anything special here other than using standard org mode functions like org-entry-put to create properties. For whatever reason, the org-mode folks have decided that the entire property drawer should be indented to align with the first character after the stars.

lawlist commented 10 years ago

The way Hash works now looks like this:

:PROPERTIES:
:ToodledoID: 341546156
:ToodledoFolder: TASKS
:Hash:       68c98e08f9780308cfc5d066e2ab8549

I am proposing that Hash look instead like this -- without the extra spaces at the beginning:

:PROPERTIES:
:ToodledoID: 341546156
:ToodledoFolder: TASKS
:Hash: 68c98e08f9780308cfc5d066e2ab8549

There is something happening in the Hash creation that incorporates the spaces being used by org-indent-line.

christopherjwhite commented 10 years ago

This is still something in org-mode. org-toodledo simply updates or adds the hash by calling (org-entry-put), and org-mode does the rest, including adding spaces. I suspect it's trying to make the property drawer look a bit tidy, aligning values for multiple properties, but that's just a guess.

Try the following with the cursor in the middle of any todo item:

(org-entry-put (point) "Foo" "adsfasdfasdfadsf3ew34")

In my environment it puts several spaces between the property name :Foo: and the value.

lawlist commented 10 years ago

Yes, I just tried your test and confirm the same result. Thank you for helping me understand that the Hash creation is not causing this issue.

(defun lawlist-org-entry-put ()
(interactive)
(org-entry-put (point) "Foo" "adsfasdfasdfadsf3ew34") )
christopherjwhite commented 10 years ago

Cool -- btw, if you're unaware of eval-expression, it will avoid having to wrap the above in an interactive function. You first have to enable it via:

(put 'eval-expression 'disabled nil)

Stick the above in your .emacs or the like. Then you can do the following:

M-x eval-expression Eval: (org-entry-put (point) "Foo" "adsfasdf")

I think it also has a default key binding of M-:

lawlist commented 10 years ago

Thank you very much for that useful tip, which is certainly much better than me writing an interactive function every time I want to evaluate an expression. Greatly appreciated! :)