Function: tuareg--merlin-buffer-signature

tuareg--merlin-buffer-signature is a natively compiled function defined in tuareg.el.

Signature

(tuareg--merlin-buffer-signature BUF)

Documentation

Return the signature of BUF or nil if there was a problem.

Source Code

;; Defined in /nix/store/6mbh851dhnag8f92qfrlh9ckldzwf6c6-emacs-packages-deps/share/emacs/site-lisp/elpa/tuareg-20260626.936/tuareg.el
(defun tuareg--merlin-buffer-signature (buf)
  "Return the signature of BUF or nil if there was a problem."
  (let (sig)
    (with-temp-buffer
      (insert "module TuaregBufferSignature = struct\n")
      (insert-buffer-substring-no-properties buf)
      (insert "\nend")
      (goto-char (point-min))
      (when (merlin--type-enclosing-query)
        ;; Similar to `merlin--type-enclosing-go' but return the type.
        (let ((data (elt merlin-enclosing-types merlin-enclosing-offset)))
          (if (cddr data)
              (setq sig (merlin--type-enclosing-text data))))))
    (when (and sig (string-match "\\`sig\\>" sig) (>= (length sig) 9))
      (setq sig (string-trim (substring sig 3 -3)))
      (replace-regexp-in-string "\n  " "\n" sig))))