summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-06-19 21:56:43 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-06-19 22:08:19 +0200
commit613d3848b8cd09bd8f9ec94362c210d23e788cdd (patch)
treea4222d89ffe1ea5ebba5c4ebc5702b36a5b84b92
parent598d167f40693dd5b5ed27c579c433a3c23b8472 (diff)
downloademacs-613d3848b8cd09bd8f9ec94362c210d23e788cdd.tar.gz
Remove XEmacs compat code from ansi-color.el
* lisp/ansi-color.el (ansi-color-apply-overlay-face) (ansi-color-make-face, ansi-color-make-extent) (ansi-color-set-extent-face): Remove XEmacs compat code.
-rw-r--r--lisp/ansi-color.el69
1 files changed, 26 insertions, 43 deletions
diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el
index fe8cadacda7..31bed6028cc 100644
--- a/lisp/ansi-color.el
+++ b/lisp/ansi-color.el
@@ -424,9 +424,7 @@ this."
"Make an overlay from BEG to END, and apply face FACE.
If FACE is nil, do nothing."
(when face
- (ansi-color-set-extent-face
- (ansi-color-make-extent beg end)
- face)))
+ (overlay-put (ansi-color-make-extent beg end) 'face face)))
(defun ansi-color-apply-text-property-face (beg end face)
"Set the `font-lock-face' property to FACE in region BEG..END.
@@ -454,45 +452,32 @@ If FACE is nil, do nothing."
; (message "Reached %d." pos)))
; (setq pos (next-overlay-change pos)))))
-;; Emacs/XEmacs compatibility layer
-
(defun ansi-color-make-face (property color)
"Return a face with PROPERTY set to COLOR.
PROPERTY can be either symbol `foreground' or symbol `background'.
-For Emacs, we just return the cons cell (PROPERTY . COLOR).
-For XEmacs, we create a temporary face and return it."
- (if (featurep 'xemacs)
- (let ((face (make-face (intern (concat color "-" (symbol-name property)))
- "Temporary face created by ansi-color."
- t)))
- (set-face-property face property color)
- face)
- (cond ((eq property 'foreground)
- (cons 'foreground-color color))
- ((eq property 'background)
- (cons 'background-color color))
- (t
- (cons property color)))))
-
-(defun ansi-color-make-extent (from to &optional object)
- "Make an extent for the range [FROM, TO) in OBJECT.
-
-OBJECT defaults to the current buffer. XEmacs uses `make-extent', Emacs
-uses `make-overlay'. XEmacs can use a buffer or a string for OBJECT,
-Emacs requires OBJECT to be a buffer."
- (if (fboundp 'make-extent)
- (make-extent from to object)
- ;; In Emacs, the overlay might end at the process-mark in comint
- ;; buffers. In that case, new text will be inserted before the
- ;; process-mark, ie. inside the overlay (using insert-before-marks).
- ;; In order to avoid this, we use the `insert-behind-hooks' overlay
- ;; property to make sure it works.
- (let ((overlay (make-overlay from to object)))
- (overlay-put overlay 'evaporate t)
- (overlay-put overlay 'modification-hooks '(ansi-color-freeze-overlay))
- (overlay-put overlay 'insert-behind-hooks '(ansi-color-freeze-overlay))
- overlay)))
+For Emacs, we just return the cons cell (PROPERTY . COLOR)."
+ (cond ((eq property 'foreground)
+ (cons 'foreground-color color))
+ ((eq property 'background)
+ (cons 'background-color color))
+ (t
+ (cons property color))))
+
+(defun ansi-color-make-extent (from to &optional buffer)
+ "Make an extent for the range [FROM, TO) in BUFFER.
+
+BUFFER defaults to the current buffer."
+ ;; The overlay might end at the process-mark in comint
+ ;; buffers. In that case, new text will be inserted before the
+ ;; process-mark, ie. inside the overlay (using insert-before-marks).
+ ;; In order to avoid this, we use the `insert-behind-hooks' overlay
+ ;; property to make sure it works.
+ (let ((overlay (make-overlay from to buffer)))
+ (overlay-put overlay 'evaporate t)
+ (overlay-put overlay 'modification-hooks '(ansi-color-freeze-overlay))
+ (overlay-put overlay 'insert-behind-hooks '(ansi-color-freeze-overlay))
+ overlay))
(defun ansi-color-freeze-overlay (overlay is-after begin end &optional len)
"Prevent OVERLAY from being extended.
@@ -506,11 +491,9 @@ property."
(move-overlay overlay (overlay-start overlay) begin)))
(defun ansi-color-set-extent-face (extent face)
- "Set the `face' property of EXTENT to FACE.
-XEmacs uses `set-extent-face', Emacs uses `overlay-put'."
- (if (featurep 'xemacs)
- (set-extent-face extent face)
- (overlay-put extent 'face face)))
+ "Set the `face' property of EXTENT to FACE."
+ (declare (obsolete overlay-put "27.1"))
+ (overlay-put extent 'face face))
;; Helper functions