all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-mode keybinding
@ 2012-08-18  7:55 drain
  2012-08-18 16:08 ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: drain @ 2012-08-18  7:55 UTC (permalink / raw)
  To: Help-gnu-emacs

Tried to remap org-beginning-of-line to C-q, neither of these two methods
worked:

(1)

(add-hook 'org-mode-hook 
          (lambda ()
            (local-set-key "\C-q" 'org-beginning-of-line)))

(2) 

(add-hook 'org-mode-hook
          '(lambda ()
             (define-key org-mode-map "\C-q" 'org-beginning-of-line)))





--
View this message in context: http://emacs.1067599.n5.nabble.com/org-mode-keybinding-tp261738.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



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

* Re: org-mode keybinding
  2012-08-18  7:55 org-mode keybinding drain
@ 2012-08-18 16:08 ` Bastien
  2012-08-19 10:41   ` drain
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2012-08-18 16:08 UTC (permalink / raw)
  To: drain; +Cc: Help-gnu-emacs

drain <aeuster@gmail.com> writes:

> Tried to remap org-beginning-of-line to C-q, neither of these two methods
> worked:
>
> (1)
>
> (add-hook 'org-mode-hook 
>           (lambda ()
>             (local-set-key "\C-q" 'org-beginning-of-line)))
>
> (2) 
>
> (add-hook 'org-mode-hook
>           '(lambda ()
>              (define-key org-mode-map "\C-q" 'org-beginning-of-line)))

Use `org-defkey' and the org-mode map:

(org-defkey org-mode-map "\C-q" 'org-beginning-of-line)

HTH,

-- 
 Bastien



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

* Re: org-mode keybinding
  2012-08-18 16:08 ` Bastien
@ 2012-08-19 10:41   ` drain
  2012-08-19 11:18     ` Peter Dyballa
  0 siblings, 1 reply; 8+ messages in thread
From: drain @ 2012-08-19 10:41 UTC (permalink / raw)
  To: Help-gnu-emacs

(define-key org-mode-map "\C-q" 'org-beginning-of-line)

produces the init error / warning:

"Symbol's value as variable is void: org-mode-map."

Just to be clear, I'm using Emacs 23.3.1, and copy / pasted the above
directly into my .emacs.

(I also tried Bastien's first suggestion (which I improperly responded to
only to him), but that produced:

"Symbol's function definition is void: org-defkey")





--
View this message in context: http://emacs.1067599.n5.nabble.com/org-mode-keybinding-tp261738p261809.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



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

* Re: org-mode keybinding
  2012-08-19 10:41   ` drain
@ 2012-08-19 11:18     ` Peter Dyballa
  2012-08-19 11:48       ` drain
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Dyballa @ 2012-08-19 11:18 UTC (permalink / raw)
  To: drain; +Cc: Help-gnu-emacs


Am 19.08.2012 um 12:41 schrieb drain:

> "Symbol's value as variable is void: org-mode-map."

You need to load or require org-mode first. Otherwise org-mode-map does not exist in the context of your init file.

--
Greetings

  Pete

Spam will be a thing of the past in two years' time.
				– Bill Gates, Jan 2004




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

* Re: org-mode keybinding
  2012-08-19 11:18     ` Peter Dyballa
@ 2012-08-19 11:48       ` drain
  2012-08-22 16:21         ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: drain @ 2012-08-19 11:48 UTC (permalink / raw)
  To: Help-gnu-emacs


Peter Dyballa wrote
> 
> 
> You need to load or require org-mode first. Otherwise org-mode-map does
> not exist in the context of your init file.
> 
> 

Now the code loads without error, just like the first two variations I
listed, but the remapped command is still functioning like
beginning-of-line, rather than org-beginning-of-line.

Perhaps to be clearer, if this is my heading, and point starts at P, right
after the last dot of the ellipsis:

*Movies...P

and I press C-q, point moves on top of the first dot of the ellipsis. I
Press C-q again, point moves on top of the asterisk.

C-a, however, which is mapped to org-beginning-of-line in org.el, moves
point from the last ellipsis dot to the asterisk immediately.



--
View this message in context: http://emacs.1067599.n5.nabble.com/org-mode-keybinding-tp261738p261815.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



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

* Re: org-mode keybinding
       [not found] <mailman.7187.1345276544.855.help-gnu-emacs@gnu.org>
@ 2012-08-22 14:56 ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2012-08-22 14:56 UTC (permalink / raw)
  To: help-gnu-emacs

>           '(lambda ()

Don't quote lambdas.


        Stefan "who doesn't know why your code didn't work"


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

* Re: org-mode keybinding
  2012-08-19 11:48       ` drain
@ 2012-08-22 16:21         ` Bastien
  2012-08-23  5:46           ` drain
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2012-08-22 16:21 UTC (permalink / raw)
  To: drain; +Cc: Help-gnu-emacs

drain <aeuster@gmail.com> writes:

> Now the code loads without error, just like the first two variations I
> listed, but the remapped command is still functioning like
> beginning-of-line, rather than org-beginning-of-line.
>
> Perhaps to be clearer, if this is my heading, and point starts at P, right
> after the last dot of the ellipsis:
>
> *Movies...P
>
> and I press C-q, point moves on top of the first dot of the ellipsis. I
> Press C-q again, point moves on top of the asterisk.
>
> C-a, however, which is mapped to org-beginning-of-line in org.el, moves
> point from the last ellipsis dot to the asterisk immediately.

I cannot reproduce or understand the problem.

If you have

  (require 'org)
  (define-key org-mode-map "\C-q" 'org-beginning-of-line)

then C-q will call `org-beginning-of-line'.

Perhaps you can instrument `org-beginning-of-line' ?

C-h f org-beginning-of-line RET to find the function and
C-u C-M-x at the end of the function to "edebug" it.

Then C-q again to see what happens.

-- 
 Bastien



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

* Re: org-mode keybinding
  2012-08-22 16:21         ` Bastien
@ 2012-08-23  5:46           ` drain
  0 siblings, 0 replies; 8+ messages in thread
From: drain @ 2012-08-23  5:46 UTC (permalink / raw)
  To: Help-gnu-emacs

I had to unbind C-q from beginning-of-line in my keybindings-minor-mode. 

Not a problem, since org-beginning-of-line has all the functionality of
beginning-of-line, plus the org-mode extra strength.




--
View this message in context: http://emacs.1067599.n5.nabble.com/org-mode-keybinding-tp261738p262142.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



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

end of thread, other threads:[~2012-08-23  5:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-18  7:55 org-mode keybinding drain
2012-08-18 16:08 ` Bastien
2012-08-19 10:41   ` drain
2012-08-19 11:18     ` Peter Dyballa
2012-08-19 11:48       ` drain
2012-08-22 16:21         ` Bastien
2012-08-23  5:46           ` drain
     [not found] <mailman.7187.1345276544.855.help-gnu-emacs@gnu.org>
2012-08-22 14:56 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.