Function: pdf-info-make-local-server

pdf-info-make-local-server is a natively compiled function defined in pdf-info.el.

Signature

(pdf-info-make-local-server &optional BUFFER FORCE-RESTART-P)

Documentation

Create a server instance local to BUFFER.

Does nothing if BUFFER already has a local instance. Unless FORCE-RESTART-P is non-nil, then quit a potential process and restart it.

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-make-local-server (&optional buffer force-restart-p)
  "Create a server instance local to BUFFER.

Does nothing if BUFFER already has a local instance.  Unless
FORCE-RESTART-P is non-nil, then quit a potential process and
restart it."
  (unless buffer
    (setq buffer (current-buffer)))
  (with-current-buffer buffer
    (unless (and
             (not force-restart-p)
             (local-variable-p 'pdf-info--queue)
             (processp (pdf-info-process))
             (eq (process-status (pdf-info-process))
                 'run))
      (when (and (local-variable-p 'pdf-info--queue)
                 (processp (pdf-info-process)))
        (tq-close pdf-info--queue))
      (set (make-local-variable 'pdf-info--queue) nil)
      (pdf-info-process-assert-running t)
      (add-hook 'kill-buffer-hook #'pdf-info-kill-local-server nil t)
      pdf-info--queue)))