Function: format-annotate-location
format-annotate-location is a byte-compiled function defined in
format.el.gz.
Signature
(format-annotate-location LOC ALL IGNORE TRANSLATIONS)
Documentation
Return annotation(s) needed at location LOC.
This includes any properties that change between LOC - 1 and LOC.
If ALL is true, don't look at previous location, but generate annotations for
all non-nil properties.
Third argument IGNORE is a list of text-properties not to consider.
Use the TRANSLATIONS alist (see format-annotate-region for doc).
Return value is a vector of 3 elements:
1. List of annotations to close
2. List of annotations to open.
3. List of properties that were ignored or couldn't be annotated.
The annotations in lists 1 and 2 need not be strings.
They can be whatever the FORMAT-FN in format-annotate-region
can handle. If that is enriched-make-annotation, they can be
either strings, or lists of the form (PARAMETER VALUE).
Source Code
;; Defined in /usr/src/emacs/lisp/format.el.gz
;;; Internal functions for format-annotate-region.
(defun format-annotate-location (loc all ignore translations)
"Return annotation(s) needed at location LOC.
This includes any properties that change between LOC - 1 and LOC.
If ALL is true, don't look at previous location, but generate annotations for
all non-nil properties.
Third argument IGNORE is a list of text-properties not to consider.
Use the TRANSLATIONS alist (see `format-annotate-region' for doc).
Return value is a vector of 3 elements:
1. List of annotations to close
2. List of annotations to open.
3. List of properties that were ignored or couldn't be annotated.
The annotations in lists 1 and 2 need not be strings.
They can be whatever the FORMAT-FN in `format-annotate-region'
can handle. If that is `enriched-make-annotation', they can be
either strings, or lists of the form (PARAMETER VALUE)."
(let* ((prev-loc (1- loc))
(before-plist (if all nil (text-properties-at prev-loc)))
(after-plist (text-properties-at loc))
p negatives positives prop props not-found)
;; make list of all property names involved
(setq p before-plist)
(while p
(if (not (memq (car p) props))
(push (car p) props))
(setq p (cdr (cdr p))))
(setq p after-plist)
(while p
(if (not (memq (car p) props))
(push (car p) props))
(setq p (cdr (cdr p))))
(while props
(setq prop (pop props))
(if (memq prop ignore)
nil ; If it's been ignored before, ignore it now.
(let ((before (if all nil (car (cdr (memq prop before-plist)))))
(after (car (cdr (memq prop after-plist)))))
(if (equal before after)
nil ; no change; ignore
(let ((result (format-annotate-single-property-change
prop before after translations)))
(if (not result)
(push prop not-found)
(setq negatives (nconc negatives (car result))
positives (nconc positives (cdr result)))))))))
(vector negatives positives not-found)))