unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Alain.Cochard@unistra.fr
To: Tatsu Takamaro <tatsu.takamaro@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Q1 - the keys' bindings to work more widely
Date: Sun, 15 Dec 2024 11:05:39 +0100	[thread overview]
Message-ID: <26462.43507.306572.307952@frac.u-strasbg.fr> (raw)
In-Reply-To: <6fc3743a-6a0c-cc4d-9470-dcd634d3b461@gmail.com>

Tatsu Takamaro writes on Sun 15 Dec 2024 02:46:

 > I would like to have my keys (my bindings) working more widely so that I
 > could trust them more. But for now some of them don't work. E. g. in a
 > Help buffer C-c doesn't work as a copy action (though it works globally
 > as I set). And this is not surprising.  I understand that major modes
 > have priority over the global one. What is the best idea to make my keys
 > more reliable? One way is to change all the major and minor modes, but
 > it's a big load of work and code. Another way is to create my own minor
 > mode key bindings and make it be turned on by default, and I managed to
 > find how it should be done ("init-value" and "global" should be non-nil,
 > in the "define-minor-mode" call). So I hope I'm somewhere close to the
 > solution. Here is my function call with an example of C-c rebinding:
 > 
 > (define-minor-mode ttkeys-mode "My key bindings"
 > :init-value 1 :lighter " TT" :global 1
 > :keymap
 > '(
 > ("C-c" . #'kill-ring-save)
 > ("C-a" . #'mark-whole-buffer)
 > )
 > )
 > 
 > The TT mode is being shown normally, I can switch in on and off, but the 
 > C-c and C-a don't work as I told them to. I tried to vary signs like # 
 > and ', but no result. What am I doing wrong?
 > 
 > And, maybe there is some other advice that you could give to make my 
 > keys more reliable (make them work everywhere in Emacs)? Don't offer a 
 > CUA mode, I know about it, but it doesn't meet my needs.

I am not sure it addresses your question (in particular, I do not redefine
C-c), and I have read that this way is frowned upon, but here is what I do:

;; First:
(defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")

;; Then all my keys like that:
(define-key my-keys-minor-mode-map "\M-." 'scroll-up)

-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes                 | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | bureau 110, ancien bât.



      parent reply	other threads:[~2024-12-15 10:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-14 23:46 Q1 - the keys' bindings to work more widely Tatsu Takamaro
2024-12-15  2:15 ` [External] : " Drew Adams
2024-12-16 23:11   ` Tatsu Takamaro
2024-12-16 23:55     ` Drew Adams via Users list for the GNU Emacs text editor
2024-12-17  0:05       ` Drew Adams
2024-12-17  0:16         ` Tatsu Takamaro
2024-12-17  2:17           ` Drew Adams
2024-12-17  5:41             ` Tatsu Takamaro
2024-12-17  6:28               ` Yuri Khan
2024-12-17  5:42             ` Tatsu Takamaro
2024-12-15 10:05 ` Alain.Cochard [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=26462.43507.306572.307952@frac.u-strasbg.fr \
    --to=alain.cochard@unistra.fr \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tatsu.takamaro@gmail.com \
    /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.
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).