From 4db75eb59194f7e38afd83c5acec48b173e7aeea Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Wed, 28 Sep 2022 13:41:45 -0700 Subject: [PATCH] Replace dwim-shell-command with eshell-command Gives the same feature, but has offers more. --- ha-config.org | 10 ---------- ha-eshell.org | 23 +++++++++++++---------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/ha-config.org b/ha-config.org index bba64de..7462258 100644 --- a/ha-config.org +++ b/ha-config.org @@ -100,16 +100,6 @@ Rewriting my shell scripts in Emacs Lisp uses my [[https://gitlab.com/howardabra ("C-M-|" . piper) ("C-|" . piper-user-interface))) #+end_src -Interested in the [[https://github.com/xenodium/dwim-shell-command][DWIM Shell Command]] project from [[https://xenodium.com/emacs-dwim-shell-command/][Álvaro Ramírez]]. It acts like the regular [[help:shell-command][shell-command]], but the ~q~ closes the results. A command with =<>= operates on the filename of the current buffer, so =chmod a+x <>= works as expected. More useful in [[help:dired][dired]] where you can mark a bunch of files and then operate on all files with such syntax. -#+begin_src emacs-lisp - (use-package dwim-shell-command - :straight (:host github :repo "xenodium/dwim-shell-command") - :bind (("M-!" . dwim-shell-command) - :map dired-mode-map - ([remap dired-do-async-shell-command] . dwim-shell-command) - ([remap dired-do-shell-command] . dwim-shell-command) - ([remap dired-smart-shell-command] . dwim-shell-command))) -#+end_src ** Yet Another Snippet System (YASnippets) Using [[https://github.com/joaotavora/yasnippet][yasnippet]] to convert templates into text: diff --git a/ha-eshell.org b/ha-eshell.org index e98e9d9..61a0e99 100644 --- a/ha-eshell.org +++ b/ha-eshell.org @@ -1,4 +1,4 @@ -#+TITLE: Eshell +#+TITLE: Expanding Eshell #+AUTHOR: Howard X. Abrams #+DATE: 2022-09-13 #+FILETAGS: :emacs: @@ -788,21 +788,24 @@ Scrolling through the output and searching for results that can be copied to the :hook ((eshell-pred-load . ha-eshell-add-predicates) (eshell-exit . delete-window)) - :bind (:map eshell-mode-map + :bind (("M-!" . execute-command-on-file-buffer) + ("s-1" . execute-command-on-file-buffer) + :map eshell-mode-map ("M-R" . eshell-insert-history) ("C-d" . ha-eshell-quit-or-delete-char))) #+end_src -Note that the default list to [[emacs-lisp:(describe-variable 'eshell-visual-commands)][eshell-visual-commands]] is mostly good enough. +Note that the default list to [[emacs-lisp:(describe-variable 'eshell-visual-commands)][eshell-visual-commands]] is good enough. -Finally, add some leader commands to call my previously defined functions: +Add leader commands to call my defined functions: #+begin_src emacs-lisp (ha-leader - "a e" '(:ignore t :which-key "eshell") - "a e e" '("new eshell" . eshell-here) - "a e r" '("remote" . eshell-remote) - "a e p" '("project" . eshell-project) - "a e g" '("at point" . eshell-here-on-line) - "a e !" '("exec on file-buffer" . execute-command-on-file-buffer)) + "!" '("eshell cmd" . execute-command-on-file-buffer) + "a e" '(:ignore t :which-key "eshell") + "a e e" '("new eshell" . eshell-here) + "a e r" '("remote" . eshell-remote) + "a e p" '("project" . eshell-project) + "a e g" '("at point" . eshell-here-on-line) + "a e !" '("exec on file-buffer" . execute-command-on-file-buffer)) #+end_src No, i’m not sure why =use-package= has an issue with both =:hook=, =:bind= and =:config= directives in sequence. * Technical Artifacts :noexport: