aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiran Bastaja <miran.bastaja04@gmail.com>2024-09-12 00:50:50 +0200
committerMiran Bastaja <miran.bastaja04@gmail.com>2024-09-12 01:26:18 +0200
commitc7f0b509fb53474dfdd1f2773fc0a9947513d224 (patch)
tree7b71ebb528356da982c783a16b622d39935b83a2
parent7889a68eb0327f21175bc5abc187d68763fced64 (diff)
emacs: set up autopairs and start setting up whitespace mode
-rw-r--r--share/xpkgs/emacs/emacs.el53
1 files changed, 21 insertions, 32 deletions
diff --git a/share/xpkgs/emacs/emacs.el b/share/xpkgs/emacs/emacs.el
index 51c0314..6958fcb 100644
--- a/share/xpkgs/emacs/emacs.el
+++ b/share/xpkgs/emacs/emacs.el
@@ -1,3 +1,5 @@
+;; -*- coding: utf-8 -*-
+
;;; For performance
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 1024 1024)) ;; 1mb
@@ -46,38 +48,17 @@
;; Define the whitespace style.
(setq-default whitespace-style
- '(face spaces empty tabs newline trailing space-mark tab-mark newline-mark))
-
-;; Whitespace color corrections.
-(require 'color)
-(let* ((ws-lighten 30) ;; Amount in percentage to lighten up black.
- (ws-color (color-lighten-name "#000000" ws-lighten)))
- (custom-set-faces
- `(whitespace-newline ((t (:foreground ,ws-color))))
- `(whitespace-missing-newline-at-eof ((t (:foreground ,ws-color))))
- `(whitespace-space ((t (:foreground ,ws-color))))
- `(whitespace-space-after-tab ((t (:foreground ,ws-color))))
- `(whitespace-space-before-tab ((t (:foreground ,ws-color))))
- `(whitespace-tab ((t (:foreground ,ws-color))))
- `(whitespace-trailing ((t (:foreground ,ws-color))))))
+ '(face spaces tabs newline space-mark tab-mark newline-mark))
-;; Make these characters represent whitespace.
(setq-default whitespace-display-mappings
- '(
- (space-mark 32 [183] [46])
- (newline-mark ?\n [172 ?\n] [36 ?\n])
- (newline-mark ?\r [182] [35])
- (tab-mark ?\t [187 ?\t] [62 ?\t])))
-
-;; Don't enable whitespace for.
-(setq-default whitespace-global-modes
- '(not shell-mode
- help-mode
- magit-mode
- magit-diff-mode
- ibuffer-mode
- dired-mode
- occur-mode))
+ ;; all numbers are unicode codepoint in decimal
+ '(
+ ;; 32 is SPACE, 183 is MIDDLE DOT ·
+ (space-mark 32 [183])
+ ;; 10 is LINE FEED, 182 isPILCROW SIGN ¶
+ (newline-mark 10 [182 10])
+ ;; 9 is tab, 182 isPILCROW SIGN ¶
+ (tab-mark 9 [9655 9])))
;; Set whitespace actions.
(setq-default whitespace-action
@@ -109,11 +90,19 @@
;; Make a single ESC quit the current action
-(global-set-key (kbd "<escape>" 'keyboard-escape-quit))
+(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
+;; Autopairs
(add-hook 'prog-mode-hook
(lambda ()
- (electric-pair-local-mode)))
+ (electric-pair-mode 1)))
;; Org mode config
(setq-default org-startup-indented t)
+
+
+;; Emacs lisp mode config
+(add-hook 'emacs-lisp-mode-hook
+ (lambda ()
+ ;; Use spaces, not tabs
+ (setq indent-tabs-mode nil)))