aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/shell.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/shell.el')
-rw-r--r--lisp/shell.el33
1 files changed, 17 insertions, 16 deletions
diff --git a/lisp/shell.el b/lisp/shell.el
index 18bb3722427..641f274045d 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -308,10 +308,11 @@ for Shell mode only."
308 (const :tag "on" t)) 308 (const :tag "on" t))
309 :group 'shell) 309 :group 'shell)
310 310
311(defcustom shell-comint-fl-enable t 311(defcustom shell-fontify-input-enable t
312 "Enable fontification of input in shell buffers. 312 "Enable fontification of input in shell buffers.
313This variable only has effect when the shell is started. Use the 313This variable only has effect when the shell is started. Use the
314command `comint-fl-mode' to toggle fontification of input." 314command `comint-fontify-input-mode' to toggle fontification of
315input."
315 :type 'boolean 316 :type 'boolean
316 :group 'shell 317 :group 'shell
317 :safe 'booleanp 318 :safe 'booleanp
@@ -623,8 +624,8 @@ command."
623 :interactive nil 624 :interactive nil
624 :after-hook 625 :after-hook
625 (unless comint-use-prompt-regexp 626 (unless comint-use-prompt-regexp
626 (if shell-comint-fl-enable 627 (if shell-fontify-input-enable
627 (comint-fl-mode)) 628 (comint-fontify-input-mode))
628 (if shell-highlight-undef-enable 629 (if shell-highlight-undef-enable
629 (shell-highlight-undef-mode))) 630 (shell-highlight-undef-mode)))
630 631
@@ -1664,8 +1665,8 @@ Similar to `executable-find', but use cache stored in
1664 (if buf (buffer-local-value 'default-directory buf) 1665 (if buf (buffer-local-value 'default-directory buf)
1665 default-directory))) 1666 default-directory)))
1666 (cond 1667 (cond
1667 ;; Don't highlight command output. Mostly useful if 1668 ;; Don't fontify command output. Mostly useful if
1668 ;; `comint-fl-mode' is disabled. 1669 ;; `comint-fontify-input-mode' is disabled.
1669 ((text-property-any beg (point) 'field 'output) 1670 ((text-property-any beg (point) 'field 'output)
1670 nil) 1671 nil)
1671 ((member cmd shell-highlight-undef-aliases) 1672 ((member cmd shell-highlight-undef-aliases)
@@ -1696,7 +1697,7 @@ Similar to `executable-find', but use cache stored in
1696(define-minor-mode shell-highlight-undef-mode 1697(define-minor-mode shell-highlight-undef-mode
1697 "Highlight undefined shell commands and aliases. 1698 "Highlight undefined shell commands and aliases.
1698This minor mode is mostly useful in `shell-mode' buffers and 1699This minor mode is mostly useful in `shell-mode' buffers and
1699works better if `comint-fl-mode' is enabled." 1700works better if `comint-fontify-input-mode' is enabled."
1700 :init-value nil 1701 :init-value nil
1701 (if shell--highlight-undef-indirect 1702 (if shell--highlight-undef-indirect
1702 (progn 1703 (progn
@@ -1706,7 +1707,7 @@ works better if `comint-fl-mode' is enabled."
1706 (with-current-buffer buf 1707 (with-current-buffer buf
1707 (font-lock-remove-keywords nil shell-highlight-undef-keywords)))) 1708 (font-lock-remove-keywords nil shell-highlight-undef-keywords))))
1708 (font-lock-remove-keywords nil shell-highlight-undef-keywords)) 1709 (font-lock-remove-keywords nil shell-highlight-undef-keywords))
1709 (remove-hook 'comint-fl-mode-hook 1710 (remove-hook 'comint-fontify-input-mode-hook
1710 #'shell-highlight-undef-mode-restart t) 1711 #'shell-highlight-undef-mode-restart t)
1711 1712
1712 (when shell-highlight-undef-mode 1713 (when shell-highlight-undef-mode
@@ -1722,9 +1723,9 @@ works better if `comint-fl-mode' is enabled."
1722 (concat 1723 (concat
1723 "\\(" 1724 "\\("
1724 "[;(){}`|&]" 1725 "[;(){}`|&]"
1725 (if comint-fl-mode 1726 (if comint-fontify-input-mode
1726 ;; `comint-fl-mode' already puts point-min on end of 1727 ;; `comint-fontify-input-mode' already puts
1727 ;; prompt 1728 ;; point-min on end of prompt
1728 "" 1729 ""
1729 (concat "\\|" comint-prompt-regexp)) 1730 (concat "\\|" comint-prompt-regexp))
1730 "\\|^" 1731 "\\|^"
@@ -1740,7 +1741,7 @@ works better if `comint-fl-mode' is enabled."
1740 (lambda () 1741 (lambda ()
1741 (setq shell-highlight-undef-regexp regexp) 1742 (setq shell-highlight-undef-regexp regexp)
1742 (font-lock-add-keywords nil shell-highlight-undef-keywords t)))) 1743 (font-lock-add-keywords nil shell-highlight-undef-keywords t))))
1743 (cond (comint-fl-mode 1744 (cond (comint-fontify-input-mode
1744 (setq shell--highlight-undef-indirect setup) 1745 (setq shell--highlight-undef-indirect setup)
1745 (if-let ((buf (comint-indirect-buffer t))) 1746 (if-let ((buf (comint-indirect-buffer t)))
1746 (with-current-buffer buf 1747 (with-current-buffer buf
@@ -1748,7 +1749,7 @@ works better if `comint-fl-mode' is enabled."
1748 (add-hook 'comint-indirect-setup-hook setup nil t))) 1749 (add-hook 'comint-indirect-setup-hook setup nil t)))
1749 (t (funcall setup)))) 1750 (t (funcall setup))))
1750 1751
1751 (add-hook 'comint-fl-mode-hook 1752 (add-hook 'comint-fontify-input-mode-hook
1752 #'shell-highlight-undef-mode-restart nil t)) 1753 #'shell-highlight-undef-mode-restart nil t))
1753 1754
1754 (font-lock-flush)) 1755 (font-lock-flush))
@@ -1756,9 +1757,9 @@ works better if `comint-fl-mode' is enabled."
1756(defun shell-highlight-undef-mode-restart () 1757(defun shell-highlight-undef-mode-restart ()
1757 "If `shell-highlight-undef-mode' is on, restart it. 1758 "If `shell-highlight-undef-mode' is on, restart it.
1758`shell-highlight-undef-mode' performs its setup differently 1759`shell-highlight-undef-mode' performs its setup differently
1759depending on `comint-fl-mode'. It's useful to call this function 1760depending on `comint-fontify-input-mode'. It's useful to call
1760when switching `comint-fl-mode' in order to make 1761this function when switching `comint-fontify-input-mode' in order
1761`shell-highlight-undef-mode' redo its setup." 1762to make `shell-highlight-undef-mode' redo its setup."
1762 (when shell-highlight-undef-mode 1763 (when shell-highlight-undef-mode
1763 (shell-highlight-undef-mode 1))) 1764 (shell-highlight-undef-mode 1)))
1764 1765