all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "Óscar Fuentes" <ofv@wanadoo.es>, help-gnu-emacs@gnu.org
Subject: RE: Writing source code with Unicode characters
Date: Thu, 6 Feb 2014 14:59:56 -0800 (PST)	[thread overview]
Message-ID: <3109d383-d633-4be2-8859-1fa2e0c9e0fa@default> (raw)
In-Reply-To: <87vbwsq8mj.fsf@wanadoo.es>

> Drew:
> Thanks but that's not quite the thing I'm looking for. It is good
> when you need to write a few unicode chars

Why a few?  It's precisely when you want to define *lots* of such
chars that the macro is the most helpful.

> and wish to save a few keystrokes by not invoking C-x 8 RET
> <name>, but not so convenient when you are interested on quickly
> typing unicode chars on a similar way you type ordinary text,
> which would require setting quite a few keybindings

Suit yourself.  But your "quickly typing unicode chars on a
similar way you type ordinary text" sounds to me a *lot* like
having keys that insert the chars you want - in effect, another
(soft) keyboard or keyboard range.

And that essentially means "setting quite a few keybindings".
But you define those keys only once.  And you can do it in a
systematic way.

You use the Shift key now to reach certain chars using your
keyboard.  You could just as easily use another key (as a prefix
key) to "shift" any of your keys so they directly type Greek
chars or math symbols.

Why wouldn't you want a `lambda' key on your keyboard?
And `alpha' ... `omega' keys if you use Greek letters a lot, as
you say.  

E.g., you now have `l' and `Shift l' (for `L').  Why not also,
say, `<lwindow> l' for lowercase lambda and `Shift <lwindow> l'
for uppercase lambda?  Likewise for other Greek letters you use.

And for any such commands (e.g. some of the math symbols)
that you do *not* want to bind to keys, it is trivial to use
*completion* against the command name - which is also the
Unicode char name.

If by "quickly typing unicode chars on a similar way you type
ordinary text" you really meant (as per Eli's suggestion) typing
not a single key for the char but a bunch of keys that spell out
the *name* of the char (e.g. `l a m b d a'), then that is what
you already get with completion - except that you need not type
the whole name.

So in that sense too of "quickly typing...ordinary text",
I would think that macro `ucsc-make-commands' would help you.

> and it would not be an advantage over binding the key
> sequences to (insert-char <the-char-itself>).

Sure, you could write your own:

(defun my-THE-CHAR-command ()
  (interactive)
  (insert-char <the-char-itself>))

But I suspect maybe you are missing the point.  You would need
to create such code (including the inserted <the-char-itself>)
for *each character* you  use - either by hand or by program.

Writing such code is exactly what macro `ucsc-make-commands'
does for you.  And it does it in one fell swoop for a whole
range of chars.

But again, suit yourself, of course.  Just thought perhaps
it was not clear what I was suggesting for your use case.



  reply	other threads:[~2014-02-06 22:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 18:26 Writing source code with Unicode characters Óscar Fuentes
2014-02-06 18:45 ` Eli Zaretskii
2014-02-06 18:48 ` Drew Adams
2014-02-06 19:23 ` Göktuğ Kayaalp
2014-02-06 20:38 ` Óscar Fuentes
2014-02-06 22:59   ` Drew Adams [this message]
2014-02-07  0:32 ` Florian Beck
     [not found] <mailman.13962.1391711236.10748.help-gnu-emacs@gnu.org>
2014-02-06 20:36 ` Eric Wolf
2014-02-07  2:52 ` Rusi
2014-02-07 16:41   ` Rusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3109d383-d633-4be2-8859-1fa2e0c9e0fa@default \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=ofv@wanadoo.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.