;;; -*- 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")
(kill-ring-save start end)
(when at-eof
(kill-append "\n" t))
- (save-excursion
+ (save-mark-and-excursion
(forward-line)
(dotimes (ignored arg)
(yank)))