There is a function that does this already:
(save-buffers-kill-emacs &optional ARG)
Offer to save each buffer, then kill this Emacs process.
With prefix ARG, silently save all file-visiting buffers without asking.
You can call it interactively with
C-u M-x save-buffers-kill-emacs and all files are saved without asking you and emacs quits, problem solved!
Your keybinding didn't work for two reasons:
(kbd "S-;") is not shifted ";" (i.e., ":"), it is ";" with the Super bit on. To bind to ":" just use ":" like this -
- ":" is not a prefix key, so you can't use it in a chain
(kbd ": x") without further changes. Either you need to define a prefix-map and bind it to ":" (see below), or investigate some other approach.
So, to get a save-all-and-quit bound to a key, the easiest solution is probably:
(global-set-key (kbd "C-c x")
Here the function is bound to
C-c x, but you can change it to anything else.
If you really want to use ":" as a prefix, you'd do something like this:
(global-set-key ":" my-keymap)
;; define kill-emacs:
(define-key my-keymap "x" (lambda ()
Now, of course, you've lost use of the : key for entering the ":" character. You can get it back by adding it to your keymap:
(define-key my-keymap ":" 'self-insert-command)
: x will save all buffers and kill emacs, and
: : will enter a ":".