Using indent-rigidly.

This commit is contained in:
Kazu Yamamoto 2012-08-10 09:21:09 +09:00
parent 549e045673
commit e284080fca

View File

@ -12,24 +12,10 @@
(defun ghc-make-indent-shallower (beg end) (defun ghc-make-indent-shallower (beg end)
(interactive "r") (interactive "r")
(let ((n ghc-indent-offset)) (indent-rigidly (region-beginning) (region-end) (- ghc-indent-offset)))
(save-excursion
(save-restriction
(narrow-to-region beg end)
(goto-char beg)
(while (not (eobp))
(delete-region (point) (+ (point) n))
(forward-line))))))
(defun ghc-make-indent-deeper (beg end) (defun ghc-make-indent-deeper (beg end)
(interactive "r") (interactive "r")
(let ((indent (make-string ghc-indent-offset 32))) (indent-rigidly (region-beginning) (region-end) ghc-indent-offset))
(save-excursion
(save-restriction
(narrow-to-region beg end)
(goto-char beg)
(while (not (eobp))
(insert indent)
(forward-line))))))
(provide 'ghc-indent) (provide 'ghc-indent)