unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Peter <pmc@citylink.dinoex.sub.org>
To: help-gnu-emacs@gnu.org
Subject: endless loop when redefining keys
Date: Tue, 17 Oct 2023 17:55:18 +0200	[thread overview]
Message-ID: <ZS6uZq60qugGmdrZ@disp.intra.daemon.contact> (raw)


In my first approach to set keys (a few years ago) I had this
for my <I'm already gone> function:

(fset 'save-and-exit
   "^U^X^C")
(global-unset-key (kbd "<f10>"))
(global-set-key (kbd "<f10>") 'save-and-exit)

Now I found that this does apparently not run my own (newly written)
kill-buffer-hook functions, or at least doesn't ask their questions.
So for a quick fix I removed the ^U from that code.

And now I have an endless loop and need to kill emacs from unix.
(Only when there is a modified buffer it should save)

I know that the 'fset' is now superfluous, and that I could just
bind <f10> to 'save-buffers-kill-emacs'. I kept it this way for now
only for documentation.
But then, why does it loop in this way? It is not from my macros -
I removed these for test.

To reproduce:

 - have a clean install
 - enter this into default.el:

(fset 'save-and-exit
   "^X^C")
(global-set-key (kbd "<f10>") 'save-and-exit)

 - run "emacs Testfile" and modify the Testfile
 - press <f10>


When pressing ^U^X^C the Testfile is just saved unconditionally - as
expected.
When pressing ^X^C, there is a prompt to save Testfile.
When clicking menu-File-Quit, there is a popup NOT asking for individual
buffers, but for all of them at once.
When closing the window from WM, the same popup.
But when pressing <f10> it computes forever.
~~~~~~~~~~~~~~~~~~~

Aapparently there are side-effects with defining keys, which I do not
yet understand and which can lead to unexpected looping.



                 reply	other threads:[~2023-10-17 15:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=ZS6uZq60qugGmdrZ@disp.intra.daemon.contact \
    --to=pmc@citylink.dinoex.sub.org \
    --cc=help-gnu-emacs@gnu.org \
    /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).