Various fixes and updates to siren-text-manipulation

This commit is contained in:
2016-04-03 10:28:20 +01:00
parent 692ce25121
commit 0c94ed7c70

View File

@@ -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)