GNU-devel ELPA - shelisp

shelisp

Description
execute elisp in shell
Latest
shelisp-1.0.0.0.20221212.230255.tar (.sig), 2024-Mar-31, 20.0 KiB
Maintainer
Michael R. Mauger <michael@mauger.com>
Atom feed
shelisp.xml
Website
https://elpa.gnu.org/packages/shelisp.html
Browse repository
CGit or Gitweb
Badge

To install this package from Emacs, use package-install or list-packages.

Full description

Comint process (likely shell-mode) can write out Emacs Lisp
expressions and have them executed.

When the shell process writes out a string of the form:
  \e_#EMACS# elisp-expr \a

Where, "elisp-expr" is a valid elisp expression.  The elisp
expression is executed as if you had invoked the function
within Emacs itself.  The elisp expression may include a call to
the function `f' which will expand the filename parameter into an
appropriate filename for Emacs using the appropriate Tramp prefix
if necessary.

This script also defines an Alist variable that creates shell
commands and the `printf'-style format to generate the full elisp
expression with command parameters substituted into the command.  A
function is placed in the `shell-mode-hook' to actually create the
shell functions and aliases to format the elisp expressions and
embed them in an escape sequence so that they are detected and
executed.

In most usage this mode merely allows you to type "e filename"
rather than "C-x C-f filename" which isn't much of a savings.
However, with this mode enabled, you can write shell scripts to
invoke Emacs Lisp functions.  But beware, the shell script will not
wait for completion of the elisp expression, nor return anything
back (see ToDo's below).

INSTALLATION

After installing this package from ELPA, you must add the following
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 for bash, ksh, and fish is provided (thank you for your
  motivation and effort, Eduardo Ochs <eduardoochs@gmail.com>);
  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.

* Implement a wait for completion facility similar to `emacsclient'
  or the work done in `with-editor' with the "sleeping editor."
  That is, pause the shell activity with a long sleep, until C-c
  C-c or C-c C-k is typed in Emacs and the caller is awoken with a
  signal.

KNOWN BUGS

The simplistic implementation of the shell functions will not
properly handle filenames containing double quote characters (\")
nor backslashes (\\).  While this is an error, it does not
represent a significant limitation in the implementation.  The
caller can properly add backslashes to the filename string before
passing it to printf to generate the elisp expression.  In the end,
the purpose is to create a valid elisp expression string.

Old versions

shelisp-1.0.0.0.20211010.211345.tar.lz2021-Oct-114.39 KiB
shelisp-0.9.1.0.20210926.72746.tar.lz2021-Sep-274.35 KiB
shelisp-0.9.1.0.20210926.32746.tar.lz2021-Oct-094.36 KiB
shelisp-0.9.1.0.20210913.233739.tar.lz2021-Sep-144.08 KiB
shelisp-0.9.1.0.20210913.31814.tar.lz2021-Sep-133.93 KiB
shelisp-0.9.1.0.20201201.220825.tar.lz2020-Dec-143.62 KiB