mirror of
https://github.com/Foltik/dotfiles
synced 2024-11-24 04:22:50 -05:00
Flesh out indentation stuff
This commit is contained in:
parent
fd92b046a7
commit
3fc2e5077e
@ -699,33 +699,43 @@ 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)
|
||||||
|
|
||||||
(setq whitespace-style '(face tabs tab-mark trailing))
|
;; Define functions for every level of indent that might need hooking
|
||||||
(custom-set-faces
|
(cl-macrolet
|
||||||
'(whitespace-tab ((t (:foreground "#636363")))))
|
((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)))
|
||||||
|
|
||||||
(setq whitespace-display-mappings
|
;; TODO: Replace with dedicated whitespace config
|
||||||
'((tab-mark 9 [124 9] [92 9])))
|
(setq whitespace-style '(face tabs tab-mark trailing))
|
||||||
|
(custom-set-faces
|
||||||
|
'(whitespace-tab ((t (:foreground "#636363")))))
|
||||||
|
|
||||||
(add-hook 'prog-mode-hook #'whitespace-mode)
|
;; Make tabs visible
|
||||||
|
(setq whitespace-display-mappings
|
||||||
|
'((tab-mark 9 [124 9] [92 9])))
|
||||||
|
|
||||||
|
(add-hook 'prog-mode-hook #'whitespace-mode)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
*** Parentheses
|
*** Parentheses
|
||||||
**** Smartparens
|
**** Smartparens
|
||||||
|
Loading…
Reference in New Issue
Block a user