lokedhs / gnu-apl-mode

GNU APL mode for Emacs
GNU General Public License v3.0
94 stars 18 forks source link

Adapting spanish keyboard #38

Closed anquegi closed 4 years ago

anquegi commented 4 years ago

Hi, thanks for this great package for working with gnu-apl. I'm not sure if this is a bug or I do not understand the setup

I have a spanish keyboard (MAC OSX)

apple_spanish

So I tried to map that two variables:

(setf gnu-apl-keymap-template
"╔════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦══════════╗
║ ª∇ ║ !∇ ║ \"∇ ║ ·∇ ║ $∇ ║ %∇ ║ &∇ ║ /∇ ║ (∇ ║ )∇ ║ =∇ ║ ?∇ ║ ¿∇ ║          ║
║ º∇ ║ 1∇ ║ 2∇ ║ 3∇ ║ 4∇ ║ 5∇ ║ 6∇ ║ 7∇ ║ 8∇ ║ 9∇ ║ 0∇ ║ '∇ ║ ¡∇ ║ BACKSP   ║
╠════╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═══════╣
║       ║ Q∇ ║ W∇ ║ E∇ ║ R∇ ║ T∇ ║ Y∇ ║ U∇ ║ I∇ ║ O∇ ║ P∇ ║ ^∇ ║ *∇ ║       ║
║  TAB  ║ q∇ ║ w∇ ║ e∇ ║ r∇ ║ t∇ ║ y∇ ║ u∇ ║ i∇ ║ o∇ ║ p∇ ║ `∇ ║ +∇ ║    R  ║
╠═══════╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╗  E  ║
║ (CAPS   ║ A∇ ║ S∇ ║ D∇ ║ F∇ ║ G∇ ║ H∇ ║ J∇ ║ K∇ ║ L∇ ║ Ñ∇ ║ ¨∇ ║ Ç∇ ║  T  ║
║  LOCK)  ║ a∇ ║ s∇ ║ d∇ ║ f∇ ║ g∇ ║ h∇ ║ j∇ ║ k∇ ║ l∇ ║ ñ∇ ║ ´∇ ║ ç∇ ║     ║
╠═══════╦═╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩════╩═════╣
║       ║ >∇  ║ Z∇ ║ X∇ ║ C∇ ║ V∇ ║ B∇ ║ N∇ ║ M∇ ║ ;∇ ║ :∇ ║ _∇ ║           ║
║ SHIFT ║ <∇  ║ z∇ ║ x∇ ║ c∇ ║ v∇ ║ b∇ ║ n∇ ║ m∇ ║ ,∇ ║ .∇ ║ -∇ ║  SHIFT    ║
╚═══════╩═════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩═══════════╝"
)

and

(setf gnu-apl--symbols
'(("diamond" "◊" "<")
 ("diaeresis" "¨" "1")
 ("i-beam" "⌶" "!")
 ("macron" "¯" "2")
 ("del-tilde" "⍫" "\"")
 ("less-than" "<" "3")
 ("del-stile" "⍒" "·")
 ("less-than-or-equal-to" "≤" "4")
 ("delta-stile" "⍋" "$")
 ("equals" "=" "5")
 ("circle-stile" "⌽" "%")
 ("greater-than-or-equal-to" "≥" "6")
 ("circle-backslash" "⍉" "&")
 ("greater-than" ">" "7")
 ("circled-minus" "⊖" "/")
 ("not-equal-to" "≠" "8")
 ("circle-star" "⍟" "(")
 ("logical-or" "∨" "9")
 ("down-caret-tilde" "⍱" ")")
 ("logical-and" "∧" "0")
 ("up-caret-tilde" "⍲" "=")
 ("multiplication-sign" "×" "'")
 ("exclamation-mark" "!" "?")
 ("division-sign" "÷" "¡")
 ("quad-divide" "⌹" "¿")
 ("question-mark" "?" "q")
 ("omega" "⍵" "w")
 ("omega-underbar" "⍹" "W")
 ("epsilon" "∊" "e")
 ("epsilon-underbar" "⍷" "E")
 ("rho" "⍴" "r")
 ("tilde" "∼" "t")
 ("tilde-diaeresis" "⍨" "T")
 ("uparrow" "↑" "y")
 ("yen-sign" "¥" "Y")
 ("downarrow" "↓" "u")
 ("iota" "⍳" "i")
 ("iota-underbar" "⍸" "I")
 ("circle" "○" "o")
 ("circle-diaeresis" "⍥" "O")
 ("star-operator" "⋆" "p")
 ("star-diaeresis" "⍣" "P")
 ("leftarrow" "←" "`")
 ("quote-quad" "⍞" "^")
 ("rightarrow" "→" "*")
 ("zilde" "⍬" "+")
 ("right-tack" "⊢" "ç")
 ("left-tack" "⊣" "Ç")
 ("alpha" "⍺" "a")
 ("alpha-underbar" "⍶" "A")
 ("left-ceiling" "⌈" "s")
 ("left-floor" "⌊" "d")
 ("underscore" "_" "f")
 ("del-tilde" "⍫" "F")
 ("nabla" "∇" "g")
 ("increment" "∆" "h")
 ("delta-underbar" "⍙" "H")
 ("ring-operator" "∘" "j")
 ("jot-diaeresis" "⍤" "J")
 ("apostrophe" "'" "k")
 ("quad-diamond" "⌺" "K")
 ("quad" "⎕" "l")
 ("squish-quad" "⌷" "L")
 ("down-tack-jot" "⍎" "ñ")
 ("identical-to" "≡" "Ñ")
 ("up-tack-jot" "⍕" "´")
 ("not-identical-to" "≢" "¨")
 ("subset-of" "⊂" "z")
 ("superset-of" "⊃" "x")
 ("greek-letter-chi" "χ" "X")
 ("intersection" "∩" "c")
 ("left-shoe-stile" "⍧" "C")
 ("union" "∪" "v")
 ("up-tack" "⊥" "b")
 ("pound-sign" "£" "B")
 ("down-tack" "⊤" "n")
 ("divides" "|" "m")
 ("shoe-jot" "⍝" ",")
 ("comma-bar" "⍪" ";")
 ("backslash-bar" "⍀" ":")
 ("slash-bar" "⌿" "-")
 ("quad-colon" "⍠" "_")
 ("pi" "π" )
 ("root" "√")
 ("inverted-exclamation-mark" "¡")
 ("quad-backslash" "⍂" )
 ("inverted-question-mark" "¿")))

That can be usefull for spanish keyboards too.

But when I tried to work with gnu-apl insert mode it doesn't work well for spanish only keys Ñ,Ç<>, and ºª

I should change the gnua apl insert

it works well for other similar keys betwween spanish and english keyboads but for this different letters I do not get anything. Also when I tap . the spanish suymbols do not appair,

Captura de pantalla 2020-03-09 a las 12 26 58

I'm using this


GNU Emacs 28.0.50 (build 2, x86_64-apple-darwin19.3.0, NS appkit-1894.30 Version 10.15.3 (Build 19D76))
 of 2020-02-17

I'm not sure where to continue. the reason seems to use quail UTF-8, maybe is this:

https://emacs.stackexchange.com/questions/38907/quail-rules-utf8-behaviour

lokedhs commented 4 years ago

This is a bit strange. The keymap is initialised in gnu-apl--make-base-mode-map, which simply creates key definitions based on the content of gnu-apl--symbols.

This would suggest to me that a key definition such as s-Ñ is not possible. Are you able to map this key at all?

anquegi commented 4 years ago

Well I'm not using currently any mapping with Ñ but I'm using mappings with Ç and º, nothings with Ñ; I suppose that you are looking for thins like this:

One is, just a causality, for starting APL-Z input. this all work perfectly:


(global-set-key (kbd "C-º") '(lambda () (interactive) (set-input-method "APL-Z")))
(global-set-key (kbd "M-º") 'shell-command-on-region)
 (global-set-key (kbd "M-ç") 'anzu-query-replace)
(global-set-key (kbd "C-M-ç") 'anzu-query-replace-regexp)

I do not get the point but I believe that wuail is only working with ASCII chars

anquegi commented 4 years ago

Thanks

This is a bit strange

You were asolutly right the problem is htat I do not really read carefully the readme and also quail works with standard keyboards and with ASCII extended characters (below 255):

Note that both of these variable shall be set before loading the gnu-apl-mode. In order for changes in gnu-apl--symbols to take place one better to restart Emacs; for gnu-apl-keymap-template it is enough to just hide/show keyboard help.

The problem was that in my configuration file I had

(require 'gnu-apl-mode)

(setf gnu-apl-keymap-template
"╔════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦══

(setf gnu-apl--symbols
'(("diamond" "◊" "<")
 ("diaeresis" "¨" "1")
        ...

Si I loaded gnu-apl-mode before of defining this variables, and that was the problem I deleted the require and now it is working with a spanish keyboard. for the sake of completion and for other users I left the configuration for a spanish key board MAC. Sorry for not read the doc. and thanks for this great package

;;; my-apl.el --- GNU-APL configuration -*- lexical-binding: t; -*-
;;; Commentary:
;;; GNU-APL configuration
;;; Keyboard manage
;;; Code:

(setf gnu-apl-keymap-template
"╔════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦══════════╗
║ ª∇ ║ !∇ ║ \"∇ ║ ·∇ ║ $∇ ║ %∇ ║ &∇ ║ /∇ ║ (∇ ║ )∇ ║ =∇ ║ ?∇ ║ ¿∇ ║          ║
║ º∇ ║ 1∇ ║ 2∇ ║ 3∇ ║ 4∇ ║ 5∇ ║ 6∇ ║ 7∇ ║ 8∇ ║ 9∇ ║ 0∇ ║ '∇ ║ ¡∇ ║ BACKSP   ║
╠════╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═══════╣
║       ║ Q∇ ║ W∇ ║ E∇ ║ R∇ ║ T∇ ║ Y∇ ║ U∇ ║ I∇ ║ O∇ ║ P∇ ║ ^∇ ║ *∇ ║       ║
║  TAB  ║ q∇ ║ w∇ ║ e∇ ║ r∇ ║ t∇ ║ y∇ ║ u∇ ║ i∇ ║ o∇ ║ p∇ ║ `∇ ║ +∇ ║    R  ║
╠═══════╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╗  E  ║
║ (CAPS   ║ A∇ ║ S∇ ║ D∇ ║ F∇ ║ G∇ ║ H∇ ║ J∇ ║ K∇ ║ L∇ ║ Ñ∇ ║ ¨∇ ║ Ç∇ ║  T  ║
║  LOCK)  ║ a∇ ║ s∇ ║ d∇ ║ f∇ ║ g∇ ║ h∇ ║ j∇ ║ k∇ ║ l∇ ║ ñ∇ ║ ´∇ ║ ç∇ ║     ║
╠═══════╦═╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩════╩═════╣
║       ║ >∇  ║ Z∇ ║ X∇ ║ C∇ ║ V∇ ║ B∇ ║ N∇ ║ M∇ ║ ;∇ ║ :∇ ║ _∇ ║           ║
║ SHIFT ║ <∇  ║ z∇ ║ x∇ ║ c∇ ║ v∇ ║ b∇ ║ n∇ ║ m∇ ║ ,∇ ║ .∇ ║ -∇ ║  SHIFT    ║
╚═══════╩═════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩═══════════╝"
)

(setf gnu-apl--symbols
      '(("diamond" "◊" "<")
        ("diaeresis" "¨" "1")
        ("i-beam" "⌶" "!")
        ("macron" "¯" "2")
        ("del-tilde" "⍫" "\"")
        ("less-than" "<" "3")
        ("del-stile" "⍒" "·")
        ("less-than-or-equal-to" "≤" "4")
        ("delta-stile" "⍋" "$")
        ("equals" "=" "5")
        ("circle-stile" "⌽" "%")
        ("greater-than-or-equal-to" "≥" "6")
        ("circle-backslash" "⍉" "&")
        ("greater-than" ">" "7")
        ("circled-minus" "⊖" "/")
        ("not-equal-to" "≠" "8")
        ("circle-star" "⍟" "(")
        ("logical-or" "∨" "9")
        ("down-caret-tilde" "⍱" ")")
        ("logical-and" "∧" "0")
        ("up-caret-tilde" "⍲" "=")
        ("multiplication-sign" "×" "'")
        ("exclamation-mark" "!" "?")
        ("division-sign" "÷" "¡")
        ("quad-divide" "⌹" "¿")
        ("question-mark" "?" "q")
        ("omega" "⍵" "w")
        ("omega-underbar" "⍹" "W")
        ("epsilon" "∊" "e")
        ("epsilon-underbar" "⍷" "E")
        ("rho" "⍴" "r")
        ("tilde" "∼" "t")
        ("tilde-diaeresis" "⍨" "T")
        ("uparrow" "↑" "y")
        ("yen-sign" "¥" "Y")
        ("downarrow" "↓" "u")
        ("iota" "⍳" "i")
        ("iota-underbar" "⍸" "I")
        ("circle" "○" "o")
        ("circle-diaeresis" "⍥" "O")
        ("star-operator" "⋆" "p")
        ("star-diaeresis" "⍣" "P")
        ("leftarrow" "←" "`")
        ("quote-quad" "⍞" "^")
        ("rightarrow" "→" "*")
        ("zilde" "⍬" "+")
        ("right-tack" "⊢" "ç")
        ("left-tack" "⊣" "Ç")
        ("alpha" "⍺" "a")
        ("alpha-underbar" "⍶" "A")
        ("left-ceiling" "⌈" "s")
        ("left-floor" "⌊" "d")
        ("underscore" "_" "f")
        ("del-tilde" "⍫" "F")
        ("nabla" "∇" "g")
        ("increment" "∆" "h")
        ("delta-underbar" "⍙" "H")
        ("ring-operator" "∘" "j")
        ("jot-diaeresis" "⍤" "J")
        ("apostrophe" "'" "k")
        ("quad-diamond" "⌺" "K")
        ("quad" "⎕" "l")
        ("squish-quad" "⌷" "L")
        ("down-tack-jot" "⍎" "ñ")
        ("identical-to" "≡" "Ñ")
        ("up-tack-jot" "⍕" "´")
        ("not-identical-to" "≢" "¨")
        ("subset-of" "⊂" "z")
        ("superset-of" "⊃" "x")
        ("greek-letter-chi" "χ" "X")
        ("intersection" "∩" "c")
        ("left-shoe-stile" "⍧" "C")
        ("union" "∪" "v")
        ("up-tack" "⊥" "b")
        ("pound-sign" "£" "B")
        ("down-tack" "⊤" "n")
        ("divides" "|" "m")
        ("shoe-jot" "⍝" ",")
        ("comma-bar" "⍪" ";")
        ("backslash-bar" "⍀" ":")
        ("slash-bar" "⌿" "-")
        ("quad-colon" "⍠" "_")
        ("pi" "π" "º")
        ("root" "√" "ª")
        ("inverted-exclamation-mark" "¡")
        ("quad-backslash" "⍂" ">")
        ("inverted-question-mark" "¿")))

(provide 'my-apl)
;;; my-apl.el ends here
Captura de pantalla 2020-03-13 a las 18 28 08
lokedhs commented 4 years ago

You're right. gnu-apl-keymap-template should probably be a defcustom rather than defvar. With the appropriate update function, the right thing can be done once a change is made to the variable.