emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Alternative to arrow keys (more ergonomic)?
@ 2014-06-12 14:00 Martin Beck
  2014-06-12 14:41 ` Jorge A. Alfaro-Murillo
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Beck @ 2014-06-12 14:00 UTC (permalink / raw)
  To: emacs orgmode-mailinglist

[-- Attachment #1: Type: text/html, Size: 924 bytes --]

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

* Re: Alternative to arrow keys (more ergonomic)?
  2014-06-12 14:00 Alternative to arrow keys (more ergonomic)? Martin Beck
@ 2014-06-12 14:41 ` Jorge A. Alfaro-Murillo
  2014-06-12 14:45   ` Thorsten Jolitz
  2014-06-13  7:18   ` Martin Beck
  0 siblings, 2 replies; 8+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2014-06-12 14:41 UTC (permalink / raw)
  To: emacs-orgmode

Hi Martin,

"Martin Beck" <elwood151@web.de> writes:

> I'm using Shift+RightArrow and Shift+LeftArrow quite often to change
> the scheduled or deadline dates of a task in my agenda view. As I have
> a normal large keyboard (where the arrow keys are between the
> alphanumeric block and the numeric keypad like here:
> http://www.microsoft.com/hardware/_base_v1//products/wireless-desktop-3000/mk_
> wd3000_otherviews01.jpg ). So the arrow key is difficult to reach and
> forces me to leave the QUERTZ keys with the right hand. Can I define
> an additional key or key combination which does the same thing like
> RightArrow and is easier to reach? Which one would be available in the
> agenda view?

I have the (totally useless) CapsLock key of my keyboard remapped to
Hyper, which allows me to use an extra modifier for emacs commands.

For your case after you have a Hyper key you could "make" your own arrow
keys without your right fingers moving away from J K L ; where they
belong:

#+BEGIN_SRC emacs-lisp
  (global-set-key (kbd "H-i") 'previous-line)
  (global-set-key (kbd "H-k") 'next-line)
  (global-set-key (kbd "H-j") 'left-char)
  (global-set-key (kbd "H-l") 'right-char)
#+END_SRC

and for org:

#+BEGIN_SRC emacs-lisp
  (define-key org-mode-map (kbd "H-S-i") 'org-shiftup)
  (define-key org-mode-map (kbd "H-S-k") 'org-shiftdown)
  (define-key org-mode-map (kbd "H-S-j") 'org-shiftleft)
  (define-key org-mode-map (kbd "H-S-l") 'org-shiftright)
#+END_SRC

In Linux I use xmodmap for the remapping of the CapsLock key. While you
are at it you can also remap the Alt key to Cntrl and the Super to Meta,
to that you press C- commands with your left thumb and not with your
left pinky, avoiding the common emacs pinky problem.

Best,

Jorge.

PS: http://i.stack.imgur.com/2kbJv.jpg
http://www.splitreason.com/Product_Images/4e3477bef139.jpg 

PPS: to be fair some very fast typists use CapsLock
(http://seanwrona.com/typing.php)

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

* Re: Alternative to arrow keys (more ergonomic)?
  2014-06-12 14:41 ` Jorge A. Alfaro-Murillo
@ 2014-06-12 14:45   ` Thorsten Jolitz
  2014-06-12 15:19     ` Jorge A. Alfaro-Murillo
  2014-06-13  7:18   ` Martin Beck
  1 sibling, 1 reply; 8+ messages in thread
From: Thorsten Jolitz @ 2014-06-12 14:45 UTC (permalink / raw)
  To: emacs-orgmode

jorge.a.alfaro@gmail.com (Jorge A. Alfaro-Murillo) writes:

Hi,

> I have the (totally useless) CapsLock key of my keyboard remapped to
> Hyper, which allows me to use an extra modifier for emacs commands.
>
> For your case after you have a Hyper key you could "make" your own arrow
> keys without your right fingers moving away from J K L ; where they
> belong:
>
> #+BEGIN_SRC emacs-lisp
>   (global-set-key (kbd "H-i") 'previous-line)
>   (global-set-key (kbd "H-k") 'next-line)
>   (global-set-key (kbd "H-j") 'left-char)
>   (global-set-key (kbd "H-l") 'right-char)
> #+END_SRC
>
> and for org:
>
> #+BEGIN_SRC emacs-lisp
>   (define-key org-mode-map (kbd "H-S-i") 'org-shiftup)
>   (define-key org-mode-map (kbd "H-S-k") 'org-shiftdown)
>   (define-key org-mode-map (kbd "H-S-j") 'org-shiftleft)
>   (define-key org-mode-map (kbd "H-S-l") 'org-shiftright)
> #+END_SRC
>
> In Linux I use xmodmap for the remapping of the CapsLock key. While you
> are at it you can also remap the Alt key to Cntrl and the Super to Meta,
> to that you press C- commands with your left thumb and not with your
> left pinky, avoiding the common emacs pinky problem.

Just out of curiosity - did you try this on the console (without X) too? 

-- 
cheers,
Thorsten

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

* Re: Alternative to arrow keys (more ergonomic)?
  2014-06-12 14:45   ` Thorsten Jolitz
@ 2014-06-12 15:19     ` Jorge A. Alfaro-Murillo
  2014-06-12 17:24       ` Thorsten Jolitz
  0 siblings, 1 reply; 8+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2014-06-12 15:19 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Just out of curiosity - did you try this on the console (without X) too? 

Xmodmap does not work without X, at least I suppose that is what the X
stands for =)

If someone knows how to remap outside of X please let me know.

Since I use emacs not in X in my phone, my workaround is to create a
hyper key in another place (F6 is a good place for the keyboard of
JuiceSSH in Android). It is not really a modifier, so to press 'H-j',
you actually do 'F6 j', that is 'F6' followed by 'j', but I guess that
is as good as you can get with a keyboard onscreen without installing a
super tiny keyboard (e.g. Hacker's Keyboard).

#+BEGIN_SRC emacs-lisp
  (defun hyperify (prompt)
    (let ((e (read-event)))
      (vector (if (numberp e)
                  (logior (lsh 1 24) e)
                (if (memq 'hyper (event-modifiers e))
                    e
                  (add-event-modifier "H-" e))))))

  (defun add-event-modifier (string e)
    (let ((symbol (if (symbolp e) e (car e))))
      (setq symbol (intern (concat string
                                   (symbol-name symbol))))
      (if (symbolp e)
          symbol
        (cons symbol (cdr e)))))

  (define-key key-translation-map (kbd "<f6>") 'hyperify)
#+END_SRC

Best,

Jorge.

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

* Re: Alternative to arrow keys (more ergonomic)?
  2014-06-12 15:19     ` Jorge A. Alfaro-Murillo
@ 2014-06-12 17:24       ` Thorsten Jolitz
  0 siblings, 0 replies; 8+ messages in thread
From: Thorsten Jolitz @ 2014-06-12 17:24 UTC (permalink / raw)
  To: emacs-orgmode

jorge.a.alfaro@gmail.com (Jorge A. Alfaro-Murillo) writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Just out of curiosity - did you try this on the console (without X) too? 
>
> Xmodmap does not work without X, at least I suppose that is what the X
> stands for =)

I know, thats why I asked.

> If someone knows how to remap outside of X please let me know.

In Archlinux, I copied console keymap

,---------------------
| de-latin1-nodeadkeys
`---------------------

adapted it to my emacs needs, saved it and put

,----------------------------------
| KEYMAP=de-latin1-nodeadkeys-emacs
`----------------------------------

in my /etc/vconsole.conf. 

It looks somehow like this:

,--------------------------------------------------------------------------------------
| # de-latin1-nodeadkeys-emacs.map: German keymap with special keybindings for Emacs
| 
| include "de-latin1.map"
| 
| # control keycode   7 = Control_asciicircum
| keycode  13 = apostrophe       grave
| keycode  27 = plus             asterisk         asciitilde
| # keycode  41 = asciicircum      degree
| 
| # corresponding keys in de-latin1.map:
| # keycode  13 = dead_acute       dead_grave
| # keycode  27 = plus             asterisk         dead_tilde
| # keycode  41 = dead_circumflex  degree
| 
| # unterste Zeile:
| keycode  29 = AltGr             AltGr           AltGr           AltGr
| [...]
| etc etc
`--------------------------------------------------------------------------------------

Would be interesting if (and how) it works to actually define and use a
hyper-key on the console, because even the standard modifiers like C-,
M- and don't always work, especially when combined (see 'org on a
tty' in the manual) or in combination with S-. 

> Since I use emacs not in X in my phone, my workaround is to create a
> hyper key in another place (F6 is a good place for the keyboard of
> JuiceSSH in Android). It is not really a modifier, so to press 'H-j',
> you actually do 'F6 j', that is 'F6' followed by 'j', but I guess that
> is as good as you can get with a keyboard onscreen without installing a
> super tiny keyboard (e.g. Hacker's Keyboard).
>
> #+BEGIN_SRC emacs-lisp
>   (defun hyperify (prompt)
>     (let ((e (read-event)))
>       (vector (if (numberp e)
>                   (logior (lsh 1 24) e)
>                 (if (memq 'hyper (event-modifiers e))
>                     e
>                   (add-event-modifier "H-" e))))))
>
>   (defun add-event-modifier (string e)
>     (let ((symbol (if (symbolp e) e (car e))))
>       (setq symbol (intern (concat string
>                                    (symbol-name symbol))))
>       (if (symbolp e)
>           symbol
>         (cons symbol (cdr e)))))
>
>   (define-key key-translation-map (kbd "<f6>") 'hyperify)
> #+END_SRC

sounds interesting ...

-- 
cheers,
Thorsten

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

* Re: Alternative to arrow keys (more ergonomic)?
  2014-06-12 14:41 ` Jorge A. Alfaro-Murillo
  2014-06-12 14:45   ` Thorsten Jolitz
@ 2014-06-13  7:18   ` Martin Beck
  2014-06-13  7:33     ` Martin Beck
  1 sibling, 1 reply; 8+ messages in thread
From: Martin Beck @ 2014-06-13  7:18 UTC (permalink / raw)
  To: emacs-orgmode

Jorge A. Alfaro-Murillo <jorge.a.alfaro <at> gmail.com> writes:
> I have the (totally useless) CapsLock key of my keyboard remapped to
> Hyper, which allows me to use an extra modifier for emacs commands.
> 

Hi Jorge,

thanks a lot for your suggestion - for me, that CapsLock key is useless too,
so it's a good idea to use it for that.

Sorry, if it may be obvious, but how do I remap CapsLock to H (Hyper)?

Kind regards

Martin

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

* Re: Alternative to arrow keys (more ergonomic)?
  2014-06-13  7:18   ` Martin Beck
@ 2014-06-13  7:33     ` Martin Beck
  2014-06-13 14:24       ` Jorge A. Alfaro-Murillo
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Beck @ 2014-06-13  7:33 UTC (permalink / raw)
  To: emacs-orgmode

Martin Beck <elwood151 <at> web.de> writes:

> Sorry, if it may be obvious, but how do I remap CapsLock to H (Hyper)?
> 
> Kind regards
> 
> Martin
> 
> 


p.s. I tried 
;; remap CapsLock Key to Hyper Key
;;source: http://ergoemacs.org/emacs/emacs_hyper_super_keys.html ,
http://emacs-fu.blogspot.de/2008/12/remapping-caps-lock.html
(setq w32-enable-caps-lock nil)
(global-set-key [capslock] 'hyper)

but when trying to use your keys, it returns an error, that function hyper
is void.
How can I define/enable it?

Martin

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

* Re: Alternative to arrow keys (more ergonomic)?
  2014-06-13  7:33     ` Martin Beck
@ 2014-06-13 14:24       ` Jorge A. Alfaro-Murillo
  0 siblings, 0 replies; 8+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2014-06-13 14:24 UTC (permalink / raw)
  To: emacs-orgmode

Martin Beck <elwood151@web.de> writes:

>> Sorry, if it may be obvious, but how do I remap CapsLock to H
>> (Hyper)?
>> 
>
> p.s. I tried ;; remap CapsLock Key to Hyper Key ;;source:
> http://ergoemacs.org/emacs/emacs_hyper_super_keys.html ,
> http://emacs-fu.blogspot.de/2008/12/remapping-caps-lock.html (setq
> w32-enable-caps-lock nil) (global-set-key [capslock] 'hyper)

Dear Martin,

I think you should try to do that outside of emacs, in the configuration
of your system. I use Linux so I only have an answer for that.

I think the easiest way is to create a configuration file for xmodmap,
the common location and name is "~/.Xmodmap". My file looks like this:

#+BEGIN_EXAMPLE
clear control
clear lock
clear mod1
clear mod3
clear mod4

keycode 66 = Hyper_L
keycode 37 = Super_L
keycode 133 = Alt_L Meta_L
keycode 64 = Control_L
keycode 108 = Control_R
keycode 135 = Alt_R Meta_R
keycode 105 = Menu

add mod1 = Alt_R Alt_L Meta_R Meta_L
add mod3 = Hyper_L
add mod4    = Super_L
add control = Control_R Control_L
#+END_EXAMPLE

In this case I have Hyper where the CapsLock key is, and the final row
which in the keyboard is:

"Control Super Alt Space Alt MenuKey Control"

gets mapped to:

"Super Alt/Meta Control Space Control Alt/Meta MenuKey"

(which drives anyone that tries my computer nuts, but it is very
comfortable for emacs.)

The keycodes with numbers in the example are the positions of the keys
in my keyboard. This is different depending on your keyboard, so you
have to figure out yours. For that, use the program xev (in a terminal
type xev) and press the keys that you are interested to map. Between
many information it will give you the keycode for each key you press.

Once you finish with the .Xmodmap file, you can load the configuration
by typing in a terminal 'xmodmap .Xmodmap' (without the single quotes).

If you are using GDM, XDM or KDM, in particular under Gnome or KDE, the
.Xmodmap file is loaded automatically every time you start a session. If
you are not using any of those, you can modify the file ~/.xinitrc (or
~/.config/openbox/autostart in Openbox):

#+BEGIN_EXAMPLE
if [ -s ~/.Xmodmap ]; then
    xmodmap ~/.Xmodmap
fi
#+END_EXAMPLE

I hope it helps.

Best,

Jorge

PS: For linux check also XKB.

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

end of thread, other threads:[~2014-06-13 14:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-12 14:00 Alternative to arrow keys (more ergonomic)? Martin Beck
2014-06-12 14:41 ` Jorge A. Alfaro-Murillo
2014-06-12 14:45   ` Thorsten Jolitz
2014-06-12 15:19     ` Jorge A. Alfaro-Murillo
2014-06-12 17:24       ` Thorsten Jolitz
2014-06-13  7:18   ` Martin Beck
2014-06-13  7:33     ` Martin Beck
2014-06-13 14:24       ` Jorge A. Alfaro-Murillo

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