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) 

HighResolutionMusic.com - Download Hi-Res Songs

1 Alan Walker

Different World flac

Alan Walker. 2018. Writer: Shy Nodi;Alan Walker;Fredrik Borch Olsen;James Njie;Marcus Arnbekk;Gunnar Greve Pettersen;K-391;Corsak;Shy Martin;Magnus Bertelsen.
2 Skylar Grey

Everything I Need flac

Skylar Grey. 2018.
3

Tell Me It's Over

4 Ariana Grande

​Thank U, Next flac

Ariana Grande. 2018. Writer: Crazy Mike;Scootie;Victoria Monét;Tayla Parx;TBHits;Ariana Grande.
5 Julian Jordan

Glitch flac

Julian Jordan. 2018.
6 Mesto

Wait Another Day flac

Mesto. 2018.
7 The Chainsmokers

Hope flac

The Chainsmokers. 2018. Writer: Kate Morgan;Chris Lyon;Alex Pall;Andrew Taggart.
8 Anne-Marie

Rewrite The Stars flac

Anne-Marie. 2018. Writer: Benj Pasek;Justin Paul.
9 Ariana Grande

Imagine flac

Ariana Grande. 2018. Writer: Jameel Roberts;Priscilla Renea;Happy Perez;Andrew "Pop" Wansel;Ariana Grande.
10 Rita Ora

Let You Love Me flac

Rita Ora. 2018. Writer: Rita Ora;Easyfun;Fred Gibson;Noonie Bao;LotusIV;Ilsey Juber.
11 Alan Walker

Lily flac

Alan Walker. 2018.
12 Alan Walker

Lost Control flac

Alan Walker. 2018.
13 Emma Hewitt

Take Everything flac

Emma Hewitt. 2018. Writer: G. Emery;E. Hewitt;A. Hewitt.
14 Conor Maynard

How You Love Me flac

Conor Maynard. 2018. Writer: Yoshi Breen;Thom Bridges;Hardwell;Rik Annema;Conor Maynard;Cimo Fränkel;Snoop Dogg.
15 ZAYN

There You Are flac

ZAYN. 2018. Writer: Joe Garrett;Levi Lennox;Michael Hannides;Anthony Hannides;ZAYN.
16 Pollyanna

Starchild flac

Pollyanna. 2018.
17 (G)I-DLE

POP/STARS flac

(G)I-DLE. 2018. Writer: Riot Music Team;Harloe.
18 Fitz And The Tantrums

HandClap flac

Fitz And The Tantrums. 2017. Writer: Fitz And The Tantrums;Eric Frederic;Sam Hollander.
19 Mark Ronson

Nothing Breaks Like A Heart flac

Mark Ronson. 2018. Writer: Thomas Brenneck;Maxime Picard;Ilsey Juber;Conor Szymanski;Clement Picard;Mark Ronson;Miley Cyrus.
20 Alan Walker

I Don't Wanna Go flac

Alan Walker. 2018.

Related questions

Hot questions

Language

Popular Tags