Emacs: Clean up main settings.
parent
a4de491950
commit
6456632d18
|
@ -12,8 +12,50 @@
|
||||||
;;; Force on using the minibuffer instead.
|
;;; Force on using the minibuffer instead.
|
||||||
(setq use-dialog-box nil)
|
(setq use-dialog-box nil)
|
||||||
|
|
||||||
;;; Timeout before echoing the prefix of an unfinished keystroke.
|
(setq
|
||||||
(setq echo-keystrokes 0.5)
|
recentf-max-saved-items 100
|
||||||
|
disabled-command-function nil ; Enable all disabled commands.
|
||||||
|
scroll-error-top-bottom t ; Alternative scrolling
|
||||||
|
kill-whole-line t ; Kill whole line including \n.
|
||||||
|
scroll-step 1 ; Line by line scrolling
|
||||||
|
calendar-week-start-day 1
|
||||||
|
calendar-date-style 'iso
|
||||||
|
comint-prompt-read-only t
|
||||||
|
woman-fill-column fill-column
|
||||||
|
abbrev-file-name (expand-file-name "abbrev_defs" "~/personal")
|
||||||
|
frame-title-format (concat "%b" (unless (daemonp) " [serverless]"))
|
||||||
|
delete-by-moving-to-trash t
|
||||||
|
uniquify-buffer-name-style 'forward
|
||||||
|
vc-follow-symlinks t ; Disable prompt (but leave warning) on git symlink.
|
||||||
|
sort-fold-case t
|
||||||
|
|
||||||
|
;;; Clipboard and primary selection.
|
||||||
|
select-enable-primary t
|
||||||
|
save-interprogram-paste-before-kill t
|
||||||
|
|
||||||
|
;;; Save all visited URLs.
|
||||||
|
url-history-track t
|
||||||
|
url-history-file (expand-file-name "url/history" user-emacs-directory)
|
||||||
|
|
||||||
|
;; Timeout before echoing the prefix of an unfinished keystroke.
|
||||||
|
echo-keystrokes 0.5
|
||||||
|
|
||||||
|
;; Disable autosave features.
|
||||||
|
auto-save-default nil
|
||||||
|
auto-save-list-file-prefix nil
|
||||||
|
|
||||||
|
;; Place backup files in specific directory.
|
||||||
|
backup-directory-alist
|
||||||
|
`(("." . ,(expand-file-name "backups" user-emacs-directory)))
|
||||||
|
|
||||||
|
;; Enforce horizontal splitting. 140 means that the window is large enough to
|
||||||
|
;; hold 2 other windows of 70 columns.
|
||||||
|
split-height-threshold nil
|
||||||
|
split-width-threshold 140
|
||||||
|
|
||||||
|
;; TODO: Ediff does not seem to auto-refine. Bug? Compare daemon and no-daemon.
|
||||||
|
ediff-window-setup-function 'ediff-setup-windows-plain
|
||||||
|
ediff-split-window-function 'split-window-horizontally)
|
||||||
|
|
||||||
;;; Remember last cursor position.
|
;;; Remember last cursor position.
|
||||||
(save-place-mode)
|
(save-place-mode)
|
||||||
|
@ -21,35 +63,17 @@
|
||||||
;;; allows to save places at a strategic moment.
|
;;; allows to save places at a strategic moment.
|
||||||
(add-hook 'before-save-hook 'save-place-kill-emacs-hook)
|
(add-hook 'before-save-hook 'save-place-kill-emacs-hook)
|
||||||
|
|
||||||
;;; Recent files.
|
(savehist-mode) ; Save M-: history.
|
||||||
(setq recentf-max-saved-items 100)
|
|
||||||
|
|
||||||
;;; Save M-: history.
|
(setq-default major-mode 'text-mode) ; Default mode.
|
||||||
(savehist-mode)
|
|
||||||
|
|
||||||
;;; Disable autosave features.
|
|
||||||
(setq auto-save-default nil)
|
|
||||||
(setq auto-save-list-file-prefix nil)
|
|
||||||
|
|
||||||
;;; Place backup files in specific directory.
|
|
||||||
(setq backup-directory-alist
|
|
||||||
`(("." . ,(expand-file-name "backups" user-emacs-directory))))
|
|
||||||
|
|
||||||
;;; Default mode
|
|
||||||
(setq-default major-mode 'text-mode)
|
|
||||||
|
|
||||||
;;; Disable suspend key since it is useless on Emacs server.
|
;;; Disable suspend key since it is useless on Emacs server.
|
||||||
(global-unset-key (kbd "C-z"))
|
(global-unset-key (kbd "C-z"))
|
||||||
(global-unset-key (kbd "C-x C-z"))
|
(global-unset-key (kbd "C-x C-z"))
|
||||||
|
|
||||||
;;; Make questions less annoying.
|
(defalias 'yes-or-no-p 'y-or-n-p) ; Make questions less annoying.
|
||||||
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
||||||
|
|
||||||
;;; Enable all disabled commands.
|
(size-indication-mode 1) ; Print buffer size in mode line.
|
||||||
(setq disabled-command-function nil)
|
|
||||||
|
|
||||||
;;; Print buffer size in mode line.
|
|
||||||
(size-indication-mode 1)
|
|
||||||
|
|
||||||
;;; Display defun in mode line.
|
;;; Display defun in mode line.
|
||||||
;; (which-function-mode)
|
;; (which-function-mode)
|
||||||
|
@ -78,20 +102,11 @@
|
||||||
(setq auto-revert-interval 1)
|
(setq auto-revert-interval 1)
|
||||||
(add-hook 'auto-revert-tail-mode-hook 'ambrevar/turn-on-absolute-line-number)
|
(add-hook 'auto-revert-tail-mode-hook 'ambrevar/turn-on-absolute-line-number)
|
||||||
|
|
||||||
;;; Alternative scrolling
|
|
||||||
(setq scroll-error-top-bottom t)
|
|
||||||
|
|
||||||
;;; Kill whole line including \n.
|
|
||||||
(setq kill-whole-line t)
|
|
||||||
|
|
||||||
;;; Indentation
|
;;; Indentation
|
||||||
(setq-default tab-width 2)
|
(setq-default tab-width 2)
|
||||||
(defvaralias 'standard-indent 'tab-width)
|
(defvaralias 'standard-indent 'tab-width)
|
||||||
(setq-default indent-tabs-mode t)
|
(setq-default indent-tabs-mode t)
|
||||||
|
|
||||||
;;; Line by line scrolling
|
|
||||||
(setq scroll-step 1)
|
|
||||||
|
|
||||||
(setq
|
(setq
|
||||||
whitespace-style
|
whitespace-style
|
||||||
'(face empty indentation space-after-tab space-before-tab tab-mark trailing))
|
'(face empty indentation space-after-tab space-before-tab tab-mark trailing))
|
||||||
|
@ -116,12 +131,6 @@
|
||||||
(when (getenv "MANWIDTH")
|
(when (getenv "MANWIDTH")
|
||||||
(setq-default fill-column (string-to-number (getenv "MANWIDTH"))))
|
(setq-default fill-column (string-to-number (getenv "MANWIDTH"))))
|
||||||
(add-hook 'text-mode-hook 'turn-on-auto-fill)
|
(add-hook 'text-mode-hook 'turn-on-auto-fill)
|
||||||
;; (setq sentence-end-double-space nil)
|
|
||||||
|
|
||||||
;;; Enforce horizontal splitting. 140 means that the window is large enough to
|
|
||||||
;;; hold 2 other windows of 70 columns.
|
|
||||||
(setq split-height-threshold nil
|
|
||||||
split-width-threshold 140)
|
|
||||||
|
|
||||||
;;; Windmove mode
|
;;; Windmove mode
|
||||||
;;; By default, it allows easy window switching with Shift+arrows. I like to
|
;;; By default, it allows easy window switching with Shift+arrows. I like to
|
||||||
|
@ -154,7 +163,6 @@
|
||||||
(executable-find browse-url-kde-program)
|
(executable-find browse-url-kde-program)
|
||||||
(executable-find browse-url-conkeror-program)
|
(executable-find browse-url-conkeror-program)
|
||||||
(executable-find browse-url-chrome-program)))
|
(executable-find browse-url-chrome-program)))
|
||||||
(setq shr-external-browser browse-url-browser-function)
|
|
||||||
(setq browse-url-browser-function '(;; TODO: Display hyperspec in other window.
|
(setq browse-url-browser-function '(;; TODO: Display hyperspec in other window.
|
||||||
("http://www.lispworks.com/reference/HyperSpec/.*" . eww-browse-url)
|
("http://www.lispworks.com/reference/HyperSpec/.*" . eww-browse-url)
|
||||||
("file:///.*HyperSpec.*" . eww-browse-url)
|
("file:///.*HyperSpec.*" . eww-browse-url)
|
||||||
|
@ -164,7 +172,8 @@
|
||||||
(setq shr-width (string-to-number (or (getenv "MANWIDTH") "80"))
|
(setq shr-width (string-to-number (or (getenv "MANWIDTH") "80"))
|
||||||
;; If you're using a dark theme, and the messages are hard to read, it
|
;; If you're using a dark theme, and the messages are hard to read, it
|
||||||
;; can help to change the luminosity, e.g.:
|
;; can help to change the luminosity, e.g.:
|
||||||
shr-color-visible-luminance-min 80)
|
shr-color-visible-luminance-min 80
|
||||||
|
shr-external-browser browse-url-browser-function)
|
||||||
|
|
||||||
;;; Extend MIME-types support for videos.
|
;;; Extend MIME-types support for videos.
|
||||||
(with-eval-after-load 'mailcap
|
(with-eval-after-load 'mailcap
|
||||||
|
@ -191,22 +200,15 @@
|
||||||
(show-paren-mode 1)
|
(show-paren-mode 1)
|
||||||
;;; By default, there’s a small delay before showing a matching parenthesis. Set
|
;;; By default, there’s a small delay before showing a matching parenthesis. Set
|
||||||
;;; it to 0 to deactivate.
|
;;; it to 0 to deactivate.
|
||||||
(setq show-paren-delay 0)
|
(setq show-paren-delay 0
|
||||||
(setq show-paren-when-point-inside-paren t)
|
show-paren-when-point-inside-paren t)
|
||||||
|
|
||||||
;;; Electric Pairs to auto-complete () [] {} "" etc. It works on regions.
|
;;; Electric Pairs to auto-complete () [] {} "" etc. It works on regions.
|
||||||
;; (electric-pair-mode)
|
;; (electric-pair-mode)
|
||||||
|
|
||||||
;;; Spawn terminal shortcut: WM's binding is s+<return>.
|
|
||||||
(global-set-key (kbd "C-x M-<return>") 'spawn-terminal)
|
|
||||||
|
|
||||||
;;; Calendar ISO display.
|
|
||||||
(setq calendar-week-start-day 1)
|
|
||||||
(setq calendar-date-style 'iso)
|
|
||||||
|
|
||||||
;;; Compilation bindings and conveniences.
|
;;; Compilation bindings and conveniences.
|
||||||
(setq compilation-ask-about-save nil)
|
(setq compilation-ask-about-save nil
|
||||||
(setq compilation-scroll-output 'first-error)
|
compilation-scroll-output 'first-error)
|
||||||
(with-eval-after-load 'compile
|
(with-eval-after-load 'compile
|
||||||
;; Making `compilation-directory' local only works with `recompile'
|
;; Making `compilation-directory' local only works with `recompile'
|
||||||
;; and if `compile' is never used. In such a scenario,
|
;; and if `compile' is never used. In such a scenario,
|
||||||
|
@ -232,14 +234,6 @@
|
||||||
;; Do not use `recompile' since we want to change the compilation folder for the current buffer.
|
;; Do not use `recompile' since we want to change the compilation folder for the current buffer.
|
||||||
"<f6>" 'ambrevar/compile-last-command)
|
"<f6>" 'ambrevar/compile-last-command)
|
||||||
|
|
||||||
;;; REVIEW: Bug 26658 reports that cc-modes mistakenly does not make use of prog-mode-map.
|
|
||||||
;;; The following line is a suggested work-around.
|
|
||||||
;;; This should be fixed in Emacs 26.
|
|
||||||
(eval-after-load 'cc-mode '(set-keymap-parent c-mode-base-map prog-mode-map))
|
|
||||||
|
|
||||||
;;; Comint mode
|
|
||||||
(setq comint-prompt-read-only t)
|
|
||||||
|
|
||||||
;;; Desktop-mode
|
;;; Desktop-mode
|
||||||
;;; REVIEW: `desktop-kill' should not query the user in `kill-emacs-hook'.
|
;;; REVIEW: `desktop-kill' should not query the user in `kill-emacs-hook'.
|
||||||
;;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28943
|
;;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28943
|
||||||
|
@ -255,7 +249,7 @@
|
||||||
(or (not (boundp 'desktop-save-mode))
|
(or (not (boundp 'desktop-save-mode))
|
||||||
(null desktop-save-mode)))
|
(null desktop-save-mode)))
|
||||||
(when (< emacs-major-version 27)
|
(when (< emacs-major-version 27)
|
||||||
;; By default, Emacs<27 prompts for unsafe variable when loading desktop
|
;; TODO: By default, Emacs<27 prompts for unsafe variable when loading desktop
|
||||||
;; which stucks the daemon. Disable this behaviour.
|
;; which stucks the daemon. Disable this behaviour.
|
||||||
(defun ambrevar/enable-safe-local-variables ()
|
(defun ambrevar/enable-safe-local-variables ()
|
||||||
(setq enable-local-variables t))
|
(setq enable-local-variables t))
|
||||||
|
@ -312,9 +306,6 @@
|
||||||
;; server-mode does not seem to have any post-start hook.
|
;; server-mode does not seem to have any post-start hook.
|
||||||
(advice-add 'server-start :after #'ambrevar/desktop-setup)
|
(advice-add 'server-start :after #'ambrevar/desktop-setup)
|
||||||
|
|
||||||
;;; Buffer names.
|
|
||||||
(setq uniquify-buffer-name-style 'forward)
|
|
||||||
|
|
||||||
;;; Skeleton settings
|
;;; Skeleton settings
|
||||||
(when (require 'patch-skeletons nil 'noerror)
|
(when (require 'patch-skeletons nil 'noerror)
|
||||||
;;; Do not expand abbrevs in skeletons.
|
;;; Do not expand abbrevs in skeletons.
|
||||||
|
@ -324,14 +315,6 @@
|
||||||
"C->" 'skeleton-next-position
|
"C->" 'skeleton-next-position
|
||||||
"C-<" 'skeleton-previous-position))
|
"C-<" 'skeleton-previous-position))
|
||||||
|
|
||||||
;;; Disable prompt (but leave warning) on git symlink.
|
|
||||||
(setq vc-follow-symlinks t)
|
|
||||||
|
|
||||||
;;; Clipboard and primary selection.
|
|
||||||
;; (setq select-enable-clipboard t)
|
|
||||||
(setq select-enable-primary t
|
|
||||||
save-interprogram-paste-before-kill t)
|
|
||||||
|
|
||||||
;;; Move mouse away.
|
;;; Move mouse away.
|
||||||
(mouse-avoidance-mode 'banish)
|
(mouse-avoidance-mode 'banish)
|
||||||
;;; That binding is not very useful and gets in the way of C-<mouse-1>.
|
;;; That binding is not very useful and gets in the way of C-<mouse-1>.
|
||||||
|
@ -345,27 +328,12 @@
|
||||||
"C-<mouse-4>" 'text-scale-increase)
|
"C-<mouse-4>" 'text-scale-increase)
|
||||||
(setq text-scale-mode-step 1.1)
|
(setq text-scale-mode-step 1.1)
|
||||||
|
|
||||||
;;; Sort
|
|
||||||
(setq sort-fold-case t)
|
|
||||||
|
|
||||||
;;; Replace not-so-useful comment-dwim binding.
|
;;; Replace not-so-useful comment-dwim binding.
|
||||||
(global-set-key (kbd "M-;") 'comment-line)
|
(global-set-key (kbd "M-;") 'comment-line)
|
||||||
|
|
||||||
;;; Eldoc: Disable if too distracting.
|
|
||||||
;; (global-eldoc-mode 0)
|
|
||||||
;; (setq eldoc-idle-delay 0.1) ; Could be even more distracting.
|
|
||||||
|
|
||||||
;;; Replace `kill-buffer' binding by `kill-this-buffer'.
|
;;; Replace `kill-buffer' binding by `kill-this-buffer'.
|
||||||
(global-set-key (kbd "C-x k") 'kill-this-buffer)
|
(global-set-key (kbd "C-x k") 'kill-this-buffer)
|
||||||
|
|
||||||
;;; Ediff
|
|
||||||
;;; TODO: Ediff does not seem to auto-refine. Bug? Compare daemon and no-daemon.
|
|
||||||
(setq ediff-window-setup-function 'ediff-setup-windows-plain
|
|
||||||
ediff-split-window-function 'split-window-horizontally)
|
|
||||||
|
|
||||||
;;; Trash
|
|
||||||
(setq delete-by-moving-to-trash t)
|
|
||||||
|
|
||||||
;;; Display Time World
|
;;; Display Time World
|
||||||
(setq
|
(setq
|
||||||
zoneinfo-style-world-list
|
zoneinfo-style-world-list
|
||||||
|
@ -380,9 +348,6 @@
|
||||||
("America/New_York" "New York")
|
("America/New_York" "New York")
|
||||||
("America/Los_Angeles" "Los Angeles")))
|
("America/Los_Angeles" "Los Angeles")))
|
||||||
|
|
||||||
;;; Frame title
|
|
||||||
(setq frame-title-format (concat "%b" (unless (daemonp) " [serverless]")))
|
|
||||||
|
|
||||||
;;; Initial scratch buffer message.
|
;;; Initial scratch buffer message.
|
||||||
(require 'functions) ; For `ambrevar/fortune-scratch-message'.
|
(require 'functions) ; For `ambrevar/fortune-scratch-message'.
|
||||||
(let ((fortune (ambrevar/fortune-scratch-message)))
|
(let ((fortune (ambrevar/fortune-scratch-message)))
|
||||||
|
@ -401,19 +366,11 @@
|
||||||
;; edebug-test-coverage t
|
;; edebug-test-coverage t
|
||||||
;; edebug-trace t)
|
;; edebug-trace t)
|
||||||
|
|
||||||
|
|
||||||
;;; Make windowing more reactive on. This is especially true with Helm on EXWM.
|
;;; Make windowing more reactive on. This is especially true with Helm on EXWM.
|
||||||
|
;; TODO: Test if still a problem with Emacs 27.
|
||||||
(when (= emacs-major-version 26)
|
(when (= emacs-major-version 26)
|
||||||
(setq x-wait-for-event-timeout nil))
|
(setq x-wait-for-event-timeout nil))
|
||||||
|
|
||||||
(setq woman-fill-column fill-column)
|
|
||||||
|
|
||||||
;;; Save all visited URLs.
|
|
||||||
(setq url-history-track t
|
|
||||||
url-history-file (expand-file-name "url/history" user-emacs-directory))
|
|
||||||
|
|
||||||
(setq abbrev-file-name (expand-file-name "abbrev_defs" "~/personal"))
|
|
||||||
|
|
||||||
(when (require 'so-long nil 'noerror)
|
(when (require 'so-long nil 'noerror)
|
||||||
(global-so-long-mode 1))
|
(global-so-long-mode 1))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue