;;; Code:
+(eval-when-compile
+ (require 'cl))
+
;;; Compatibility:
(defun custom-xmas-add-text-properties (start end props &optional object)
(funcall 'set-face-underline-p 'underline t))))
(defun custom-xmas-set-text-properties (start end props &optional buffer)
- (if (or (null buffer) (bufferp buffer))
+ (if (null buffer)
(if props
(while props
(custom-put-text-property
;; Put it in the Help menu, if possible.
(if (string-match "XEmacs" emacs-version)
- ;; XEmacs (disabled because it doesn't work)
- (and current-menubar
- (add-menu-item '("Help") "Customize..." 'customize nil))
+ (if (featurep 'menubar)
+ ;; XEmacs (disabled because it doesn't work)
+ (and current-menubar
+ (add-menu-item '("Help") "Customize..." 'customize t)))
;; Emacs 19.28 and earlier
(global-set-key [ menu-bar help customize ]
'("Customize..." . customize))
(defun custom-face-import (custom value)
"Modify CUSTOM's VALUE to match internal expectations."
- (let ((name (symbol-name value)))
+ (let ((name (or (and (facep value) (symbol-name (face-name value)))
+ (symbol-name value))))
(list (if (string-match "\
custom-face-\\(.*\\)-\\(.*\\)-\\(.*\\)-\\(.*\\)-\\(.*\\)-\\(.*\\)"
name)
(intern (match-string 6 name)))
value))))
-(defun custom-face-lookup (fg bg stipple bold italic underline)
+(defun custom-face-lookup (&optional fg bg stipple bold italic underline)
"Lookup or create a face with specified attributes."
(let ((name (intern (format "custom-face-%s-%s-%s-%S-%S-%S"
(or fg "default")
(copy-face 'default name)
(when (and fg
(not (string-equal fg "default")))
- (set-face-foreground name fg))
+ (condition-case ()
+ (set-face-foreground name fg)
+ (error nil)))
(when (and bg
(not (string-equal bg "default")))
- (set-face-background name bg))
+ (condition-case ()
+ (set-face-background name bg)
+ (error nil)))
(when (and stipple
(not (string-equal stipple "default"))
(not (eq stipple 'custom:asis))
(not (string-match "XEmacs" emacs-version)))
(custom-category-put 'custom-hidden-properties intangible t)
-(eval-when 'load
- (if (file-readable-p custom-file)
- (load-file custom-file)))
+(if (file-readable-p custom-file)
+ (load-file custom-file))
(provide 'custom)