mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
test: `visible-buffer-substring' should not return text properties.
When using `visible-buffer-substring' to examine a buffer, the text properties are not useful, so don't include them.
This commit is contained in:
parent
d0a048f856
commit
c70c7f86b8
1 changed files with 6 additions and 3 deletions
|
@ -51,16 +51,19 @@ FILENAME is OUTPUT."
|
|||
(with-temp-file (or filename "OUTPUT") (insert text))))
|
||||
|
||||
(defun visible-buffer-string ()
|
||||
"Same as `buffer-string', but excludes invisible text."
|
||||
"Same as `buffer-string', but excludes invisible text and
|
||||
removes any text properties."
|
||||
(visible-buffer-substring (point-min) (point-max)))
|
||||
|
||||
(defun visible-buffer-substring (start end)
|
||||
"Same as `buffer-substring', but excludes invisible text."
|
||||
"Same as `buffer-substring-no-properties', but excludes
|
||||
invisible text."
|
||||
(let (str)
|
||||
(while (< start end)
|
||||
(let ((next-pos (next-char-property-change start end)))
|
||||
(when (not (invisible-p start))
|
||||
(setq str (concat str (buffer-substring start next-pos))))
|
||||
(setq str (concat str (buffer-substring-no-properties
|
||||
start next-pos))))
|
||||
(setq start next-pos)))
|
||||
str))
|
||||
|
||||
|
|
Loading…
Reference in a new issue