Rewrite indentation function to a generic one
This commit is contained in:
parent
a449bcbb5b
commit
ed90e42076
2 changed files with 10 additions and 21 deletions
23
behaviour.el
23
behaviour.el
|
|
@ -91,27 +91,16 @@
|
||||||
(defun set-width (columns)
|
(defun set-width (columns)
|
||||||
"Set line length to X COLUMNS.
|
"Set line length to X COLUMNS.
|
||||||
Additional characters after X are highlighted."
|
Additional characters after X are highlighted."
|
||||||
(interactive "NNumber of columns to use:")
|
(interactive "NNumber of columns to use: ")
|
||||||
(setq column-enforce-column columns)
|
(setq column-enforce-column columns)
|
||||||
(column-enforce-mode -1)
|
(column-enforce-mode -1)
|
||||||
(column-enforce-mode 1))
|
(column-enforce-mode 1))
|
||||||
|
|
||||||
;;; TODO: Convert to proper functions
|
(defun set-indent (step)
|
||||||
(defun set-tab-4 ()
|
"Set indentation to X STEPs."
|
||||||
"Set tab length to 4 spaces."
|
(interactive "NNumber of columns for one step: ")
|
||||||
(interactive)
|
(setq tab-width step)
|
||||||
(setq tab-width 4)
|
(setq tab-stop-list (number-sequence step 200 step)))
|
||||||
(setq tab-stop-list (quote(4 8 12 16 24 28 32 36 40 44 48 52 56 60 64 68 72 76
|
|
||||||
80 84 88 92 96 100 104 108 112 116 120))))
|
|
||||||
|
|
||||||
(defun set-tab-2 ()
|
|
||||||
"Set tab length to 2 spaces."
|
|
||||||
(interactive)
|
|
||||||
(setq tab-width 2)
|
|
||||||
(setq tab-stop-list (quote(2 4 6 8 10 12 14 16 20 22 24 26 28 30 32 34 36 38
|
|
||||||
40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70
|
|
||||||
72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102
|
|
||||||
104 106 108 110 112 114 116 118 120))))
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;; additional features ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;; additional features ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
(remove-hook 'html-mode-hook 'web-mode-config)
|
(remove-hook 'html-mode-hook 'web-mode-config)
|
||||||
(remove-hook 'haskell-mode-hook 'haskell-mode-config)
|
(remove-hook 'haskell-mode-hook 'haskell-mode-config)
|
||||||
|
|
||||||
(set-tab-4)
|
(set-indent 4)
|
||||||
(set-width 99))
|
(set-width 99))
|
||||||
|
|
||||||
(add-hook 'rust-mode-hook 'rust-mode-config)
|
(add-hook 'rust-mode-hook 'rust-mode-config)
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
(remove-hook 'html-mode-hook 'web-mode-config)
|
(remove-hook 'html-mode-hook 'web-mode-config)
|
||||||
(remove-hook 'haskell-mode-hook 'haskell-mode-config)
|
(remove-hook 'haskell-mode-hook 'haskell-mode-config)
|
||||||
|
|
||||||
(set-tab-2))
|
(set-indent 2))
|
||||||
|
|
||||||
(add-hook 'elixir-mode-hook 'elixir-mode-config)
|
(add-hook 'elixir-mode-hook 'elixir-mode-config)
|
||||||
(add-hook 'elixir-mode-hook (set-width 80))
|
(add-hook 'elixir-mode-hook (set-width 80))
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
(remove-hook 'html-mode-hook 'web-mode-config)
|
(remove-hook 'html-mode-hook 'web-mode-config)
|
||||||
(remove-hook 'elixir-mode-hook 'elixir-mode-config)
|
(remove-hook 'elixir-mode-hook 'elixir-mode-config)
|
||||||
|
|
||||||
(set-tab-4)
|
(set-indent 4)
|
||||||
(set-width 80))
|
(set-width 80))
|
||||||
|
|
||||||
(add-hook 'haskell-mode-hook 'haskell-mode-config)
|
(add-hook 'haskell-mode-hook 'haskell-mode-config)
|
||||||
|
|
@ -86,7 +86,7 @@
|
||||||
(remove-hook 'html-mode-hook 'web-mode-config)
|
(remove-hook 'html-mode-hook 'web-mode-config)
|
||||||
(remove-hook 'haskell-mode-hook 'haskell-mode-config)
|
(remove-hook 'haskell-mode-hook 'haskell-mode-config)
|
||||||
|
|
||||||
(set-tab-2)
|
(set-indent 2)
|
||||||
|
|
||||||
(flycheck-mode 1)
|
(flycheck-mode 1)
|
||||||
(set-width 80))
|
(set-width 80))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue