diff options
author | Juri Linkov <juri@linkov.net> | 2023-06-29 10:13:06 +0300 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2023-06-29 10:13:06 +0300 |
commit | d5cff340b3b4ab616bf4549150754cb99549afe3 (patch) | |
tree | 488cde990527d203ceadf35df64424c7667142b7 /test/lisp/misc-tests.el | |
parent | ef16339918e3f31831dd271cde40cb2072069875 (diff) | |
download | emacs-d5cff340b3b4ab616bf4549150754cb99549afe3.tar.gz emacs-d5cff340b3b4ab616bf4549150754cb99549afe3.tar.bz2 emacs-d5cff340b3b4ab616bf4549150754cb99549afe3.zip |
* lisp/misc.el (duplicate-line-final-position): New defcustom (bug#64185).
* lisp/misc.el (duplicate-line): Use it.
* test/lisp/misc-tests.el (misc--duplicate-line): Add tests for
duplicate-line-final-position.
Don't merge to master.
Diffstat (limited to 'test/lisp/misc-tests.el')
-rw-r--r-- | test/lisp/misc-tests.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/lisp/misc-tests.el b/test/lisp/misc-tests.el index f1d22e099b9..ea27ea1653b 100644 --- a/test/lisp/misc-tests.el +++ b/test/lisp/misc-tests.el @@ -88,6 +88,20 @@ (duplicate-line 2) (should (equal (buffer-string) "abc\ndefg\ndefg\ndefg\nh\n")) (should (equal (point) 7))) + ;; Duplicate a line (twice) and move point to the first duplicated line. + (with-temp-buffer + (insert "abc\ndefg\nh\n") + (goto-char 7) + (let ((duplicate-line-final-position 1)) (duplicate-line 2)) + (should (equal (buffer-string) "abc\ndefg\ndefg\ndefg\nh\n")) + (should (equal (point) 12))) + ;; Duplicate a line (twice) and move point to the last duplicated line. + (with-temp-buffer + (insert "abc\ndefg\nh\n") + (goto-char 7) + (let ((duplicate-line-final-position -1)) (duplicate-line 2)) + (should (equal (buffer-string) "abc\ndefg\ndefg\ndefg\nh\n")) + (should (equal (point) 17))) ;; Duplicate a non-terminated line. (with-temp-buffer (insert "abc") |