unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* endless loop when redefining keys
@ 2023-10-17 15:55 Peter
  0 siblings, 0 replies; only message in thread
From: Peter @ 2023-10-17 15:55 UTC (permalink / raw)
  To: help-gnu-emacs


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.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-17 15:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-17 15:55 endless loop when redefining keys Peter

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).