emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] property values and timestamps


From: Nick Dokos
Subject: Re: [O] property values and timestamps
Date: Fri, 14 Oct 2011 12:29:35 -0400

Nick Dokos <address@hidden> wrote:

> Skip Collins <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]