Digging on dwim-shell-command

Nice and interesting idea. Not crazy about the <<f>> format, but it
seems to be a nice replacement.
This commit is contained in:
Howard Abrams 2022-08-09 09:59:47 -07:00
parent 45c1686fa1
commit b3256bdcac

View file

@ -88,10 +88,8 @@ And some Mac-specific settings:
(add-to-list 'default-frame-alist '(ns-appearance . dark)))
#+end_src
* Support Packages
** Piper
** Piper and DWIM Shell Commands
Rewriting my shell scripts in Emacs Lisp uses my [[https://gitlab.com/howardabrams/emacs-piper][emacs-piper project]], and this code spills into my configuration code, so let's load it now:
#+begin_src emacs-lisp
(use-package piper
:straight (:host gitlab :repo "howardabrams/emacs-piper")
@ -100,6 +98,16 @@ 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 =<<f>>= operates on the filename of the current buffer, so =chmod a+x <<f>>= 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:
@ -471,7 +479,8 @@ Let's try this general "space" prefix by defining some top-level operations, inc
(ha-leader
"SPC" '("M-x" . execute-extended-command)
"." '("repeat" . repeat)
"!" 'shell-command
"!" '("shell command" . dwim-shell-command)
"|" 'piper
"X" '("org capture" . org-capture)
"L" '("store org link" . org-store-link)
"RET" 'bookmark-jump