[elpa] master c96b7b7: Added greenbar package

2020-10-18 Thread mmaug--- via
branch: master
commit c96b7b7c3958530a51b6be837848439a915f3773
Author: Michael R. Mauger 
Commit: Michael R. Mauger 

Added greenbar package
---
 packages/greenbar/greenbar.el | 179 ++
 1 file changed, 179 insertions(+)

diff --git a/packages/greenbar/greenbar.el b/packages/greenbar/greenbar.el
new file mode 100644
index 000..f81cc4a
--- /dev/null
+++ b/packages/greenbar/greenbar.el
@@ -0,0 +1,179 @@
+;;; greenbar.el --- Mark comint output with "greenbar" background -*- 
lexical-binding: t -*-
+
+;; Copyright (C) 2013, 2015, 2020  Michael R. Mauger
+
+;; Author: Michael R. Mauger 
+;; Version: 1.0
+;; Package-Type: simple
+;; Keywords: faces, terminals
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+
+;; For some of us old neck beards who learned to write software on
+;; pucch cards and print out our code and output on wide line
+;; printers.  When reading long rows of text across a 14 7/8" page it
+;; was helpful to have alternating bands of subtle background coloring
+;; to guide your eyes across the line.  This is also referred to as
+;; `zebra striping` and is enabled in on PostScript output in
+;; `ps-print.el' by enabling the `ps-zebra-stripes' setting.
+
+;; To enable `greenbar-mode' in your `comint-mode' buffers, add the
+;; following to your Emacs configuration:
+
+;; (add-hook 'comint-mode-hook #'greenbar-mode)
+
+;; If you want to enable `greenbar-mode' only in a single mode derived
+;; from `comint-mode', then you need to add `greenbar-mode' only to
+;; the desired derive mode hook.  Adding `greenbar-mode' to
+;; `comint-mode-hook' enables it for all comint derived modes.
+
+;; The variable `greenbar-color-theme' is a list of predefined bar
+;; background colors.  Each element of the list is a list: the first
+;; member of which is a symbol that is the name of the theme; the rest
+;; of the list are color names which are used as background colors for
+;; successive bands of lines.
+
+;; The variable `greenbar-color-list' controls which set of color bars
+;; are to be applied.  The value is either a name from color theme
+;; defined in `greenbar-color-themes' or it is a list of color names.
+
+;;; Code:
+
+(require 'comint)
+
+(defgroup greenbar nil
+  "Stripe comint output like \"green bar\", or \"zebra stripe\" paper."
+  :group 'comint)
+
+(defvar-local greenbar-current-bar 0
+  "Index into `greenbar-background-colors' that is active.")
+
+(defvar-local greenbar-current-line 0
+  "The line into the bar that is active.")
+
+(defcustom greenbar-lines-per-bar 3
+  "How many lines of output should be colored together."
+  :group 'greenbar
+  :type 'integer)
+
+(defvar greenbar-color-themes
+  (list
+   (cons 'greenbar
+ (if (eq (frame-parameter nil 'background-mode) 'dark)
+ '("#344034" "#343434")
+   '("#e4f0e4" "#f0f0f0")))
+   (cons 'graybar
+ (list
+  (if (eq (frame-parameter nil 'background-mode) 'dark)
+  "gray30" "gray70")
+  (face-background 'default)))
+   (cons 'rainbow
+ (let ((x (if (eq (frame-parameter nil 'background-mode) 'dark) "40" 
"f0"))
+   (o (if (eq (frame-parameter nil 'background-mode) 'dark) "34" 
"e4")))
+
+   (mapcar (lambda (c)
+ (eval `(concat "#" ,@c)))
+   `((,x ,x ,o) (,x ,o ,o) (,x ,o ,x) (,o ,o ,x) (,o ,x ,x) 
(,o ,x ,o))
+  "Greenbar themes.
+
+A list of greenbar themes, each of which is a list starting with
+a symbol that names the theme followed by the list bar colors.")
+
+(defcustom greenbar-background-colors 'greenbar
+  "List of background colors to be applied to output stripes."
+  :group 'greenbar
+  :type `(choice ,@(mapcar (lambda (c)
+ (list 'const (car c)))
+   greenbar-color-themes)
+ (repeat (color :tag "Background list"
+
+(defun greenbar-color-list ()
+  "Get the list of greenbar background colors."
+(or (cdr (assoc greenbar-background-colors
+greenbar-color-themes))
+greenbar-background-colors))
+
+(defun greenbar-next-bar ()
+  "Reset the local configuration if we are at the end of a bar.
+
+If `greenbar-lines' is zero, reset it to
+`greenbar-lines-per-bar', and move `greenbar-current-bar' to the
+next one."
+
+  (when (zerop greenbar-current-lin

[elpa] master 6c5e5b1: greenbar -- cleaned-up comments and docstrings

2020-10-19 Thread mmaug--- via
branch: master
commit 6c5e5b19b2d76ab84f48e83152987b89369ecac6
Author: Michael R. Mauger 
Commit: Michael R. Mauger 

greenbar -- cleaned-up comments and docstrings
---
 packages/greenbar/greenbar.el | 33 ++---
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/packages/greenbar/greenbar.el b/packages/greenbar/greenbar.el
index c29fe2a..de3aa22 100644
--- a/packages/greenbar/greenbar.el
+++ b/packages/greenbar/greenbar.el
@@ -22,13 +22,19 @@
 
 ;;; Commentary:
 
-;; For some of us old neck beards who learned to write software on
-;; pucch cards and print out our code and output on wide line
-;; printers.  When reading long rows of text across a 14 7/8" page it
+;; For us old neck beards, who learned to write software on punch
+;; cards and print out our code and output on wide line printers, it
 ;; was helpful to have alternating bands of subtle background coloring
-;; to guide your eyes across the line.  This is also referred to as
-;; `zebra striping` and is enabled in on PostScript output in
-;; `ps-print.el' by enabling the `ps-zebra-stripes' setting.
+;; to guide our eyes across the line on the page.  Reading long rows
+;; of text across a 14 7/8" page, it was very easy to loose your place
+;; vertically while scanning the page horizontally.  The subtle
+;; background shading was often done with pale bands of green
+;; alternating with the white of the paper.
+
+;; Paper pre-printed with the pale green bars was often referred to as
+;; "green bar" and the technique is also referred to as "zebra
+;; striping."  In Emacs, in `ps-print.el' (PostScript print facility),
+;; the feature is enabling with the `ps-zebra-stripes' setting.
 
 ;; To enable `greenbar-mode' in your `comint-mode' buffers, add the
 ;; following to your Emacs configuration:
@@ -37,7 +43,7 @@
 
 ;; If you want to enable `greenbar-mode' only in a single mode derived
 ;; from `comint-mode', then you need to add `greenbar-mode' only to
-;; the desired derive mode hook.  Adding `greenbar-mode' to
+;; the desired derived mode hook.  Adding `greenbar-mode' to
 ;; `comint-mode-hook' enables it for all comint derived modes.
 
 ;; The variable `greenbar-color-theme' is a list of predefined bar
@@ -50,6 +56,11 @@
 ;; are to be applied.  The value is either a name from color theme
 ;; defined in `greenbar-color-themes' or it is a list of color names.
 
+;; The variable `greenbar-lines-per-bar' controls how many output
+;; lines are displayed using each band's background color.
+
+;; Suggestions for other background color themes are always welcome.
+
 ;;; Code:
 
 (require 'comint)
@@ -85,17 +96,17 @@
 
(mapcar (lambda (c) (apply #'concat "#" c))
`((,x ,x ,o) (,x ,o ,o) (,x ,o ,x) (,o ,o ,x) (,o ,x ,x) 
(,o ,x ,o))
-  "Greenbar themes.
+  "A list of Greenbar themes.
 
-A list of greenbar themes, each of which is a list starting with
-a symbol that names the theme followed by the list bar colors.")
+Each member of the list starts with a symbol that identifies the
+theme followed by the list bar colors.")
 
 (defcustom greenbar-background-colors 'greenbar
   "List of background colors to be applied to output stripes."
   :type `(choice ,@(mapcar (lambda (c)
  (list 'const (car c)))
greenbar-color-themes)
- (repeat (color :tag "Background list"
+ (repeat (color :tag "Background color"
 
 (defun greenbar-color-list ()
   "Get the list of greenbar background colors."



[elpa] master 6fc0acf: Add `greenbar-highlight-input' to highlight command input.

2020-10-24 Thread mmaug--- via
branch: master
commit 6fc0acf63e3402950ce6ebef2d67a47cc48103fb
Author: Michael R. Mauger 
Commit: Michael R. Mauger 

Add `greenbar-highlight-input' to highlight command input.

Originally they were highlighted mistakenly. The default now avoids
highlighting the input commands to help you visuallize the commands
and their results.
---
 packages/greenbar/greenbar.el | 35 +--
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/packages/greenbar/greenbar.el b/packages/greenbar/greenbar.el
index de3aa22..a145414 100644
--- a/packages/greenbar/greenbar.el
+++ b/packages/greenbar/greenbar.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2013-2020  Free Software Foundation, Inc.
 
 ;; Author: Michael R. Mauger 
-;; Version: 1.0
+;; Version: 1.1
 ;; Package-Type: simple
 ;; Keywords: faces, terminals
 
@@ -59,11 +59,16 @@
 ;; The variable `greenbar-lines-per-bar' controls how many output
 ;; lines are displayed using each band's background color.
 
+;; By default, input lines are not highlighted, but if
+;; `greenbar-highlight-input' is set to a non-nil value, then input is
+;; also highlighted with green bars as well.
+
 ;; Suggestions for other background color themes are always welcome.
 
 ;;; Code:
 
 (require 'comint)
+(require 'cl-lib)
 
 (defgroup greenbar nil
   "Stripe comint output like \"green bar\", or \"zebra stripe\" paper."
@@ -108,12 +113,27 @@ theme followed by the list bar colors.")
greenbar-color-themes)
  (repeat (color :tag "Background color"
 
+(defcustom greenbar-highlight-input nil
+  "Should prompts and command input be highlighted."
+  :type 'booleanp)
+
 (defun greenbar-color-list ()
   "Get the list of greenbar background colors."
 (or (cdr (assoc greenbar-background-colors
 greenbar-color-themes))
 greenbar-background-colors))
 
+(defun greenbar-is-valid-bar (color-list)
+  "Return non-nil, if COLOR-LIST is a list of valid colors."
+  (and color-list
+   (listp color-list)
+   (cl-every #'identity
+ (mapcar #'color-defined-p color-list
+
+(defun greenbar-is-command-input (_start end)
+  "Return non-nil, if input is in region betweeen START and END."
+  (= end comint-last-input-end))
+
 (defun greenbar-next-bar ()
   "Reset the local configuration if we are at the end of a bar.
 
@@ -132,12 +152,15 @@ Every `greenbar-lines-per-bar' lines are colored with a 
rotating
 set of background colors found in
 `greenbar-background-colors'."
 
-  (let ((bg-list (greenbar-color-list))
+  (let ((bar (greenbar-color-list))
 (start comint-last-output-start)
 (end (process-mark (get-buffer-process (current-buffer)
 
-;;(message "greenbar: %S %S %S" start end (replace-regexp-in-string "\n" 
"n" (buffer-substring start end)))
-(when (and bg-list (listp bg-list) (not (= start end)))
+(when (and (greenbar-is-valid-bar bar)
+   (not (= start end))
+   (or greenbar-highlight-input
+   (not (greenbar-is-command-input start end
+
   (greenbar-next-bar) ; make sure greenbar state is valid
   (save-excursion
 (save-restriction
@@ -160,10 +183,10 @@ set of background colors found in
 (setq greenbar-current-line (forward-line greenbar-current-line))
 
 ;; Mark the bar
-(let ((bar-face (nth greenbar-current-bar bg-list)))
+(let ((bar-bg (nth greenbar-current-bar bar)))
   (font-lock-append-text-property
start (point)
-   'font-lock-face (list :background bar-face
+   'font-lock-face (list :background bar-bg
  :extend t)))
 
 ;; Get ready for the next bar



[elpa] externals/shelisp 32f9134: Version 1.0.0 Added support from zsh and fish

2021-10-10 Thread mmaug--- via
branch: externals/shelisp
commit 32f91342f0039aa0e78a032b5b2a651ed5b1b79e
Author: Michael R. Mauger 
Commit: Michael R. Mauger 

Version 1.0.0 Added support from zsh and fish
---
 shelisp.el | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/shelisp.el b/shelisp.el
index 8bbd5a2..97b8694 100644
--- a/shelisp.el
+++ b/shelisp.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2018-2021  Free Software Foundation, Inc.
 
 ;; Author: Michael R. Mauger 
-;; Version: 0.9.1
+;; Version: 1.0.0
 ;; Package-Type: simple
 ;; Keywords: terminals, lisp, processes
 
@@ -67,7 +67,7 @@
 ;;   the execution of any elisp expressions submitted thru the shelisp
 ;;   escape sequence.
 
-;; * Support for bash, ksh, and fish is provided (thank you for
+;; * Support for bash, ksh, and fish is provided (thank you for your
 ;;   motivation and effort, Eduardo Ochs );
 ;;   support for csh, tcsh, ksh, ash, dash, mosh, and sh is welcomed.
 ;;
@@ -95,7 +95,7 @@
 (require 'pp)
 (require 'term)
 
-(declare-function internal-default-process-filter "process.c")
+(declare-function internal-default-process-filter "process.c" '(proc text))
 
 ;;;###autoload
 (define-minor-mode shelisp-mode
@@ -124,18 +124,18 @@ settings (`explicit-shell-file-name', the environment 
variable
 (defvar shelisp--wrapper-commands
   '((bash
  "unset -f shelisp_%1$s"
- "function shelisp_%1$s { printf '\\e_#EMACS# %2$s \e\\' \"$@\" ; }"
+ "function shelisp_%1$s { printf '\\e_#EMACS# %2$s \\e' \"$@\" ; }"
  "alias %1$s=shelisp_%1$s")
 (dash
- "shelisp_%1$s () {; printf '\\e_#EMACS# %2$s \e\\' \"$@\" ; }"
+ "shelisp_%1$s () {; printf '\\e_#EMACS# %2$s \\e' \"$@\" ; }"
  "alias %1$s=shelisp_%1$s")
 (zsh
  "unfunction shelisp_%1$s >/dev/null 2>&1"
- "function shelisp_%1$s { printf '\\e_#EMACS# %2$s \e\\' \"$@\" ; }"
+ "function shelisp_%1$s { printf '\\e_#EMACS# %2$s \\e' \"$@\" ; }"
  "alias %1$s=shelisp_%1$s")
 (fish
  "function %1$s"
- "printf '\\e_#EMACS# %2$s \e\\' $argv"
+ "printf '\\e_#EMACS# %2$s \\e' $argv"
  "end"))
 
   "Alist of shell commands necessary to make ShElisp work.
@@ -155,7 +155,12 @@ executed when the command is used.")
   "String to separate commands sent to the shell.")
 
 (defun shelisp--file-name (file)
-  "Apply remote host in `default-directory' to FILE."
+  "Apply remote host in `default-directory' to FILE.
+
+This is bound to the function `f' in the elisp expression handled
+by ShElisp.  This permits absolute filenames on remote hosts to
+be properly referenced."
+
   (if (and (file-name-absolute-p file)
   (not (file-remote-p file)))
   (concat (file-remote-p default-directory) file)
@@ -246,7 +251,7 @@ printf, with \"\\\"%s\\\"\", you use \\=`(f \\\"%s\\\")\\='.
 expression and cannot be used elsewhere.")
 
 (defun shelisp-add-commands ()
-  "Add Emacs Lisp to shell aliases (assumes GNU bash syntax)."
+  "Add Emacs Lisp to shell aliases."
 
   ;; Infer the shell
   (unless shelisp-shell



[elpa] externals/shelisp 16c2e95: Added support for zsh and fish shells along side bash

2021-09-12 Thread mmaug--- via
branch: externals/shelisp
commit 16c2e954f53b9fbf7c839e57b36234aade0222aa
Author: Michael R. Mauger 
Commit: Michael R. Mauger 

Added support for zsh and fish shells along side bash
---
 shelisp.el | 51 ++-
 1 file changed, 42 insertions(+), 9 deletions(-)

diff --git a/shelisp.el b/shelisp.el
index d470e5c..fc5d4d2 100644
--- a/shelisp.el
+++ b/shelisp.el
@@ -1,6 +1,6 @@
 ;;; shelisp.el --- execute elisp in shell  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2018-2019  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2021  Free Software Foundation, Inc.
 
 ;; Author: Michael R. Mauger 
 ;; Version: 0.9.1
@@ -110,6 +110,39 @@ while in a shell mode buffer."
 (defvar shelisp-debug nil
   "When non-nil, display messages showing the elisp expression.")
 
+(defvar shelisp-shell 'bash
+  "Identifies the shell scripting environment in use.")
+
+(defvar shelisp--wrapper-commands
+  '((bash
+ "unset -f shelisp_%1$s"
+ "function shelisp_%1$s { printf '\\e_#EMACS# %2$s \\a' \"$@\" ; }"
+ "alias %1$s=shelisp_%1$s")
+(zsh
+ "unfunction shelisp_%1$s >/dev/null 2>&1"
+ "function shelisp_%1$s { printf '\\e_#EMACS# %2$s \\a' \"$@\" ; }"
+ "alias %1$s=shelisp_%1$s")
+(fish
+ "function %1$s"
+ "printf '\\e_#EMACS# %2$s \\a' $argv"
+ "end"))
+
+  "Alist of shell commands necessary to make ShElisp work.
+
+The key of the alist is either an atom that identifies the type
+of shell (See `shelisp-shell' for defining the type of shell).
+
+The value is a series of strings which will be sent to the shell.
+Each string will be separated by the `shelisp--wrapper-separator'
+string.  The assempled string is used as a specification for the
+`format' function.  The first format parameter (\"%1$s\") is the
+command to be defined with \"%1$s\" set to the command; the
+second parameter (\"%2$s\") is the elisp expression to be
+executed when the command is used.")
+
+(defvar shelisp--wrapper-separator " ; "
+  "String to separate commands sent to the shell.")
+
 (defun shelisp--file-name (file)
   "Apply remote host in `default-directory' to FILE."
   (if (and (file-name-absolute-p file)
@@ -196,7 +229,8 @@ expression and cannot be used elsewhere.")
 (defun shelisp-add-commands ()
   "Add Emacs Lisp to shell aliases (assumes GNU bash syntax)."
 
-  (when (and shelisp-mode shelisp-commands)
+  (when (and shelisp-mode shelisp-commands
+ (assoc shelisp-shell shelisp--wrapper-commands))
 (let ((proc (get-buffer-process (current-buffer
   (dolist (c shelisp-commands)
 (let ((cmd (car c))
@@ -205,13 +239,12 @@ expression and cannot be used elsewhere.")
proc
(apply #'format
   (mapconcat #'identity
- '("unset -f shelisp_%s"
-   "function shelisp_%s { printf '\\e_#EMACS# %s 
\\a' \"$@\"; }"
-   "alias %s=shelisp_%s" "")
- " ; ")
-(list cmd cmd
- (replace-regexp-in-string "\"" "\"" expr)
- cmd cmd)
+ (append (cdr (assoc shelisp-shell
+ shelisp--wrapper-commands))
+ '(""))
+ shelisp--wrapper-separator)
+  (list cmd
+   (replace-regexp-in-string "\"" "\"" expr))
   (process-send-string proc "\n"
 
 (provide 'shelisp)



[elpa] externals/shelisp 9ede6c4: Infer shell from shell-mode if not specified

2021-09-13 Thread mmaug--- via
branch: externals/shelisp
commit 9ede6c4955b9a6266f745de83f8b3f79446cc73d
Author: Michael R. Mauger 
Commit: Michael R. Mauger 

Infer shell from shell-mode if not specified
---
 shelisp.el | 30 ++
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/shelisp.el b/shelisp.el
index fc5d4d2..17d080f 100644
--- a/shelisp.el
+++ b/shelisp.el
@@ -65,8 +65,9 @@
 
 ;; * Support `term-mode' like `shell-mode'
 
-;; * Provide support for creation of shell commands for command shells
-;;   other than bash -- csh, tcsh, zsh, ksh, ash, dash, fish, mosh, sh.
+;; * Support for bash, ksh, and fish is provided (thank you for
+;;   motivation and effort, Eduardo Ochs );
+;;   support for csh, tcsh, ksh, ash, dash, mosh, and sh is welcomed.
 ;;
 ;;   Support for non-Linux shells is left as an exercise for a
 ;;   masochistic hacker.
@@ -90,6 +91,7 @@
 ;;; Code:
 (require 'cl-lib)
 (require 'pp)
+(require 'term)
 
 ;;;###autoload
 (define-minor-mode shelisp-mode
@@ -110,8 +112,12 @@ while in a shell mode buffer."
 (defvar shelisp-debug nil
   "When non-nil, display messages showing the elisp expression.")
 
-(defvar shelisp-shell 'bash
-  "Identifies the shell scripting environment in use.")
+(defvar shelisp-shell nil
+  "Identifies the shell scripting environment in use.
+
+If nil, the shell is inferred from the from the `shell'
+settings (`explicit-shell-file-name', the environment variable
+`ESHELL', or `shell-file-name').")
 
 (defvar shelisp--wrapper-commands
   '((bash
@@ -200,7 +206,7 @@ convert it to a string."
 ;;;###autoload
 (defvar shelisp-commands (let ((cmds '(("e" . "(find-file-other-window (f 
\"%s\"))")
("v" . "(view-file-other-window (f 
\"%s\"))")
-   ("dired" . "(dired \"%s\")")
+   ("dired" . "(dired (f \"%s\"))")
("ediff" . "(ediff (f \"%s\") (f 
\"%s\"))"
(when (locate-library "magit")
  (push '("magit" . "(magit-status)") cmds))
@@ -229,7 +235,15 @@ expression and cannot be used elsewhere.")
 (defun shelisp-add-commands ()
   "Add Emacs Lisp to shell aliases (assumes GNU bash syntax)."
 
-  (when (and shelisp-mode shelisp-commands
+  ;; Infer the shell
+  (unless shelisp-shell
+(let ((sh (or explicit-shell-file-name
+  (getenv "ESHELL")
+  shell-file-name)))
+  (when sh
+(setq-local shelisp-shell (intern (file-name-base sh))
+
+  (when (and shelisp-mode shelisp-commands shelisp-shell
  (assoc shelisp-shell shelisp--wrapper-commands))
 (let ((proc (get-buffer-process (current-buffer
   (dolist (c shelisp-commands)
@@ -243,8 +257,8 @@ expression and cannot be used elsewhere.")
  shelisp--wrapper-commands))
  '(""))
  shelisp--wrapper-separator)
-  (list cmd
-   (replace-regexp-in-string "\"" "\"" expr))
+  (list cmd expr)
+
   (process-send-string proc "\n"
 
 (provide 'shelisp)



[elpa] externals/shelisp b2b219e: Added term/vterm/non-shell-modes support

2021-09-27 Thread mmaug--- via
branch: externals/shelisp
commit b2b219ee7b670b273a6e2107126e0640f8a7513d
Author: Michael R. Mauger 
Commit: Michael R. Mauger 

Added term/vterm/non-shell-modes support
---
 shelisp.el | 78 +-
 1 file changed, 62 insertions(+), 16 deletions(-)

diff --git a/shelisp.el b/shelisp.el
index 17d080f..8bbd5a2 100644
--- a/shelisp.el
+++ b/shelisp.el
@@ -56,14 +56,16 @@
 ;; to your Emacs initialization script:
 
 ;;   (add-hook 'shell-mode-hook #'shelisp-mode)
+;;   (add-hook 'term-mode-hook #'shelisp-mode)
+
+;;   ;; iff `vterm' package was installed
+;;   (add-hook 'vterm-mode-hook #'shelisp-mode)
 
 ;; TO DOs:
 
 ;; * Provide a security feature that prompts the Emacs user to approve
-;; * the execution of any elisp expressions submitted thru the shelisp
-;; * escape sequence.
-
-;; * Support `term-mode' like `shell-mode'
+;;   the execution of any elisp expressions submitted thru the shelisp
+;;   escape sequence.
 
 ;; * Support for bash, ksh, and fish is provided (thank you for
 ;;   motivation and effort, Eduardo Ochs );
@@ -93,20 +95,17 @@
 (require 'pp)
 (require 'term)
 
+(declare-function internal-default-process-filter "process.c")
+
 ;;;###autoload
 (define-minor-mode shelisp-mode
   "Enable elisp expressions embedded in ANSI APC (Application
 Program Control) escape sequences to be located and executed
 while in a shell mode buffer."
   nil " ShElisp" nil
-
-  (if (not shelisp-mode)
-  (remove-hook 'comint-preoutput-filter-functions
-  #'shelisp-exec-lisp)
-;; Parse elisp escape sequences
-(add-hook 'comint-preoutput-filter-functions
- #'shelisp-exec-lisp 'append)
-(shelisp-add-commands)))
+  (if shelisp-mode
+  (shelisp--enable)
+(shelisp--disable)))
 
 ;;;###autoload
 (defvar shelisp-debug nil
@@ -119,18 +118,24 @@ If nil, the shell is inferred from the from the `shell'
 settings (`explicit-shell-file-name', the environment variable
 `ESHELL', or `shell-file-name').")
 
+(defvar-local shelisp--previous-process-filter nil
+  "Previous value of process filter.  See `set-process-filter'.")
+
 (defvar shelisp--wrapper-commands
   '((bash
  "unset -f shelisp_%1$s"
- "function shelisp_%1$s { printf '\\e_#EMACS# %2$s \\a' \"$@\" ; }"
+ "function shelisp_%1$s { printf '\\e_#EMACS# %2$s \e\\' \"$@\" ; }"
+ "alias %1$s=shelisp_%1$s")
+(dash
+ "shelisp_%1$s () {; printf '\\e_#EMACS# %2$s \e\\' \"$@\" ; }"
  "alias %1$s=shelisp_%1$s")
 (zsh
  "unfunction shelisp_%1$s >/dev/null 2>&1"
- "function shelisp_%1$s { printf '\\e_#EMACS# %2$s \\a' \"$@\" ; }"
+ "function shelisp_%1$s { printf '\\e_#EMACS# %2$s \e\\' \"$@\" ; }"
  "alias %1$s=shelisp_%1$s")
 (fish
  "function %1$s"
- "printf '\\e_#EMACS# %2$s \\a' $argv"
+ "printf '\\e_#EMACS# %2$s \e\\' $argv"
  "end"))
 
   "Alist of shell commands necessary to make ShElisp work.
@@ -202,12 +207,20 @@ convert it to a string."
t t str)
   str)
 
+(defun shelisp--process-output-filter (proc str)
+  "Insert STR into buffer owned by PROC after executing elisp."
+
+  (funcall (or shelisp--previous-process-filter
+   #'internal-default-process-filter)
+   proc
+   (shelisp-exec-lisp str)))
 
 ;;;###autoload
 (defvar shelisp-commands (let ((cmds '(("e" . "(find-file-other-window (f 
\"%s\"))")
("v" . "(view-file-other-window (f 
\"%s\"))")
("dired" . "(dired (f \"%s\"))")
-   ("ediff" . "(ediff (f \"%s\") (f 
\"%s\"))"
+   ("ediff" . "(ediff (f \"%s\") (f 
\"%s\"))")
+   ("man"   . "(man \"%s\")"
(when (locate-library "magit")
  (push '("magit" . "(magit-status)") cmds))
(when (or (bound-and-true-p viper-mode)
@@ -261,5 +274,38 @@ expression and cannot be used elsewhere.")
 
   (process-send-string proc "\n"
 
+
+(defun shelisp--enable ()
+  "Enable `shelisp-mode' in the current buffer."
+
+  (let ((proc (get-buffer-process (current-buffer
+(cond
+ ((derived-mode-p 'comint-mode)
+  ;; Parse elisp escape sequences
+  (add-hook 'comint-preoutput-filter-functions
+   #'shelisp-exec-lisp 'append)
+  (shelisp-add-commands))
+
+ (proc
+  (setq shelisp--previous-process-filter (process-filter proc))
+  (set-process-filter proc #'shelisp--process-output-filter)
+  (shelisp-add-commands))
+
+ (:else
+  (message"ShElisp is not active")
+
+(defun shelisp--disable ()
+  "Disable `shelisp-mode' in the current buffer."
+
+  (let ((proc (get-buffer-process (current-buffer
+(cond
+ ((derived-mode-p 'comint-mode)
+  (remove-hook 'comint-preoutput-filter-functions
+  #'she