emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Unuseful keybindings


From: Drew Adams
Subject: RE: Unuseful keybindings
Date: Sun, 23 Dec 2012 13:13:36 -0800

> Speaking of odd key bindings, I just noticed that `home' goes to the
> beginning of the line instead of the beginning of the buffer.  Looking
> at the source code, it seems like this change was done 12 years ago.
> :-)
> 
> Isn't that an odd choice?  `home' in Firefox, for instance, 
> goes to the beginning of the page.  And `M-C-<' is more of a
> mouthful than `C-a', so that seems kinda odd...

Indeed.  I didn't even realize that we had made such a silly change.  It was bad
enough to waste `home' on `beginning-of-buffer' (prior to Emacs 21, when that
silly change was made).

Now if `home' were bound to something like the following, which is repeatable,
then it would be a lot more useful.  First time: bol, subsequently:
next/previous line's bol.

I use this and the eol version _all_ the time (but I use them on `C-a' and
`C-e', not `home' and `end').

(defun beginning-of-line+ (&optional n)
  "Move cursor to beginning of current line or next line if repeated.
This is the similar to `beginning-of-line', but:
1. With arg N, the direction is the opposite: this command moves
   backward, not forward, N lines.
2. If called interactively with no prefix arg:
      If the previous command was also `beginning-of-line+', then move
      to the beginning of the previous line.  Else, move to the
      beginning of the current line.
   Otherwise, move to the beginning of the Nth previous line (Nth next
      line if N<0).  Command `beginning-of-line', by contrast, moves to
      the beginning of the (N-1)th next line."
  (interactive
   (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg) 0)))
  (unless n (setq n 0))                 ; non-interactive with no arg
  (if (and (eq this-command last-command) (not current-prefix-arg))
      (forward-line -1)
    (forward-line (- n))))

http://www.emacswiki.org/emacs-en/download/misc-cmds.el




reply via email to

[Prev in Thread] Current Thread [Next in Thread]