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.
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
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
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
> 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?
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
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
> 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.
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
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