the key to Emacs keys 2

Tue, 17 May 2016 01:30:37 +0200

> I kind of run out of keys on my keyboard.
> Since this function is rarely used(I use
> English for 99% of the time), I think the
> function keys is fine.

To each his own. And Emacs makes that much
easier to achieve. By changing Emacs, you
become a better programmer and better computer
user, and even Emacs gets better, until the
point you realize there is already a built-in
function, or module, that does what you have
done, only better, and then it all starts over
at a higher level... Because, if anything can
start anew, then everything must continue!

That said, if you rarely use the function,
there is no need for a shortcut. Remember,
"optimize the common case".

If you think it is to much to type the actual
function name, instead make an alias - or
several! You'll find that it is actually faster
to invoke as it is easier to remember and,
again, does not require arm movement way from
typing position.

Why several aliases? Because sometimes you
remember "test-colors", and sometimes
"color-test" - with aliases, they can all be
correct! But here, compare: will you remember
that "color-test" years ago was assigned F6?

So, e.g.,

    (defalias 'download 'w3m-dl-dwim)
    (defalias 'dl       'w3m-dl-dwim)

Regardless, I don't think you are running out
of shutcuts :)

Many shortcuts are assigned to stuff you never
use - you can replace those. It is not because
the stuff is bad - it can be just appealing to
another personality, or involve technology you
just don't use!

Here is a tool - eval, invoke, and start
hammering away, and you'll see:

    (defun show-key-command (&optional the-key command)
      (interactive)
      (let*((key-prompt           "(hit key! or C-g to quit)")
            (prompt               (if command (format " %s   %s " command key-prompt)
                                    key-prompt))
            (key                  (or the-key (read-key-sequence-vector prompt)))
            (new-command          (key-binding key))
            (command-or-undefined (or new-command "undefined")) )
        (if the-key (message "%s" command-or-undefined)
          (unless (equal key [7]) ; [7] is C-g
            (show-key-command nil command-or-undefined) ))))

If you really *do* run out of shortcuts, get
a new prefix key, e.g. C-o which is short and
close - check your hands when at asdf jkl; and
note the required movement to strike C-o!

Now even a new world of shortcuts opens. E.g.,

    (define-prefix-command        'C-o-prefix)
    (global-set-key        "\C-o" 'C-o-prefix)
    (global-set-key        "\C-ow" #'window-increase-size)

Back to Blogomatic.