all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* The euro symbol in emacs
@ 2014-12-04 20:01 Guido Van Hoecke
  2014-12-04 20:44 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Guido Van Hoecke @ 2014-12-04 20:01 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

Adapted from many posts and pages on the net, I have following piece of
lisp in my .emacs to be able to insert the euro symbol:

  (global-set-key (kbd "s-2") (lambda () (interactive)  (insert  ?€ )))

That works fine for text buffers, but it does not work in the prompt area.
It does not work e.g. when one wants to search for a € in a text buffer.

So is there really no way to specify the character code corresponding to a
key combination in such a way that it also works at the emacs prompt?

Guido


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: The euro symbol in emacs
       [not found] <mailman.15272.1417723349.1147.help-gnu-emacs@gnu.org>
@ 2014-12-04 20:10 ` Álvar Ibeas
  2014-12-04 20:11 ` Álvar Ibeas
  1 sibling, 0 replies; 13+ messages in thread
From: Álvar Ibeas @ 2014-12-04 20:10 UTC (permalink / raw)
  To: help-gnu-emacs

Guido Van Hoecke <guivho@gmail.com> writes:

> So is there really no way to specify the character code corresponding to a
> key combination in such a way that it also works at the emacs prompt?

Hi,

Maybe this is what you’re looking for: C-x 8 RET (insert-char), followed
by the code point or name of the character, i.e.,

C-x 8 RET 20AC
C-x 8 RET EURO SIGN


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: The euro symbol in emacs
       [not found] <mailman.15272.1417723349.1147.help-gnu-emacs@gnu.org>
  2014-12-04 20:10 ` The euro symbol in emacs Álvar Ibeas
@ 2014-12-04 20:11 ` Álvar Ibeas
  2014-12-04 20:22   ` Álvar Ibeas
  1 sibling, 1 reply; 13+ messages in thread
From: Álvar Ibeas @ 2014-12-04 20:11 UTC (permalink / raw)
  To: help-gnu-emacs

Guido Van Hoecke <guivho@gmail.com> writes:

> So is there really no way to specify the character code corresponding to a
> key combination in such a way that it also works at the emacs prompt?

Hi,

Maybe this is what you’re looking for: C-x 8 RET (insert-char), followed
by the code point or name of the character, i.e.,

C-x 8 RET 20AC
C-x 8 RET EURO SIGN


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: The euro symbol in emacs
  2014-12-04 20:11 ` Álvar Ibeas
@ 2014-12-04 20:22   ` Álvar Ibeas
  0 siblings, 0 replies; 13+ messages in thread
From: Álvar Ibeas @ 2014-12-04 20:22 UTC (permalink / raw)
  To: help-gnu-emacs

ibeas@gmx.com (Álvar Ibeas) writes:

> Maybe this is what you’re looking for: C-x 8 RET (insert-char), followed

I see now that it’s not, you want to keep your binding!


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: The euro symbol in emacs
  2014-12-04 20:01 Guido Van Hoecke
@ 2014-12-04 20:44 ` Eli Zaretskii
  2014-12-04 20:51 ` Stefan Monnier
  2014-12-04 20:53 ` Drew Adams
  2 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2014-12-04 20:44 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Guido Van Hoecke <guivho@gmail.com>
> Date: Thu, 4 Dec 2014 21:01:53 +0100
> 
>   (global-set-key (kbd "s-2") (lambda () (interactive)  (insert  ?€ )))

Why do you even need that?  Why not use an input method?




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: The euro symbol in emacs
  2014-12-04 20:01 Guido Van Hoecke
  2014-12-04 20:44 ` Eli Zaretskii
@ 2014-12-04 20:51 ` Stefan Monnier
  2014-12-04 20:53 ` Drew Adams
  2 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2014-12-04 20:51 UTC (permalink / raw)
  To: help-gnu-emacs

>   (global-set-key (kbd "s-2") (lambda () (interactive)  (insert  ?€ )))

Try

   (define-key input-decode-map [?\s-2] [?€])


-- Stefan




^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: The euro symbol in emacs
  2014-12-04 20:01 Guido Van Hoecke
  2014-12-04 20:44 ` Eli Zaretskii
  2014-12-04 20:51 ` Stefan Monnier
@ 2014-12-04 20:53 ` Drew Adams
  2014-12-05  7:57   ` Guido Van Hoecke
       [not found]   ` <mailman.15304.1417766262.1147.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 13+ messages in thread
From: Drew Adams @ 2014-12-04 20:53 UTC (permalink / raw)
  To: Guido Van Hoecke, help-gnu-emacs

> (global-set-key (kbd "s-2") (lambda () (interactive)  (insert  ?€)))
> 
> That works fine for text buffers, but it does not work in the prompt
> area.

The prompt area is read-only, normally.  My crystal ball tells me that
you really mean "in the minibuffer", i.e., during input.

For that, try adding that binding to one or all of the minibuffer
keymaps.  It is probably enough to add it to only `minibuffer-local-map':

(define-key minibuffer-local-map (kbd "s-2")
                                 (lambda () (interactive) (insert ?€)))



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: The euro symbol in emacs
  2014-12-04 20:53 ` Drew Adams
@ 2014-12-05  7:57   ` Guido Van Hoecke
  2014-12-05 15:15     ` Drew Adams
       [not found]   ` <mailman.15304.1417766262.1147.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 13+ messages in thread
From: Guido Van Hoecke @ 2014-12-05  7:57 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

Hi Drew

On 4 December 2014 at 21:53, Drew Adams <drew.adams@oracle.com> wrote:

> > (global-set-key (kbd "s-2") (lambda () (interactive)  (insert  ?€)))
> >
> > That works fine for text buffers, but it does not work in the prompt
> > area.
>
> The prompt area is read-only, normally.  My crystal ball tells me that
> you really mean "in the minibuffer", i.e., during input.
>
> For that, try adding that binding to one or all of the minibuffer
> keymaps.  It is probably enough to add it to only `minibuffer-local-map':
>
> (define-key minibuffer-local-map (kbd "s-2")
>                                  (lambda () (interactive) (insert ?€)))
>

This sounds like the way to go, but it doen't seem to work. Tried the
minibuffer-local-map as well as all other minibuffer-*-map maps that are
listed when completing F1 v minibuffer-

Well, I'll stick with C-X 8 RET 20AC for now...

Guido


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: The euro symbol in emacs
       [not found]   ` <mailman.15304.1417766262.1147.help-gnu-emacs@gnu.org>
@ 2014-12-05  9:10     ` Ralf Fassel
  2014-12-05 10:21     ` Joost Kremers
  1 sibling, 0 replies; 13+ messages in thread
From: Ralf Fassel @ 2014-12-05  9:10 UTC (permalink / raw)
  To: help-gnu-emacs

* Guido Van Hoecke <guivho@gmail.com>
| > The prompt area is read-only, normally.  My crystal ball tells me that
| > you really mean "in the minibuffer", i.e., during input.
| >
| > For that, try adding that binding to one or all of the minibuffer
| > keymaps.  It is probably enough to add it to only `minibuffer-local-map':
| >
| > (define-key minibuffer-local-map (kbd "s-2")
| >                                  (lambda () (interactive) (insert ?€)))
| >
>
| This sounds like the way to go, but it doen't seem to work. Tried the
| minibuffer-local-map as well as all other minibuffer-*-map maps that
| are listed when completing F1 v minibuffer-

You also mentioned searching, so have a look at 'isearch-mode-map'.

    isearch-forward is an interactive compiled Lisp function in `isearch.el'.
  --<snip-snip>--
    As you type characters, they add to the search string and are found.
    The following non-printing keys are bound in `isearch-mode-map'.

HTH
R'


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: The euro symbol in emacs
       [not found]   ` <mailman.15304.1417766262.1147.help-gnu-emacs@gnu.org>
  2014-12-05  9:10     ` Ralf Fassel
@ 2014-12-05 10:21     ` Joost Kremers
  2014-12-05 12:26       ` Guido Van Hoecke
  1 sibling, 1 reply; 13+ messages in thread
From: Joost Kremers @ 2014-12-05 10:21 UTC (permalink / raw)
  To: help-gnu-emacs

Guido Van Hoecke wrote:
> This sounds like the way to go, but it doen't seem to work. Tried the
> minibuffer-local-map as well as all other minibuffer-*-map maps that are
> listed when completing F1 v minibuffer-
>
> Well, I'll stick with C-X 8 RET 20AC for now...

IMHO you're going about this the wrong way. What you should probably be
using is an input method (see the Emacs manual for details). If you set
(or customize) the variable `default-input-method' to something like
"latin-9-prefix", you can use C-\ to toggle the input method and then
type the Euro symbol with the sequence «~e» (without the guillemets, of
course). This also works in the minibuffer, to the extent it makes sense
(e.g., in isearch-(for|back)ward, etc. The isearch prompt ever tells you
that an input method is active.) The latin-9-prefix input method also
allows you to type other characters, such as ë, é, è, ï, ç, etc.

Another method is to configure your keyboard layout in such a way that
you can type the Euro symbol by using some modifier key. AFAIK in
Windows and OS X this is already configured, though you'll need to find
out which key combo to use. On Window, I think it's AltGr+2 or AltGr+e,
on OS X ⌥⇧2 (option-shift-2). On Linux, you may need to configure it
yourself, or it may already be set up, depending on your distro / window
manager.

If you really want to use Super-2, it's probably better to (on Linux)
use Xmodmap or your WM's keyboard settings. That way, the method works
in every app that supports the Euro symbol, not just in Emacs, and it'll
work in the minibuffer as well without having to hunt down the correct
keymap variables.

HTH


-- 
Joost Kremers                                   joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: The euro symbol in emacs
  2014-12-05 10:21     ` Joost Kremers
@ 2014-12-05 12:26       ` Guido Van Hoecke
  0 siblings, 0 replies; 13+ messages in thread
From: Guido Van Hoecke @ 2014-12-05 12:26 UTC (permalink / raw)
  To: Joost Kremers; +Cc: help-gnu-emacs

Joost,

You solved my problem.

On 5 December 2014 at 11:21, Joost Kremers <joost.m.kremers@gmail.com>
wrote:

> Guido Van Hoecke wrote:
> > This sounds like the way to go, but it doen't seem to work. Tried the
> > minibuffer-local-map as well as all other minibuffer-*-map maps that are
> > listed when completing F1 v minibuffer-
> >
> > Well, I'll stick with C-X 8 RET 20AC for now...
>
> IMHO you're going about this the wrong way. What you should probably be
> using is an input method (see the Emacs manual for details). If you set
> (or customize) the variable `default-input-method' to something like
> "latin-9-prefix", you can use C-\ to toggle the input method and then
> type the Euro symbol with the sequence «~e» (without the guillemets, of
> course). This also works in the minibuffer, to the extent it makes sense
> (e.g., in isearch-(for|back)ward, etc. The isearch prompt ever tells you
> that an input method is active.) The latin-9-prefix input method also
> allows you to type other characters, such as ë, é, è, ï, ç, etc.
>
> Another method is to configure your keyboard layout in such a way that
> you can type the Euro symbol by using some modifier key. AFAIK in
> Windows and OS X this is already configured, though you'll need to find
> out which key combo to use. On Window, I think it's AltGr+2 or AltGr+e,
> on OS X ⌥⇧2 (option-shift-2). On Linux, you may need to configure it
> yourself, or it may already be set up, depending on your distro / window
> manager.
>

I used the free Ukelele app [1] to remap my rarely used ± key to emit € and
my problem is solved.

And as you pointed out, this solution works everywhere.

Thank you, and all other people that have been helping in this thread.

Guido

​[1] http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ukelele^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: The euro symbol in emacs
  2014-12-05  7:57   ` Guido Van Hoecke
@ 2014-12-05 15:15     ` Drew Adams
  2014-12-05 17:39       ` Guido Van Hoecke
  0 siblings, 1 reply; 13+ messages in thread
From: Drew Adams @ 2014-12-05 15:15 UTC (permalink / raw)
  To: Guido Van Hoecke; +Cc: help-gnu-emacs

>> (define-key minibuffer-local-map
>>             (kbd "s-2")
>>             (lambda () (interactive) (insert ?€)))
>
> This sounds like the way to go, but it doen't seem to work. Tried
> the minibuffer-local-map as well as all other minibuffer-*-map
> maps that are listed when completing F1 v minibuffer-

Works for me.  (I don't use a `super-' modifier, but putting,
say, "C-o" in place of "s-2" shows that it works fine.)



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: The euro symbol in emacs
  2014-12-05 15:15     ` Drew Adams
@ 2014-12-05 17:39       ` Guido Van Hoecke
  0 siblings, 0 replies; 13+ messages in thread
From: Guido Van Hoecke @ 2014-12-05 17:39 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

Hi Drew,

On 5 December 2014 at 16:15, Drew Adams <drew.adams@oracle.com> wrote:

> >> (define-key minibuffer-local-map
> >>             (kbd "s-2")
> >>             (lambda () (interactive) (insert ?€)))
> >
> > This sounds like the way to go, but it doen't seem to work. Tried
> > the minibuffer-local-map as well as all other minibuffer-*-map
> > maps that are listed when completing F1 v minibuffer-
>
> Works for me.  (I don't use a `super-' modifier, but putting,
> say, "C-o" in place of "s-2" shows that it works fine.)
>

Does not work​

​for me. Tried minibuffer-local-map as well as
minibuffer-local-isearch-map. Tried C-o, C-i, C-2 as well as C-`, but no
success.

Of course, the fact that I am an evil user probably complicates things :(

Anyway, the remapped PLUS MINUS key works well for me.

Have a nice weekend,

Guido​


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-12-05 17:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.15272.1417723349.1147.help-gnu-emacs@gnu.org>
2014-12-04 20:10 ` The euro symbol in emacs Álvar Ibeas
2014-12-04 20:11 ` Álvar Ibeas
2014-12-04 20:22   ` Álvar Ibeas
2014-12-04 20:01 Guido Van Hoecke
2014-12-04 20:44 ` Eli Zaretskii
2014-12-04 20:51 ` Stefan Monnier
2014-12-04 20:53 ` Drew Adams
2014-12-05  7:57   ` Guido Van Hoecke
2014-12-05 15:15     ` Drew Adams
2014-12-05 17:39       ` Guido Van Hoecke
     [not found]   ` <mailman.15304.1417766262.1147.help-gnu-emacs@gnu.org>
2014-12-05  9:10     ` Ralf Fassel
2014-12-05 10:21     ` Joost Kremers
2014-12-05 12:26       ` Guido Van Hoecke

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.