[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/objed db542e0 127/216: Add replace inside object op
From: |
Stefan Monnier |
Subject: |
[elpa] externals/objed db542e0 127/216: Add replace inside object op |
Date: |
Tue, 8 Jan 2019 12:29:25 -0500 (EST) |
branch: externals/objed
commit db542e0cceb6824847571c1b13bdae63f7970af7
Author: Clemera <address@hidden>
Commit: Clemera <address@hidden>
Add replace inside object op
---
README.asc | 6 +++---
objed.el | 18 +++++++++++++++++-
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/README.asc b/README.asc
index 56c18cd..1484836 100644
--- a/README.asc
+++ b/README.asc
@@ -254,9 +254,6 @@ Commands to switch to other objects (and move point to its
start):
|kbd:[_]
|Switch to symbol object.
-|kbd:[%]
-|Switch to content object (defined by textual content of current object).
-
|kbd:[c]
|Prefix to switch to other objects, see `objed-object-map` for available
objects and `objed-define-object` to add your own.
|===
@@ -321,6 +318,9 @@ commands" below):
|kbd:[:]
|Comment and duplicate object.
+|kbd:[%]
+|Query replace narrowed to current object.
+
|kbd:[$]
|Flyspell textual content of object.
diff --git a/objed.el b/objed.el
index d3d8e9b..48f8af5 100644
--- a/objed.el
+++ b/objed.el
@@ -336,7 +336,6 @@ See also `objed-disabled-p'"
(yank-pop . region)
;; misc
(which-key-C-h-dispatch . char)
- (recenter-top-bottom . line)
)
"Entry commands and associated objects."
:group 'objed
@@ -361,6 +360,7 @@ be used to restore previous states."
undo-only
delete-other-windows
reposition-window
+ recenter-top-bottom
)
"Regular Emacs commands which should not exit modal edit state.
@@ -463,6 +463,7 @@ To avoid loading `avy' set this var before activating
`objed-mode.'"
(declare-function avy-goto-char "ext:avy")
(declare-function edit-indirect-region "ext:edit-indirect")
(declare-function electric-pair-syntax-info "ext:elec-pair")
+(declare-function hl-line-unhighlight "ext:hl-line")
@@ -766,6 +767,9 @@ cons of guessed object and its state."
(define-key map "z" 'objed-ace)
;; swiper like object search
(define-key map "j" 'objed-occur)
+ ;; TODO: start query replace in current object,
+ ;; or for all
+ (define-key map "%" (objed-define-op nil objed-replace current))
;; prefix keys
(define-key map "x" 'objed-op-map)
@@ -776,6 +780,7 @@ cons of guessed object and its state."
;; direct object switches
(define-key map "." 'objed-identifier-object)
(define-key map "_" 'objed-symbol-object)
+
;;(define-key map "%" 'objed-contents-object)
;; not regular objects, selection
;; (define-key map (kbd "M-SPC") 'objed-select-object)
@@ -2582,6 +2587,17 @@ c: capitalize."
(undo-tree-undo '(4))
(undo '(4))))
+(defun objed-replace (beg end)
+ "Query replace narrowed to region BEG, END."
+ (interactive "r")
+ (save-excursion
+ (save-restriction
+ (narrow-to-region beg end)
+ (goto-char (point-min))
+ (hl-line-unhighlight)
+ (deactivate-mark)
+ (call-interactively 'query-replace-regexp))))
+
;; * OP execution
- [elpa] externals/objed a277292 191/216: Add option to wrap the region with any string(using universal arg), (continued)
- [elpa] externals/objed a277292 191/216: Add option to wrap the region with any string(using universal arg), Stefan Monnier, 2019/01/08
- [elpa] externals/objed 043ec68 198/216: Adjust some bindings (q should quit window for convenience), Stefan Monnier, 2019/01/08
- [elpa] externals/objed 90af56a 203/216: Adjust objed-activate, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 1bbd30f 210/216: Dont activate in minibuffer, Stefan Monnier, 2019/01/08
- [elpa] externals/objed b006b28 213/216: Change toggle state binding, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 8ac3ec3 169/216: Mention numeric args, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 0800b1f 201/216: Improve objed-quit-window, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 8e86602 212/216: Change del-insert binding, leave binding DEL free, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 4aa3530 196/216: Don't init when mode has own modal setup, Stefan Monnier, 2019/01/08
- [elpa] externals/objed c87e826 150/216: Add News file to document changes., Stefan Monnier, 2019/01/08
- [elpa] externals/objed db542e0 127/216: Add replace inside object op,
Stefan Monnier <=
- [elpa] externals/objed 8d3399a 132/216: Adjust mark bindings, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 78116f5 151/216: Mention Readme and News, Stefan Monnier, 2019/01/08
- [elpa] externals/objed d801608 148/216: Cleanup for extend, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 6ed0f62 146/216: Merge remote-tracking branch 'origin/master', Stefan Monnier, 2019/01/08
- [elpa] externals/objed 862d168 164/216: Fix ipipe schedule timer, Stefan Monnier, 2019/01/08
- [elpa] externals/objed a0a8f81 158/216: Improve exchange point and mark, Stefan Monnier, 2019/01/08
- [elpa] externals/objed e9bfd92 156/216: Switch code order to avoid confusing compile warnings, Stefan Monnier, 2019/01/08
- [elpa] externals/objed add4b8f 154/216: Markup again, Stefan Monnier, 2019/01/08
- [elpa] externals/objed cf1db37 140/216: Allow users to define a function to allow/prevent objed init, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 26c88ba 168/216: Revert to 0, 1 is needed for 10>, Stefan Monnier, 2019/01/08