emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-insert-timestamp issue
@ 2012-01-25  1:19 Marcelo de Moraes Serpa
  2012-01-25  1:46 ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: Marcelo de Moraes Serpa @ 2012-01-25  1:19 UTC (permalink / raw)
  To: Org Mode

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

Hi guys,

I have bound org-insert-timestamp to C-c C-y, like so:

(global-set-key (kbd "C-c C-y") (lambda() (interactive)
(org-insert-time-stamp nil t nil nil nil nil)))

However, once in an org-mode buffer, when I press C-c C-y, I get the
following in the mini-buffer:

if: Not at a time-stamp range, and none found in current line

What does that mean and how could I fix it so that the current timestamp is
inserted (current datetime)?

Thanks in advance,

-Marcelo.

[-- Attachment #2: Type: text/html, Size: 654 bytes --]

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

* Re: org-insert-timestamp issue
  2012-01-25  1:19 org-insert-timestamp issue Marcelo de Moraes Serpa
@ 2012-01-25  1:46 ` Nick Dokos
  2012-01-25  2:52   ` Marcelo de Moraes Serpa
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2012-01-25  1:46 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: nicholas.dokos, Org Mode

Marcelo de Moraes Serpa <celoserpa@gmail.com> wrote:

> --485b393aac6dde430a04b7500c79
> Content-Type: text/plain; charset=ISO-8859-1
> 
> Hi guys,
> 
> I have bound org-insert-timestamp to C-c C-y, like so:
> 
> (global-set-key (kbd "C-c C-y") (lambda() (interactive)
> (org-insert-time-stamp nil t nil nil nil nil)))
> 
> However, once in an org-mode buffer, when I press C-c C-y, I get the
> following in the mini-buffer:
> 
> if: Not at a time-stamp range, and none found in current line
> 
> What does that mean and how could I fix it so that the current timestamp is
> inserted (current datetime)?
> 

Org-mode rebinds C-c C-y to org-evaluate-time-range, so you are not calling
the function that you think you are calling when you press C-c C-y in an
org-mode buffer. It only works in *other* buffers :-)

If you don't care about org-evaluate-time-range, you can probably rebind C-c C-y
in a hook:

(add-hook 'org-mode-hook (function (lambda () 
 	  	  		     (local-set-key (kbd "C-c C-y")
				                    (lambda() (interactive)
				 	              (org-insert-time-stamp nil t nil nil nil nil))))))

Nick

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

* Re: org-insert-timestamp issue
  2012-01-25  1:46 ` Nick Dokos
@ 2012-01-25  2:52   ` Marcelo de Moraes Serpa
  2012-01-25  3:48     ` Nick Dokos
  2012-01-25  6:15     ` Bastien
  0 siblings, 2 replies; 6+ messages in thread
From: Marcelo de Moraes Serpa @ 2012-01-25  2:52 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Org Mode

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

Hi Nick, thank you very much!

Why does org rebinds C-c C-y to that function? Is that a default binding
for org?

Marcelo.

On Tue, Jan 24, 2012 at 7:46 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:

> Marcelo de Moraes Serpa <celoserpa@gmail.com> wrote:
>
> > --485b393aac6dde430a04b7500c79
> > Content-Type: text/plain; charset=ISO-8859-1
> >
> > Hi guys,
> >
> > I have bound org-insert-timestamp to C-c C-y, like so:
> >
> > (global-set-key (kbd "C-c C-y") (lambda() (interactive)
> > (org-insert-time-stamp nil t nil nil nil nil)))
> >
> > However, once in an org-mode buffer, when I press C-c C-y, I get the
> > following in the mini-buffer:
> >
> > if: Not at a time-stamp range, and none found in current line
> >
> > What does that mean and how could I fix it so that the current timestamp
> is
> > inserted (current datetime)?
> >
>
> Org-mode rebinds C-c C-y to org-evaluate-time-range, so you are not calling
> the function that you think you are calling when you press C-c C-y in an
> org-mode buffer. It only works in *other* buffers :-)
>
> If you don't care about org-evaluate-time-range, you can probably rebind
> C-c C-y
> in a hook:
>
> (add-hook 'org-mode-hook (function (lambda ()
>                                     (local-set-key (kbd "C-c C-y")
>                                                    (lambda() (interactive)
>
>  (org-insert-time-stamp nil t nil nil nil nil))))))
>
> Nick
>
>

[-- Attachment #2: Type: text/html, Size: 2076 bytes --]

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

* Re: org-insert-timestamp issue
  2012-01-25  2:52   ` Marcelo de Moraes Serpa
@ 2012-01-25  3:48     ` Nick Dokos
  2012-01-25  6:15     ` Bastien
  1 sibling, 0 replies; 6+ messages in thread
From: Nick Dokos @ 2012-01-25  3:48 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: nicholas.dokos, Org Mode

Marcelo de Moraes Serpa <celoserpa@gmail.com> wrote:


> Why does org rebinds C-c C-y to that function? Is that a default binding
> for org?
> 

Yes - see line 17340 in org.el.

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

* Re: org-insert-timestamp issue
  2012-01-25  2:52   ` Marcelo de Moraes Serpa
  2012-01-25  3:48     ` Nick Dokos
@ 2012-01-25  6:15     ` Bastien
  2012-01-25  8:58       ` Carsten Dominik
  1 sibling, 1 reply; 6+ messages in thread
From: Bastien @ 2012-01-25  6:15 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: nicholas.dokos, Org Mode

Hi Marcelo,

Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:

> Why does org rebinds C-c C-y to that function? Is that a default
> binding for org?

Yes.  But `C-c y' is free.

HTH,

-- 
 Bastien

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

* Re: org-insert-timestamp issue
  2012-01-25  6:15     ` Bastien
@ 2012-01-25  8:58       ` Carsten Dominik
  0 siblings, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2012-01-25  8:58 UTC (permalink / raw)
  To: Bastien; +Cc: nicholas.dokos, Org Mode, Marcelo de Moraes Serpa


On 25.1.2012, at 06:15, Bastien wrote:

> Hi Marcelo,
> 
> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
> 
>> Why does org rebinds C-c C-y to that function? Is that a default
>> binding for org?
> 
> Yes.  But `C-c y' is free.

Just to expand on this, in Emacs, C-c letter keys are reserved for the users,
but C-c C-letter is for the major modes.  So for your own private global
bindings, C-c letter is much safer.

- Carsten

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

end of thread, other threads:[~2012-01-25  8:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-25  1:19 org-insert-timestamp issue Marcelo de Moraes Serpa
2012-01-25  1:46 ` Nick Dokos
2012-01-25  2:52   ` Marcelo de Moraes Serpa
2012-01-25  3:48     ` Nick Dokos
2012-01-25  6:15     ` Bastien
2012-01-25  8:58       ` Carsten Dominik

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