emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* property values and timestamps
@ 2011-10-14  5:16 Skip Collins
  2011-10-14  5:27 ` Nick Dokos
  2011-10-14  5:50 ` Nick Dokos
  0 siblings, 2 replies; 10+ messages in thread
From: Skip Collins @ 2011-10-14  5:16 UTC (permalink / raw)
  To: emacs-org list

I store a timestamp in a property. I create the property by
typing
C-c C-x p
and then entering the property name, say BIRTHDAY. Then I
have to enter the date manually.

It would be nice if
C-c !
and other timestamp creation commands were available in
the minibuffer when entering property values.

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

* Re: property values and timestamps
  2011-10-14  5:16 property values and timestamps Skip Collins
@ 2011-10-14  5:27 ` Nick Dokos
  2011-10-14 10:36   ` Giovanni Ridolfi
  2011-10-14  5:50 ` Nick Dokos
  1 sibling, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2011-10-14  5:27 UTC (permalink / raw)
  To: Skip Collins; +Cc: nicholas.dokos, emacs-org list

Skip Collins <skip.collins@gmail.com> wrote:

> I store a timestamp in a property. I create the property by
> typing
> C-c C-x p
> and then entering the property name, say BIRTHDAY. Then I
> have to enter the date manually.
> 

You can plan ahead a bit and avoid the manual entry:

o enter the time stamp into the org file: C-c ! or whatever.

o kill the timestamp

o enter the property - when it's time to enter the value,
  yank the killed timestamp.

> It would be nice if
> C-c !
> and other timestamp creation commands were available in
> the minibuffer when entering property values.
> 

But this *would* be nicer, indeed.

Nick

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

* Re: property values and timestamps
  2011-10-14  5:16 property values and timestamps Skip Collins
  2011-10-14  5:27 ` Nick Dokos
@ 2011-10-14  5:50 ` Nick Dokos
  2011-10-14 15:40   ` Skip Collins
  1 sibling, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2011-10-14  5:50 UTC (permalink / raw)
  To: Skip Collins; +Cc: nicholas.dokos, emacs-org list

Skip Collins <skip.collins@gmail.com> wrote:

> I store a timestamp in a property. I create the property by
> typing
> C-c C-x p
> and then entering the property name, say BIRTHDAY. Then I
> have to enter the date manually.
> 
> It would be nice if
> C-c !
> and other timestamp creation commands were available in
> the minibuffer when entering property values.
> 

They cannot be: org-time-stamp-inactive uses the minibuffer, and calling
a function that uses the minibuffer *from* the minibuffer (as
org-set-property would do) make emacs unhappy. You might be able to get
away with a simpler function that inserts e.g. the current timestamp
without asking the user any questions, but you cannot have the full
generality of C-c !

Nick

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

* Re: property values and timestamps
  2011-10-14  5:27 ` Nick Dokos
@ 2011-10-14 10:36   ` Giovanni Ridolfi
  0 siblings, 0 replies; 10+ messages in thread
From: Giovanni Ridolfi @ 2011-10-14 10:36 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Skip Collins, emacs-org list

Nick Dokos <nicholas.dokos@hp.com> writes:

> Skip Collins <skip.collins@gmail.com> wrote:
>
>> I store a timestamp in a property. 

You can  use a capture template:

(setq org-capture-templates (quote (("a" "vArious" entry (file+headline
"c:/myfile.org" "Appt") ":PROPERTIES:
:Birthday:  %^u
:END:))))

hth
Giovanni

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

* Re: property values and timestamps
  2011-10-14  5:50 ` Nick Dokos
@ 2011-10-14 15:40   ` Skip Collins
  2011-10-14 15:59     ` Nick Dokos
  0 siblings, 1 reply; 10+ messages in thread
From: Skip Collins @ 2011-10-14 15:40 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: nicholas.dokos

> org-time-stamp-inactive uses the minibuffer, and calling
> a function that uses the minibuffer *from* the minibuffer (as
> org-set-property would do) make emacs unhappy.

Elisp does seem to allow recursive minibuffers:
http://www.gnu.org/software/emacs/elisp/html_node/Recursive-Mini.html

Would the implementation of this for org-set-property be straightforward?

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

* Re: property values and timestamps
  2011-10-14 15:40   ` Skip Collins
@ 2011-10-14 15:59     ` Nick Dokos
  2011-10-14 16:29       ` Nick Dokos
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2011-10-14 15:59 UTC (permalink / raw)
  To: Skip Collins; +Cc: nicholas.dokos, emacs-orgmode

Skip Collins <skip.collins@gmail.com> wrote:

> > org-time-stamp-inactive uses the minibuffer, and calling
> > a function that uses the minibuffer *from* the minibuffer (as
> > org-set-property would do) make emacs unhappy.
> 
> Elisp does seem to allow recursive minibuffers:
> http://www.gnu.org/software/emacs/elisp/html_node/Recursive-Mini.html
> 
> Would the implementation of this for org-set-property be straightforward?
> 

Oh, very nice: I didn't know about that. Here's a proof-of-concept
snippet, redefining the org-completing-read function to bind
org-time-stamp-inactive to a key ("!" in the following, but you will
probably want to season to taste):

--8<---------------cut here---------------start------------->8---
(setq enable-recursive-minibuffers t)

(defun org-completing-read (&rest args)
  "Completing-read with SPACE being a normal character."
  (let ((minibuffer-local-completion-map
	 (copy-keymap minibuffer-local-completion-map)))
    (org-defkey minibuffer-local-completion-map " " 'self-insert-command)
    (org-defkey minibuffer-local-completion-map "?" 'self-insert-command)
    (org-defkey minibuffer-local-completion-map "!" 'org-time-stamp-inactive)
    (apply 'org-icompleting-read args)))
--8<---------------cut here---------------end--------------->8---

It even seems to work!-)

Thanks,
Nick

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

* Re: property values and timestamps
  2011-10-14 15:59     ` Nick Dokos
@ 2011-10-14 16:29       ` Nick Dokos
  2011-10-14 17:34         ` Skip Collins
  2011-10-21 15:47         ` Bastien
  0 siblings, 2 replies; 10+ messages in thread
From: Nick Dokos @ 2011-10-14 16:29 UTC (permalink / raw)
  To: Skip Collins, emacs-orgmode; +Cc: nicholas.dokos

Nick Dokos <nicholas.dokos@hp.com> wrote:

> Skip Collins <skip.collins@gmail.com> wrote:
> 
> > > org-time-stamp-inactive uses the minibuffer, and calling
> > > a function that uses the minibuffer *from* the minibuffer (as
> > > org-set-property would do) make emacs unhappy.
> > 
> > Elisp does seem to allow recursive minibuffers:
> > http://www.gnu.org/software/emacs/elisp/html_node/Recursive-Mini.html
> > 
> > Would the implementation of this for org-set-property be straightforward?
> > 
> 
> Oh, very nice: I didn't know about that. Here's a proof-of-concept
> snippet, redefining the org-completing-read function to bind
> org-time-stamp-inactive to a key ("!" in the following, but you will
> probably want to season to taste):
> 
> (setq enable-recursive-minibuffers t)
> 
> (defun org-completing-read (&rest args)
>   "Completing-read with SPACE being a normal character."
>   (let ((minibuffer-local-completion-map
> 	 (copy-keymap minibuffer-local-completion-map)))
>     (org-defkey minibuffer-local-completion-map " " 'self-insert-command)
>     (org-defkey minibuffer-local-completion-map "?" 'self-insert-command)
>     (org-defkey minibuffer-local-completion-map "!" 'org-time-stamp-inactive)
>     (apply 'org-icompleting-read args)))
> 
> It even seems to work!-)
> 

Still a proof-of-concept, but better than the first attempt - set
recursive minibuffers locally and use the standard keybinding:

--8<---------------cut here---------------start------------->8---
(defun org-completing-read (&rest args)
  "Completing-read with SPACE being a normal character."
  (let ((minibuffer-local-completion-map
	 (copy-keymap minibuffer-local-completion-map))
	(enable-recursive-minibuffers t))
    (org-defkey minibuffer-local-completion-map " " 'self-insert-command)
    (org-defkey minibuffer-local-completion-map "?" 'self-insert-command)
    (org-defkey minibuffer-local-completion-map (kbd "C-c !") 'org-time-stamp-inactive)
    (apply 'org-icompleting-read args)))
--8<---------------cut here---------------end--------------->8---

Nick

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

* Re: property values and timestamps
  2011-10-14 16:29       ` Nick Dokos
@ 2011-10-14 17:34         ` Skip Collins
  2011-10-21 15:48           ` Bastien
  2011-10-21 15:47         ` Bastien
  1 sibling, 1 reply; 10+ messages in thread
From: Skip Collins @ 2011-10-14 17:34 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: nicholas.dokos

> Still a proof-of-concept, but better than the first attempt - set
> recursive minibuffers locally and use the standard keybinding:

That was easy. I'm looking forward to this making its way into the
main repository. Where else would a recursive minibuffer make sense?
How about putting links into properties. Or timestamps into links. Or
timestamps into capture fields. The possibilities are endless :-)

Thanks.

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

* Re: property values and timestamps
  2011-10-14 16:29       ` Nick Dokos
  2011-10-14 17:34         ` Skip Collins
@ 2011-10-21 15:47         ` Bastien
  1 sibling, 0 replies; 10+ messages in thread
From: Bastien @ 2011-10-21 15:47 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Skip Collins, emacs-orgmode

Hi Skip and Nick,

Nick Dokos <nicholas.dokos@hp.com> writes:

> Still a proof-of-concept, but better than the first attempt - set
> recursive minibuffers locally and use the standard keybinding:
>
> (defun org-completing-read (&rest args)
>   "Completing-read with SPACE being a normal character."
>   (let ((minibuffer-local-completion-map
> 	 (copy-keymap minibuffer-local-completion-map))
> 	(enable-recursive-minibuffers t))
>     (org-defkey minibuffer-local-completion-map " " 'self-insert-command)
>     (org-defkey minibuffer-local-completion-map "?" 'self-insert-command)
>     (org-defkey minibuffer-local-completion-map (kbd "C-c !") 'org-time-stamp-inactive)
>     (apply 'org-icompleting-read args)))

I allowed recursive minibuffers in `org-completing-read'.

Thanks for this neat idea and proof-of-concept!

-- 
 Bastien

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

* Re: property values and timestamps
  2011-10-14 17:34         ` Skip Collins
@ 2011-10-21 15:48           ` Bastien
  0 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2011-10-21 15:48 UTC (permalink / raw)
  To: Skip Collins; +Cc: nicholas.dokos, emacs-orgmode

Hi Skip,

Skip Collins <skip.collins@gmail.com> writes:

>> Still a proof-of-concept, but better than the first attempt - set
>> recursive minibuffers locally and use the standard keybinding:
>
> That was easy. I'm looking forward to this making its way into the
> main repository. Where else would a recursive minibuffer make sense?

I think `org-completing-read' is the most significant one, but yes, 
there might be others.  Please keep us posted about new ideas.

-- 
 Bastien

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

end of thread, other threads:[~2011-10-21 16:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-14  5:16 property values and timestamps Skip Collins
2011-10-14  5:27 ` Nick Dokos
2011-10-14 10:36   ` Giovanni Ridolfi
2011-10-14  5:50 ` Nick Dokos
2011-10-14 15:40   ` Skip Collins
2011-10-14 15:59     ` Nick Dokos
2011-10-14 16:29       ` Nick Dokos
2011-10-14 17:34         ` Skip Collins
2011-10-21 15:48           ` Bastien
2011-10-21 15:47         ` 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).