Do I really want to call execute-command-on-buffer?

This is a really nifty function, but should I call it all the time?
Adding the name of the buffer automatically is sweet... until I don't
want that feature.
This commit is contained in:
Howard Abrams 2022-10-04 20:41:01 -07:00
parent 097431544e
commit f9003e172f
2 changed files with 6 additions and 6 deletions

View file

@ -90,7 +90,7 @@ And some Mac-specific settings:
(add-to-list 'default-frame-alist '(ns-appearance . dark)))
#+end_src
* Support Packages
** Piper and DWIM Shell Commands
** Piper
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
@ -606,7 +606,7 @@ 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" . dwim-shell-command)
"!" '("shell command" . shell-command)
"|" 'piper
"X" '("org capture" . org-capture)
"L" '("store org link" . org-store-link)

View file

@ -938,11 +938,11 @@ Sometimes you need to change something about the current file you are editing...
Will rename the current file to now have a .txt extension.
See `eshell-display-modifier-help' for details on that."
(interactive "sCommand to execute: ")
(let* ((file-name (buffer-file-name))
(full-cmd (cond ((string-match (rx "$$") cmd)
(replace-regexp-in-string (rx "$$") file-name cmd))
((string-match (rx (literal file-name)) cmd)
((and file-name (string-match (rx (literal file-name)) cmd))
cmd)
(t
(concat cmd " " file-name)))))
@ -974,7 +974,7 @@ Here is where we associate all the functions and their hooks with =eshell=, thro
:hook ((eshell-pred-load . ha-eshell-add-predicates))
:bind (("M-!" . execute-command-on-file-buffer)
:bind (("M-!" . eshell-command)
("s-1" . execute-command-on-file-buffer)
:map eshell-mode-map
("M-R" . eshell-insert-history)
@ -991,7 +991,7 @@ Add leader commands to call my defined functions:
"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))
"a e b" '("exec on file-buffer" . execute-command-on-file-buffer))
#+end_src
No, im not sure why =use-package= has an issue with both =:hook=, =:bind= and =:config= directives in sequence.
* Technical Artifacts :noexport: