Uncomment spacemacs/indent-region-or-buffer and move it

to spacemacs/funcs.el
This commit is contained in:
syl20bnr 2015-03-26 12:26:09 -04:00
parent a00e52b10b
commit 3bdb08773d
2 changed files with 26 additions and 27 deletions

View File

@ -28,30 +28,3 @@ point reaches the beginning or end of the buffer, stop there."
(back-to-indentation)
(when (= orig-point (point))
(move-beginning-of-line 1))))
;; from Prelude
;; TODO To adapt for `=' of evil
;; (defvar spacemacs-indent-sensitive-modes
;; '(coffee-mode
;; python-mode
;; slim-mode
;; haml-mode
;; yaml-mode
;; makefile-mode
;; makefile-gmake-mode
;; makefile-imake-mode
;; makefile-bsdmake-mode)
;; "Modes for which auto-indenting is suppressed.")
;; (defun spacemacs/indent-region-or-buffer ()
;; "Indent a region if selected, otherwise the whole buffer."
;; (interactive)
;; (unless (member major-mode spacemacs-indent-sensitive-modes)
;; (save-excursion
;; (if (region-active-p)
;; (progn
;; (indent-region (region-beginning) (region-end))
;; (message "Indented selected region."))
;; (progn
;; (evil-indent (point-min) (point-max))
;; (message "Indented buffer.")))
;; (whitespace-cleanup))))

View File

@ -143,6 +143,32 @@ the current state and point position."
(sp-newline)
(setq counter (1- counter)))))
;; from Prelude
(defvar spacemacs-indent-sensitive-modes
'(coffee-mode
python-mode
slim-mode
haml-mode
yaml-mode
makefile-mode
makefile-gmake-mode
makefile-imake-mode
makefile-bsdmake-mode)
"Modes for which auto-indenting is suppressed.")
(defun spacemacs/indent-region-or-buffer ()
"Indent a region if selected, otherwise the whole buffer."
(interactive)
(unless (member major-mode spacemacs-indent-sensitive-modes)
(save-excursion
(if (region-active-p)
(progn
(indent-region (region-beginning) (region-end))
(message "Indented selected region."))
(progn
(evil-indent (point-min) (point-max))
(message "Indented buffer.")))
(whitespace-cleanup))))
;; from magnars
(defun eval-and-replace ()
"Replace the preceding sexp with its value."