all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-mode with a custom binding on S-Up and no shift-select
@ 2009-05-19  8:38 Alain Ketterlin
  2009-05-22  3:51 ` Kevin Rodgers
  2009-05-22  9:23 ` Vagn Johansen
  0 siblings, 2 replies; 3+ messages in thread
From: Alain Ketterlin @ 2009-05-19  8:38 UTC (permalink / raw)
  To: help-gnu-emacs


Hello,

I've just started using org-mode and have a small problem with <S-up>
and <S-down>. I don't use shift-select-mode. My .emacs has:

(global-set-key (kbd "S-<down>") `(lambda ()
                                    (interactive)
                                    (scroll-up 1)))

and similar for <S-up>. (BTW, is interactive of any use here? I copied
this somewhere, my elisp skills are almost non-existent.)

Org-mode has special use for <S-up> and <S-down>. I would like to keep
my own bindings, except on timestamps. I have customized
org-support-shift-select, with the hope that org-mode would revert to
default behavior, but it does not. Instead, it seems that it tries to
emulate shift-select-mode.

Is there any way to keep my own bindings? If not, is there any way to
have org-mode's on timestamps, scroll-up by 1 otherwise?

Thanks in advance for any help.

-- Alain.


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

* Re: org-mode with a custom binding on S-Up and no shift-select
  2009-05-19  8:38 org-mode with a custom binding on S-Up and no shift-select Alain Ketterlin
@ 2009-05-22  3:51 ` Kevin Rodgers
  2009-05-22  9:23 ` Vagn Johansen
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2009-05-22  3:51 UTC (permalink / raw)
  To: help-gnu-emacs

Alain Ketterlin wrote:
> I've just started using org-mode and have a small problem with <S-up>
> and <S-down>. I don't use shift-select-mode. My .emacs has:
> 
> (global-set-key (kbd "S-<down>") `(lambda ()
>                                     (interactive)
>                                     (scroll-up 1)))
> 
> and similar for <S-up>.

That's what can happen when you define keys that are not reserved for
the user.  Sticking to Control-C LETTER combinations is safest.

> (BTW, is interactive of any use here? I copied
> this somewhere, my elisp skills are almost non-existent.)

Yes, it is mandatory: only interactive functions can be bound to keys.

> Org-mode has special use for <S-up> and <S-down>. I would like to keep
> my own bindings, except on timestamps. I have customized
> org-support-shift-select, with the hope that org-mode would revert to
> default behavior, but it does not. Instead, it seems that it tries to
> emulate shift-select-mode.
> 
> Is there any way to keep my own bindings?

Use local-set-key within an org-mode hook function.

> If not, is there any way to
> have org-mode's on timestamps, scroll-up by 1 otherwise?

That's a bit trickier.

-- 
Kevin Rodgers
Denver, Colorado, USA





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

* Re: org-mode with a custom binding on S-Up and no shift-select
  2009-05-19  8:38 org-mode with a custom binding on S-Up and no shift-select Alain Ketterlin
  2009-05-22  3:51 ` Kevin Rodgers
@ 2009-05-22  9:23 ` Vagn Johansen
  1 sibling, 0 replies; 3+ messages in thread
From: Vagn Johansen @ 2009-05-22  9:23 UTC (permalink / raw)
  To: help-gnu-emacs

Alain Ketterlin <alain@dpt-info.u-strasbg.fr> writes:

> Hello,
>
> I've just started using org-mode and have a small problem with <S-up>
> and <S-down>. I don't use shift-select-mode. My .emacs has:
>
> (global-set-key (kbd "S-<down>") `(lambda ()
>                                     (interactive)
>                                     (scroll-up 1)))

I have the same bindings .. well it is (scroll-up 2) in my case.

> and similar for <S-up>. (BTW, is interactive of any use here? I copied
> this somewhere, my elisp skills are almost non-existent.)
>
> Org-mode has special use for <S-up> and <S-down>. I would like to keep
> my own bindings, except on timestamps. 

And the same problem. If often add priorities to tasks (#A,..) when I
want to scroll down.


I just cooked up the code below. I sets up the shift up/down to
scrolling. IF in org-mode and NOT at the beginning of the line then
the org shift functions are called.


(require 'org)

(global-set-key [S-up] 'vj-scroll-down-hook)
(global-set-key [S-down] 'vj-scroll-up-hook)

(defun vj-org-shift-keys-setup ()
  (interactive)
  (local-set-key [S-up] 'vj-scroll-down)
  (local-set-key [S-down] 'vj-scroll-up))


(add-hook 'org-mode-hook  'vj-org-shift-keys-setup)

(defun vj-scroll-up (&optional arg)
  "Vj scroll-up."
  (interactive)
  (if (and (equal major-mode 'org-mode) (not (bolp)))
    ;; In org-mode and not at beginning of line
    (org-shiftup arg)
    ;; else
    (scroll-up 2)))


(defun vj-scroll-down (&optional arg)
  "Vj scroll-down."
  (interactive)
  (if (and (equal major-mode 'org-mode) (not (bolp)))
    ;; In org-mode and not at beginning of line
    (org-shiftdown arg)
    ;; else
    (scroll-down 2)))

-- 
Vagn Johansen


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

end of thread, other threads:[~2009-05-22  9:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-19  8:38 org-mode with a custom binding on S-Up and no shift-select Alain Ketterlin
2009-05-22  3:51 ` Kevin Rodgers
2009-05-22  9:23 ` Vagn Johansen

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.