From 0b0f0fa73cfe9df2fc167bcba291b257e0b4b1fb Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sat, 18 Aug 2012 13:19:27 +0200 Subject: Merge .emacs.d --- .emacs.d/site-lisp/shift-indent.el | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .emacs.d/site-lisp/shift-indent.el (limited to '.emacs.d/site-lisp/shift-indent.el') diff --git a/.emacs.d/site-lisp/shift-indent.el b/.emacs.d/site-lisp/shift-indent.el new file mode 100644 index 0000000..d6d6e76 --- /dev/null +++ b/.emacs.d/site-lisp/shift-indent.el @@ -0,0 +1,33 @@ +(require 'simple) + +(defun indent-shift-left (start end &optional count) + (interactive + (if mark-active + (list (region-beginning) (region-end) current-prefix-arg) + (list (line-beginning-position) (line-end-position) current-prefix-arg))) + (if count + (setq count (prefix-numeric-value count)) + (setq count tab-width)) + (when (> count 0) + (let ((deactivate-mark nil)) + (save-excursion + (goto-char start) + (while (< (point) end) + (if (and (< (current-indentation) count) + (not (looking-at "[ \t]*$"))) + (error "Can't shift all lines enough")) + (forward-line)) + (indent-rigidly start end (- count)))))) + +(add-to-list 'debug-ignored-errors "^Can't shift all lines enough") + +(defun indent-shift-right (start end &optional count) + (interactive + (if mark-active + (list (region-beginning) (region-end) current-prefix-arg) + (list (line-beginning-position) (line-end-position) current-prefix-arg))) + (let ((deactivate-mark nil)) + (if count + (setq count (prefix-numeric-value count)) + (setq count tab-width)) + (indent-rigidly start end count))) -- cgit v1.2.3-54-g00ecf