Function: pdf-util-with-edges
pdf-util-with-edges is a macro defined in pdf-util.el.
Signature
(pdf-util-with-edges LIST-OF-EDGES &rest BODY)
Documentation
Provide some convenient macros for the edges in LIST-OF-EDGES.
LIST-OF-EDGES should be a list of variables (X ...), each one holding a list of edges. Inside BODY the symbols X-left, X-top, X-right, X-bot, X-width and X-height expand to their respective values.
Source Code
;; Defined in /nix/store/63h5z2vmzn0mfavcxi2idi23g5xcgkbl-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20260102.1101/pdf-util.el
(defmacro pdf-util-with-edges (list-of-edges &rest body)
"Provide some convenient macros for the edges in LIST-OF-EDGES.
LIST-OF-EDGES should be a list of variables \(X ...\), each one
holding a list of edges. Inside BODY the symbols X-left, X-top,
X-right, X-bot, X-width and X-height expand to their respective
values."
(declare (indent 1) (debug (sexp &rest form)))
(unless (cl-every 'symbolp list-of-edges)
(error "Argument should be a list of symbols"))
(let ((list-of-syms
(mapcar (lambda (edge)
(cons edge (mapcar
(lambda (kind)
(intern (format "%s-%s" edge kind)))
'(left top right bot width height))))
list-of-edges)))
(macroexpand-all
`(cl-symbol-macrolet
,(apply #'nconc
(mapcar
(lambda (edge-syms)
(let ((edge (nth 0 edge-syms))
(syms (cdr edge-syms)))
`((,(pop syms) (nth 0 ,edge))
(,(pop syms) (nth 1 ,edge))
(,(pop syms) (nth 2 ,edge))
(,(pop syms) (nth 3 ,edge))
(,(pop syms) (- (nth 2 ,edge)
(nth 0 ,edge)))
(,(pop syms) (- (nth 3 ,edge)
(nth 1 ,edge))))))
list-of-syms))
,@body))))