Improve kill-ring-deindent-mode

* etc/NEWS:
* lisp/simple.el (kill-ring-deindent-buffer-substring-function):
(kill-ring-deindent-mode): Deindent by the column number at BEG
in lieu of the indentation at BEG.
This commit is contained in:
Po Lu 2023-08-11 16:08:16 +08:00
parent dcd551d6c8
commit 3dbf2edb3c
2 changed files with 6 additions and 6 deletions

View file

@ -148,8 +148,8 @@ right-aligned to is controlled by the new user option
---
** New global minor mode 'kill-ring-deindent-mode'.
When enabled, text being saved to the kill ring will be de-indented by
the number of columns its first line is indented. For example,
saving the entire function call within:
the column number at its start. For example, saving the entire
function call within:
foo ()
{

View file

@ -11150,13 +11150,13 @@ seconds."
Maybe delete it if DELETE is non-nil.
Before saving the text, indent it leftwards by the number of
columns of indentation at BEG."
columns at BEG."
(let ((a beg)
(b end))
(setq beg (min a b)
end (max a b)))
(let ((indentation (save-excursion (goto-char beg)
(current-indentation)))
(current-column)))
(text (if delete
(delete-and-extract-region beg end)
(buffer-substring beg end))))
@ -11170,8 +11170,8 @@ columns of indentation at BEG."
"Toggle removal of indentation from text saved to the kill ring.
When this minor mode is enabled, text saved into the kill ring is
indented towards the left by the number of columns the line at
the start of the text being saved is in turn indented."
indented towards the left by the column number at the start of
that text."
:global 't
:group 'killing
(if kill-ring-deindent-mode