#+TITLE: Key - Emacs #+AUTHOR: Juan Placencia * Package Define Emacs key package. #+BEGIN_SRC emacs-lisp (use-package emacs :after uno-key :config (provide 'uno-key-emacs)) #+END_SRC * Keybinds Define core keybinds. #+BEGIN_SRC emacs-lisp (use-package emacs :after uno-key-emacs :custom (confirm-kill-emacs 'y-or-n-p) :general (uno-leader-define :placebo t ;; Dummy keyword required to use variable name below uno-leader-key '(execute-extended-command :which-key "Execute command") "f" '(:ignore t :which-key "File") "fe" '(:ignore t :which-key "Emacs") "fR" '(uno/key/emacs/rename-file :which-key "Rename file") "fs" '(save-buffer :which-key "Save file") "fS" '(uno/key/emacs/save-all-files :which-key "Save all files") "h" '(:ignore t :which-key "Help") "hd" '(:ignore t :which-key "Describe") "hdb" '(describe-bindings :which-key "Describe bindings") "hdc" '(describe-char :which-key "Describe char") "hdF" '(describe-face :which-key "Describe face") "hdm" '(describe-mode :which-key "Describe mode") "hdp" '(describe-package :which-key "Describe package") "hdt" '(describe-theme :which-key "Describe theme") "q" '(:ignore t :which-key "Quit") "qq" '(save-buffers-kill-terminal :which-key "Save all and quit Emacs") "qQ" '(kill-emacs :which-key "Quit Emacs") "qx" '(save-buffers-kill-emacs :which-key "Save all and kill Emacs") "t" '(:ignore t :which-key "Toggle")) :init (defun uno/key/emacs/save-all-files () "Save all files." (interactive) (save-some-buffers t (lambda () (and (not buffer-read-only) (buffer-file-name)))))) #+END_SRC ** Restart Emacs Use =restart-emacs= to handle different edge cases. #+BEGIN_SRC emacs-lisp (use-package restart-emacs :after uno-key-emacs :custom (restart-emacs-restore-frames t) :general (uno-leader-define "qr" '(restart-emacs :which-key "Restart Emacs"))) #+END_SRC