From db492b1e41de332c92565a159a0b50c2520afc81 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 13 May 2022 21:30:05 +0200 Subject: [PATCH] Remove some XEmacs compat code from eudc-bob.el * lisp/net/eudc-bob.el (eudc-bob-can-display-inline-images): Make into obsolete alias for display-graphic-p. Update all callers. (eudc-bob-display-jpeg): Remove XEmacs compat code. --- lisp/net/eudc-bob.el | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/lisp/net/eudc-bob.el b/lisp/net/eudc-bob.el index f543678fa2d..68a0ccb3a13 100644 --- a/lisp/net/eudc-bob.el +++ b/lisp/net/eudc-bob.el @@ -86,7 +86,7 @@ `("EUDC Image Menu" ["---" nil nil] ["Toggle inline display" eudc-bob-toggle-inline-display - (eudc-bob-can-display-inline-images)] + (display-graphic-p)] ,@(cdr (cdr eudc-bob-generic-menu)))) (defvar eudc-bob-sound-menu @@ -109,14 +109,6 @@ (setq overlays (cdr overlays))) value)) -(defun eudc-bob-can-display-inline-images () - "Return non-nil if we can display images inline." - (if (fboundp 'console-type) - (and (memq (console-type) '(x mswindows)) - (fboundp 'make-glyph)) - (and (fboundp 'display-graphic-p) - (display-graphic-p)))) - (defun eudc-bob-make-button (label keymap &optional menu plist) "Create a button with LABEL. Attach KEYMAP, MENU and properties from PLIST to a new overlay covering @@ -142,19 +134,7 @@ LABEL." "Display the JPEG DATA at point. If INLINE is non-nil, try to inline the image otherwise simply display a button." - (cond ((fboundp 'make-glyph) - (let ((glyph (if (eudc-bob-can-display-inline-images) - (make-glyph (list (vector 'jpeg :data data) - [string :data "[JPEG Picture]"]))))) - (eudc-bob-make-button "[JPEG Picture]" - eudc-bob-image-keymap - eudc-bob-image-menu - (list 'glyph glyph - 'end-glyph (if inline glyph) - 'duplicable t - 'invisible inline - 'object-data data)))) - ((fboundp 'create-image) + (cond ((fboundp 'create-image) (let* ((image (create-image data nil t)) (props (list 'object-data data 'eudc-image image))) (when (and inline (image-type-available-p 'jpeg)) @@ -167,7 +147,7 @@ display a button." (defun eudc-bob-toggle-inline-display () "Toggle inline display of an image." (interactive) - (when (eudc-bob-can-display-inline-images) + (when (display-graphic-p) (let* ((overlays (append (overlays-at (1- (point))) (overlays-at (point)))) image) @@ -287,11 +267,13 @@ display a button." ;;;###autoload (defun eudc-display-jpeg-inline (data) "Display the JPEG DATA inline at point if possible." - (eudc-bob-display-jpeg data (eudc-bob-can-display-inline-images))) + (eudc-bob-display-jpeg data (display-graphic-p))) ;;;###autoload (defun eudc-display-jpeg-as-button (data) "Display a button for the JPEG DATA." (eudc-bob-display-jpeg data nil)) +(define-obsolete-function-alias 'eudc-bob-can-display-inline-images #'display-graphic-p "29.1") + ;;; eudc-bob.el ends here -- 2.39.2