1
0
mirror of https://github.com/Foltik/dotfiles synced 2024-11-27 21:19:51 -05:00

Flesh out indentation stuff

This commit is contained in:
Jack Foltz 2019-02-10 14:07:01 -05:00
parent fd92b046a7
commit 3fc2e5077e
No known key found for this signature in database
GPG Key ID: E7B502AB1576E6CD

View File

@ -699,29 +699,39 @@ Set some *sane* defaults
#+END_SRC #+END_SRC
Define some *useful* helper functions Define some *useful* helper functions
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun foltz-indent-tabs () (defun jf-indent-tabs (width)
(interactive) (interactive "nTab width: ")
(setq tab-width foltz-tab-width) (setq tab-width width)
(local-set-key (kbd "") 'tab'to-tab-stop) (local-set-key (kbd "TAB") 'tab-to-tab-stop)
(setq indent-tabs-mode t)) (setq indent-tabs-mode t))
(defun foltz-indent-spaces (num-spaces) (defun jf-indent-spaces (num)
(interactive) (interactive "nNumber of spaces: ")
(setq tab-width num-spaces) (setq tab-width num)
(setq indent-tabs-mode nil)) (setq indent-tabs-mode nil))
(defun foltz-indent-2-spaces ()
(foltz-indent-spaces 2))
(defun foltz-indent-4-spaces ()
(foltz-indent-spaces 4))
(defun foltz-indent-8-spaces ()
(foltz-indent-spaces 8))
(foltz-indent-4-spaces) ;; Default
(jf-indent-spaces 4)
;; Define functions for every level of indent that might need hooking
(cl-macrolet
((jf-define-indent-funs (widths)
`(progn
,@(mapcan
(lambda (num)
`((defun ,(intern (concat "jf-indent-" (number-to-string num) "-spaces")) ()
(jf-indent-spaces ,num))
(defun ,(intern (concat "jf-indent-tabs-" (number-to-string num))) ()
(jf-indent-tabs ,num))))
widths))))
(jf-define-indent-funs (2 4 8)))
;; TODO: Replace with dedicated whitespace config
(setq whitespace-style '(face tabs tab-mark trailing)) (setq whitespace-style '(face tabs tab-mark trailing))
(custom-set-faces (custom-set-faces
'(whitespace-tab ((t (:foreground "#636363"))))) '(whitespace-tab ((t (:foreground "#636363")))))
;; Make tabs visible
(setq whitespace-display-mappings (setq whitespace-display-mappings
'((tab-mark 9 [124 9] [92 9]))) '((tab-mark 9 [124 9] [92 9])))