-;; extract a face from a list of char properties, if there is one:
-(defun hfy-p-to-face (props)
- "Given PROPS, a list of text properties, return the value of the face
-property, or nil."
- (if props
- (if (string= (car props) "face")
- (let ((propval (cadr props)))
- (if (and (listp propval) (not (cdr propval)))
- (car propval)
- propval))
- (hfy-p-to-face (cddr props)))
- nil))
-
-(defun hfy-p-to-face-lennart (props)
- "Given PROPS, a list of text properties, return the value of the face
-property, or nil."
- (when props
- (let ((face (plist-get props 'face))
- (font-lock-face (plist-get props 'font-lock-face))
- (button (plist-get props 'button))
- ;;(face-rec (memq 'face props))
- ;;(button-rec (memq 'button props)))
- )
- (if button
- (let* ((category (plist-get props 'category))
- (face (when category (plist-get (symbol-plist category) 'face))))
- face)
- (or font-lock-face
- face)))))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; (defun hfy-get-face-at (pos)
-;; ;; (let ((face (get-char-property-and-overlay pos 'face)))
-;; ;; (when (and face (listp face)) (setq face (car face)))
-;; ;; (unless (listp face)
-;; ;; face)))
-;; ;;(get-char-property pos 'face)
-;; ;; Overlays are handled later
-;; (if (or (not show-trailing-whitespace)
-;; (not (get-text-property pos 'hfy-show-trailing-whitespace)))
-;; (get-text-property pos 'face)
-;; (list 'trailing-whitespace (get-text-property pos 'face)))
-;; )
-
-(defun hfy-prop-invisible-p (prop)
- "Is text property PROP an active invisibility property?"
- (or (and (eq buffer-invisibility-spec t) prop)
- (or (memq prop buffer-invisibility-spec)
- (assq prop buffer-invisibility-spec))))
+(defalias 'hfy-prop-invisible-p
+ (if (fboundp 'invisible-p) #'invisible-p
+ (lambda (prop)
+ "Is text property PROP an active invisibility property?"
+ (or (and (eq buffer-invisibility-spec t) prop)
+ (or (memq prop buffer-invisibility-spec)
+ (assq prop buffer-invisibility-spec))))))