This is Interesting: Free IT Magazines  
Home > Archive > Emacs > December 2006 > Emacs's Command Frequency and default keyboard shortcuts





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Emacs's Command Frequency and default keyboard shortcuts
Xah Lee

2006-10-03, 7:14 pm

Here's a visual layout of the default keybinds in emacs:
http://xahlee.org/emacs/emacs_kb_shortcuts.html

A important aspect in designing default keyboard shortcuts is have kb
shortcuts for the most frequently used commands, and, the top most
frequently used commands should have most easily-pressed keystrokes.
For example, they should be on the home row.

Use this program to compute the command frequency of your emacs use.
http://xahlee.org/emacs/command-frequency.el

Once you have accumulated 20k runs of self-insert-command, please send
me the results.
I hope to comile some stats. I will do a report here when i get
results.

Thanks.=20

Xah
xah@xahlee.org
=E2=88=91 http://xahlee.org/

Xah Lee

2006-10-11, 1:14 pm

here's my results.

; start 2006-10-05T21:31:39-07:00
; end 2006-10-11T06:52:03-07:00
; http://xahlee.org/emacs/command-frequency.el

28723 self-insert-command
9578 next-line
7431 previous-line
4402 backward-word
3428 forward-word
2544 kill-region
2394 isearch-printing-char
1820 forward-char
1669 delete-backward-char
1426 backward-char
1169 save-buffer
905 newline
751 yank
701 backward-delete-char-untabify
682 kill-buffer-silently
580 scroll-up
496 mwheel-scroll
439 isearch-forward
387 other-window
379 undo
372 previous-history-element
372 dired-next-line
362 delete-char
320 scroll-down
285 minibuffer-complete
277 isearch-other-meta-char
276 execute-extended-command
264 dired
262 set-mark-command
260 isearch-other-control-char
236 move-beginning-of-line
232 dired-advertised-find-file
194 find-file
177 beginning-of-buffer
162 revert-buffer
160 move-end-of-line
147 recenter
138 dired-previous-line
135 isearch-repeat-forward
134 kill-ring-save
131 extend-selection
126 delete-other-windows
119 end-of-buffer
113 eval-last-sexp
111 isearch-backward
109 minibuffer-keyboard-quit
108 split-window-vertically
104 ibuffer-mark-for-delete
104 mouse-drag-region
102 fill-paragraph
94 ignore
88 shell-command
88 exit-minibuffer
83 isearch-repeat-backward
83 mouse-set-point
81 keyboard-quit
76 nil
71 lisp-indent-line
71 describe-function
68 just-one-space
65 grep
62 browse-url-of-buffer
56 wrap-url
56 delete-window
54 mark-whole-buffer
53 python-backspace
53 center-line
51 x-w
51 handle-switch-frame
50 sgml-close-tag
48 describe-key
47 dired-do-query-replace-regexp
37 shell-command-on-region
37 Info-follow-nearest-node
33 kill-buffer-silently
33 html-paragraph
32 query-replace
28 ,bbedit
28 next-buffer
27 x-note
26 dired-mark-files-regexp
26 bookmark-bmenu-list
25 Info-up
23 ibuffer-forward-line
23 bookmark-bmenu-this-window
23 switch-to-buffer
22 query-replace-regexp
22 remove-hard-wrap
21 x-b
20 previous-buffer
19 ibuffer-backward-line
19 minibuffer-complete-and-exit
18 ibuffer
18 string-rectangle
18 tt
17 cperl-electric-backspace
17 ispell-word
16 isearch-abort
16 other-frame
16 sgml-slash
15 compile-goto-error
15 insert-p
14 word-entry
14 beginning-of-defun
14 universal-argument-other-key
14 universal-argument
14 next-history-element
13 ffap
12 ibuffer-mark-forward
12 dired-do-rename
11 set-variable
11 backward-up-list
11 apropos-command
10 ff
10 ibuffer-visit-buffer
10 ibuffer-update
10 date
10 dt
10 dired-do-copy
9 insert-register
9 tag-image2
9 sgml-maybe-name-self
9 command-frequency-display
8 ibuffer-do-save
8 ibuffer-mark-unsaved-buffers
8 forward-sexp
8 html-list-item
7 kill-line-backward
7 ibuffer-do-kill-on-deletion-marks
7 html-headline-2
7 grep-find
7 minibuffer-complete-word
7 set-input-method
7 downcase-word
6 upcase-initials-region
6 Info-menu
6 line-spacing-toggle
6 newline-and-indent
6 describe-variable
6 dired-do-flagged-delete
6 dired-flag-file-deletion
6 replace-string
6 back-to-indentation
6 quoted-insert
5 htmlize-buffer
5 toggle-input-method
5 (lambda nil (interactive) (let ((orig-function (symbol-function
(quote message)))) (unwind-protect (progn (defun message (string &rest
arguments) (let* ((s1 (concat prompt (buffer-substring
(shell-command/minibuffer-prompt-end) (point-max)))) (s2 (apply
(function format) string arguments)) (w (- (window-width) (string-width
s1) (string-width s2) 1))) (funcall orig-function (if (>=3D w 0) (concat
s1 (make-string w 32) s2) s2)) (if (sit-for 0.3) (funcall orig-function
s1)) s2)) (require (quote shell)) (require (quote comint))
(run-hook-with-args-until-success (quote
shell-command-complete-functions))) (fset (quote message)
orig-function))))
5 upcase-word
5 lisp-complete-symbol
5 mouse-set-font
5 View-quit
5 mode-exited
4 name-last-kbd-macro
4 exchange-point-and-mark
4 dired-unmark-all-marks
4 wikipfy-block
4 replace-quotes
4 #[nil =EC=80=80=E2=83=BF=EF=B7=82!=C2=87 [split-window-vertically find-fi=
le
~/web/emacs/unicode.txt] 2 nil nil]
4 dired-create-directory
4 atom-entry
4 Info-mouse-follow-nearest-node
4 info
3 kill-rectangle
3 indent-for-tab-command
3 sgml-delete-tag
3 what-cursor-position
3 isearch-delete-char
3 #[nil =EC=80=80=E6=8C=80=E8=9C=80=E2=80=80=E5=
AF=B2] 1 inserts a unicode =
char. nil]
3 man
3 html-headline-3
3 dired-up-directory
3 dired-mark
3 push-button
3 mark-sexp
3 Info-history-back
3 make-frame-command
2 insert-kbd-macro
2 replace-html-chars
2 digit-argument
2 scroll-bar-toolkit-scroll
2 undefined
2 mac-dnd-handle-drag-n-drop-event
2 date-tag
2 yank-pop
2 complete-symbol
2 mouse-save-then-kill
2 replace-list
2 copy-to-register
2 mouse-select-window
2 mouse-drag-mode-line
2 dired-flag-backup-files
2 isearch-toggle-case-fold
2 move-to-window-line
2 wrap-url-simple
1 kmacro-end-macro
1 kmacro-start-macro
1 isearch-edit-string
1 open-unicode-template
1 eval-region
1 insert-upright-arrow
1 tmm-menubar
1 Info-exit
1 mouse-set-region
1 kill-buffer
1 view-emacs-news
1 indent-new-comment-line
1 list-colors-display
1 html-headline-1
1 dired-show-file-type
1 dired-sort-toggle-or-edit
1 html-mode
1 html-helper-mode
1 text-mode
1 goto-line
1 kill-line
1 count-lines-page
1 view-lossage
1 comment-dwim
1 set-goal-column
1 (lambda (event) (interactive e) (setq tabbar-last-selected-tab (quote
(aladdin5.html . HTML))) (when tabbar-select-tab-function
(select-window (posn-window (event-start event))) (funcall
tabbar-select-tab-function event (quote (aladdin5.html . HTML)))
(force-mode-line-update) (sit-for 0)))
1 tabbar-mode
1 isearch-yank-line
1 html-href-anchor
1 sgml-attributes
1 describe-mode
1 backward-sexp
1 describe-prefix-bindings
1 quit-window
1 pendo-entry
1 isearch-ring-advance
1 eval-buffer


Please send me yours. Thanks.


Xah Lee wrote:
> Here's a visual layout of the default keybinds in emacs:
> http://xahlee.org/emacs/emacs_kb_shortcuts.html
>
> A important aspect in designing default keyboard shortcuts is have kb
> shortcuts for the most frequently used commands, and, the top most
> frequently used commands should have most easily-pressed keystrokes.
> For example, they should be on the home row.
>
> Use this program to compute the command frequency of your emacs use.
> http://xahlee.org/emacs/command-frequency.el
>
> Once you have accumulated 20k runs of self-insert-command, please send
> me the results.
> I hope to comile some stats. I will do a report here when i get
> results.
>=20
> Thanks.=20
>=20
> Xah
> xah@xahlee.org
> =E2=88=91 http://xahlee.org/


Xah Lee

2006-10-13, 1:12 pm

Here are some convenient keyboard shortcuts i use, as a example of what
type of keyboard shortcuts one can add to enhance productivity.

; keyboard alias for arrow keys
; with meta down,
; keys under the right hand home position become cusor keys
; i.e. Dvorak QWERTY
; c i
; htn jkl
(global-set-key (kbd "M-h") 'backward-char) ; was mark-paragraph
(global-set-key (kbd "M-n") 'forward-char)
(global-set-key (kbd "M-c") 'previous-line) ; was capitalize-word
(global-set-key (kbd "M-t") 'next-line) ; was transpose-words

; map the window manipulation keys to meta 0, 1, 2, o
(global-set-key (kbd "M-2") 'split-window-vertically)
(global-set-key (kbd "M-1") 'delete-other-windows)
(global-set-key (kbd "M-0") 'delete-window)
(global-set-key (kbd "M-o") 'other-window)

; easy key for undo
(global-set-key (kbd "M-e") 'undo) (global-unset-key "\C-_"); was
forward-sentence

; easy key for marking
(global-set-key (kbd "M-SPC") 'set-mark-command) ; was just-one-space

(global-set-key (kbd "M-a") 'mark-whole-buffer) ; was
backward-sentence.
(global-set-key (kbd "M-s") 'save-buffer) ; M-s was center-line. cmd-s
is OS X convention.
(defalias 'center-line 'save-buffer)

(global-set-key (kbd "<home>") 'beginning-of-buffer) ; OS X convention
(global-set-key (kbd "<end>") 'end-of-buffer) ; OS X convention

; change C-x to C-t, so that C-x on Microsoft's split keyboard
; with Dvorak layout can be easier to type.
(keyboard-translate ?\C-t ?\C-x)

In general, you want to make the most frequently used commands to be
the most easy to type. For example, M-e is much easier for the hand
than the default keystrokes for undo C-_ or C-/. Undo is a very
frequently used command, but C-_ involves holding down control and
shift keys and pressing another key with the most awkward finger the
pinky. The C-/ isn't much better since the slash is pressed by the
pinky and is located in a most far away position that one has to grope
for.

Similarly, the command set-mark-command which is used to mark a region,
is frequently used. However, its default shortcut C-SPC is less
convenient than M-SPC. Moving from the control key to the meta key
reduces the emacs pinky problem. (see How To Avoid The Emacs Pinky
Problem)

http://xahlee.org/emacs/keyboard_shortcuts.html

Xah
xah@xahlee.org
=E2=88=91 http://xahlee.org/

Dan Espen

2006-10-13, 1:12 pm

"Xah Lee" <xah@xahlee.org> writes:

> Here are some convenient keyboard shortcuts i use, as a example of what
> type of keyboard shortcuts one can add to enhance productivity.
>
> ; map the window manipulation keys to meta 0, 1, 2, o
> (global-set-key (kbd "M-2") 'split-window-vertically)
> (global-set-key (kbd "M-1") 'delete-other-windows)
> (global-set-key (kbd "M-0") 'delete-window)
> (global-set-key (kbd "M-o") 'other-window)


Your focus seems to be efficiency.

XEmacs has so many functions available,
I like to focus on being able to remember the keystrokes
to the things I use rarely.

I generally use as much of the XEmacs window as possible,
I have the window manager leave off the title bar and run without
toolbar, scrollbar and menubar. This lets be turn them on and off,
only one key, with a bunch of modifiers is required:

(defun my-toggle-toolbar ()
"Toggle the toolbar"
(interactive)
(if (fboundp 'menubar-toggle-toolbar-visibility) ; 19.13 way
(menubar-toggle-toolbar-visibility)
(set-specifier default-toolbar-visible-p
(not (specifier-instance
default-toolbar-visible-p)))))

;; Note, control, shift, and alt work singly and in any combination:
(define-key global-map [(control f10)] 'my-toggle-scrollbar)
(define-key global-map [(shift f10)] 'my-toggle-menubar)
(define-key global-map [(alt f10)] 'my-toggle-toolbar)

(define-key global-map [(control shift f10)] '(lambda () (interactive)
(my-toggle-scrollbar)
(my-toggle-menubar)))
(define-key global-map [(alt control f10)] '(lambda () (interactive)
(my-toggle-toolbar)
(my-toggle-scrollbar)))
(define-key global-map [(alt shift f10)] '(lambda () (interactive)
(my-toggle-toolbar)
(my-toggle-menubar)))
(define-key global-map [(alt control shift f10)] '(lambda () (interactive)
(my-toggle-scrollbar)
(my-toggle-toolbar)
(my-toggle-menubar)))

Most of the time I split windows horizontally, but for those rare cases
where I need to get things side by side:

(define-key global-map [(f12)] 'split-window-vertically)
(define-key global-map [(shift f12)] 'split-window-horizontally)
Thorsten Bonow

2006-10-13, 1:12 pm

>>>>> "Xah" == Xah Lee <xah@xahlee.org> writes:

Xah> In general, you want to make the most frequently used commands to be
Xah> the most easy to type.

Huh, me? No. Why do you think so? :-)

"In general", this is simply not true for Emacs and I don't think that it should
be a primary goal.

1. It's difficult if not impossible to define the most frequently used commands
in an unambiguous way. command-frequency.el is nice, but won't really help you
here: Emacs has modes for different types of files with different sets of
shortcuts. If---in my case---the AucTeX keys appear high on the list this
month, this only means that I have written a lot of text instead of doing
some programming. I wouldn't think of changing anything which would drive me
crazy when going back to programming. And what about normal "mixed months"?

2. Of course, you don't try to hide important shortcuts if you can help it, but
the developers of Emacs decided to aim for a system of shortcuts with some
logic behind it. This comes at a price: Some keys are difficult to type or
don't make sense for a non-US keyboard layout etc. But after years of using
Emacs I'm still impressed how easy it is to get into a mode I haven't used
for years. I am surprised that you don't mention this system. Compromising it
just for a few dozen shortcuts is shortsighted in my opinion.

3. The only supplementation I could think of is an "orthogonal" system of
keyboard shortcuts which don't interfere with the Emacs system, e.g. viper
mode, the vi(m) emulation.

To put it in a nutshell, I don't think your way of changing shortcuts plays well
with Emacs established philosophy, put to a test for decades now. Emacs let's
you do it, if it suits you. But that should be all...

Toto

--
Contact information and PGP key at
http://www-users.rwth-aachen.de/thorsten.bonow

On rainy, dark autumn Saturday afternoons---when the late Douglas
Adams used to enter The Long Dark Tea Time Of The Soul---I
habitually google for postings of one Jonathan Fine...

Miles Bader

2006-10-13, 7:15 pm

Xah's definition of "easy to type" also seems quite bizarre -- almost
all of the suggested rebindings he gives are _harder_ to type for me.

His suggestions also greatly overuse the meta-key for non-frequent
commands; clearly this is in imitation of typical MS bindings, but it's
really wasteful to use a valuable modifier key for commands that are
only typed occasionally and never "repeatedly".

Given the obvious compatibility problems of making any large scale
changes in common bindings (it's _never_ going to happen by default),
not to mention the generally poor quality of the suggested changes, I'd
say it's a complete non-starter. But then he's been flogging this crap
for _ages_ on this newsgroup, so I guess he's used to hearing this.

[However, it is kind of interesting to see concrete data about command
frequencies.]

-Miles

--
A zen-buddhist walked into a pizza shop and
said, "Make me one with everything."
Dan Espen

2006-10-13, 7:15 pm

Miles Bader <miles@gnu.org> writes:

> Xah's definition of "easy to type" also seems quite bizarre -- almost
> all of the suggested rebindings he gives are _harder_ to type for me.


I guess you missed the part about the Dvorak keyboard.

> His suggestions also greatly overuse the meta-key for non-frequent
> commands; clearly this is in imitation of typical MS bindings, but it's
> really wasteful to use a valuable modifier key for commands that are
> only typed occasionally and never "repeatedly".
>
> Given the obvious compatibility problems of making any large scale
> changes in common bindings (it's _never_ going to happen by default),
> not to mention the generally poor quality of the suggested changes, I'd
> say it's a complete non-starter. But then he's been flogging this crap
> for _ages_ on this newsgroup, so I guess he's used to hearing this.


So far, no potty mouth.
Hope he's turning over a new leaf.

> [However, it is kind of interesting to see concrete data about command
> frequencies.]


I never got around to using his functions, maybe I will, but I mostly
use GNUS with my home copy of XEmacs, so I don't think the results
will be that interesting.
Xah Lee

2006-10-15, 7:13 pm

Of interest!

(global-set-key (kbd "M-<left>") 'previous-user-buffer)
(global-set-key (kbd "M-<right>") 'next-user-buffer)
(global-set-key (kbd "M-S-<left>") 'previous-emacs-buffer)
(global-set-key (kbd "M-S-<right>") 'next-emacs-buffer)

(defun next-user-buffer ()
"Switch to the next user buffer in cyclic order.\n
User buffers are those not starting with *."
(interactive)
(next-buffer)
(let ((i 0))
(while (and (string-match "^*" (buffer-name)) (< i 10))
(setq i (1+ i)) (next-buffer) )))

(defun previous-user-buffer ()
"Switch to the next user buffer in cyclic order.\n
User buffers are those not starting with *."
(interactive)
(previous-buffer)
(let ((i 0))
(while (and (string-match "^*" (buffer-name)) (< i 10))
(setq i (1+ i)) (previous-buffer) )))

(defun next-emacs-buffer ()
"Switch to the next emacs buffer in cyclic order.\n
Emacs buffers are those starting with *."
(interactive)
(next-buffer)
(let ((i 0))
(while (and (not (string-match "^*" (buffer-name))) (< i 10))
(setq i (1+ i)) (next-buffer) )))

(defun previous-emacs-buffer ()
"Switch to the next user buffer in cyclic order.\n
Emacs buffers are those starting with *."
(interactive)
(previous-buffer)
(let ((i 0))
(while (and (not (string-match "^*" (buffer-name))) (< i 10))
(setq i (1+ i)) (previous-buffer) )))

Xah
xah@xahlee.org
=E2=88=91 http://xahlee.org/

John Sullivan

2006-10-15, 7:13 pm

"Xah Lee" <xah@xahlee.org> writes:

> Of interest!
>


In Emacs 22:

,----[ C-h f next-buffer RET ]
| next-buffer is an interactive compiled Lisp function in `simple.el'.
| It is bound to C-x <C-right>, C-x <right>, <menu-bar> <buffer> <next-buffer>.
| (next-buffer)
|
| Switch to the next buffer in cyclic order.
`----

,----[ C-h f previous-buffer RET ]
| previous-buffer is an interactive compiled Lisp function in `simple.el'.
| It is bound to C-x <C-left>, C-x <left>, <menu-bar> <buffer> <previous-buffer>.
| (previous-buffer)
|
| Switch to the previous buffer in cyclic order.
|
| [back]
`----

There is also already cyclebuffer.el.

http://www.emacswiki.org/cgi-bin/wiki/CycleBuffer

--
-John Sullivan
-http://www.wjsullivan.net
-GPG Key: AE8600B6
RaoulGough@yahoo.co.uk

2006-10-16, 1:12 pm

Thorsten Bonow wrote:
>
> Xah> In general, you want to make the most frequently used commands to be
> Xah> the most easy to type.
>
> Huh, me? No. Why do you think so? :-)
>
> "In general", this is simply not true for Emacs and I don't think that it should
> be a primary goal.

[snip]
> 2. Of course, you don't try to hide important shortcuts if you can help it, but
> the developers of Emacs decided to aim for a system of shortcuts with some
> logic behind it. This comes at a price: Some keys are difficult to type or
> don't make sense for a non-US keyboard layout etc. But after years of using
> Emacs I'm still impressed how easy it is to get into a mode I haven't used
> for years. I am surprised that you don't mention this system. Compromising it
> just for a few dozen shortcuts is shortsighted in my opinion.

[snip]

I've begun to notice that C-x is really quite awkward for me to type
(this is on a US QWERTY layout). My usual finger positions for this
key-chord are left little finger on CTRL and left middle on X, which
puts the left middle finger under an unusual strain since it's cramped
up diagonally. Any ideas on improving this situation?

[Note: comp.emacs.xemacs dropped from followup-to]

--
Raoul Gough.

John Sullivan

2006-10-16, 7:13 pm

RaoulGough@yahoo.co.uk writes:

> I've begun to notice that C-x is really quite awkward for me to type
> (this is on a US QWERTY layout). My usual finger positions for this
> key-chord are left little finger on CTRL and left middle on X, which
> puts the left middle finger under an unusual strain since it's cramped
> up diagonally. Any ideas on improving this situation?
>


Use dvorak x is where the b is in qwerty. So with control remapped to caps
lock, C-x is usually left pinky + right index for me.

--
-John Sullivan
-http://www.wjsullivan.net
-GPG Key: AE8600B6
Miles Bader

2006-10-17, 1:12 am

RaoulGough@yahoo.co.uk writes:
> I've begun to notice that C-x is really quite awkward for me to type
> (this is on a US QWERTY layout). My usual finger positions for this
> key-chord are left little finger on CTRL and left middle on X, which
> puts the left middle finger under an unusual strain since it's cramped
> up diagonally. Any ideas on improving this situation?


Where is your control key? Many Emacs key combos are much nicer with a
"real" control key (to the left of the "a" key), and are kind of awkward
with the "new age" control key (somewhere down in the corner).

So for me, for instance, C-x is pinky+left-index; I have to shift my
whole left hand over, but once shifted, it's quite comfortable, and it's
a convenient position to hit following control-key combos.

[Most people just remap caps-lock to control, but I have a Happy Hacking
keyboard with a proper layout :-]

-Miles
--
`Suppose Korea goes to the World Cup final against Japan and wins,' Moon said.
`All the past could be forgiven.' [NYT]
Xah Lee

2006-10-17, 1:12 am

Raoul Gough wrote:
=C2=ABI've begun to notice that C-x is really quite awkward for me to type
(this is on a US QWERTY layout). My usual finger positions for this
key-chord are left little finger on CTRL and left middle on X, which
puts the left middle finger under an unusual strain since it's cramped
up diagonally. Any ideas on improving this situation?=C2=BB

Thanks for reminding me of this extremely XXXXed emacs design, which
has escaped my notice.

The need to press x with modifiers, is the single most frequently
needed operation in emacs. This is so critical that the command
frequency list doesn't even bring the issue up, since these prefix
keystrokes are needed to call up any command.

The Control-x is possibly the most awkward key combination on a
standard keyboard, and unfortunately, it is the key strokes that emacs
wants people to use the most. It is in fact, the sole contribution to
the well-known =E2=80=9Cemacs pinky=E2=80=9D repetitive strain injury, and =
is one
of the main driving force for people to detest emacs.

Given that we are stuck with the C-x (at least for now), for a article
on How To Avoid The Emacs Pinky Problem, see
http://xahlee.org/emacs/emacs_pinky.html

In short, one of the most important thing is that you should use a
proper keyboard with large modifier keys, and with them positioned on
both sides of the keyboard in a symmetric way to the left/right home
keys, so that the right side set are actually touch-type functional.

(keyboard layout and the physical keyboard design are the other
extremely XXXXed up products of shameless XXXXers in our society (and
supported as a side effect of political struggle by our tech geekers.
That's why we still have it to this day.))

Many people, as a sloppy work-around with the emacs pinky problem,
swaps the conventional positions of the left Control key and Cap Lock
key. This does work as a work around, but is not a solution as tech
geekers drivels about.

As we have discussed before, the most used commands must have the most
easy-to-type keystrokes. The C-x, as a prefix keystroke for calling
emacs command, therefore must have the most easy to type.

Assume that we are given the physical design of a conventional keyboard
and the common qwerty layout, then the most comfortable key combo for
the control combination would be one of the DF or JK keys, both are
under the home row pressed by the index and middle fingers. And given
that most keyboards don't have a touch-type-functional right set
Control and Meta keys, therefore JK would be the optimal choices for
the command prefix keys. (so that, the left hand can hold down the
modifier keys, and the other hand, can press J or K. Between the
choices of J vs K, K is probably better since the longer middle finger
makes it more comfortable to type. Therefore, C-x and M-x really should
be C-t and M-k.

On the dvorak keyboard (which is one major fix up of the XXXXed
keyboard layout that is qwerty which by itself contributed to endless
hand injuries), the right hand index finger's key is T. Thus, on the
dvorak layout, the C-x should be C-t.

(Note: if you are using dvorak, the x is the qwerty's b, so that you
can type C-x by having your left hand hold down control on the left
side, and right hand's index finger moves to the lower left to press
the x. However, this won't work if you are using a Split Keyboard
(which is a major fix up to the XXXXed up physical keyboard design). On
a split keyboard, the Qwerty's B is on the left side of the keyboard,
and is very awkward to press C-b either with left hand itself or both
left and right hands. (photo here
http://xahlee.org/emacs/i/ms_wnm_keyboard.jpg ))

I use a Dvorak keyboard layout. I use a split key physical keyboard. I
have C-x remapped to C-t.

Please see also:
Modernization of Emacs
http://xahlee.org/emacs/modernization.html

Xah
xah@xahlee.org
=E2=88=91 http://xahlee.org/

David Hansen

2006-10-17, 7:13 am

On 16 Oct 2006 07:39:27 -0700 RaoulGough@yahoo.co.uk wrote:

> I've begun to notice that C-x is really quite awkward for me to type
> (this is on a US QWERTY layout). My usual finger positions for this
> key-chord are left little finger on CTRL and left middle on X, which
> puts the left middle finger under an unusual strain since it's cramped
> up diagonally. Any ideas on improving this situation?


Swap Ctrl and Caps Lock.

David
David Kastrup

2006-10-17, 7:13 am

David Hansen <david.hansen@gmx.net> writes:

> On 16 Oct 2006 07:39:27 -0700 RaoulGough@yahoo.co.uk wrote:
>
>
> Swap Ctrl and Caps Lock.


Rather have Caps Lock be an additional Control key. When would you
_ever_ need Caps Lock? The only use I can think of is to appear like
an idiot on Usenet, and there are other ways for doing that.

--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Evan Monroig

2006-10-17, 7:13 am

"Xah Lee" <xah@xahlee.org> writes:
[...]
> On the dvorak keyboard (which is one major fix up of the XXXXed
> keyboard layout that is qwerty which by itself contributed to endless
> hand injuries), the right hand index finger's key is T.


Under the right hand index is the letter H, isn't it? T is on its
right.

(unless I have a strange dvorak layout..)

Evan
Pascal Bourguignon

2006-10-17, 7:13 am

David Kastrup <dak@gnu.org> writes:

> David Hansen <david.hansen@gmx.net> writes:
>
>
> Rather have Caps Lock be an additional Control key. When would you
> _ever_ need Caps Lock? The only use I can think of is to appear like
> an idiot on Usenet, and there are other ways for doing that.


Indeed, like M-x caps-mode RET HOWDY! ;-)

--
__Pascal Bourguignon__ http://www.informatimago.com/

"Logiciels libres : nourris au code source sans farine animale."
Jochem Huhmann

2006-10-17, 1:13 pm

"Xah Lee" <xah@xahlee.org> writes:

> The Control-x is possibly the most awkward key combination on a
> standard keyboard, and unfortunately, it is the key strokes that emacs
> wants people to use the most. It is in fact, the sole contribution to
> the well-known “emacs pinky” repetitive strain injury, and is one
> of the main driving force for people to detest emacs.


Why does anyone need a finger to press the Control key? Try to keep your
fingers in the home position (index fingers on f and j) and press and
hold left Control with your hand without moving any finger. Works fine
for me. If I had to use my pinky for that, I'd have moved back to vi
long ago.


Jochem

--
"A designer knows he has arrived at perfection not when there is no
longer anything to add, but when there is no longer anything to take away."
- Antoine de Saint-Exupery
Miles Bader

2006-10-18, 1:13 am

Pascal Bourguignon <pjb@informatimago.com> writes:
>
> Indeed, like M-x caps-mode RET HOWDY! ;-)


On that note (only works in Emacs 22):


(define-minor-mode caps-lock-mode
"When enabled, all self-inserting characters will be converted to uppercase."
:lighter " CapsLock"
(if caps-lock-mode
(local-set-key [remap self-insert-command] 'self-insert-upcased)
(local-unset-key [remap self-insert-command])))

(defun self-insert-upcased ()
(interactive)
(insert (upcase last-input-char)))


[THANKS, KIM, FOR THE WONDERFUL "[REMAP ...]" KEY-BINDING MECHANISM!!!!]


-Miles
--
Suburbia: where they tear out the trees and then name streets after them.
Miles Bader

2006-10-18, 1:12 pm

HERE'S A SLIGHTLY IMPROVED VERSION (AGAIN, ONLY FOR EMACS 22/23):


(defvar caps-lock-mode-map
(let ((map (make-sparse-keymap)))
(define-key map [remap self-insert-command] 'self-insert-upcased)
map))

(define-minor-mode caps-lock-mode
"When enabled, convert all self-inserting characters to uppercase."
:lighter " CapsLock")

(defun self-insert-upcased (arg)
(interactive "p")
(setq last-command-char (upcase last-command-char))
(self-insert-command arg))


[THANKS TO STEFAN MONNIER FOR SUGGESTING TO USE A MINOR-MODE KEYMAP.]

-MILES
--
My spirit felt washed. With blood. [Eli Shin, on "The Passion of the Christ"]
David Hansen

2006-10-18, 1:12 pm

On Wed, 18 Oct 2006 22:28:13 +0900 Miles Bader wrote:

> HERE'S A SLIGHTLY IMPROVED VERSION (AGAIN, ONLY FOR EMACS 22/23):


Shouldn't that minor mode be enabled (per default) in
message-mode and erc-mode?

David
Miles Bader

2006-10-18, 7:13 pm

David Hansen <david.hansen@gmx.net> writes:
>
> Shouldn't that minor mode be enabled (per default) in
> message-mode and erc-mode?


I'D SAY SO.

-MILES
--
`The suburb is an obsolete and contradictory form of human settlement'
RaoulGough@yahoo.co.uk

2006-10-19, 7:13 am

Jochem Huhmann wrote:
> "Xah Lee" <xah@xahlee.org> writes:
>
>
> Why does anyone need a finger to press the Control key? Try to keep your
> fingers in the home position (index fingers on f and j) and press and
> hold left Control with your hand without moving any finger. Works fine
> for me. If I had to use my pinky for that, I'd have moved back to vi
> long ago.


That seems difficult to me! I assume you're managing to hold it down
with the palm of your hand - have you got one of those over-sized
control keys on your keyboard?

I've tried out using C-j remapped to be the same as C-x as follows:

(global-set-key "\C-j" 'Control-X-prefix) ;; Was newline-and-indent

C-j is really easy to type on a QWERTY layout. Unfortunately some of
the major modes have C-j in their mode-maps, so it can get remapped to
something ordinary like sh-newline-and-indent.

So what I'm trying now is a modified CAPSLOCK which maps to the HYPER
modifier and then maping H-j to be an equivalent C-x prefix key*.
Unfortunately, this isn't ideal either, since some of the keys in
ctl-x-map are designed to work with the control key held down. e.g.
it's more awkward to type H-j C-q than C-x C-q.

Maybe I'll stick with C-j and use find-file-hooks to reset C-j after
the major mode has messed with it...

I also noticed that iswitchb-mode sets up some keys like this:

(global-set-key "\C-xb" 'iswitchb-buffer)

instead of

(define-key ctl-x-map "b" 'iswitchb-buffer)

Is this a bug in iswitchb-mode?

* Emacs complains about "\H-j" as a key specifier with the error
"Invalid modifier in string". I had to follow the FAQ's advice and map
H-j to something interactively and then examine command-history to find
out that [16777322] is the vector specifying H-j.

--
Raoul Gough.

Johan Bockgård

2006-10-19, 1:12 pm

RaoulGough@yahoo.co.uk writes:

> * Emacs complains about "\H-j" as a key specifier with the error
> "Invalid modifier in string".


Hyper events can't be put in strings. You can use a vector, [?\H-j],
or the kbd macro, (kbd "H-j").

--
Johan Bockgård
Bernd Schmitt

2006-10-21, 7:16 pm

On 19.10.2006 12:14, RaoulGough@yahoo.co.uk wrote:
> So what I'm trying now is a modified CAPSLOCK which maps to the HYPER
> modifier and then maping H-j to be an equivalent C-x prefix key*.
> Unfortunately, this isn't ideal either, since some of the keys in
> ctl-x-map are designed to work with the control key held down. e.g.
> it's more awkward to type H-j C-q than C-x C-q.

This is very interesting, how do you map CAPSLOCK to the HYPER
modifier? Could this be done with emacs-lisp only, too?

curiously,
Bernd

P.S. f'up2 comp.emacs, ok?
RaoulGough@yahoo.co.uk

2006-10-23, 1:11 pm

Bernd Schmitt wrote:
> On 19.10.2006 12:14, RaoulGough@yahoo.co.uk wrote:
> This is very interesting, how do you map CAPSLOCK to the HYPER
> modifier? Could this be done with emacs-lisp only, too?


Well, I'm working with Hummingbird Exceed (a windows-based Xserver) and
I did it more or less via the configuration GUI, which nicely takes
care of the low-level keycode mappings for you, but I think it should
be possible with xmodmap as well. I doubt it's possible to do just with
emacs-lisp, and don't know if it's possible without XWindows

Anyway, here's some results of interrogating the setup via xmodmap:

$ xmodmap -pke | grep -i Hyper
keycode 65 = Hyper_L

$ xmodmap -pm
xmodmap: up to 3 keys per modifier, (keycodes in parentheses):

shift Shift_L (0x31), Shift_R (0x3d)
lock
control Control_L (0x24), Hyper_L (0x41), Control_R (0x5f)
mod1 Alt_L (0x3f), Mode_switch (0x62)
mod2
mod3 Mode_switch (0x62)
mod4
mod5

Actually, as you can see above, I've mapped Hyper_L back to control,
because I gave up on the idea of using the Hyper key to access the
control-x prefix map. Originaly, I had it doing mod2, which seemed to
work fine.

For any other Exceed users, I also had to "unlatch" CapsLock in the
XKeys "Edit - Settings" menu to get this to work.

>
> curiously,
> Bernd
>
> P.S. f'up2 comp.emacs, ok?


Thanks - I didn't realise I was replying to a cross-post.

--
Raoul Gough.

Stefan Monnier

2006-11-23, 7:11 pm

> (global-set-key "\C-j" 'Control-X-prefix) ;; Was newline-and-indent

> C-j is really easy to type on a QWERTY layout. Unfortunately some of
> the major modes have C-j in their mode-maps, so it can get remapped to
> something ordinary like sh-newline-and-indent.


You can try

(define-key key-translation-map [?\C-j] [?\C-x])

But this will not only turn `C-j k' into `C-x k' but also `C-j C-j' into
`C-x C-x'. Another option:

(define my-remap-mode-map
(let ((map (make-sparse-keymap)))
(define-key map [?\C-j] 'Control-X-prefix)
map))
(define-minor-mode my-remap-mode
"A minor mode to remap C-j to C-x."
:global t)
(my-remap-mode 1)

It may still be overridden by other minor modes, but at least it will
override major mode bindings. In Emacs-22 you'll be able to use
emulation-mode-map-alists, which takes precedence over minor-mode bindings.

> I also noticed that iswitchb-mode sets up some keys like this:


> (global-set-key "\C-xb" 'iswitchb-buffer)


> instead of


> (define-key ctl-x-map "b" 'iswitchb-buffer)


> Is this a bug in iswitchb-mode?


Arguably, yes. Although it shouldn't affect you: as long as your C-x is
still bound to Control-X-prefix, then the above will modify the
Control-X-prefix map and will thus also affect your C-j prefix.

> * Emacs complains about "\H-j" as a key specifier with the error
> "Invalid modifier in string". I had to follow the FAQ's advice and map
> H-j to something interactively and then examine command-history to find
> out that [16777322] is the vector specifying H-j.


Don't use strings to represent key-sequences. [16777322] is usually written
[?\H-j]. Emacs also accepts the XEmacs syntax [(hyper j)], or [(hyper ?j)].


Stefan

rgb

2006-12-06, 1:14 pm

15712 self-insert-command
11880 next-line
8538 previous-line
7222 forward-word
4553 forward-char
4141 nonincremental-repeat-search-forward
3790 nil
3704 mwheel-scroll
3273 back-to-indentation-or-beginning
2724 backward-char
2557 delete-backward-char
2479 end-of-code-or-line
2309 cua-delete-region
1695 backward-word
1333 indent-relative
1247 cua-scroll-up
1212 just-one-space
1196 previous-history-element
1131 cua-scroll-down
1095 (lambda nil (interactive) (scroll-up 1))
1066 handle-switch-frame
972 rgb-doublespace-maybe
932 search-backward
802 cua-copy-region
802 yank
721 nonincremental-search-forward
714 universal-argument-other-key
706 digit-argument
674 cua-resize-rectangle-right
636 cua-resize-rectangle-down
596 execute-extended-command
544 dired-next-line
501 mouse-drag-region
495 delete-char
488 jump-to-register
481 point-to-register
410 (lambda nil (interactive) (scroll-down 1))
401 facemenu-set-bold
397 nonincremental-repeat-search-backward
343 beginning-of-buffer
338 insert-prior-line-char
321 mouse-set-point
298 newline-and-indent
287 next-file-buffer
254 other-window
241 dired-previous-line
232 kill-buffer
228 cua-move-rectangle-right
218 (lambda nil (interactive) (mark-sexp -1 t))
192 backward-delete-char-untabify
174 cua-resize-rectangle-up
168 end-of-buffer
165 search-word-under-cursor
165 undo
162 cua-insert-char-rectangle
152 ediff-next-difference
147 kill-this-buffer
146 scroll-bar-toolkit-scroll
114 kill-region
88 search-word-at-mouseclick
85 cua-move-rectangle-down
81 minibuffer-complete-word
81 exit-minibuffer
78 goto-last-change
77 prev-file-buffer
70 cua-set-rectangle-mark
67 dired-advertised-find-file
59 skeleton-pair-insert-maybe-here
59 cua-resize-rectangle-left
57 save-buffer
54 (lambda nil (interactive) (mark-sexp 1 t))
54 switch-to-buffer
53 next-history-element
52 cua-resize-rectangle-page-down
51 cua-move-rectangle-left
45 eval-defun
45 upcase-word
43 overwrite-mode
42 abort-recursive-edit
39 occur
37 dired
37 indent-for-tab-command
36 cua-resize-rectangle-page-up
36 query-replace
34 write-file
33 indent-according-to-mode
32 make-frame-command
31 bookmark-bmenu-list
30 bookmark-bmenu-other-window-with-mouse
30 cua-clear-rectangle-mark
29 mouse-save-then-kill
29 query-replace-regexp
28 cua-rotate-rectangle
26 find-file
26 menu-bar-select-buffer
25 cua-delete-char-rectangle
25 nonincremental-re-search-forward
24 kill-buffer-and-window
22 kmacro-end-macro
21 c-indent-command
21 cua--paste-rectangle
21 cua-copy-rectangle
20 scroll-all-by-lines-down
20 dtw
18 nmcobol-mode
18 revert-buffer
17 ediff-quit
16 flyspell-correct-word-before-point
16 describe-key-briefly
16 cua-resize-rectangle-bot
15 mark-whole-buffer
14 cua-blank-rectangle
14 kmacro-start-macro
14 dired-mouse-find-file-other-window
14 collect-lines
13 occur-mode-mouse-goto
13 mouse-set-region
13 cua-move-rectangle-up
13 dired-flag-file-deletion
13 ediff-previous-difference
13 w32-drag-n-drop
12 popup-ruler
12 cua-delete-rectangle
11 delete-indentation
11 search-word-under-cursor-forward
10 popup-ruler-vertical
10 push-button
10 skeleton-pair-insert-maybe
10 comment-dwim
9 eval-last-sexp
8 anchored-transpose
8 describe-function
8 [S-home 92 116 99 104 107 58]
8 dired-do-flagged-delete
7 insert-register
7 (lambda nil (interactive) (imenu--menubar-select (quote (*Rescan* .
-99))))
7 flyspell-correct-word
7 cua-close-rectangle
7 quoted-insert
6 mouse-select-window
6 eval-expression
6 recentf-open-more-files
6 downcase-word
6 capitalize-word
6 sort-lines
6 recentf-open-most-recent-file-2
5 mouse-drag-mode-line
5 emacs-lisp-byte-compile-and-load
5 ddl-mode
5 set-fill-column
5 split-window-vertically
5 split-window-horizontally
5 ps-print-buffer-with-faces
5 dired-sort-toggle-or-edit
5 (lambda nil (interactive) (goto-char (1- (window-end))))
5 cua-exchange-point-and-mark
5 ignore
4 column-marker-1
4 universal-argument
4 flush-lines
4 negative-argument
4 delete-other-windows
4 insert-sequence-symbol
4 ispell-next-error
4 ediff-toggle-help
4 ediff-toggle-wide-display
4 emacs-lisp-byte-compile
4 lisp-indent-line
4 mode-exited
4 bookmark-bmenu-this-window
4 undefined
4 (lambda nil (interactive) (goto-char (window-start)))
4 narrow-to-region
4 sort-columns
3 delete-window
3 menu-function-96
3 tal-mode
3 comment-indent-new-line
3 recentf-open-most-recent-file-1
3 keyboard-quit
3 cua-cut-to-global-mark
3 recentf-cancel-dialog
3 menu-find-file-existing
3 print-faces-on-color-only
3 prt8
3 widget-button-press
3 my-drw
3 dired-do-chgrp
3 widen
3 minibuffer-complete-and-exit

xahlee@gmail.com

2006-12-13, 7:12 pm

Thanks a lot!

So far, your stat is the only one i've received.

Emacsers, please do send me your command frequency stats. Please see
http://xahlee.org/emacs/command-frequency.el
Thanks.

Xah
xah@xahlee.org
=E2=88=91 http://xahlee.org/


rgb wrote:
> 15712 self-insert-command
> 11880 next-line
> 8538 previous-line
> 7222 forward-word
> 4553 forward-char
> 4141 nonincremental-repeat-search-forward
> 3790 nil
> 3704 mwheel-scroll
> 3273 back-to-indentation-or-beginning

..=2E.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com