[Top][All Lists]

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

RE: if vs. when vs. and: style question

From: Drew Adams
Subject: RE: if vs. when vs. and: style question
Date: Wed, 25 Mar 2015 11:23:54 -0700 (PDT)

> > If you use a particular Unicode character often, just give its
> > insertion a command and bind that to a key.  If you have 30 such
> > chars, put them all on a prefix key.  Or use completion on their
> > command names (names you created, so easy for you to type, remember,
> > complete to,...).
> >
> > IOW, it's not a big deal to insert Unicode characters, especially
> > if you insert the same ones over and over.  You do not need to use
> > `C-x 8 RET' each time.
> Sorry, that scales up for more than 1 or 2 characters how?

Well, I doubt that I can convince you.  I can only repeat what I

There is a big difference, I think, between (1) using `C-x 8 RET'
to complete against zillions of character names (or code points) that
you might not be familiar with and (2) completing against a relative
few (5? 10? 50? 150?) char-command names that you yourself came up with.

My point is that if someone uses relatively few - which, depending on
the person, could be 5 or 500 (or 5000?) chars, then it can make sense
to put their insertion on keys (commands).

> I already have a little piece of oak tag paper that I've cut out
> to surround the 6-key pad above the arrow keys.
> The paper has the legend:
>            UNDO
>     -keys-
>            COPY
> Yep, even for 5 specially assigned keys, my mind sometimes goes
> blank and I look at the paper.

Hey, my mind goes blank too.  But instead of paper I use completion.
IOW, I ask Emacs for help.

> A normal keyboard just isn't designed for a bunch of strange
> characters.

Maybe so.  But if you use the euro character a *lot*, for example,
then you might just consider assigning it a key.  Rather than using
`C-x 8 RET euro sign RET' each time to insert it.

It's also possible to have a command that, in effect, switches to
a keymap that treats your American keyboard as a French one or
whatever, just by changing the relevant key bindings.  Is that
useful for someone?  Maybe; dunno.

> Another poster described the issue well.
> If we used some other kind of input device, those characters
> might be a good idea.  Until then, not so much.

Given a particular physical keyboard, it's a tradeoff (i.e. choice)
wrt which keys do what.  Certainly it is true that the keys of a
typical American keyboard are used a lot in programming languages,
so someone who programs is likely to want to keep those keys bound
to the self-inserting chars they default to.  Such a programmer
probably needs `$' on a key, and isn't about to replace it with a
euro symbol.

But beyond that, it can make sense for someone to assign relatively
easy key sequences to insertion of frequently used Unicode chars.
It all depends on what you need, what you use Emacs for.

If you use lots of Greek chars, but mixed in with mostly ASCII or
Latin 1 chars, then it might make sense for you to assign simple
key sequences to Greek chars.  If you write *mostly* Greek then you
might want to use a Greek keyboard or remap the keys of a non-Greek
keyboard to Greek chars.

FWIW, I think that my library `ucs-cmds.el' can help in the former
case.  You can quickly define commands that insert specific chars,
by specifying a Unicode range etc.

This macro call creates an insertion command for each Greek letter:
(ucsc-make-commands "^greek [a-z]+ letter")

That's 330 commands (330 chars).  Here are the commands for the
letter epsilon, for example:
The command names are the Unicode char names, with hyphens instead
of spaces, and lowercase instead of uppercase.

You can of course create shorter aliases, if you like, and use
completion with `M-x'.  And you can assign the 20 or 50 Greek
chars that you use most often to short key sequences.  Or you can
put a bunch of the commands (or all 330) on a prefix key, say
`C-M-g'.  (And nothing requires you to create a command for each
of the 330 Unicode Greek chars.  It's easy to define just the
commands you need.)

It's all about what you need.  If you don't need to insert Unicode
chars, then "Circulez ; il n'y a rien a voir."

As for opening the floodgates to the use of Unicode in programming
code, I don't see that as a problem, one way or the other, wrt
user-defined names.

On the other hand, if you use a language that *requires* you to use
Unicode chars that are hard for you to input, then I'd suggest that
you either try something like the above (e.g., type `=>' to get the
arrow char you want) or you change languages. ;-)

reply via email to

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