branch: externals/objed commit 4ffaef149057be53be21f46c6afe57d3c432a1ce Author: Clemens Radermacher <clem...@posteo.net> Commit: Clemens Radermacher <clem...@posteo.net>
Improve object state handling for default movement commands --- objed.el | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/objed.el b/objed.el index e85740c..bfab0de 100644 --- a/objed.el +++ b/objed.el @@ -578,7 +578,10 @@ BEFORE and AFTER are forms to execute before/after calling the command." (setq this-command ',cmd) (call-interactively ',cmd) ,after - (objed--switch-to ',obj objed--obj-state) + (objed--switch-to ',obj + (if (eq objed--object ',obj) + objed--obj-state + 'whole)) (when (or prb pre) (cond ((and prb (= (point) (region-end))) @@ -675,7 +678,10 @@ selected one." (call-interactively 'forward-word)) (setq this-command 'forward-word) (call-interactively 'forward-word)) - (objed--switch-to 'word objed--obj-state))) + (objed--switch-to 'word + (if (eq objed--object 'word) + objed--obj-state + 'whole)))) (define-key map "r" (defun objed-backward-word () "Call `backward-word' and switch to object word" (interactive) @@ -688,13 +694,18 @@ selected one." (call-interactively 'backward-word)) (setq this-command 'backward-word) (call-interactively 'backward-word)) - (objed--switch-to 'word objed--obj-state))) + (objed--switch-to 'word + (if (eq objed--object 'word) + objed--obj-state + 'whole)))) (define-key map "S" 'objed-move-word-forward) (define-key map "R" 'objed-move-word-backward) - (define-key map "f" (objed--call-and-switch objed--forward-sexp sexp)) - (define-key map "b" (objed--call-and-switch objed--backward-sexp sexp)) + (define-key map "f" (objed--call-and-switch + objed--forward-sexp sexp)) + (define-key map "b" (objed--call-and-switch + objed--backward-sexp sexp)) (define-key map "F" 'objed-move-object-forward) (define-key map "B" 'objed-move-object-backward)