From fde9363a57d0d38d592122fe5ca01aaafd0afa52 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 24 Nov 2021 19:38:41 +0100 Subject: Add new function 'add-display-text-property' * doc/lispref/display.texi (Display Property): Document it. * lisp/emacs-lisp/subr-x.el (add-display-text-property): New function. --- test/lisp/emacs-lisp/subr-x-tests.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/lisp/emacs-lisp') diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index f9cfea888c7..69d59e84f6d 100644 --- a/test/lisp/emacs-lisp/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el @@ -676,5 +676,23 @@ (buffer-string)) "foo\n"))) +(ert-deftest test-add-display-text-property () + (with-temp-buffer + (insert "Foo bar zot gazonk") + (add-display-text-property 4 8 'height 2.0) + (add-display-text-property 2 12 'raise 0.5) + (should (equal (get-text-property 2 'display) '(raise 0.5))) + (should (equal (get-text-property 5 'display) + '((raise 0.5) (height 2.0)))) + (should (equal (get-text-property 9 'display) '(raise 0.5)))) + (with-temp-buffer + (insert "Foo bar zot gazonk") + (put-text-property 4 8 'display [(height 2.0)]) + (add-display-text-property 2 12 'raise 0.5) + (should (equal (get-text-property 2 'display) '(raise 0.5))) + (should (equal (get-text-property 5 'display) + [(raise 0.5) (height 2.0)])) + (should (equal (get-text-property 9 'display) '(raise 0.5))))) + (provide 'subr-x-tests) ;;; subr-x-tests.el ends here -- cgit v1.2.3