emacs: make several "kill" or "yank" command wrappers report the command they are

This commit is contained in:
Protesilaos Stavrou 2025-04-10 08:08:01 +03:00
parent 7cd1d0197d
commit 851a90a06e
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
2 changed files with 26 additions and 14 deletions

View file

@ -16300,8 +16300,9 @@ positions. Otherwise, copy the current line."
(region-beginning)
(region-end))))
(if (and beg end)
(kill-ring-save beg end)
(prot-simple-copy-line)))
(copy-region-as-kill beg end)
(prot-simple-copy-line))
(setq this-command 'kill-ring-save))
;;;###autoload
(defun prot-simple-kill-region (&optional beg end)
@ -16337,7 +16338,8 @@ BOUNDARIES is a cons cell representing buffer positions."
(prot-simple--duplicate-buffer-substring
(if (region-active-p)
(cons (region-beginning) (region-end))
(cons (line-beginning-position) (line-end-position)))))
(cons (line-beginning-position) (line-end-position))))
(setq this-command 'yank))
;;;###autoload
(defun prot-simple-yank-replace-line-or-region ()
@ -16348,7 +16350,8 @@ This command can then be followed by the standard
(if (use-region-p)
(delete-region (region-beginning) (region-end))
(delete-region (line-beginning-position) (line-end-position)))
(yank))
(yank)
(setq this-command 'yank))
;;;###autoload
(defun prot-simple-multi-line-below ()
@ -16368,7 +16371,8 @@ This command can then be followed by the standard
(defun prot-simple-kill-line-backward ()
"Kill from point to the beginning of the line."
(interactive)
(kill-line 0))
(kill-line 0)
(setq this-command 'kill-line))
;;;###autoload
(defun prot-simple-delete-line ()
@ -16378,7 +16382,8 @@ This command can then be followed by the standard
(end (line-end-position)))
(if (eq point end)
(delete-region point (+ end 1))
(delete-region point end))))
(delete-region point end)))
(setq this-command 'kill-whole-line))
;;;###autoload
(defun prot-simple-delete-line-backward ()
@ -16388,7 +16393,8 @@ This command can then be followed by the standard
(beg (line-beginning-position)))
(if (eq point beg)
(delete-region (- beg 1) point)
(delete-region point beg))))
(delete-region point beg)))
(setq this-command 'kill-whole-line))
;;;###autoload
(define-minor-mode prot-simple-auto-fill-visual-line-mode

View file

@ -241,8 +241,9 @@ positions. Otherwise, copy the current line."
(region-beginning)
(region-end))))
(if (and beg end)
(kill-ring-save beg end)
(prot-simple-copy-line)))
(copy-region-as-kill beg end)
(prot-simple-copy-line))
(setq this-command 'kill-ring-save))
;;;###autoload
(defun prot-simple-kill-region (&optional beg end)
@ -278,7 +279,8 @@ BOUNDARIES is a cons cell representing buffer positions."
(prot-simple--duplicate-buffer-substring
(if (region-active-p)
(cons (region-beginning) (region-end))
(cons (line-beginning-position) (line-end-position)))))
(cons (line-beginning-position) (line-end-position))))
(setq this-command 'yank))
;;;###autoload
(defun prot-simple-yank-replace-line-or-region ()
@ -289,7 +291,8 @@ This command can then be followed by the standard
(if (use-region-p)
(delete-region (region-beginning) (region-end))
(delete-region (line-beginning-position) (line-end-position)))
(yank))
(yank)
(setq this-command 'yank))
;;;###autoload
(defun prot-simple-multi-line-below ()
@ -309,7 +312,8 @@ This command can then be followed by the standard
(defun prot-simple-kill-line-backward ()
"Kill from point to the beginning of the line."
(interactive)
(kill-line 0))
(kill-line 0)
(setq this-command 'kill-line))
;;;###autoload
(defun prot-simple-delete-line ()
@ -319,7 +323,8 @@ This command can then be followed by the standard
(end (line-end-position)))
(if (eq point end)
(delete-region point (+ end 1))
(delete-region point end))))
(delete-region point end)))
(setq this-command 'kill-whole-line))
;;;###autoload
(defun prot-simple-delete-line-backward ()
@ -329,7 +334,8 @@ This command can then be followed by the standard
(beg (line-beginning-position)))
(if (eq point beg)
(delete-region (- beg 1) point)
(delete-region point beg))))
(delete-region point beg)))
(setq this-command 'kill-whole-line))
;;;###autoload
(define-minor-mode prot-simple-auto-fill-visual-line-mode