Function: markdown-ts--code-block-xref-find-definitions
markdown-ts--code-block-xref-find-definitions is an interactive and
byte-compiled function defined in markdown-ts-mode.el.gz.
Signature
(markdown-ts--code-block-xref-find-definitions &rest ARGS)
Documentation
Helper command for xref-find-definitions in a code-block context.
Find thing at point. Adjust the references on the xref stack to the base buffer. Pass through ARGS if not in a code block with an available mode.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
;; NOTE: Do not add this command to `markdown-ts-code-block-commands'.
(defun markdown-ts--code-block-xref-find-definitions (&rest args)
"Helper command for `xref-find-definitions' in a code-block context.
Find thing at point.
Adjust the references on the xref stack to the base buffer.
Pass through ARGS if not in a code block with an available mode."
(interactive)
(if-let* ((block-mode (markdown-ts-code-block-mode-at))
((fboundp block-mode)))
(condition-case err
(unwind-protect
(progn
;; Record a placeholder xref marker in the base buffer. This
;; will be retained if the command succeeds to push a marker in
;; the code-block buffer which we will pop.
(xref-push-marker-stack)
;; `xref-find-definitions' is a thing command in
;; `markdown-ts-code-block-thing-commands'.
(markdown-ts--run-command-in-code-block block-mode
#'xref-find-definitions
args))
;; Pop the top xref marker. If the command succeeded, the
;; top marker will be the code-block buffer marker. If it
;; failed, we'll pop the placeholder which is now of no
;; value.
;; TODO: Propose an `xref' pop function that doesn't "go
;; back".
(let ((history (xref--get-history)))
(unless (null (car history))
(pop (car history)))))
(error
;; Propagate the signal.
(signal (car err) (cdr err))))
;; Not in a code block context. This should really never happen.
(funcall-interactively #'xref-find-definitions args)))