Your ~/.emacs config is fairly straightforward and does the job. Here are some optimizations and improvements for readability, style, and some minor efficiency gains:
- Use
setq for setting variables instead of setq-default unless you want to set buffer-local default values.
- Replace
(quote ...) with '... for readability.
- Group related configurations.
- Avoid repeated calls to
set-face-* when using custom-set-faces.
- Use
with-eval-after-load for loading external files if they depend on something (optional).
- Use
push instead of add-to-list if adding at the front is preferred.
- Organize the file with comments and spacing.
Here's your optimized ~/.emacs:
;;; fullscreen
(custom-set-variables
'(initial-frame-alist '((fullscreen . maximized))))
;;; Disable GUI elements
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(horizontal-scroll-bar-mode -1)
;;; Basic defaults
(setq major-mode 'text-mode ;; default major mode
large-file-warning-threshold nil ;; disable large file warnings
make-backup-files nil ;; disable backup files
column-number-mode t ;; enable column number globally
inhibit-startup-screen t) ;; disable startup screen
;;; Appearance
(add-to-list 'load-path "~/.emacs.d/libs")
(add-to-list 'default-frame-alist '(background-color . "#c0c0c0"))
(custom-set-faces
'(region ((t (:background "#000080"))))
'(fringe ((t (:background "#c0c0c0"))))
'(default ((t (:family "Iosevka Term" :height 240))))) ;; height=24pt * 10
;;; Load custom elisp
(load "~/.emacs.d/pascalkeyz.el")
(load "~/.emacs.d/veteres-acies-audax.el")
;;; Enable disabled commands
(put 'upcase-region 'disabled nil)
;;; Remove auto-fill from text-mode hook
(remove-hook 'text-mode-hook 'turn-on-auto-fill)
Explanation of the main changes:
custom-set-faces handles all face customization in one place.
- Use
:family and :height in set-face-attribute is equivalent to specifying font and size. Height is given in 1/10 pt units, so 24pt font is 240.
- Used
setq instead of setq-default for major-mode, since major-mode is usually buffer-local and something you normally set per buffer, but in practice it still can be used to set the default major mode for new buffers.
- Grouped related settings and added comments for clarity.
If you want to improve performance more or maintainability, consider switching to use-package declarations or modularizing your config, but for a simple config this is clean and effective.