[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/shell-command+ ee9e3e6 17/36: added `.' command
From: |
Stefan Monnier |
Subject: |
[elpa] externals/shell-command+ ee9e3e6 17/36: added `.' command |
Date: |
Fri, 25 Sep 2020 11:01:24 -0400 (EDT) |
branch: externals/shell-command+
commit ee9e3e684920004c8258d91ac2c30f3d157c34ff
Author: Philip K <philip@warpmail.net>
Commit: Philip K <philip@warpmail.net>
added `.' command
---
README.md | 7 +------
bang.el | 13 ++++++++++---
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index f001a4b..7036bc5 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,7 @@
`bang` is a `shell-command` substitute that makes it easier to run
commands on regions or whole buffers. This is done by potentially
interpreting the first character differently, as the `bang` docstring
-explains:
-
- When COMMAND starts with
- < the output of COMMAND replaces the current selection
- > COMMAND is run with the current selection as input
- | the current selection is filtered through COMMAND
+explains.
Bang has been based on a function of the same name by [Leah
Neukirchen][leah].
diff --git a/bang.el b/bang.el
index 2be0b25..8907f37 100644
--- a/bang.el
+++ b/bang.el
@@ -39,6 +39,7 @@ When COMMAND starts with
< the output of COMMAND replaces the current selection
> COMMAND is run with the current selection as input
| the current selection is filtered through COMMAND
+ . COMMAND executes in the relative path following the dot
Without any argument, `bang' will behave like `shell-command'.
@@ -52,7 +53,9 @@ between BEG and END. Otherwise the whole buffer is processed."
(if (use-region-p) (region-end) (point-max))))
(save-match-data
(unless (string-match (rx bos (* space)
- (or (group "<") (group ">") (group "|") "")
+ (or (group "<") (group ">") (group "|")
+ (group "." (* (not space))) "")
+ (* space)
(group (* not-newline))
eos)
command)
@@ -60,13 +63,14 @@ between BEG and END. Otherwise the whole buffer is
processed."
(let ((has-< (match-string-no-properties 1 command))
(has-> (match-string-no-properties 2 command))
(has-| (match-string-no-properties 3 command))
+ (has-. (match-string-no-properties 4 command))
(rest (condition-case nil
(replace-regexp-in-string
(rx (* ?\\ ?\\) (or ?\\ (group "%")))
buffer-file-name
- (match-string-no-properties 4 command)
+ (match-string-no-properties 5 command)
nil nil 1)
- (error (match-string-no-properties 4 command)))))
+ (error (match-string-no-properties 5 command)))))
(cond (has-< (delete-region beg end)
(shell-command rest t shell-command-default-error-buffer)
(exchange-point-and-mark))
@@ -76,6 +80,9 @@ between BEG and END. Otherwise the whole buffer is processed."
(has-| (shell-command-on-region
beg end rest t t
shell-command-default-error-buffer t))
+ (has-. (let ((default-directory (expand-file-name has-.)))
+ (shell-command rest (if current-prefix-arg t nil)
+ shell-command-default-error-buffer)))
(t (shell-command command (if current-prefix-arg t nil)
shell-command-default-error-buffer)))
(when has->
- [elpa] branch externals/shell-command+ created (now 339931d), Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ 57afacb 01/36: initial export, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ 3eed583 10/36: fixed typo on the first line, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ ac4ec3c 07/36: added initial readme, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ bed12c8 11/36: minor code cleanup, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ 0931b93 03/36: added cc0 as license, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ c0129cc 02/36: converted all tabs to spaced, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ aecad16 13/36: added link to public inbox, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ 64c0fcf 06/36: delete shell output instead of killing it, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ 253d4bc 14/36: removed history code, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ ee9e3e6 17/36: added `.' command,
Stefan Monnier <=
- [elpa] externals/shell-command+ 11e121a 25/36: added support for bang--command-regexp to start with ~, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ a47986d 32/36: updated commentary section, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ f004dfb 23/36: require at least one non-whitespace character in command, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ 55f3e2a 16/36: emulated insert-into-buffer feature from shell-command, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ f80c7c3 29/36: autoload bang command, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ 8758933 24/36: removed trailing whitespace, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ ab6bb0e 18/36: reworked `.' command, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ 87b5ad3 21/36: version bump, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ 339931d 36/36: rename bang to shell-command+, Stefan Monnier, 2020/09/25
- [elpa] externals/shell-command+ b5398d1 34/36: use eshell handler if available, Stefan Monnier, 2020/09/25