From 29aaeb5528ed5a4706519b87eeaf3bb32b5df6e2 Mon Sep 17 00:00:00 2001 From: Pontus Freyhult <pont@soua.net> Date: Fri, 29 Oct 2004 10:41:09 +0000 Subject: [PATCH] Revert to aliases for face-foreground and face-background and related changes: New function lyskom-safe-color-name and changes in lp--entry-set-background and lp--entry-set-foreground. --- src/ChangeLog | 14 +++++++++++++- src/compatibility.el | 23 +++++------------------ src/mship-edit.el | 6 ++++-- src/utilities.el | 5 +++++ 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 34a8f50a..7350059b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2004-10-29 Pontus Freyhult <pont@soua.net> + + * mship-edit.el (lp--entry-set-background): Use + lyskom-safe-color-name. + (lp--entry-set-foreground): Dito. + + * utilities.el (lyskom-safe-color-name): New function. + + * compatibility.el (color-name): New alias. + (color-specifier-p): New alias. + (face-background): Reverted previous change, alias again. + (face-foreground): Reverted previous change, alias again. + 2004-10-29 Pontus Freyhult <pont@pontus.its.uu.se> * lyskom-rest.el (lyskom-format-image): Disabled run time @@ -7,7 +20,6 @@ (put-image): New alias. (create-image): New alias. - 2004-10-29 Pontus Freyhult <pont@soua.net> * lyskom-rest.el (lyskom-format-image): Bugix: Used let instead diff --git a/src/compatibility.el b/src/compatibility.el index 43ffe29d..a0f05011 100644 --- a/src/compatibility.el +++ b/src/compatibility.el @@ -301,24 +301,8 @@ KEYS should be a string in the format used for saving keyboard macros (lyskom-function-alias frame-property (frame property &optional default) (or (cdr (assq property (frame-parameters frame))) default)) - -(defun lyskom-face-background (face) - "Call face-background and return a string with the name or nil." - (let ((f (face-background face nil))) - (cond ((stringp f) f) - ((and (fboundp 'color-specifier-p) - (color-specifier-p f)) - (color-name f))))) - -(defun lyskom-face-foreground (face) - "Call face-foreground and return a string with the name or nil." - (let ((f (face-foreground face nil))) - (cond ((stringp f) f) - ((and (fboundp 'color-specifier-p) - (color-specifier-p f)) - (color-name f))))) - - +(lyskom-function-alias face-background (face) nil) +(lyskom-function-alias face-foreground (face) nil) (lyskom-function-alias find-face (face) (and (facep face) face)) @@ -355,6 +339,9 @@ See `walk-windows' for the meaning of MINIBUF and FRAME." ;;; ================================================================ ;;; Color stuff +(lyskom-function-alias color-specifier-p (obj) nil) +(lyskom-function-alias color-name (obj) nil) + (lyskom-with-external-functions (color-rgb-components make-specifier set-specifier) diff --git a/src/mship-edit.el b/src/mship-edit.el index 24c528f9..bbb83122 100644 --- a/src/mship-edit.el +++ b/src/mship-edit.el @@ -170,7 +170,8 @@ This function does not tell the server about the change." (delq extent (lp--entry->extents entry))))) (let* ((extent (cdr (assq 'color (lp--entry->extents entry)))) - (facename (intern (format "lyskom-%s-background" color))) + (facename (intern (format "lyskom-%s-background" + (lyskom-safe-color-name color)))) (face (or (lyskom-find-face facename) (lyskom-make-face facename t)))) (unless extent (lyskom-xemacs-or-gnu @@ -203,7 +204,8 @@ This function does not tell the server about the change." (delq extent (lp--entry->extents entry))))) (let* ((extent (cdr (assq 'fcolor (lp--entry->extents entry)))) - (facename (intern (format "lyskom-%s-foreground" color))) + (facename (intern (format "lyskom-%s-foreground" + (lyskom-safe-color-name color)))) (face (or (lyskom-find-face facename) (lyskom-make-face facename t)))) (unless extent (lyskom-xemacs-or-gnu diff --git a/src/utilities.el b/src/utilities.el index cac08d59..c3156126 100644 --- a/src/utilities.el +++ b/src/utilities.el @@ -1889,6 +1889,11 @@ has the bug in that algorithm fixed)." ;;; '(face test-default)))))) ;;; +(defun lyskom-safe-color-name (c) + "Return a color name as a string or nil." + (cond ((stringp c) c) + ((lyskom-color-specifier-p c) (lyskom-color-name c)))) + (defun lyskom-is-url (text) "Return non-nil if TEXT can be interpreted as an URL. -- GitLab