Minimize emacs on Windows with Meta-Space, n?

MikeTheTall 07/29/2018. 2 answers, 102 views
microsoft-windows frames

I'd like to minimize emacs on Windows, when I press the Alt-Space, then n keys, just like with other Windows programs (because Alt-Space opens the program's menu that includes the 'Mi_n_imize' option, and 'n' then tells Windows to minimize that program/window)

I've rebound my left alt to be my Meta key.

So I want to set things up so that Meta-Space n will invoke (suspend-frame)

I tried this:

(global-set-key (kbd "M-SPC n") 'suspend-frame) 

But I got the error message Key sequence M-SPC n starts with non-prefix key M-SPC

Is there a clear explanation of what 'prefix' vs. 'non-prefix' keys are?

Is there a way to work around this, and to use Meta-Space in a key sequence?

UPDATE: I've found the GNU Emacs manual entry for prefix keys as well as this Wiki page on adding prefix keys but the following doesn't work:

(define-prefix-command 'keymap-meta-space)
(global-set-key (kbd "M-SPC") 'keymap-meta-space )
(define-key keymap-meta-space (kbd "M-n") 'suspend-frame)

After evaluating all three sexp's I press M-SPC, then I press n, and then emacs waits for me to press something else (by displaying M-SPC n- in the minibuffer).

2 Answers

DoMiNeLa10 07/30/2018.

M-SPC is bound to just-one-space by default, which is a command, not a prefix key. In order to be able to bind M-SPC n, you'd have to unbind it first:

(global-unset-key (kbd "M-SPC"))
(global-set-key (kbd "M-SPC n") #'suspend-frame) 

MikeTheTall 07/29/2018.

This actually did work, once I put it into my init.el and restarted emacs:

(define-prefix-command 'keymap-meta-space)
(global-set-key (kbd "M-SPC") 'keymap-meta-space )
(define-key keymap-meta-space (kbd "n") 'suspend-frame)

; and, just in case I don't release the Meta key fast enough:
(define-key keymap-meta-space (kbd "M-n") 'suspend-frame) - Download Hi-Res Songs


Birthday Party flac

AJR. 2019. Writer: Adam Met;Jack Met;Ryan Met;Peter Ivers;David Lynch.
2 Loote

Your Side Of The Bed flac

Loote. 2018. Writer: ​Jesse Saint John;Jackson Foote;Emma Lov Block.

100 Bad Days flac

AJR. 2019. Writer: Jack Met;Adam Met;Ryan Met.
4 Joe Jonas

Longer Than I Thought flac

Joe Jonas. 2018. Writer: Patrick Nissley;Jackson Foote;Dave Katz.
5 Loote

Out Of My Head flac

Loote. 2018. Writer: Emma Lov Block;Michael Pollack;Jeremy Dussolliet;Jackson Foote.
6 Iselin Solheim

Anyone Out There flac

Iselin Solheim. 2019. Writer: Iselin Solheim;Max Grahn.
7 Loote

Wish I Never Met You flac

Loote. 2018. Writer: Jackson Foote;Alex Peter Koste;Jeremy Dussolliet;Emma Lov Block.
8 Kim Petras

Heart To Break flac

Kim Petras. 2018. Writer: Cirkut;Aaron Joseph;Dr. Luke;Jacob Kasher;Kim Petras.
9 A L E X

Out On The Trampoline At Night flac

A L E X. 2018. Writer: A L E X.
10 A L E X

I Want To Hold Your Hand flac

A L E X. 2018. Writer: A L E X.
11 A L E X

Field flac

A L E X. 2018. Writer: A L E X.
12 A L E X

Save Me flac

A L E X. 2018. Writer: A L E X.
13 Devin

Summer Lover flac

Devin. 2019. Writer: Tommy Lee James;Stuart Crichton;Oliver Heldens;Nile Rodgers;Devin Guisande.
14 A L E X

9 To 5 flac

A L E X. 2018. Writer: A L E X.
15 A L E X

Skirt flac

A L E X. 2018. Writer: A L E X.
16 Florian Picasso

Midnight Sun (Extended Version) flac

Florian Picasso. 2019.
17 Florian Picasso

Midnight Sun flac

Florian Picasso. 2019.
18 21 Savage

Enzo flac

21 Savage. 2019. Writer: YungLunchBox;Sheck Wes;Offset;Gucci Mane;21 Savage;DJ Snake.
19 Tales Of Ratatösk

Battle Of The Doomed Gods 320kbps

Tales Of Ratatösk. 2019.
20 Tales Of Ratatösk

Andro 320kbps

Tales Of Ratatösk. 2019.

Related questions

Hot questions


Popular Tags