doomemacs/modules/lang/sh/autoload.el
Henrik Lissner 94b16cba6c
Standardize REPL commands & improve SPC o r
- SPC o r now prompts for a REPL to open when none was found for the
  current buffer.
- REPL handlers must now follow the naming convention "*/open*-repl".
  e.g. +python/open-ipython-repl, +emacs-lisp/open-repl, etc.
- +eval/open-repl has been split in two:
  - +eval/open-repl-other-window
  - +eval/open-repl-same-window
2019-02-18 01:59:56 -05:00

36 lines
1.2 KiB
EmacsLisp

;;; lang/sh/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +sh--match-variables-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
"[^\\]\\(\\$\\)\\({.+?}\\|\\<[a-zA-Z0-9_]+\\|[@*#!]\\)"
limit t))
(not (eq (nth 3 (syntax-ppss)) ?\"))))
res)))
;;;###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)))
(defvar sh-shell-file)
;;;###autoload
(defun +sh/open-repl ()
"Open a shell REPL."
(let* ((dest-sh (symbol-name sh-shell))
(sh-shell-file dest-sh))
(sh-shell-process t)
(with-current-buffer "*shell*"
(rename-buffer (format "*shell [%s]*" dest-sh)))))