Function: pdf-info-query--parse-response
pdf-info-query--parse-response is a natively compiled function defined
in pdf-info.el.
Signature
(pdf-info-query--parse-response CMD RESPONSE)
Documentation
Parse one epdfinfo RESPONSE to CMD.
Returns a cons (STATUS . RESULT), where STATUS is one of nil for a regular response, error for an error (RESULT contains the error message) or interrupted, i.e. the command was interrupted.
Source Code
;; Defined in /nix/store/63h5z2vmzn0mfavcxi2idi23g5xcgkbl-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20260102.1101/pdf-info.el
(defun pdf-info-query--parse-response (cmd response)
"Parse one epdfinfo RESPONSE to CMD.
Returns a cons \(STATUS . RESULT\), where STATUS is one of nil
for a regular response, error for an error \(RESULT contains the
error message\) or interrupted, i.e. the command was
interrupted."
(with-current-buffer
(get-buffer-create " *pdf-info-query--parse-response*")
(erase-buffer)
(insert response)
(goto-char 1)
(cond
((looking-at "ERR\n")
(forward-line)
(cons 'error (buffer-substring-no-properties
(point)
(progn
(re-search-forward "^\\.\n")
(1- (match-beginning 0))))))
((looking-at "OK\n")
(let (result)
(forward-line)
(while (not (and (= (char-after) ?.)
(= (char-after (1+ (point))) ?\n)))
(push (pdf-info-query--read-record) result))
(cons nil (pdf-info-query--transform-response
cmd (nreverse result)))))
((looking-at "INT\n")
(cons 'interrupted nil))
(t
(cons 'error "Invalid server response")))))