all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vagn Johansen <gonz808@hotmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: org-mode with a custom binding on S-Up and no shift-select
Date: Fri, 22 May 2009 11:23:43 +0200	[thread overview]
Message-ID: <m2bppl5w4g.fsf@hotmail.com> (raw)
In-Reply-To: 87ljotcwrq.fsf@dpt-info.u-strasbg.fr

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


      parent reply	other threads:[~2009-05-22  9:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2bppl5w4g.fsf@hotmail.com \
    --to=gonz808@hotmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.