Move Emacs default settings to (almost) the top
This commit is contained in:
parent
224c12a060
commit
cde06cd98d
@ -669,14 +669,15 @@ From [[http://whattheemacsd.com/file-defuns.el-02.html][whattheemacsd.org]].
|
|||||||
(message "File '%s' successfully removed" filename)))))
|
(message "File '%s' successfully removed" filename)))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* Emacs configuration
|
* Set up the very basics
|
||||||
|
|
||||||
** Set up the really basic things
|
Now that we have package management configured we can set up defaults more easily. This includes every builtin packages, font faces, and the like.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package emacs
|
(use-package emacs
|
||||||
:ensure nil
|
:ensure nil
|
||||||
:init
|
:init
|
||||||
|
;; Required for Consult/Vertico
|
||||||
(defun crm-indicator (args)
|
(defun crm-indicator (args)
|
||||||
(cons (format "[CRM%s] %s"
|
(cons (format "[CRM%s] %s"
|
||||||
(replace-regexp-in-string
|
(replace-regexp-in-string
|
||||||
@ -685,6 +686,11 @@ From [[http://whattheemacsd.com/file-defuns.el-02.html][whattheemacsd.org]].
|
|||||||
(car args))
|
(car args))
|
||||||
(cdr args)))
|
(cdr args)))
|
||||||
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
|
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
|
||||||
|
(setq frame-title-format '((:eval (concat system-name
|
||||||
|
": "
|
||||||
|
(if (buffer-file-name)
|
||||||
|
(abbreviate-file-name (buffer-file-name))
|
||||||
|
"%b")))))
|
||||||
:custom
|
:custom
|
||||||
(user-full-name "Gergely Polonkai")
|
(user-full-name "Gergely Polonkai")
|
||||||
(user-mail-address "gergely@polonkai.eu")
|
(user-mail-address "gergely@polonkai.eu")
|
||||||
@ -700,7 +706,29 @@ From [[http://whattheemacsd.com/file-defuns.el-02.html][whattheemacsd.org]].
|
|||||||
(minibuffer-setup . cursor-intangible-mode))
|
(minibuffer-setup . cursor-intangible-mode))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Set up some default faces
|
** Set Org’s main directory
|
||||||
|
|
||||||
|
Since a lot of packages (org-projectile, org-caldav, etc.) rely on it, it needs to be set as early as possible.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq org-directory (expand-file-name "NextCloud/orgmode" user-documents-directory))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Set up my personal keymap
|
||||||
|
|
||||||
|
I set it up at the beginning so i can use it with ~use-package~ invocations from early on
|
||||||
|
|
||||||
|
This might (should?) become a [[*general][general]] map later.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(defvar gpolonkai/pers-map (make-sparse-keymap)
|
||||||
|
"My own, personal, keymap!")
|
||||||
|
(define-prefix-command 'gpolonkai/pers-map)
|
||||||
|
(define-key ctl-x-map "t" 'gpolonkai/pers-map)
|
||||||
|
(define-key global-map (kbd "C-t") 'gpolonkai/pers-map)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Set up some faces
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package faces
|
(use-package faces
|
||||||
@ -710,7 +738,7 @@ From [[http://whattheemacsd.com/file-defuns.el-02.html][whattheemacsd.org]].
|
|||||||
(trailing-whitespace ((t (:inherit nil :background "red3")))))
|
(trailing-whitespace ((t (:inherit nil :background "red3")))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Use ligatures
|
*** Fira Code comes with nice ligatures, let’s use them!
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package ligature
|
(use-package ligature
|
||||||
@ -784,49 +812,40 @@ From [[http://whattheemacsd.com/file-defuns.el-02.html][whattheemacsd.org]].
|
|||||||
(global-ligature-mode t))
|
(global-ligature-mode t))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Set up my personal keymap
|
** Set the default font and configure font resizing
|
||||||
|
|
||||||
I set it up early so i can use it in ~use-package~ calls immediately.
|
Before this can be used, make sure the [[https://zhm.github.io/symbola/][Symbola]] font is installed.
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defvar gpolonkai/pers-map (make-sparse-keymap)
|
(defun gpolonkai/set-font-size (frame)
|
||||||
"My own, personal, keymap!")
|
(when (display-graphic-p frame)
|
||||||
(define-prefix-command 'gpolonkai/pers-map)
|
(set-face-attribute 'default frame :font "Fira Code Retina-14")
|
||||||
(define-key ctl-x-map "t" 'gpolonkai/pers-map)
|
(set-frame-font "Fira Code Retina-14" t (list frame))))
|
||||||
(define-key global-map (kbd "C-t") 'gpolonkai/pers-map)
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** I really don’t want to type more than i really must…
|
(defun --set-emoji-font (frame)
|
||||||
|
"Adjust the font setting of FRAME so Emacs can display Emoji properly."
|
||||||
|
(when (display-graphic-p frame)
|
||||||
|
(set-fontset-font t 'symbol
|
||||||
|
(font-spec :family "Symbola")
|
||||||
|
frame 'prepend)
|
||||||
|
(set-fontset-font t 'unicode
|
||||||
|
"Noto Emoji"
|
||||||
|
nil 'append)))
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
(add-hook 'after-make-frame-functions 'gpolonkai/set-font-size)
|
||||||
(defalias 'yes-or-no-p 'y-or-n-p)
|
(add-hook 'after-make-frame-functions '--set-emoji-font)
|
||||||
#+END_SRC
|
|
||||||
|
(gpolonkai/set-font-size nil)
|
||||||
|
(--set-emoji-font nil)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** Set UTF-8 as the default encoding
|
** Set UTF-8 as the default encoding
|
||||||
|
|
||||||
Just to make sure, although most Linux DEs do this for me.
|
Just to make sure, although most Linux DEs do this for me.
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(set-language-environment "UTF-8")
|
(set-language-environment "UTF-8")
|
||||||
(set-default-coding-systems 'utf-8)
|
(set-default-coding-systems 'utf-8)
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** Set Org’s main directory
|
|
||||||
|
|
||||||
Since a lot of packages use it as their base (org-projectile, org-caldav, etc.), i need
|
|
||||||
it as early as possible.
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(setq org-directory (expand-file-name "NextCloud/orgmode" user-documents-directory))
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** ~simple.el~ settings
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package simple
|
|
||||||
:ensure nil
|
|
||||||
:custom
|
|
||||||
(column-number-mode t))
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Default frame settings
|
** Default frame settings
|
||||||
@ -835,9 +854,60 @@ it as early as possible.
|
|||||||
(use-package frame
|
(use-package frame
|
||||||
:ensure nil
|
:ensure nil
|
||||||
:custom
|
:custom
|
||||||
|
;; Make that cursor blink!
|
||||||
(blink-cursor-mode t))
|
(blink-cursor-mode t))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
** I really don’t want to type more than i really must…
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Tweak window chrome, AKA let’s set up the UI
|
||||||
|
|
||||||
|
Turn off the scroll bar (that’s why Nyan-cat is here), the toolbar (I don’t really use it), and
|
||||||
|
the menu bar (I rarely use it, and in those rare occasions I can simply turn it on.)
|
||||||
|
|
||||||
|
Also, maximise the frame.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(tool-bar-mode 0)
|
||||||
|
(menu-bar-mode 0)
|
||||||
|
(when window-system
|
||||||
|
(scroll-bar-mode -1))
|
||||||
|
|
||||||
|
(set-frame-parameter nil 'fullscreen 'maximized)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Enable all the commands!
|
||||||
|
|
||||||
|
These are disabled for a reason, but i’m a rockstar, so who cares‽
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(put 'downcase-region 'disabled nil)
|
||||||
|
(put 'upcase-region 'disabled nil)
|
||||||
|
(put 'erase-buffer 'disabled nil)
|
||||||
|
(put 'narrow-to-region 'disabled nil)
|
||||||
|
(put 'narrow-to-page 'disabled nil)
|
||||||
|
(put 'set-goal-column 'disabled nil)
|
||||||
|
(put 'scroll-left 'disabled nil)
|
||||||
|
(put 'dired-find-alternate-file 'disabled nil)
|
||||||
|
(put 'Info-edit 'disabled nil)
|
||||||
|
(put 'list-timers 'disabled nil)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
* Emacs configuration
|
||||||
|
|
||||||
|
** ~simple.el~ settings
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package simple
|
||||||
|
:ensure nil
|
||||||
|
:custom
|
||||||
|
(column-number-mode t))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* Custom commands and functions
|
* Custom commands and functions
|
||||||
|
|
||||||
** Frame manipulation
|
** Frame manipulation
|
||||||
@ -961,51 +1031,6 @@ Let’s see if i can get my brain more organised this way…
|
|||||||
(org-roam-ui-open-on-start nil))
|
(org-roam-ui-open-on-start nil))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* UI preferences
|
|
||||||
|
|
||||||
** Tweak window chrome
|
|
||||||
|
|
||||||
Turn off the scroll bar (that’s why Nyan-cat is here), the toolbar (I don’t really use it), and
|
|
||||||
the menu bar (I rarely use it, and in those rare occasions I can simply turn it on.)
|
|
||||||
|
|
||||||
Also, maximise the frame.
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(tool-bar-mode 0)
|
|
||||||
(menu-bar-mode 0)
|
|
||||||
(when window-system
|
|
||||||
(scroll-bar-mode -1))
|
|
||||||
|
|
||||||
(set-frame-parameter nil 'fullscreen 'maximized)
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** Set the default font and configure font resizing
|
|
||||||
|
|
||||||
Before this can be used, make sure the [[https://zhm.github.io/symbola/][Symbola]] font is installed.
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(defun gpolonkai/set-font-size (frame)
|
|
||||||
(when (display-graphic-p frame)
|
|
||||||
(set-face-attribute 'default frame :font "Fira Code Retina-14")
|
|
||||||
(set-frame-font "Fira Code Retina-14" t (list frame))))
|
|
||||||
|
|
||||||
(defun --set-emoji-font (frame)
|
|
||||||
"Adjust the font setting of FRAME so Emacs can display Emoji properly."
|
|
||||||
(when (display-graphic-p frame)
|
|
||||||
(set-fontset-font t 'symbol
|
|
||||||
(font-spec :family "Symbola")
|
|
||||||
frame 'prepend)
|
|
||||||
(set-fontset-font t 'unicode
|
|
||||||
"Noto Emoji"
|
|
||||||
nil 'append)))
|
|
||||||
|
|
||||||
(add-hook 'after-make-frame-functions 'gpolonkai/set-font-size)
|
|
||||||
(add-hook 'after-make-frame-functions '--set-emoji-font)
|
|
||||||
|
|
||||||
(gpolonkai/set-font-size nil)
|
|
||||||
(--set-emoji-font nil)
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
* Set up global minor modes provided by Emacs
|
* Set up global minor modes provided by Emacs
|
||||||
|
|
||||||
** Pretty lambdas
|
** Pretty lambdas
|
||||||
@ -1028,39 +1053,12 @@ And set up all the pretty symbols.
|
|||||||
("or" . ?∨)))
|
("or" . ?∨)))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Finally, set the frame title to the current file name
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(setq frame-title-format '((:eval (concat system-name
|
|
||||||
": "
|
|
||||||
(if (buffer-file-name)
|
|
||||||
(abbreviate-file-name (buffer-file-name))
|
|
||||||
"%b")))))
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** Treat soft line breaks as hard ones in textual modes
|
** Treat soft line breaks as hard ones in textual modes
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(add-hook 'text-mode-hook (lambda () (visual-line-mode t)))
|
(add-hook 'text-mode-hook (lambda () (visual-line-mode t)))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Enable disabled commands
|
|
||||||
|
|
||||||
Because i’m a rock star like that.
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(put 'downcase-region 'disabled nil)
|
|
||||||
(put 'upcase-region 'disabled nil)
|
|
||||||
(put 'erase-buffer 'disabled nil)
|
|
||||||
(put 'narrow-to-region 'disabled nil)
|
|
||||||
(put 'narrow-to-page 'disabled nil)
|
|
||||||
(put 'set-goal-column 'disabled nil)
|
|
||||||
(put 'scroll-left 'disabled nil)
|
|
||||||
(put 'dired-find-alternate-file 'disabled nil)
|
|
||||||
(put 'Info-edit 'disabled nil)
|
|
||||||
(put 'list-timers 'disabled nil)
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
* Load some built-in libraries
|
* Load some built-in libraries
|
||||||
|
|
||||||
** ~thingatpt~
|
** ~thingatpt~
|
||||||
|
Loading…
x
Reference in New Issue
Block a user