[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/shell-command+ bed12c8 11/36: minor code cleanup
From: |
Stefan Monnier |
Subject: |
[elpa] externals/shell-command+ bed12c8 11/36: minor code cleanup |
Date: |
Fri, 25 Sep 2020 11:01:23 -0400 (EDT) |
branch: externals/shell-command+
commit bed12c8f17dc488c9ac0283e662cf57b64c0b113
Author: Philip K <philip@warpmail.net>
Commit: Philip K <philip@warpmail.net>
minor code cleanup
---
bang.el | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/bang.el b/bang.el
index 7037471..8713526 100644
--- a/bang.el
+++ b/bang.el
@@ -3,7 +3,7 @@
;; Author: Philip K. <philip@warpmail.net>
;; Version: 0.1.0
;; Keywords: unix, processes, convenience
-;; Package-Requires: ((emacs "24.1") (cl-lib "0.5"))
+;; Package-Requires: ((emacs "24.1") (seq "2.20"))
;; URL: https://git.sr.ht/~zge/bang
;; This file is NOT part of Emacs.
@@ -29,6 +29,7 @@
;; https://leahneukirchen.org/dotfiles/.emacs
(require 'rx)
+(require 'seq)
;;; Code:
@@ -62,11 +63,9 @@
(defun bang--find-last-command (prefix)
"Helper function to find last command that started with PREFIX."
- (catch 'found
- (dolist (cmd bang--last-commands)
- (when (string-prefix-p prefix cmd)
- (throw 'found cmd)))
- (error "No such command in history")))
+ (or (seq-find (apply-partially #'string-prefix-p prefix)
+ bang--last-commands)
+ (error "No such command in history")))
(defun bang--get-command-number (arg rest)
"Helper function to find ARG'th last command.
@@ -111,8 +110,8 @@ insert a literal % quote it using a backslash.
In case a region is active, bang will only work with the region
between BEG and END. Otherwise the whole buffer is processed."
(interactive (list (read-shell-command "Bang command: ")
- (if mark-active (region-beginning) (point-min))
- (if mark-active (region-end) (point-max))))
+ (if (use-region-p) (region-beginning) (point-min))
+ (if (use-region-p) (region-end) (point-max))))
(save-match-data
(unless (string-match bang--command-regexp command)
(error "Invalid command"))
- [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 <=
- [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, 2020/09/25
- [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