test-org-src.el: Work around `current-column' bug in older emacs

* testing/lisp/test-org-src.el (test-org-src/indented-blocks): Work
around `current-column' not working in the presence of display strings
in older emacs.
This commit is contained in:
Sébastien Miquel 2023-07-07 13:58:17 +02:00 committed by Ihor Radchenko
parent 8fa7f0279e
commit 67e819d6ee
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 11 additions and 2 deletions

View File

@ -416,7 +416,13 @@ This is a tab:\t.
(let ((org-edit-src-content-indentation 2)
(org-src-preserve-indentation nil))
(font-lock-ensure)
(current-column)))))
;; `current-column' will not work with older versions of emacs
;; before commit 4243747b1b8: Fix 'current-column' in the
;; presence of display strings
(if (<= emacs-major-version 28)
(+ (progn (backward-char) (length (get-text-property (point) 'display)))
(current-column))
(current-column))))))
;; The initial tab characters respect org's `tab-width'.
(should
(equal
@ -432,7 +438,10 @@ This is a tab:\t.
(let ((org-edit-src-content-indentation 2)
(org-src-preserve-indentation nil))
(font-lock-ensure)
(current-column))))))
(if (<= emacs-major-version 28)
(+ (progn (backward-char) (length (get-text-property (point) 'display)))
(current-column))
(current-column)))))))
(ert-deftest test-org-src/indented-latex-fragments ()
"Test editing multiline indented LaTeX fragment."