Function: markdown-ts--maybe-run-command-in-code-block
markdown-ts--maybe-run-command-in-code-block is a byte-compiled
function defined in markdown-ts-mode.el.gz.
Signature
(markdown-ts--maybe-run-command-in-code-block)
Documentation
Helper function to wrap a command for a code-block context.
If this-command is a member of markdown-ts-code-block-commands and
point is within a code block with an available mode, it will run in that
code block's mode in a buffer narrowed to its content. Otherwise, the
command will run in the context of the markdown-ts-mode buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(defun markdown-ts--maybe-run-command-in-code-block ()
"Helper function to wrap a command for a code-block context.
If `this-command' is a member of `markdown-ts-code-block-commands' and
point is within a code block with an available mode, it will run in that
code block's mode in a buffer narrowed to its content. Otherwise, the
command will run in the context of the `markdown-ts-mode' buffer."
(when (memq this-command markdown-ts-code-block-commands)
(when-let* ((command this-command)
(block-mode (markdown-ts-code-block-mode-at))
((fboundp block-mode)))
(setq this-command (lambda (&rest args)
(interactive)
(apply #'markdown-ts--run-command-in-code-block
block-mode
command
args))))))