General refactors & optimizations

This commit is contained in:
Henrik Lissner 2019-04-29 18:54:46 -04:00
parent 087127a31d
commit 9735f034e1
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
4 changed files with 14 additions and 24 deletions

View file

@ -39,6 +39,8 @@ detected.")
scroll-conservatively 1001
scroll-margin 2
scroll-preserve-screen-position t
mouse-wheel-scroll-amount '(5 ((shift) . 2))
mouse-wheel-progressive-speed nil ; don't accelerate scrolling
;; Whitespace (see `editorconfig')
indent-tabs-mode nil
require-final-newline t
@ -110,7 +112,9 @@ savehist file."
;; persistent point location in buffers
:after-call (after-find-file dired-initial-position-hook)
:config
(setq save-place-file (concat doom-cache-dir "saveplace"))
(setq save-place-file (concat doom-cache-dir "saveplace")
save-place-forget-unreadable-files t
save-place-limit 200)
(defun doom*recenter-on-load-saveplace (&rest _)
"Recenter on cursor when loading a saved place."
(if buffer-file-name (ignore-errors (recenter))))
@ -258,21 +262,7 @@ savehist file."
undo-tree-enable-undo-in-region nil
undo-tree-history-directory-alist
`(("." . ,(concat doom-cache-dir "undo-tree-hist/"))))
(global-undo-tree-mode +1)
;; compress undo history with xz/gzip
(and (fset 'doom*undo-tree-make-history-save-file-name
(cond ((executable-find "zstd") (lambda (file) (concat file ".zst")))
((executable-find "gzip") (lambda (file) (concat file ".gz")))))
(advice-add #'undo-tree-make-history-save-file-name :filter-return
#'doom*undo-tree-make-history-save-file-name))
(defun doom*strip-text-properties-from-undo-history (&rest _)
(dolist (item buffer-undo-list)
(and (consp item)
(stringp (car item))
(setcar item (substring-no-properties (car item))))))
(advice-add #'undo-list-transfer-to-tree :before #'doom*strip-text-properties-from-undo-history))
(global-undo-tree-mode +1))
(def-package! command-log-mode

View file

@ -31,8 +31,6 @@
;; sane trackpad/mouse scroll settings
mac-redisplay-dont-reset-vscroll t
mac-mouse-wheel-smooth-scroll nil
mouse-wheel-scroll-amount '(5 ((shift) . 2)) ; one line at a time
mouse-wheel-progressive-speed nil ; don't accelerate scrolling
;; Curse Lion and its sudden but inevitable fullscreen mode!
;; NOTE Meaningless to railwaycat's emacs-mac build
ns-use-native-fullscreen nil

View file

@ -173,7 +173,6 @@ read-only or not file-visiting."
image-animate-loop t
indicate-buffer-boundaries nil
indicate-empty-lines nil
inhibit-compacting-font-caches t
max-mini-window-height 0.3
mode-line-default-help-echo nil ; disable mode-line mouseovers
mouse-yank-at-point t ; middle-click paste at point, not at click
@ -261,14 +260,17 @@ read-only or not file-visiting."
;; Disable `hl-line' in evil-visual mode (temporarily). `hl-line' can make the
;; selection region harder to see while in evil visual mode.
(after! evil
(defvar-local doom-buffer-hl-line-mode nil)
(defvar doom-buffer-hl-line-mode nil)
(defun doom|disable-hl-line ()
(when hl-line-mode
(setq doom-buffer-hl-line-mode t)
(setq-local doom-buffer-hl-line-mode t)
(hl-line-mode -1)))
(defun doom|enable-hl-line-maybe ()
(if doom-buffer-hl-line-mode (hl-line-mode +1)))
(add-hook 'evil-visual-state-entry-hook #'doom|disable-hl-line)
(defun doom|enable-hl-line-maybe ()
(when doom-buffer-hl-line-mode
(hl-line-mode +1)))
(add-hook 'evil-visual-state-exit-hook #'doom|enable-hl-line-maybe)))

View file

@ -209,7 +209,7 @@ enable multiple minor modes for the same regexp.")
(defun doom|enable-minor-mode-maybe ()
"Check file name against `doom-auto-minor-mode-alist'."
(when buffer-file-name
(when (and buffer-file-name doom-auto-minor-mode-alist)
(let ((name buffer-file-name)
(remote-id (file-remote-p buffer-file-name))
(alist doom-auto-minor-mode-alist))