 |
|
 |
|
|
 |
Emacs's Command Frequency and default keyboard shortcuts |
 |
 |
|
|
10-04-06 12:14 AM
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/
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Emacs's Command Frequency and default keyboard shortcuts |
 |
 |
|
|
10-11-06 06: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 unico
de =
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/
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Emacs's Command Frequency and default keyboard shortcuts |
 |
 |
|
|
10-13-06 06: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/
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Emacs's Command Frequency and default keyboard shortcuts |
 |
 |
|
|
10-13-06 06: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 () (interactiv
e)
(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)
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Emacs's Command Frequency and default keyboard shortcuts |
 |
 |
|
|
10-13-06 06: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 sh
ould
be a primary goal.
1. It's difficult if not impossible to define the most frequently used comma
nds
in an unambiguous way. command-frequency.el is nice, but won't really help y
ou
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 i
t
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...
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Emacs's Command Frequency and default keyboard shortcuts |
 |
 |
|
|
10-14-06 12:15 AM
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."
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Emacs's Command Frequency and default keyboard shortcuts |
 |
 |
|
|
10-14-06 12:15 AM
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.
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Emacs's Command Frequency and default keyboard shortcuts |
 |
 |
|
|
10-16-06 12:13 AM
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/
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Emacs's Command Frequency and default keyboard shortcuts |
 |
 |
|
|
10-16-06 12:13 AM
"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-buffe
r>.
| (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-buf
fer>.
| (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
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Emacs's Command Frequency and default keyboard shortcuts |
 |
 |
|
|
10-16-06 06: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 s
ome
> 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 u
sing
> Emacs I'm still impressed how easy it is to get into a mode I haven't u
sed
> for years. I am surprised that you don't mention this system. Compromis
ing 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.
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
|
Sponsored Links |
 |
 |
|
|
 |
All times are GMT. The time now is 01:44 AM. |
 |
|
|
 |
|
 |
|
|
 |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
|
|
|
|
|
 |
|
 |
|