]> code.delx.au - dotemacs/commitdiff
emacs25 contains comment-line
authorJames Bunton <jamesbunton@delx.net.au>
Mon, 19 Sep 2016 11:56:12 +0000 (21:56 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Mon, 19 Sep 2016 11:56:12 +0000 (21:56 +1000)
lisp/my-editing-defuns.el
lisp/my-keys.el

index bf72f9440fea4359f0696272eabddb73d70f91fc..7e7d70fe99263cfc265fcff2fdc6eefa0548cd3e 100644 (file)
@@ -1,17 +1,5 @@
 ;;; -*- lexical-binding: t -*-
 
-(defun my/comment-dwim (arg)
-  "Toggles the comment on for the active region if present or the current line otherwise."
-  (interactive "*p")
-  (cond
-   ((and mark-active transient-mark-mode)
-    (let ((start (save-excursion (goto-char (region-beginning)) (line-beginning-position)))
-          (end (save-excursion (goto-char (region-end)) (line-end-position))))
-      (comment-or-uncomment-region start end)))
-   (t
-    (comment-or-uncomment-region (line-beginning-position) (line-end-position arg))
-    (forward-line arg))))
-
 (defun my/copy-line (arg)
   "Copy the current line into the kill ring. With ARG copies that many lines."
   (interactive "p")
@@ -28,7 +16,7 @@
     (kill-ring-save start end)
     (when at-eof
       (kill-append "\n" t))
-    (save-excursion
+    (save-mark-and-excursion
       (forward-line)
       (dotimes (ignored arg)
         (yank)))
index b8c9469966379753b86115269317802d7cdb105e..aee4588e54d1a0741c23e53ad5460bbef1c775d3 100644 (file)
@@ -40,7 +40,7 @@
 
 ;; Text formatting
 (global-set-key (kbd "M-/") 'hippie-expand)
-(global-set-key (kbd "M-;") 'my/comment-dwim)
+(global-set-key (kbd "M-;") 'comment-line)
 (global-set-key (kbd "M-i") 'change-inner)
 (global-set-key (kbd "C-o") 'my/open-line-above)
 (global-set-key (kbd "M-o") 'my/open-line-below)