emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: "Daniel E. Doherty" <ded-law@ddoherty.net>,
	"emacs-orgmode@gnu org" <emacs-orgmode@gnu.org>
Subject: Re: Shift-Arrow Pass Through for windmove?
Date: Sat, 24 Apr 2010 11:05:50 +0200	[thread overview]
Message-ID: <87y6gdkyoh.fsf@gmx.de> (raw)
In-Reply-To: <B62FD19A-D3F9-41AA-9EA6-9EF1F1E462D4@gmail.com> (Carsten Dominik's message of "Sat, 24 Apr 2010 02:11:26 +0200")

Carsten Dominik <carsten.dominik@gmail.com> writes:
> On Apr 24, 2010, at 1:19 AM, Sebastian Rose wrote:
>
>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>> On Apr 23, 2010, at 6:12 PM, Sebastian Rose wrote:
>>>
>>>> Daniel E. Doherty <ded-law@ddoherty.net> writes:
>>>>> All,
>>>>>
>>>>> I make *very* frequent use of the shift-arrow keys to move from window
>>>>> to window inside emacs via windmove.  It is probably the most frequent
>>>>> key combination I access.
>>>>>
>>>>> Anyway, is there a way to make org-mode friendlier to it by passing the
>>>>> key along whenever org-mode would otherwise throw an error.  For
>>>>> example, when not on a heading, when in the agenda, and wherever else?
>>>>>
>>>>> I really like Carsten's use of the arrow keys for structure editing and
>>>>> don't want to lose that, just whenever org-mode can't make use of the
>>>>> keys.
>>>>>
>>>>> Regards,
>>>>
>>>>
>>>>
>>>> And here all the arrow keys.
>>>>
>>>> It's somewhat inelegant, since you always need to keep track of new
>>>> useful org-bindings.
>>>>
>>>> I would find an org-internal solution helpfull too. I use windmove.
>>>
>>> I have now added
>>>
>>> (defvar org-shiftup-hook nil
>>>  "Hook for functions attaching themselves to `S-up'.
>>> See `org-ctrl-c-ctrl-c-hook' for more information.")
>>> (defvar org-shiftdown-hook nil
>>>  "Hook for functions attaching themselves to `S-down'.
>>> See `org-ctrl-c-ctrl-c-hook' for more information.")
>>> (defvar org-shiftleft-hook nil
>>>  "Hook for functions attaching themselves to `S-left'.
>>> See `org-ctrl-c-ctrl-c-hook' for more information.")
>>> (defvar org-shiftright-hook nil
>>>  "Hook for functions attaching themselves to `S-right'.
>>> See `org-ctrl-c-ctrl-c-hook' for more information.")
>>>
>>> But I do not intend to attach specific functionality like windmove to them,
>>> and I'd like to reserve the possibility to make S-cursor do something
>>> in Org in more contexts.
>>>
>>> Hope this still helps.
>>
>> This could be perfect!!!
>>
>> But wouldn't the hook need to be called at the end of (e.g.)
>> `org-shiftright'?
>>
>> I want to use windmove as the last resort, as does the OP:
>>
>>
>> -   (t (org-shiftselect-error))))
>> +   (t (if org-shiftright-hook
>> +       ((run-hook-with-args-until-success 'org-shiftright-hook))
>> +       (org-shiftselect-error))))
>>
>> ;; end of org-shiftright ($otpional arg)
>>
>>
>>
>> Otherwise we would loose the org-mode specific functions.
>>
>> We want to
>>
>>  1. try to do somehing org-specific (if org-headline-p ....)
>>  2. else run the hook (i.e. windmove in this case)
>>  3. error    only if 1. and 2. failed
>>
>>
>> We do use windmove but at the same time we do _not_ want to loose all
>> those shift-right... features to come ;)
>
> Well, the idea is hat these hooks *can* overrule what org-mode wants to do,
> so whatever you put into the hook needs to decide if it wants to apply.
>
> We could add *another* hook at the end...


OK - I would love to use that one then. I could stick with my functions
otherwise.

Overruling is easily done, but to use windmove as a last resort could
not even be done using `ad-add-advice' because of the

  (t (org-shiftselect-error))



Sebastian

  reply	other threads:[~2010-04-24  9:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 20:30 Shift-Arrow Pass Through for windmove? Daniel E. Doherty
2010-04-23 16:01 ` Sebastian Rose
2010-04-23 16:12 ` Sebastian Rose
2010-04-23 18:54   ` Carsten Dominik
2010-04-23 23:19     ` Sebastian Rose
2010-04-24  0:11       ` Carsten Dominik
2010-04-24  9:05         ` Sebastian Rose [this message]
2010-04-25  7:08           ` Carsten Dominik
2010-04-25  9:34             ` Sebastian Rose
2010-04-25 20:41               ` Daniel E. Doherty
2010-04-26  8:56                 ` Sebastian Rose
2010-04-26  9:07                   ` Carsten Dominik
2010-04-24 22:03         ` Daniel E. Doherty

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87y6gdkyoh.fsf@gmx.de \
    --to=sebastian_rose@gmx.de \
    --cc=carsten.dominik@gmail.com \
    --cc=ded-law@ddoherty.net \
    --cc=emacs-orgmode@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 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).