* disable, replace binding in method-map
@ 2020-05-17 15:59 peter hodgson
2020-05-19 13:16 ` Dmitry Alexandrov
2020-05-19 15:22 ` Stefan Monnier
0 siblings, 2 replies; 3+ messages in thread
From: peter hodgson @ 2020-05-17 15:59 UTC (permalink / raw)
To: help-gnu-emacs
A simpler version of my earlier pos
1. `set-input-method` + `greek-babel`
turns an emacs buffer from U:** to BGU:
the entire keyboard is transformed to type greek;
most bindings are obvious- a = alpha, b = beta ...
but a few are handled differently from other greek maps i work with,
and these are the ones i want to a. preempt, then b.replace;
a. theta- j, sigma- s/c, ksi-x, chi-q
b. q s c x
2. i had a similar problem with org-mode
my global key settings worked as i wanted in org-mode,
unless they were set to some other task in org-mode-map
(bindings- mode trumping- minor trumps major, and major trumps global)
SO, i disabled the keys which
a. are globally bound in my emacs
but
b. org-mode-map had given its own special tasks-
this freed up such keys so they could work "globally;"
(add-hook 'org-mode-hook
(lambda ()
(define-key org-mode-map "\eh" nil)))
(add-hook 'org-mode-hook
(lambda ()
(define-key org-mode-map "\ea" nil)))
------------------------------------------
can't i do the same with greek-babel?
1. for theta (i won't need to remap 'j',
but i must preempt 'q' so i can give it a new job here
(add-hook 'input-method-hook
(lambda ()
(define-key input-method-greek-babel-map "j" nil))
(lambda ()
(define-key input-method-greek-babel-map "q" nil))
(lambda ()
(define-key input-method-greek-babel-map "q"
'θ)))
the two issues i can't successfully google are
1. does 'input-method-hook work like 'input-mode-hook?
2. how do i disable a binding, then rebind the key to a new job?
--
imputerate@puteracy.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: disable, replace binding in method-map
2020-05-17 15:59 disable, replace binding in method-map peter hodgson
@ 2020-05-19 13:16 ` Dmitry Alexandrov
2020-05-19 15:22 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Alexandrov @ 2020-05-19 13:16 UTC (permalink / raw)
To: peter hodgson; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 964 bytes --]
peter hodgson <imputerate@gmail.com> wrote:
> 1. `set-input-method` + `greek-babel`
> turns an emacs buffer from U:** to BGU:
> the entire keyboard is transformed to type greek;
> most bindings are obvious- a = alpha, b = beta ...
> but a few are handled differently from other greek maps i work with,
> and these are the ones i want to a. preempt, then b.replace;
> a. theta- j, sigma- s/c, ksi-x, chi-q
> b. q s c x
> can't i do the same with greek-babel?
Sure, you can. But itʼs semantically unclean to tamper with an input method, that is what it is for a good reason, and is named accordingly. Define a new one instead.
> 1. for theta (i won't need to remap 'j',
> but i must preempt 'q' so i can give it a new job here
I donʼt quite get, what you want here.
> input-method-greek-babel-map
Where have you found it?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: disable, replace binding in method-map
2020-05-17 15:59 disable, replace binding in method-map peter hodgson
2020-05-19 13:16 ` Dmitry Alexandrov
@ 2020-05-19 15:22 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2020-05-19 15:22 UTC (permalink / raw)
To: help-gnu-emacs
> can't i do the same with greek-babel?
Not in the same way, but yes, you can.
Here's for example the chunk of code I use to massage the TeX input
method to my liking:
(defvar my-quail-activate-hook-done nil)
(defun my-quail-activate-hook ()
(unless (member (quail-name) my-quail-activate-hook-done)
(push (quail-name) my-quail-activate-hook-done)
(when (member (quail-name) '("TeX"))
;; Copy the "_..." bindings to "\_...".
(setf (alist-get ?_ (cdr (alist-get ?\\ (quail-map))))
(alist-get ?_ (quail-map)))
;; Remove the "_..." bindings.
(setf (alist-get ?_ (quail-map)) nil)
(quail-defrule "\\hline" ["------------------------"])
)))
(add-hook 'quail-activate-hook #'my-quail-activate-hook)
-- Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-19 15:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-17 15:59 disable, replace binding in method-map peter hodgson
2020-05-19 13:16 ` Dmitry Alexandrov
2020-05-19 15:22 ` Stefan Monnier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).