doomemacs/modules/lang/sh/autoload.el

49 lines
1.4 KiB
EmacsLisp
Raw Normal View History

;;; lang/sh/autoload.el -*- lexical-binding: t; -*-
2017-02-19 18:57:16 -05:00
;;;###autoload
(defun +sh--match-variables-in-quotes (limit)
2017-02-19 18:57:16 -05:00
"Search for variables in double-quoted strings bounded by LIMIT."
(with-syntax-table sh-mode-syntax-table
(let (res)
(while
(and (setq res
(re-search-forward
"[^\\]\\(\\$\\)\\({.+?}\\|\\<[a-zA-Z0-9_]+\\|[@*#!]\\)"
limit t))
(not (eq (nth 3 (syntax-ppss)) ?\"))))
res)))
2017-02-19 18:57:16 -05:00
;;;###autoload
(defun +sh--match-command-subst-in-quotes (limit)
"Search for variables in double-quoted strings bounded by LIMIT."
(with-syntax-table sh-mode-syntax-table
(let (res)
(while
(and (setq res
(re-search-forward "[^\\]\\(\\$(.+?)\\|`.+?`\\)"
limit t))
(not (eq (nth 3 (syntax-ppss)) ?\"))))
res)))
2017-02-19 18:57:16 -05:00
(defvar sh-shell-file)
2017-02-19 18:57:16 -05:00
;;;###autoload
(defun +sh/open-repl ()
2017-02-19 18:57:16 -05:00
"Open a shell REPL."
2019-10-04 21:25:52 -04:00
(interactive)
2017-02-19 18:57:16 -05:00
(let* ((dest-sh (symbol-name sh-shell))
(sh-shell-file dest-sh))
(sh-shell-process t)
(with-current-buffer "*shell*"
2019-10-04 21:25:52 -04:00
(rename-buffer (format "*shell [%s]*" dest-sh))
(current-buffer))))
;;;###autoload
(defun +sh-lookup-documentation-handler ()
"Look up documentation in `man' or `woman'."
(interactive)
(call-interactively
(if (executable-find "man")
#'man
#'woman))
(current-buffer))