[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 34662c2 1/3: Move non-compat Gnus functions to gnus
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master 34662c2 1/3: Move non-compat Gnus functions to gnus-util.el |
Date: |
Wed, 10 Feb 2016 00:01:39 +0000 |
branch: master
commit 34662c20bc0f0d6cc40af99ab830a80bc4952258
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Move non-compat Gnus functions to gnus-util.el
* lisp/gnus/gnus-util.el (gnus-remove-image, gnus-put-image)
(gnus-create-image, gnus-image-type-available-p): Move here
from gnus-ems.el, since these aren't compat functions.
---
lisp/gnus/gnus-ems.el | 51 ------------------------------------------------
lisp/gnus/gnus-util.el | 48 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 51 deletions(-)
diff --git a/lisp/gnus/gnus-ems.el b/lisp/gnus/gnus-ems.el
index f72031b..a4c091e 100644
--- a/lisp/gnus/gnus-ems.el
+++ b/lisp/gnus/gnus-ems.el
@@ -158,57 +158,6 @@
"Non-nil means the mark and region are currently active in this buffer."
mark-active) ; aliased to region-exists-p in XEmacs.
-(autoload 'gnus-alive-p "gnus-util")
-(autoload 'mm-disable-multibyte "mm-util")
-
-;;; Image functions.
-
-(defun gnus-image-type-available-p (type)
- (and (fboundp 'image-type-available-p)
- (if (fboundp 'display-images-p)
- (display-images-p)
- t)
- (image-type-available-p type)))
-
-(defun gnus-create-image (file &optional type data-p &rest props)
- (let ((face (plist-get props :face)))
- (when face
- (setq props (plist-put props :foreground (face-foreground face)))
- (setq props (plist-put props :background (face-background face))))
- (ignore-errors
- (apply 'create-image file type data-p props))))
-
-(defun gnus-put-image (glyph &optional string category)
- (let ((point (point)))
- (insert-image glyph (or string " "))
- (put-text-property point (point) 'gnus-image-category category)
- (unless string
- (put-text-property (1- (point)) (point)
- 'gnus-image-text-deletable t))
- glyph))
-
-(defun gnus-remove-image (image &optional category)
- "Remove the image matching IMAGE and CATEGORY found first."
- (let ((start (point-min))
- val end)
- (while (and (not end)
- (or (setq val (get-text-property start 'display))
- (and (setq start
- (next-single-property-change start 'display))
- (setq val (get-text-property start 'display)))))
- (setq end (or (next-single-property-change start 'display)
- (point-max)))
- (if (and (equal val image)
- (equal (get-text-property start 'gnus-image-category)
- category))
- (progn
- (put-text-property start end 'display nil)
- (when (get-text-property start 'gnus-image-text-deletable)
- (delete-region start end)))
- (unless (= end (point-max))
- (setq start end
- end nil))))))
-
(provide 'gnus-ems)
;;; gnus-ems.el ends here
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 31645fc..33d96bd 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -2021,6 +2021,54 @@ lists of strings."
(gnus-setdiff (cdr list1) list2)
(cons (car list1) (gnus-setdiff (cdr list1) list2)))))
+;;; Image functions.
+
+(defun gnus-image-type-available-p (type)
+ (and (fboundp 'image-type-available-p)
+ (if (fboundp 'display-images-p)
+ (display-images-p)
+ t)
+ (image-type-available-p type)))
+
+(defun gnus-create-image (file &optional type data-p &rest props)
+ (let ((face (plist-get props :face)))
+ (when face
+ (setq props (plist-put props :foreground (face-foreground face)))
+ (setq props (plist-put props :background (face-background face))))
+ (ignore-errors
+ (apply 'create-image file type data-p props))))
+
+(defun gnus-put-image (glyph &optional string category)
+ (let ((point (point)))
+ (insert-image glyph (or string " "))
+ (put-text-property point (point) 'gnus-image-category category)
+ (unless string
+ (put-text-property (1- (point)) (point)
+ 'gnus-image-text-deletable t))
+ glyph))
+
+(defun gnus-remove-image (image &optional category)
+ "Remove the image matching IMAGE and CATEGORY found first."
+ (let ((start (point-min))
+ val end)
+ (while (and (not end)
+ (or (setq val (get-text-property start 'display))
+ (and (setq start
+ (next-single-property-change start 'display))
+ (setq val (get-text-property start 'display)))))
+ (setq end (or (next-single-property-change start 'display)
+ (point-max)))
+ (if (and (equal val image)
+ (equal (get-text-property start 'gnus-image-category)
+ category))
+ (progn
+ (put-text-property start end 'display nil)
+ (when (get-text-property start 'gnus-image-text-deletable)
+ (delete-region start end)))
+ (unless (= end (point-max))
+ (setq start end
+ end nil))))))
+
(provide 'gnus-util)
;;; gnus-util.el ends here