From 0c94ed7c705f07f7597a1b105bee50a9964c802e Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sun, 3 Apr 2016 10:28:20 +0100 Subject: [PATCH] Various fixes and updates to siren-text-manipulation --- modules/siren-text-manipulation.el | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/modules/siren-text-manipulation.el b/modules/siren-text-manipulation.el index 61cf932..3bed8d4 100644 --- a/modules/siren-text-manipulation.el +++ b/modules/siren-text-manipulation.el @@ -7,11 +7,14 @@ ;;; Code: -(siren-require-packages '(move-dup expand-region)) +(siren-require-packages '(move-dup expand-region smart-shift)) -(require 'move-text) +(require 'move-dup) (require 'expand-region) +(require 'smart-shift) +(global-smart-shift-mode 1) + (defmacro allow-line-as-region-for-function (orig-function) `(defun ,(intern (concat (symbol-name orig-function) "-or-line")) () @@ -30,29 +33,14 @@ (unless (fboundp 'comment-or-uncomment-region-or-line) (allow-line-as-region-for-function comment-or-uncomment-region)) -(defun siren-shift-right (&optional arg) - "Shift the line or region to the ARG places to the right. -A place is considered `tab-width' character columns." - (interactive) - (let ((deactivate-mark nil) - (beg (or (and mark-active (region-beginning)) - (line-beginning-position))) - (end (or (and mark-active (region-end)) (line-end-position)))) - (indent-rigidly beg end (* (or arg 1) tab-width)))) - -(defun siren-shift-left (&optional arg) - "Shift the line or region to the ARG places to the left." - (interactive) - (siren-shift-right (* -1 (or arg 1)))) - ;; Keybindings (global-set-key (kbd "M-p") 'md/move-lines-up) (global-set-key (kbd "M-n") 'md/move-lines-down) -(global-set-key (kbd "C-x C-d") 'md/duplicate-up) -;; (global-set-key (kbd "C-x C-d") 'md/duplicate-down) +;; (global-set-key (kbd "C-x C-d") 'md/duplicate-up) +(global-set-key (kbd "C-x C-d") 'md/duplicate-down) -(global-set-key (kbd "C-c [") 'siren-shift-left) -(global-set-key (kbd "C-c ]") 'siren-shift-right) +(global-set-key (kbd "C-c [") 'smart-shift-left) +(global-set-key (kbd "C-c ]") 'smart-shift-right) (global-set-key (kbd "C-c /") 'comment-or-uncomment-region-or-line) (global-set-key (kbd "C-c C-/") 'comment-or-uncomment-region-or-line)