Switch from move-text to move-dup package

This allows me to remove the custom method for duplicating line, as
move-dup comes with a nice implementation.
This commit is contained in:
2016-03-29 13:34:39 +01:00
parent 38f256bbb1
commit 7557a1cf1e
3 changed files with 5 additions and 28 deletions

View File

@@ -42,28 +42,6 @@ Position the cursor at it's beginning, according to the current mode."
(interactive)
(other-window -1))
(defun siren-duplicate-current-line-or-region (arg)
"Duplicates the current line or region ARG times.
If there's no region, the current line will be duplicated. However, if
there's a region, all lines that region covers will be duplicated.
Borrowed from: http://tuxicity.se/emacs/elisp/2010/03/11/duplicate-current-line-or-region-in-emacs.html"
(interactive "p")
(let (beg end (origin (point)))
(if (and mark-active (> (point) (mark)))
(exchange-point-and-mark))
(setq beg (line-beginning-position))
(if mark-active
(exchange-point-and-mark))
(setq end (line-end-position))
(let ((region (buffer-substring-no-properties beg end)))
(dotimes (i arg)
(goto-char end)
(newline)
(insert region)
(setq end (point)))
(goto-char (+ origin (* (length region) arg) arg)))))
(defun siren-toggle-hiding (column)
"Toggle hiding/showing blocks via hs-mode.

View File

@@ -15,9 +15,6 @@
;; Evaluate buffer
(global-set-key (kbd "C-c C-e") 'eval-buffer)
;; Duplicate line
(global-set-key (kbd "C-x C-d") 'siren-duplicate-current-line-or-region)
;; Window switching
(global-set-key (kbd "C-x i") 'siren-other-window-reverse)
(global-set-key (kbd "C-x C-o") 'other-window)

View File

@@ -7,7 +7,7 @@
;;; Code:
(siren-require-packages '(move-text expand-region))
(siren-require-packages '(move-dup expand-region))
(require 'move-text)
(require 'expand-region)
@@ -46,8 +46,10 @@ A place is considered `tab-width' character columns."
(siren-shift-right (* -1 (or arg 1))))
;; Keybindings
(define-key global-map (kbd "M-p") 'move-text-up)
(define-key global-map (kbd "M-n") 'move-text-down)
(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-c [") 'siren-shift-left)
(global-set-key (kbd "C-c ]") 'siren-shift-right)