[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/objed 85941b8 16/21: Add objed-execute command
From: |
Clemens Radermacher |
Subject: |
[elpa] externals/objed 85941b8 16/21: Add objed-execute command |
Date: |
Sun, 17 Mar 2019 15:00:18 -0400 (EDT) |
branch: externals/objed
commit 85941b8825bf2b6d9647bff39004b80efed9ca86
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>
Add objed-execute command
---
README.asc | 2 +-
objed.el | 21 +++++++++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/README.asc b/README.asc
index 36a54f2..3291dc5 100644
--- a/README.asc
+++ b/README.asc
@@ -325,7 +325,7 @@ once you can mark them first (see the "Misc commands"
below):
|Replace object with inner part (raise).
|kbd:[!]
-|Replace object(s) with minibuffer input.
+|Run object contents as shell commands.
|kbd:[&]
|Pipe object region through shell command.
diff --git a/objed.el b/objed.el
index 39b5e77..eec64df 100644
--- a/objed.el
+++ b/objed.el
@@ -790,6 +790,8 @@ to the selected one."
(define-key map (kbd "<M-return>")
'objed-insert-new-object)
(define-key map "^" 'objed-raise)
+ (define-key map "!" 'objed-execute)
+
map)
"Keymap for commands when `objed' is active.")
@@ -830,15 +832,15 @@ Other single character keys are bound to
`objed-undefined'."
(define-key map "c"
;; upcase, downcase, capitalize, reformat
(objed-define-op nil objed-case-op))
+ ;; (define-key map "q" 'objed-reformat-object)
(define-key map "e" 'objed-eval)
- (define-key map "d" 'dired-jump)
- ;; remove restrictions
(define-key map "r" ctl-x-r-map)
(define-key map "n" 'objed-narrow)
;; TODO: undo propose integration
(define-key map "u" (objed--call-and-switch undo char))
+ (define-key map "d" 'dired-jump)
;; (define-key map "z" 'objed-repeat)
;; actions analog to C-x C-KEY which exit
(define-key map "s" 'save-buffer)
@@ -3175,6 +3177,21 @@ If nil ‘eval-region’ is used instead.")
(insert istring))))
+(defun objed-execute ()
+ "Execute object contents as shell commands."
+ (interactive)
+ (let* ((beg (objed--beg))
+ (end (objed--end))
+ (str (concat (buffer-substring beg end) "\n"))
+ (lines (split-string str "[\r\n]" t)))
+ (objed--reset)
+ (dolist (line lines)
+ (when (y-or-n-p (concat (format "$ %s" line)
+ "?"))
+ (shell-command line)))
+ (objed--init objed--object)))
+
+
;; * Exit active state
(defun objed--line-p (text)
- [elpa] externals/objed updated (aa8f32d -> 4cb9beb), Clemens Radermacher, 2019/03/17
- [elpa] externals/objed 209f0a6 20/21: Add reformat op, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed cc629a5 18/21: Add imenu to op map, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed 0676656 19/21: Improve url object, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed 4cb9beb 21/21: Version bump, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed 9689c72 17/21: Reinit after raise, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed 85941b8 16/21: Add objed-execute command,
Clemens Radermacher <=
- [elpa] externals/objed 4bb1b90 12/21: Add url object, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed 7627082 13/21: Don't ignore search errors, error with not other object found msg., Clemens Radermacher, 2019/03/17
- [elpa] externals/objed 998563a 06/21: Remove redundant :group declarations, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed e9bf605 07/21: Refactor objec-replace, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed 85019a8 14/21: Add raise command, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed c9b7c2a 05/21: Fix var not defined for edit-indirect, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed 2274a94 02/21: Add package-lint to linting tests, and fix its errors/warnings, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed 6ea0268 01/21: Buffer switch: Keep objed--object if possible, and update highlight, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed 1054cd8 03/21: Compile tests like elpa does, and fix the compile errors in tests, Clemens Radermacher, 2019/03/17
- [elpa] externals/objed f5cc1ce 15/21: Remove binding for disfunct objed repeat, Clemens Radermacher, 2019/03/17