help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Proper way to add bindings under C-x 8


From: Howard Melman
Subject: Re: Proper way to add bindings under C-x 8
Date: Mon, 29 Nov 2021 11:21:46 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Howard Melman <hmelman@gmail.com>
>> Date: Sat, 10 Apr 2021 17:35:07 -0400
>> 
>> >>     (global-set-key (kbd "C-x 8 1 / 5") (lambda () (interactive) (insert 
>> >> "⅕")))
>> >>     (global-set-key (kbd "C-x 8 e c") (lambda () (interactive) (insert 
>> >> "✅")))
>> >
>> > I think you want to use iso-transl-define-keys.
>> 
>> Great, that worked just fine.

Well, it mostly works just fine.  I'm using the following
and they work up until the "card suits" section:

    (defvar my-iso-transl-char-map
      '(
        ;; pretty comparisons
        (">"  . nil)                        ; first unbind »
        (">=" . [?≥])                       ; way better than » or using _>
        ("<"  . nil)                        ; first unbind «
        ("<=" . [?≤])                       ; way better than « or using _<
        ("!"  . nil)                        ; first unbind ¡
        ("!=" . [?≠])                       ; way better than ¡ or using /=
        ;; fractions that emacs doesn't include
        ("1/3" . [?⅓])
        ("1/5" . [?⅕])
        ("1/6" . [?⅙])
        ("1/7" . [?⅐])
        ("1/8" . [?⅛])
        ("1/9" . [?⅑])
        ("1/10" . [?⅒])
        ("2/3" . [?⅔])
        ("2/5" . [?⅖])
        ("3/5" . [?⅗])
        ("3/8" . [?⅜])
        ("4/5" . [?⅘])
        ("5/6" . [?⅚])
        ("5/8" . [?⅝])
        ("7/8" . [?⅞])
        ;; add the emojis I commonly use
        ("ec" . [?✅])
        ("eu" . [?👍])
        ("ed" . [?👎])
        ("ew" . [?🖐])
        ("et" . [?📺])
        ;; card suits
        ;; ("es" . [?♠️])
        ;; ("eC" . [?♣️])
        ;; ("eH" . [?♥️])
        ;; ("eD" . [?♦️])
        ))

    (require 'iso-transl)
    (iso-transl-define-keys my-iso-transl-char-map)

If the card suits are uncommented I get the error:

    (invalid-read-syntax "?")
    
I assume this is because these emoji use some more
complicated encoding since C-x = tells me it's a composed
form unlike the others.  Is there a way to include these as
well?  I don't really want to have to know the different way
different emoji are encoded but if necessary I can. 

I saw the new emoji entry stuff that Lars did, but I don't
want to wait until Emacs 29 (it would be great if that was
in Emacs 28). 

I'm using the macport "GNU Emacs 27.2 (build 1,
x86_64-apple-darwin20.6.0, Carbon Version 164 AppKit 2022.6) 

-- 

Howard




reply via email to

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