[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/eat d918dbae87 1/7: Add shell integration script for GNU B
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/eat d918dbae87 1/7: Add shell integration script for GNU Bash |
Date: |
Sat, 3 Dec 2022 14:58:36 -0500 (EST) |
branch: elpa/eat
commit d918dbae8713780e102ea5f7936fec4309650286
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Add shell integration script for GNU Bash
* integration/bash: New file.
* eat.el (eat-term-shell-integration-directory): New variable.
Contains path to the directory containing the scripts,
automatically updated when Eat is updated.
* eat.el (eat-exec, eat-eshell-mode): New enviroment variable
'EAT_SHELL_INTEGRATION_DIR'.
* eat.texi (Shell Integration): New chapter.
* eat.texi (Directory Tracking): Refer to 'Shell Integration'.
---
eat.el | 24 ++++++++++++++++++++----
eat.texi | 26 +++++++++++++++++++++++---
integration/bash | 11 +++++++++++
3 files changed, 54 insertions(+), 7 deletions(-)
diff --git a/eat.el b/eat.el
index 535cb168db..c0b9e08f52 100644
--- a/eat.el
+++ b/eat.el
@@ -255,6 +255,7 @@ This value is used by terminal programs to identify the
terminal."
"Path to directory where Eat is installed.")
(defvar eat-term-terminfo-directory)
+(defvar eat-term-shell-integration-directory)
(let ((old-install-path eat--install-path))
(setq eat--install-path
(copy-sequence
@@ -262,15 +263,27 @@ This value is used by terminal programs to identify the
terminal."
buffer-file-name))))
(defcustom eat-term-terminfo-directory eat--install-path
- "Directory where require terminfo databases can be found.
+ "Directory where required terminfo databases can be found.
This value is used by terminal programs to find the terminfo databases
that describe the capabilities of the terminal."
:type 'directory
:group 'eat-term)
+ (defcustom eat-term-shell-integration-directory
+ (expand-file-name "integration" eat--install-path)
+ "Directory where Eat shell integration scripts can be found.
+
+This value is exposed to terminal programs as
+`EAT_SHELL_INTEGRATION_DIR' environment variable."
+ :type 'directory
+ :group 'eat-ui
+ :group 'eat-eshell)
+
(when (eq eat-term-terminfo-directory old-install-path)
- (setq eat-term-terminfo-directory eat--install-path)))
+ (setq eat-term-terminfo-directory eat--install-path
+ eat-term-shell-integration-directory
+ (expand-file-name "integration" eat--install-path))))
(defcustom eat-term-inside-emacs (format "%s,eat" emacs-version)
"Value for the `INSIDE_EMACS' environment variable."
@@ -2212,7 +2225,6 @@ MODE should be one of nil and `x10', `normal',
`button-event',
URL should be a URL in the format \"file://HOST/CWD/\"; HOST can be
empty."
- (message "%S" url)
(let ((obj (url-generic-parse-url url)))
(when (and (string= (url-type obj) "file")
(or (null (url-host obj))
@@ -4563,7 +4575,9 @@ same Eat buffer. The hook `eat-exec-hook' is run after
each exec."
(list
(concat "TERM=" (eat-term-name))
(concat "TERMINFO=" eat-term-terminfo-directory)
- (concat "INSIDE_EMACS=" eat-term-inside-emacs))
+ (concat "INSIDE_EMACS=" eat-term-inside-emacs)
+ (concat "EAT_SHELL_INTEGRATION_DIR="
+ eat-term-shell-integration-directory))
process-environment))
(process-connection-type t)
;; We should suppress conversion of end-of-line format.
@@ -5103,6 +5117,8 @@ sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\""
`(("TERM" eat--eshell-term-name t)
("TERMINFO" eat-term-terminfo-directory t)
("INSIDE_EMACS" eat-term-inside-emacs t)
+ ("EAT_SHELL_INTEGRATION_DIR"
+ eat-term-shell-integration-directory t)
,@eshell-variable-aliases-list))
(advice-add #'eshell-gather-process-output :around
#'eat--eshell-adjust-make-process-args))
diff --git a/eat.texi b/eat.texi
index 3dbe0586bb..f1dbe23690 100644
--- a/eat.texi
+++ b/eat.texi
@@ -71,6 +71,7 @@ Advanced Customizations
* Mouse Tracking:: Eat tracks mouse, but this can be changed.
* Clipboard:: Integrating kill ring with terminal.
* Directory Tracking:: Tracking the working directory of program.
+* Shell Integration:: Getting the most from Eat and your shell.
* Colors:: Eat can show more than sixteen million colors.
* Fonts:: Eat can show up to sixty font different fonts.
* Blinking Text:: Annoying blinking texts.
@@ -486,9 +487,10 @@ directory is changed back to the directory from where the
program was
invoked.
To track, Eat needs the program to send this information. So, to
-enable directory tracking, you'll need to setup your shell. You'll
-need to arrange that your shell sends appropriate escape sequence at
-each prompt, for example with the command:
+enable directory tracking, you'll need to setup your shell
+(@pxref{Shell Integration}). You'll need to arrange that your shell
+sends appropriate escape sequence at each prompt, for example with the
+command:
@example
printf "\\e]7;file://%s%s\\e\\\\" "$HOSTNAME" "$PWD"
@@ -503,6 +505,24 @@ This controls directory tracking. When set to
non-@code{nil}, Eat
tracks the current working directory of programs.
@end defopt
+@node Shell Integration
+@cindex shell integration
+@cindex integration, shell
+@chapter Shell Integration
+
+Eat comes with shell scripts to integrate your favorite shell with
+Eat. You can include the script in your shell configuration file,
+it'll take care of everything.
+
+Currently only GNU Bash is supported.
+
+If you use GNU Bash, put the following in your @samp{.bashrc} file:
+
+@example
+[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && \
+ source "$EAT_SHELL_INTEGRATION_DIR/bash"
+@end example
+
@node Colors
@cindex colors
@cindex customizing colors
diff --git a/integration/bash b/integration/bash
new file mode 100644
index 0000000000..aacf981d3f
--- /dev/null
+++ b/integration/bash
@@ -0,0 +1,11 @@
+function _eat_prompt_command () {
+ # Send the current working directory, for directory tracking.
+ printf "\\e]7;file://%s%s\\e\\\\" "$HOSTNAME" "$PWD"
+}
+
+# Add '_eat_prompt_command' as the last element of 'PROMPT_COMMAND'.
+PROMPT_COMMAND[${#PROMPT_COMMAND[*]}]=_eat_prompt_command
+
+# Local Variables:
+# mode: sh
+# End:
- [nongnu] elpa/eat updated (5f4f4a87d1 -> 85c0c16380), ELPA Syncer, 2022/12/03
- [nongnu] elpa/eat 55c7d21cef 2/7: Use more uniform names for tracer functions, ELPA Syncer, 2022/12/03
- [nongnu] elpa/eat a9bf5e5248 5/7: * integration/bash: Use '__' prefix, ELPA Syncer, 2022/12/03
- [nongnu] elpa/eat 7abb81e16a 6/7: * integration/bash: Add copyright notice., ELPA Syncer, 2022/12/03
- [nongnu] elpa/eat d918dbae87 1/7: Add shell integration script for GNU Bash,
ELPA Syncer <=
- [nongnu] elpa/eat 85c0c16380 7/7: Refer to NonGNU ELPA in README, ELPA Syncer, 2022/12/03
- [nongnu] elpa/eat 729717b84f 3/7: * integration/bash: Don't setup again on reload, ELPA Syncer, 2022/12/03
- [nongnu] elpa/eat fa62d693f6 4/7: * integration/bash: Append to array more cleanly, ELPA Syncer, 2022/12/03