aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWolfgang Jenkner2015-03-27 02:54:39 +0100
committerWolfgang Jenkner2015-03-27 03:47:08 +0100
commit792d44b3c31d2a682607ab8b79ae7d26b7402f41 (patch)
treedacaaf290f706944a8585d7932cf23cacbca24fc /test
parent1d02107dab6f844a7c537bb5e98aff4e5f061246 (diff)
downloademacs-792d44b3c31d2a682607ab8b79ae7d26b7402f41.tar.gz
emacs-792d44b3c31d2a682607ab8b79ae7d26b7402f41.zip
Preserve face text properties in comint prompt.
Fixes: debbugs:20084 * lisp/font-lock.el (font-lock--remove-face-from-text-property): New function. Adapted from the previously commented out remove-single-text-property. Remove previously unused and commented out auxiliary function remove-text-property and obsolete comment. * lisp/comint.el (comint-output-filter): Use it to remove comint-highlight-prompt. (comint-snapshot-last-prompt, comint-output-filter): Use font-lock-prepend-text-property for comint-highlight-prompt. * test/automated/textprop-tests.el: New file. (textprop-tests-font-lock--remove-face-from-text-property): New test. Thus, the original face text property of a prompt "candidate" (the last line of an output chunk not ending with a newline) is preserved. This amends the fix for bug#14744.
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog5
-rw-r--r--test/automated/textprop-tests.el57
2 files changed, 62 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index a9cad319ead..30b88412468 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
12015-03-27 Wolfgang Jenkner <wjenkner@inode.at>
2
3 * automated/textprop-tests.el: New file.
4 (textprop-tests-font-lock--remove-face-from-text-property): New test.
5
12015-03-24 Michael Albinus <michael.albinus@gmx.de> 62015-03-24 Michael Albinus <michael.albinus@gmx.de>
2 7
3 * automated/tramp-tests.el (tramp-test18-file-attributes) 8 * automated/tramp-tests.el (tramp-test18-file-attributes)
diff --git a/test/automated/textprop-tests.el b/test/automated/textprop-tests.el
new file mode 100644
index 00000000000..310a7a0e976
--- /dev/null
+++ b/test/automated/textprop-tests.el
@@ -0,0 +1,57 @@
1;;; textprop-tests.el --- Test suite for text properties.
2
3;; Copyright (C) 2015 Free Software Foundation, Inc.
4
5;; Author: Wolfgang Jenkner <wjenkner@inode.at>
6;; Keywords: internal
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23;;; Code:
24
25(require 'ert)
26
27(ert-deftest textprop-tests-font-lock--remove-face-from-text-property ()
28 "Test `font-lock--remove-face-from-text-property'."
29 (let* ((string "foobar")
30 (stack (list string))
31 (faces '(bold (:foreground "red") underline)))
32 ;; Build each string in `stack' by adding a face to the previous
33 ;; string.
34 (let ((faces (reverse faces)))
35 (push (copy-sequence (car stack)) stack)
36 (put-text-property 0 3 'font-lock-face (pop faces) (car stack))
37 (push (copy-sequence (car stack)) stack)
38 (put-text-property 3 6 'font-lock-face (pop faces) (car stack))
39 (push (copy-sequence (car stack)) stack)
40 (font-lock-prepend-text-property 2 5
41 'font-lock-face (pop faces) (car stack)))
42 ;; Check that removing the corresponding face from each string
43 ;; yields the previous string in `stack'.
44 (while faces
45 ;; (message "%S" (car stack))
46 (should (equal-including-properties
47 (progn
48 (font-lock--remove-face-from-text-property 0 6
49 'font-lock-face
50 (pop faces)
51 (car stack))
52 (pop stack))
53 (car stack))))
54 ;; Sanity check.
55 ;; (message "%S" (car stack))
56 (should (and (equal-including-properties (pop stack) string)
57 (null stack)))))