about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lisp/+emacs.el26
1 files changed, 19 insertions, 7 deletions
diff --git a/lisp/+emacs.el b/lisp/+emacs.el index ecdfeaa..312657e 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el
@@ -25,6 +25,7 @@ Do this only if the buffer is not visiting a file."
25 (let ((buffer-file-name (buffer-name buf))) 25 (let ((buffer-file-name (buffer-name buf)))
26 (set-auto-mode)))) 26 (set-auto-mode))))
27 27
28
28;;; General settings 29;;; General settings
29 30
30(setq-default 31(setq-default
@@ -139,6 +140,7 @@ Do this only if the buffer is not visiting a file."
139(when (version< emacs-version "28") 140(when (version< emacs-version "28")
140 (fset 'yes-or-no-p 'y-or-n-p)) 141 (fset 'yes-or-no-p 'y-or-n-p))
141 142
143
142;;; Encodings 144;;; Encodings
143 145
144(setq-default locale-coding-system 'utf-8-unix 146(setq-default locale-coding-system 'utf-8-unix
@@ -166,6 +168,7 @@ Do this only if the buffer is not visiting a file."
166 (set-selection-coding-system 'utf-8) 168 (set-selection-coding-system 'utf-8)
167 (set-clipboard-coding-system 'utf-8))) 169 (set-clipboard-coding-system 'utf-8)))
168 170
171
169;;; Modes 172;;; Modes
170 173
171(dolist (enable-mode '(global-auto-revert-mode 174(dolist (enable-mode '(global-auto-revert-mode
@@ -189,11 +192,13 @@ Do this only if the buffer is not visiting a file."
189 (when (fboundp disable-mode) 192 (when (fboundp disable-mode)
190 (funcall disable-mode -1))) 193 (funcall disable-mode -1)))
191 194
195
192;;; Hooks 196;;; Hooks
193 197
194(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) 198(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
195(add-hook 'minibuffer-setup-hook 'cursor-intangible-mode) 199(add-hook 'minibuffer-setup-hook 'cursor-intangible-mode)
196 200
201
197;;; Better-default functions ... 202;;; Better-default functions ...
198 203
199(defun +cycle-spacing (&optional n preserve-nl-back mode) 204(defun +cycle-spacing (&optional n preserve-nl-back mode)
@@ -238,6 +243,7 @@ backward. It defaults to `backward-kill-word'."
238(advice-add #'yank :after #'+yank@indent) 243(advice-add #'yank :after #'+yank@indent)
239(advice-add #'yank-pop :after #'+yank@indent) 244(advice-add #'yank-pop :after #'+yank@indent)
240 245
246
241;;; Bindings 247;;; Bindings
242 248
243;; I need to place these bindings under `+key-mode-map' so that they aren't 249;; I need to place these bindings under `+key-mode-map' so that they aren't
@@ -255,6 +261,7 @@ backward. It defaults to `backward-kill-word'."
255 ("C-M-r" . isearch-backward))) 261 ("C-M-r" . isearch-backward)))
256 (define-key +key-mode-map (kbd (car binding)) (cdr binding))) 262 (define-key +key-mode-map (kbd (car binding)) (cdr binding)))
257 263
264
258;;; Required libraries 265;;; Required libraries
259 266
260(when (require 'uniquify nil :noerror) 267(when (require 'uniquify nil :noerror)
@@ -276,13 +283,6 @@ backward. It defaults to `backward-kill-word'."
276 (add-to-list 'recentf-exclude .etc) 283 (add-to-list 'recentf-exclude .etc)
277 (recentf-mode +1)) 284 (recentf-mode +1))
278 285
279(when (require 'repeat nil :noerror)
280 (setq-default repeat-exit-key "g"
281 repeat-exit-timeout 5)
282 (when (fboundp 'repeat-mode)
283 ;; `repeat-mode' is defined in repeat.el, which is an older library.
284 (repeat-mode +1)))
285
286(when (require 'savehist nil :noerror) 286(when (require 'savehist nil :noerror)
287 (setq-default history-length t 287 (setq-default history-length t
288 history-delete-duplicates t 288 history-delete-duplicates t
@@ -309,5 +309,17 @@ backward. It defaults to `backward-kill-word'."
309;; (add-to-list 'tramp-default-proxies-alist 309;; (add-to-list 'tramp-default-proxies-alist
310;; '((regexp-quote (system-name)) nil nil))) 310;; '((regexp-quote (system-name)) nil nil)))
311 311
312
313;;; Newer features
314;; These aren't in older version of Emacs, but they're so nice.
315
316(when (fboundp 'repeat-mode)
317 (setq-default repeat-exit-key "g"
318 repeat-exit-timeout 5)
319 (repeat-mode +1))
320
321(when (fboundp 'pixel-scroll-precision-mode)
322 (pixel-scroll-precision-mode +1))
323
312(provide '+emacs) 324(provide '+emacs)
313;;; +emacs.el ends here 325;;; +emacs.el ends here