]> git.notmuchmail.org Git - notmuch/blob - test/test-lib.el
943999622d927265357a984efce409e5a883b3ba
[notmuch] / test / test-lib.el
1 ;; test-lib.el --- auxiliary stuff for Notmuch Emacs tests.
2 ;;
3 ;; Copyright © Carl Worth
4 ;; Copyright © David Edmondson
5 ;;
6 ;; This file is part of Notmuch test suit.
7 ;;
8 ;; Notmuch is free software: you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
12 ;;
13 ;; Notmuch is distributed in the hope that it will be useful, but
14 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 ;; General Public License for more details.
17 ;;
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
20 ;;
21 ;; Authors: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
22
23 (defun visible-buffer-string ()
24   "Same as `buffer-string', but excludes invisible text."
25   (visible-buffer-substring (point-min) (point-max)))
26
27 (defun visible-buffer-substring (start end)
28   "Same as `buffer-substring', but excludes invisible text."
29   (let (str)
30     (while (< start end)
31       (let ((next-pos (next-char-property-change start end)))
32         (when (not (invisible-p start))
33           (setq str (concat str (buffer-substring start next-pos))))
34         (setq start next-pos)))
35     str))