[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/objed 0de9c61 159/216: Further improve objed-expand
From: |
Stefan Monnier |
Subject: |
[elpa] externals/objed 0de9c61 159/216: Further improve objed-expand |
Date: |
Tue, 8 Jan 2019 12:29:31 -0500 (EST) |
branch: externals/objed
commit 0de9c617202a98362308cabc99cd5d3eaf4ce365
Author: Clemera <address@hidden>
Commit: Clemera <address@hidden>
Further improve objed-expand
---
objed.el | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/objed.el b/objed.el
index 3ce0aa0..3ebf4cc 100644
--- a/objed.el
+++ b/objed.el
@@ -547,13 +547,17 @@ cons of guessed object and its state."
;; * Keymaps
-(defmacro objed--call-and-switch (cmd obj)
- "Create objed command which will invoke CMD and switch to OBJ."
+(defmacro objed--call-and-switch (cmd obj &optional before after)
+ "Create objed command which will invoke CMD and switch to OBJ.
+
+BEFORE and AFTER are forms to execute before/after calling the command."
`(defun ,(intern (format "objed-%s" (symbol-name cmd))) ()
,(format "Call `%s' and switch to object %s"
(symbol-name cmd) (symbol-name obj))
(interactive)
+ ,before
(call-interactively ',cmd)
+ ,after
(objed--switch-to ',obj)))
@@ -610,7 +614,11 @@ cons of guessed object and its state."
(define-key map "R" 'objed-move-word-backward)
(define-key map "p" (objed--call-and-switch previous-line line))
- (define-key map "n" (objed--call-and-switch next-line line))
+ (define-key map "n" (objed--call-and-switch
+ next-line line
+ (when (eq last-command 'objed-extend)
+ (objed-exchange-point-and-mark)
+ (goto-char (line-beginning-position)))))
(define-key map "P" 'objed-move-line-backward)
(define-key map "N" 'objed-move-line-forward)
@@ -1559,10 +1567,10 @@ postitive prefix argument ARG move to the nth previous
object."
(interactive "p")
(if (objed--basic-p)
(objed-context-object)
- (setq deactivate-mark nil)
;; toggle side if coming from next?
(objed--goto-previous (or arg 1))))
+
(defun objed-current-or-next-context (&optional arg)
"Move to beginning of object at point and activate it.
@@ -1572,12 +1580,10 @@ postitive prefix argument ARG move to the nth next
object."
(if (objed--basic-p)
(progn (objed-context-object)
(goto-char (objed--end)))
+ ;; on init skip current
(when (and (region-active-p)
- (<= (objed--beg) (region-beginning))
- (>= (objed--end) (region-end))
- (< (point) (objed--end)))
+ (eq last-command 'objed-extend))
(exchange-point-and-mark))
- (setq deactivate-mark nil)
(objed--goto-next (or arg 1))))
(defun objed-top-object ()
@@ -1713,6 +1719,10 @@ Update to object at current side."
(setq objed--extend-cookie
(face-remap-add-relative 'objed-hl
'objed-extend)))
+ ;; TODO:reinit oly for line, toggle state othewise..?
+ (objed--switch-to objed--object 'whole)
+ (unless (= (point) (objed--end))
+ (goto-char (objed--beg)))
(push-mark (if (or (>= (point) (objed--end))
(eq objed--object 'char))
(objed--beg)
@@ -2593,13 +2603,11 @@ on."
(when objed--extend-cookie
(face-remap-remove-relative objed--extend-cookie)
(setq objed--extend-cookie nil))
-
(when (and range
(not (eq exitf 'current)))
(set-marker (car range) nil)
(set-marker (cadr range) nil))))
-
(defun objed-quit ()
"Quit and deactivate `objed-map'."
(interactive)
- [elpa] externals/objed b9866d6 101/216: Fix undo op behavior, (continued)
- [elpa] externals/objed b9866d6 101/216: Fix undo op behavior, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 0e1d041 105/216: Simplify object macro usage, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 69db302 126/216: Some mroe init changes, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 0c5a4e3 147/216: Version bump, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 7617799 136/216: Allow testing different emacs versions, Stefan Monnier, 2019/01/08
- [elpa] externals/objed f5904c2 142/216: Add eval commands to keeper commands, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 734711a 124/216: Add move-to-window-line-top-bottom to activation cmds, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 9c816e2 133/216: Improve mark all for repeated object invokation, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 8e9ab88 152/216: Markup, Stefan Monnier, 2019/01/08
- [elpa] externals/objed a94bfdf 145/216: Add extend functionality, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 0de9c61 159/216: Further improve objed-expand,
Stefan Monnier <=
- [elpa] externals/objed ac6ecb0 149/216: Mention new extend functionality, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 4a84e59 174/216: Bind this-command when executing region command, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 60c4731 139/216: Remove key binding info in header, use readme for that, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 62c2dee 118/216: Improve move object code, Stefan Monnier, 2019/01/08
- [elpa] externals/objed c88bb7b 134/216: Mention new functionality, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 6951f1b 177/216: Add convenience bindings for forward/backward until buffer, Stefan Monnier, 2019/01/08
- [elpa] externals/objed fbabb7a 178/216: Add command to insert new object of current type, Stefan Monnier, 2019/01/08
- [elpa] externals/objed d792eb0 160/216: Dont reinit object for first extend, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 7f575aa 180/216: Fix dispatch, when no object found, Stefan Monnier, 2019/01/08
- [elpa] externals/objed f643281 171/216: Correct key names, Stefan Monnier, 2019/01/08