unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tatsu Takamaro <tatsu.takamaro@gmail.com>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: Robert Pluim <rpluim@gmail.com>, Jean Louis <bugs@gnu.support>,
	help-gnu-emacs@gnu.org
Subject: Re: Remapping keys and creating my own keymap \\ too complicated\\
Date: Tue, 10 Dec 2024 01:34:52 +0300	[thread overview]
Message-ID: <05f56e2f-cc66-3fe1-0a22-0ae6423ec853@gmail.com> (raw)
In-Reply-To: <87ttbdydsv.fsf@gmx.net>

Yes, true. Thanks, now it works. Well, that's what I have now:

(keymap-global-unset "C-q")
(keymap-global-set "C-q" #'save-buffers-kill-terminal)
(keymap-global-unset "<pause>")
(keymap-global-set "<pause>" #'quoted-insert)
(keymap-global-unset "C-a")
(keymap-global-set "C-a" #'mark-whole-buffer)
(keymap-global-unset "C-z")
(keymap-global-set "C-z" #'undo)
(keymap-global-unset "C-/")
(keymap-global-set "C-/" #'suspend-frame)
(keymap-global-unset "C-s")
(keymap-global-unset "C-f")
(keymap-global-set "C-s" #'save-buffer)
(keymap-global-set "C-f" #'isearch-forward)
(keymap-global-unset "C-x")
(keymap-global-set "C-x" #'kill-region)
(keymap-global-unset "<apps>")
(keymap-set global-map "<apps>" ctl-x-map)
(keymap-global-unset "C-c")
(keymap-global-set "C-c" #'kill-ring-save)
(keymap-global-unset "C-v")
(keymap-global-set "C-v" #'yank)
(keymap-global-unset "C-o")
(keymap-global-set "C-o" #'find-file)
(keymap-global-unset "M-o")
(keymap-global-set "M-o" #'open-line)

(keymap-global-unset "C-<left>")
(keymap-global-set "C-<left>" #'backward-sentence)
(keymap-global-unset "C-<right>")
(keymap-global-set "C-<right>" #'forward-sentence)
(keymap-global-unset "M-<up>")
(keymap-global-set "M-<up>" #'backward-paragraph)
(keymap-global-unset "M-<down>")
(keymap-global-set "M-<down>" #'forward-paragraph)
(keymap-global-unset "C-<up>")
(keymap-global-set "C-<up>" #'scroll-down-command)
(keymap-global-unset "C-<down>")
(keymap-global-set "C-<down>" #'scroll-up-command)
(keymap-global-unset "C-S-<left>")
(keymap-global-set "C-S-<left>" #'backward-kill-word)
(keymap-global-unset "C-S-<right>")
(keymap-global-set "C-S-<right>" #'kill-word)

The keys work. Not as ideal but work. The main problem is resolved. But 
if I may continue, there are some details that still bother me.

1. What if I want not to cut (or how you call it - kill) a word with 
"backward-kill-word" and "kill-word", but delete it (so as not to put 
the words into the exchange buffer)?

2. Commands "forward-sentence" and "backward-sentence" do not move by 
sentences actually. I tried in both Text and Fundamental modes. If there 
are two sentences in a line, they ignore the dot in the middle. I guess 
it is somehow connected with an internal mode's settings (what is 
considered to be a sentence). But it seems logical that when I'm in a 
Text mode, I await to treat literary sentences as sentences, where a dot 
sign is a delimiter.

3. I would like to have my keys working more widely so that I could 
trust them more. But for now (see my bindings above - they are all 
global) some of them don't work. Eg in a Help buffer C-c doesn't work as 
a copy action. 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, but I will have to turn it on in every buffer 
manually, which is also not very comfortable. What would you advice?

With respect.

Tony.

пн, 09.12.2024 2:07, Stephen Berman пишет:
> On Sun, 8 Dec 2024 19:16:02 +0300 Tatsu Takamaro<tatsu.takamaro@gmail.com>  wrote:
>
>> I did as you said and just added some commands to an .emacs file. And
>> everything worked untill I tried to change the C-x binding. Here is my exact
>> code:
>>
>> (keymap-global-unset "C-x")
>> (keymap-global-set "C-x" #'kill-region)
>> (keymap-set global-map "<apps>" 'ctl-x-map)
>>
>> It seems logical, but it doesn't work properly. The Ctrl + x works just fine
>> and cuts the selected fragment. Pressing Ctrl + x also doesn't have an effect
>> as a C-x prefix (for example, keys C-x-s don't work to save). But then there
>> is an unexpected behaviour. Pressing the Menu button (<apps>) doesn't act as
>> C-x, and I can't use it to run commands that start with C-x. For example, I
>> can't do save-buffer by pressing <apps>-s. Why is it so? What am I missing?
> `ctl-x-map' is a variable whose value is a keymap, and you want to bind
> that value, so don't quote the name:
>
> (keymap-set global-map "<apps>" ctl-x-map)
>
> Steve Berman


  reply	other threads:[~2024-12-09 22:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 16:59 Remapping keys and creating my own keymap \\ too complicated\\ Tatsu Takamaro
2024-12-04  7:43 ` Jean Louis
2024-12-04 15:49   ` Tatsu Takamaro
2024-12-04 15:55   ` Tatsu Takamaro
2024-12-04 16:06     ` Robert Pluim
2024-12-04 16:37       ` Tatsu Takamaro
2024-12-04 16:40         ` Robert Pluim
2024-12-04 17:05           ` Tatsu Takamaro
2024-12-05 10:25             ` Robert Pluim
2024-12-05 18:08               ` Tatsu Takamaro
2024-12-06  9:57                 ` Robert Pluim
2024-12-06 10:38                   ` Jean Louis
2024-12-06 13:18                     ` Robert Pluim
2024-12-08 16:16                       ` Tatsu Takamaro
2024-12-08 23:07                         ` Stephen Berman
2024-12-09 22:34                           ` Tatsu Takamaro [this message]
2024-12-04 16:25 ` Jean Louis
2024-12-04 16:57   ` Tatsu Takamaro

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=05f56e2f-cc66-3fe1-0a22-0ae6423ec853@gmail.com \
    --to=tatsu.takamaro@gmail.com \
    --cc=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    --cc=rpluim@gmail.com \
    --cc=stephen.berman@gmx.net \
    /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).