[elpa] externals/tramp 4d846b9: Tramp ELPA version 2.4.3 released
branch: externals/tramp commit 4d846b94a06a6c76d57bc017305cac8042f1fe57 Author: Michael Albinus Commit: Michael Albinus Tramp ELPA version 2.4.3 released --- test/tramp-tests.el | 1251 +++--- texi/tramp.texi | 31 ++ texi/trampver.texi |2 +- tramp-adb.el | 10 +- tramp-cmds.el|2 +- tramp-compat.el |5 + tramp-integration.el | 79 +++- tramp-loaddefs.el|2 +- tramp-sh.el | 180 tramp-smb.el |3 +- tramp.el | 64 ++- tramp.info | 157 --- trampver.el |7 +- 13 files changed, 1036 insertions(+), 757 deletions(-) diff --git a/test/tramp-tests.el b/test/tramp-tests.el index 4b887e7..9cf466d 100644 --- a/test/tramp-tests.el +++ b/test/tramp-tests.el @@ -67,6 +67,14 @@ (defvar tramp-remote-path) (defvar tramp-remote-process-environment) +;; Needed for Emacs 24. +(defvar inhibit-message) +;; Needed for Emacs 25. +(defvar connection-local-criteria-alist) +(defvar connection-local-profile-alist) +;; Needed for Emacs 26. +(defvar async-shell-command-width) + ;; Beautify batch mode. (when noninteractive ;; Suppress nasty messages. @@ -221,79 +229,89 @@ properly. BODY shall not contain a timeout." (ert-deftest tramp-test01-file-name-syntax () "Check remote file name syntax." - ;; Simple cases. - (should (tramp-tramp-file-p "/method::")) - (should (tramp-tramp-file-p "/method:host:")) - (should (tramp-tramp-file-p "/method:user@:")) - (should (tramp-tramp-file-p "/method:user@host:")) - (should (tramp-tramp-file-p "/method:user@email@host:")) - - ;; Using a port. - (should (tramp-tramp-file-p "/method:host#1234:")) - (should (tramp-tramp-file-p "/method:user@host#1234:")) - - ;; Using an IPv4 address. - (should (tramp-tramp-file-p "/method:1.2.3.4:")) - (should (tramp-tramp-file-p "/method:user@1.2.3.4:")) - - ;; Using an IPv6 address. - (should (tramp-tramp-file-p "/method:[::1]:")) - (should (tramp-tramp-file-p "/method:user@[::1]:")) - - ;; Using an IPv4 mapped IPv6 address. - (should (tramp-tramp-file-p "/method:[:::1.2.3.4]:")) - (should (tramp-tramp-file-p "/method:user@[:::1.2.3.4]:")) - - ;; Local file name part. - (should (tramp-tramp-file-p "/method:::")) - (should (tramp-tramp-file-p "/method::/:")) - (should (tramp-tramp-file-p "/method::/path/to/file")) - (should (tramp-tramp-file-p "/method::/:/path/to/file")) - (should (tramp-tramp-file-p "/method::file")) - (should (tramp-tramp-file-p "/method::/:file")) - - ;; Multihop. - (should (tramp-tramp-file-p "/method1:|method2::")) - (should (tramp-tramp-file-p "/method1:host1|method2:host2:")) - (should (tramp-tramp-file-p "/method1:user1@host1|method2:user2@host2:")) - (should (tramp-tramp-file-p - "/method1:user1@host1|method2:user2@host2|method3:user3@host3:")) - - ;; No strings. - (should-not (tramp-tramp-file-p nil)) - (should-not (tramp-tramp-file-p 'symbol)) - ;; No newline or linefeed. - (should-not (tramp-tramp-file-p "/method::file\nname")) - (should-not (tramp-tramp-file-p "/method::file\rname")) - ;; Ange-FTP syntax. - (should-not (tramp-tramp-file-p "/host:")) - (should-not (tramp-tramp-file-p "/user@host:")) - (should-not (tramp-tramp-file-p "/1.2.3.4:")) - (should-not (tramp-tramp-file-p "/[]:")) - (should-not (tramp-tramp-file-p "/[::1]:")) - (should-not (tramp-tramp-file-p "/[:::1.2.3.4]:")) - (should-not (tramp-tramp-file-p "/host:/:")) - (should-not (tramp-tramp-file-p "/host1|host2:")) - (should-not (tramp-tramp-file-p "/user1@host1|user2@host2:")) - ;; Quote with "/:" suppresses file name handlers. - (should-not (tramp-tramp-file-p "/::")) - (should-not (tramp-tramp-file-p "/:@:")) - (should-not (tramp-tramp-file-p "/:[]:")) - ;; When `tramp-mode' is nil, Tramp is not activated. - (let (tramp-mode) -(should-not (tramp-tramp-file-p "/method:user@host:"))) - ;; `tramp-ignored-file-name-regexp' suppresses Tramp. - (let ((tramp-ignored-file-name-regexp "^/method:user@host:")) -(should-not (tramp-tramp-file-p "/method:user@host:"))) - ;; Methods shall be at least two characters on MS Windows, except - ;; the default method. - (let ((system-type 'windows-nt)) -(should-not (tramp-tramp-file-p "/c:/path/to/file")) -(should-not (tramp-tramp-file-p "/c::/path/to/file")) -(should (tramp-tramp-file-p "/-::/path/to/file"))) - (let ((system-type 'gnu/linux)) -(should (tramp-tramp-file-p "/-:h:/path/to/file")) -(should (tramp-tramp-file-p "/m::/path/to/file" + (let ((syntax tramp-syntax)) +(unwind-protect + (progn + (tramp-change-syntax 'default) + ;; Simple cases. + (should (tramp-tramp-file-p "/method::")) + (should (tramp-tramp-file-p "/method:host:")) + (should (tramp-tramp-file-p "/method:user@:")) + (should (tramp-tramp-file-p "/method:user@host:")) + (should (tramp-tramp-file-p
[elpa] externals/objed c9a91b5 006/166: Rename objed-electric to objed-electric-event
branch: externals/objed commit c9a91b5815377992057942cecd140d02e2f88e7d Author: Clemens Radermacher Commit: Clemens Radermacher Rename objed-electric to objed-electric-event --- objed.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/objed.el b/objed.el index 3156e42..4e7e4e6 100644 --- a/objed.el +++ b/objed.el @@ -2562,7 +2562,7 @@ With prefix arg REG non nil ask for register." (objed--exit-objed)) (defvar objed--electric-event nil - "Saves the event used for `objed-electric'.") + "Saves the event used for `objed-electric-event'.") (defun objed-electric-pair (beg end) "Wrap region between BEG, END. @@ -2579,10 +2579,10 @@ else query for key event and use `electric'." (insert left)) (let ((event (or objed--electric-event (setq objed--electric-event (read-event "Wrap with: ") -(objed-electric beg end event +(objed-electric-event beg end event -(defun objed-electric (beg end &optional event) +(defun objed-electric-event (beg end &optional event) "Wrap region between BEG and END using `elec-pair'. EVENT is used for wrapping according to
[elpa] externals/objed 89e1e18 016/166: Also activate mc if only one fake cursor
branch: externals/objed commit 89e1e1840a9838557bcc266ba9f20e998062ac1c Author: Clemens Radermacher Commit: Clemens Radermacher Also activate mc if only one fake cursor --- objed.el | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/objed.el b/objed.el index 30d16ab..c6cf713 100644 --- a/objed.el +++ b/objed.el @@ -393,6 +393,7 @@ To avoid loading `avy' set this var before activating `objed-mode.'" (declare-function hl-line-unhighlight "ext:hl-line") (declare-function hl-line-highlight "ext:hl-line") (declare-function mc/create-fake-cursor-at-point "ext:multiple-cursors") +(declare-function mc/num-cursors "ext:multiple-cursors") @@ -3454,8 +3455,10 @@ and RANGE hold the object position data." (cond ((eq 'keep exit) (ignore)) ((eq 'mc exit) - (when (fboundp 'mc/maybe-multiple-cursors-mode) - (mc/maybe-multiple-cursors-mode)) + (when (fboundp 'multiple-cursors-mode) + (if (> (mc/num-cursors) 0) + (multiple-cursors-mode 1) + (multiple-cursors-mode 0))) (objed--exit-objed)) ((eq 'current exit) ;; use the markers for updated object
[elpa] externals/objed 225267f 011/166: Don't reinit on object dispatch when objed is active
branch: externals/objed commit 225267fd50f2983bd675e973afcad95700d70beb Author: Clemens Radermacher Commit: Clemens Radermacher Don't reinit on object dispatch when objed is active --- objed.el | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/objed.el b/objed.el index 47dd234..76efa99 100644 --- a/objed.el +++ b/objed.el @@ -537,8 +537,10 @@ update to given object." (cond (binding (funcall (cdr binding) name)) (t - (when (objed--init name) - (goto-char (objed--beg))) + (if objed--buffer + (objed--switch-to name) + (objed--init name)) + (goto-char (objed--beg)) (defun objed--switch-to-object-for-cmd (cmd)
[elpa] externals/objed 40f5799 007/166: Don't reinit when op exited objed
branch: externals/objed commit 40f57990c71fce48daf069dc03beea73b4509836 Author: Clemens Radermacher Commit: Clemens Radermacher Don't reinit when op exited objed --- objed.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/objed.el b/objed.el index 4e7e4e6..95cb723 100644 --- a/objed.el +++ b/objed.el @@ -3497,6 +3497,9 @@ and RANGE hold the object position data." (objed--switch-to exitf)) ((or (eq exit 'ignore) (bound-and-true-p multiple-cursors-mode))) + ((not objed--buffer) + ;; let op exit itself if it wants to + (ignore)) (t (if (and text (objed--line-p text)) (objed--init 'line)
[elpa] externals/objed 36bddbd 009/166: Fix map staying active when op exited objed
branch: externals/objed commit 36bddbd0ae5536d286ceb22d2b013ba0f75d1185 Author: Clemens Radermacher Commit: Clemens Radermacher Fix map staying active when op exited objed --- objed.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/objed.el b/objed.el index 6f8c404..de747d1 100644 --- a/objed.el +++ b/objed.el @@ -3518,6 +3518,8 @@ and RANGE hold the object position data." ((or (eq exit 'ignore) (bound-and-true-p multiple-cursors-mode))) ((not objed--buffer) + ;; FIXME: why stay map active after electric insertion? + (objed--exit-objed) ;; let op exit itself if it wants to (ignore)) (t
[elpa] externals/objed 6f06795 034/166: Add commands which move to prev/next object, ignoring context
branch: externals/objed commit 6f06795e412cd916c6d2f10f0a918b749a8bd83e Author: Clemens Radermacher Commit: Clemens Radermacher Add commands which move to prev/next object, ignoring context --- objed-objects.el | 10 +- objed.el | 13 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/objed-objects.el b/objed-objects.el index a4f5940..dfe831c 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -409,13 +409,21 @@ OBJ is the object to use and defaults to `objed--current-obj'." (let ((obj (or obj objed--current-obj))) (objed--apply #'max obj))) +(defvar objed--basic-objects + '(sexp line identifier word char region buffer) + "Basic objects. + +Basic object are objects which have no next/previous or which +have their own movement commands.") + + (defun objed--basic-p () "Return non-nil if current object is a basic object. From basic objects `objed' starts expanding to context objects. Thus this should be objects which have their own movement commands." - (memq objed--object '(sexp line identifier word char region buffer))) + (memq objed--object objed--basic-objects)) (defun objed--current (&optional obj) "Get the current range of interest. diff --git a/objed.el b/objed.el index e2407df..bc69932 100644 --- a/objed.el +++ b/objed.el @@ -1824,6 +1824,19 @@ postitive prefix argument ARG move to the nth previous object." (when (eq pos (point)) (error "No previous %s" objed--object) +(defun objed-previous (&optional arg) + "Move to ARG previous object of current type." + (interactive "p") + (let ((objed--basic-objects nil)) +(objed-current-or-previous-context arg))) + + +(defun objed-next (&optional arg) + "Move to ARG next object of current type." + (interactive "p") + (let ((objed--basic-objects nil)) +(objed-current-or-next-context arg))) + (defun objed-current-or-next-context (&optional arg) "Move to beginning of object at point and activate it.
[elpa] externals/objed 25111a3 010/166: Dont check buffer whe objed--buffer is gone
branch: externals/objed commit 25111a30abdbec3f5f1348fe35444c0d1176900b Author: Clemens Radermacher Commit: Clemens Radermacher Dont check buffer whe objed--buffer is gone --- objed.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/objed.el b/objed.el index de747d1..47dd234 100644 --- a/objed.el +++ b/objed.el @@ -3553,7 +3553,8 @@ If region is active deactivate it first." "Check if current buffer is still the `objed--buffer'. Resets objed if appropriate." - (unless objed--with-allow-input + (unless (or objed--with-allow-input + (not objed--buffer)) (when (not (eq (current-buffer) objed--buffer)) (objed--reset--objed-buffer) (select-window (get-buffer-window (current-buffer)) t)
[elpa] externals/objed 6a91b16 023/166: Improve mc exit behavior
branch: externals/objed commit 6a91b16fcc7c2b2861d3cd34ecb3007e67fccb60 Author: Clemens Radermacher Commit: Clemens Radermacher Improve mc exit behavior --- objed.el | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/objed.el b/objed.el index 1c9161f..ac29d4a 100644 --- a/objed.el +++ b/objed.el @@ -3458,7 +3458,7 @@ and RANGE hold the object position data." ((eq 'mc exit) (when (boundp 'multiple-cursors-mode) (if (> (mc/num-cursors) 1) - (multiple-cursors-mode 1) + (run-at-time 0 nil 'multiple-cursors-mode) (multiple-cursors-mode 0))) (objed--exit-objed)) ((eq 'current exit) @@ -3623,13 +3623,16 @@ ON got applied." (defun objed--do-objects (action exit) "Apply ACTION on marked objects and exit with EXIT." - (let ((ovs objed--marked-ovs) -(appendp (memq action '(kill-region copy-region-as-kill))) -(n 0) -(mc (and (eq exit 'mc) - (require 'multiple-cursors nil t))) -(pos (point))) + (let* ((ovs objed--marked-ovs) + (appendp (memq action '(kill-region copy-region-as-kill))) + (n 0) + (mc (and (eq exit 'mc) + (require 'multiple-cursors nil t))) + (pos (set-marker (make-marker) (overlay-start (car ovs) +;; move to last ov +(goto-char pos) (save-excursion + ;; TODO: why not bottom up, was there a reason? (dolist (ov (nreverse (copy-sequence ovs))) (let ((beg (overlay-start ov)) (end (overlay-end ov)))
[elpa] externals/objed 333b58c 014/166: Change indentation object to include leading ws
branch: externals/objed commit 333b58c6f0ed1a912566a3d040a5497f0c5ef6d4 Author: Clemens Radermacher Commit: Clemens Radermacher Change indentation object to include leading ws --- objed-objects.el | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/objed-objects.el b/objed-objects.el index 888aabf..756501b 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1806,7 +1806,10 @@ non-nil the indentation block can contain empty lines." (goto-char opos)) (line-end-position (when (and beg end) - (cons beg end + (save-excursion +(goto-char beg) +(cons (line-beginning-position) + end) (objed-define-object nil indent
[elpa] externals/objed dc673b8 022/166: Fix for mc counting non fake cursor as cursor
branch: externals/objed commit dc673b8db1e4e71e8cf6c83114ee8ee976a2c568 Author: Clemens Radermacher Commit: Clemens Radermacher Fix for mc counting non fake cursor as cursor --- objed.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objed.el b/objed.el index e2d2df2..1c9161f 100644 --- a/objed.el +++ b/objed.el @@ -3457,7 +3457,7 @@ and RANGE hold the object position data." (ignore)) ((eq 'mc exit) (when (boundp 'multiple-cursors-mode) - (if (> (mc/num-cursors) 0) + (if (> (mc/num-cursors) 1) (multiple-cursors-mode 1) (multiple-cursors-mode 0))) (objed--exit-objed))
[elpa] externals/objed 0cb2593 017/166: Tweak sexp object
branch: externals/objed commit 0cb259346a461182a41100cf653eff0d348c9505 Author: Clemens Radermacher Commit: Clemens Radermacher Tweak sexp object --- objed-objects.el | 55 +++ 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 756501b..db2df7d 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1568,33 +1568,29 @@ comments." (objed--prev-symbol)) - (defun objed--at-sexp-p () "Return sexp object if point at strutured expression." - (let ((opos (point)) -(real-this-command 'forward-sexp)) -(save-excursion - (cl-flet ((zigzag - (arg) - (ignore-errors - (forward-sexp arg) - (unless (eq opos (point)) - (prog1 (point) - (forward-sexp (- arg))) -(let ((zigp nil)) - (when (or (and (not (eobp)) - (or (memq (char-syntax (char-before)) (list ?\s ?>)) - (not (eq (char-syntax (char-after)) ?\"))) - (save-excursion - (eq (point) (progn (setq zigp (zigzag 1)) - (point) -(and (not (bobp)) - (save-excursion - (eq (point) (progn (setq zigp (zigzag -1)) - (point)) -(and zigp - (cons (min (point) zigp) - (max (point) zigp) + (let* ((opos (point)) + (objed--block-p t) + (real-this-command 'forward-sexp) + (other nil) + (atp (or (save-excursion +(ignore-errors + (forward-sexp 1) + (setq other (point)) + (forward-sexp -1) + (= (point) opos))) + (save-excursion +(ignore-errors + (forward-sexp -1) + (setq other (point)) + (forward-sexp 1) + (= (point) opos)) + +(when atp + (cons (min opos other) +(max opos other) + (objed-define-object nil sexp :atp @@ -1613,9 +1609,12 @@ comments." 'identifier)) :get-obj (let ((bounds (or (objed--at-sexp-p) -(ignore-errors - (forward-sexp -1) - (objed--at-sexp-p) +(save-excursion + (ignore-errors +(forward-sexp 1) +(forward-sexp -1) +(objed--at-sexp-p)) + (when bounds (objed-make-object :obounds bounds
[elpa] externals/objed f9c3819 020/166: Tweak sexp object again
branch: externals/objed commit f9c3819f90908baf76fbd461cdb918a3cb098088 Author: Clemens Radermacher Commit: Clemens Radermacher Tweak sexp object again --- objed-objects.el | 35 +++ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index db2df7d..6521826 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1573,19 +1573,30 @@ comments." (let* ((opos (point)) (objed--block-p t) (real-this-command 'forward-sexp) + (instring (objed--in-string-p nil t)) (other nil) - (atp (or (save-excursion -(ignore-errors - (forward-sexp 1) - (setq other (point)) - (forward-sexp -1) - (= (point) opos))) - (save-excursion -(ignore-errors - (forward-sexp -1) - (setq other (point)) - (forward-sexp 1) - (= (point) opos)) + (atp (or (when (or (bobp) +;; prevent the annoying "feature" that sexp +;; movement works across strings +(not instring) +(not (eq (char-syntax (char-after)) ?\"))) +(save-excursion + (ignore-errors +(forward-sexp 1) +(setq other (point)) +(forward-sexp -1) +(= (point) opos + (when (or (eobp) +;; prevent the annoying "feature" that sexp +;; movement works across strings +(not instring) +(not (eq (char-syntax (char-before)) ?\"))) +(save-excursion + (ignore-errors + (forward-sexp -1) + (setq other (point)) + (forward-sexp 1) + (= (point) opos))) (when atp (cons (min opos other)
[elpa] externals/objed e35d7b8 001/166: Fix objed-object-activate for the case which-key isn't active
branch: externals/objed commit e35d7b867752062168e7dd002f22664762d20ce1 Author: Clemens Radermacher Commit: Clemens Radermacher Fix objed-object-activate for the case which-key isn't active --- objed-objects.el | 64 objed.el | 3 ++- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 269ceb7..7b63cb9 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -67,37 +67,37 @@ (eval-and-compile (defun objed--transform-pos-data (plist) - (let ((np nil) -(alt nil) -(make nil) -(skip nil)) -(unless (and (plist-get plist :beg) - (plist-get plist :end)) - (user-error "Malformed macro")) -(dolist (item plist) - (if (memq item '(:beg :ibeg :end :iend)) - (progn (push item alt) - (setq skip t)) -(if (and skip - (not (keywordp item))) -(push item alt) - (push item np) - (setq skip nil - -(setq np (nreverse np)) -(setq alt (nreverse alt)) -(dolist (el alt) - (when (keywordp el) -(progn - (push el make) - (push (plist-get alt el) make -(setq make (nreverse make)) -(push 'objed-make-object make) -(append np (list :get-obj) -;; TODO:save-mark-and-excursion still needed? -;; is wrapped already? -(list (append (list 'save-mark-and-excursion) - (list make)) +(let ((np nil) + (alt nil) + (make nil) + (skip nil)) + (unless (and (plist-get plist :beg) + (plist-get plist :end)) +(user-error "Malformed macro")) + (dolist (item plist) +(if (memq item '(:beg :ibeg :end :iend)) +(progn (push item alt) + (setq skip t)) + (if (and skip + (not (keywordp item))) + (push item alt) +(push item np) +(setq skip nil + + (setq np (nreverse np)) + (setq alt (nreverse alt)) + (dolist (el alt) +(when (keywordp el) + (progn +(push el make) +(push (plist-get alt el) make + (setq make (nreverse make)) + (push 'objed-make-object make) + (append np (list :get-obj) + ;; TODO:save-mark-and-excursion still needed? + ;; is wrapped already? + (list (append (list 'save-mark-and-excursion) +(list make)) (defun objed--get-arg-plist (keylst valid &optional wrapped) "Wraps any forms of keys in keylst in `progn' and returns property list. @@ -126,7 +126,7 @@ property list where each key has an associated progn." ;; objed--block-p: dont run objeds advices here... (push `(let ((objed--block-p t)) (save-mark-and-excursion - ,@(nreverse forms))) +,@(nreverse forms))) wrapped))) (objed--get-arg-plist keylst valid wrapped)) (keylst diff --git a/objed.el b/objed.el index 0e02471..38cb3a3 100644 --- a/objed.el +++ b/objed.el @@ -1951,7 +1951,8 @@ back to `objed-initial-object' if no match found." (interactive) (objed--maybe-which-key objed-object-map "Object:") (let ((real-this-command (lookup-key objed-object-map (vector (read-key) -(when (fboundp #'which-key--hide-popup) +(when (and (bound-and-true-p which-key-mode) + (fboundp #'which-key--hide-popup)) (which-key--hide-popup)) (when real-this-command (call-interactively real-this-command
[elpa] externals/objed 32221a6 041/166: Remember object type for marked object
branch: externals/objed commit 32221a65ac7cc6350f96fc4d5b7e3f3aaa2a02d5 Author: Clemens Radermacher Commit: Clemens Radermacher Remember object type for marked object --- objed-objects.el | 1 + 1 file changed, 1 insertion(+) diff --git a/objed-objects.el b/objed-objects.el index 87c94bf..9e93a2d 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1148,6 +1148,7 @@ Uses FACE `objed-mark' by default. If KEEP is non-nil keep overlays without content." (let ((ov (make-overlay beg end))) (overlay-put ov 'objed t) +(overlay-put ov 'objed--object objed--object) (overlay-put ov 'face (or face 'objed-mark)) (overlay-put ov 'evaporate (not keep)) (overlay-put ov 'rear-nonsticky t)
[elpa] externals/objed cb1a6ca 019/166: Add continuation object feature
branch: externals/objed commit cb1a6ca1c8c71da5fd479b59f0967f12bca60d9a Author: Clemens Radermacher Commit: Clemens Radermacher Add continuation object feature --- objed.el | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/objed.el b/objed.el index 43e2d2c..ae7e4e8 100644 --- a/objed.el +++ b/objed.el @@ -3486,9 +3486,15 @@ and RANGE hold the object position data." ;; let op exit itself if it wants to (ignore)) (t - (if (and text (objed--line-p text)) - (objed--init 'line) - (objed--init 'char + (let ((co (and (= (car range) (cadr range)) ; object vanished + (objed--get-continuation-object objed--object + (if co + (objed--update-current-object co) + ;; stay active with most appr. obj + ;; use a line when we acted on lines + (if (and text (objed--line-p text)) + (objed--switch-to 'line) + (objed--switch-to 'char)) ;; cleanup (when objed--extend-cookie (face-remap-remove-relative objed--extend-cookie) @@ -3501,6 +3507,18 @@ and RANGE hold the object position data." (set-marker (cadr range) nil +(defun objed--get-continuation-object (obj) + "Rerturn continuation object for object OBJ." + ;; objects which + (cond ((memq obj '(bracket string comment)) + (let ((objed--object 'sexp)) + (objed-make-object :beg (point) + :end (objed--end (objed--get) +(t + (objed-make-object :beg (point) +:end (objed--end (objed--get)) + + (defun objed-quit () "Quit and deactivate.
[elpa] externals/objed 87da25e 018/166: Fix mc available test on exit
branch: externals/objed commit 87da25e1da5d41e1dce7b7df454f1418d539d3df Author: Clemens Radermacher Commit: Clemens Radermacher Fix mc available test on exit --- objed.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/objed.el b/objed.el index c6cf713..43e2d2c 100644 --- a/objed.el +++ b/objed.el @@ -392,6 +392,7 @@ To avoid loading `avy' set this var before activating `objed-mode.'" (declare-function electric-pair-syntax-info "ext:elec-pair") (declare-function hl-line-unhighlight "ext:hl-line") (declare-function hl-line-highlight "ext:hl-line") +(declare-function multiple-cursors-mode "ext:multiple-cursors") (declare-function mc/create-fake-cursor-at-point "ext:multiple-cursors") (declare-function mc/num-cursors "ext:multiple-cursors") @@ -3455,7 +3456,7 @@ and RANGE hold the object position data." (cond ((eq 'keep exit) (ignore)) ((eq 'mc exit) - (when (fboundp 'multiple-cursors-mode) + (when (boundp 'multiple-cursors-mode) (if (> (mc/num-cursors) 0) (multiple-cursors-mode 1) (multiple-cursors-mode 0)))
[elpa] externals/objed a2cbe3b 015/166: Create fake cursors when using insertion op for marked objects
branch: externals/objed commit a2cbe3b296b62e3160488d6d36d89a0b37be6001 Author: Clemens Radermacher Commit: Clemens Radermacher Create fake cursors when using insertion op for marked objects --- objed.el | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/objed.el b/objed.el index 38aa7eb..30d16ab 100644 --- a/objed.el +++ b/objed.el @@ -392,6 +392,9 @@ To avoid loading `avy' set this var before activating `objed-mode.'" (declare-function electric-pair-syntax-info "ext:elec-pair") (declare-function hl-line-unhighlight "ext:hl-line") (declare-function hl-line-highlight "ext:hl-line") +(declare-function mc/create-fake-cursor-at-point "ext:multiple-cursors") + + @@ -2569,7 +2572,7 @@ With prefix arg REG non nil ask for register." (defun objed-del-insert () "Delete current object and exit to insert state." (interactive) - (objed--do #'delete-region) + (objed--do #'delete-region 'mc) (objed--exit-objed)) (defvar objed--electric-event nil @@ -3450,6 +3453,10 @@ and RANGE hold the object position data." (let ((exitf (cdr (assq exit objed--exit-alist (cond ((eq 'keep exit) (ignore)) + ((eq 'mc exit) + (when (fboundp 'mc/maybe-multiple-cursors-mode) + (mc/maybe-multiple-cursors-mode)) + (objed--exit-objed)) ((eq 'current exit) ;; use the markers for updated object (objed--update-current-object @@ -3596,7 +3603,10 @@ ON got applied." "Apply ACTION on marked objects and exit with EXIT." (let ((ovs objed--marked-ovs) (appendp (memq action '(kill-region copy-region-as-kill))) -(n 0)) +(n 0) +(mc (and (eq exit 'mc) + (require 'multiple-cursors nil t))) +(pos (point))) (save-excursion (dolist (ov (nreverse (copy-sequence ovs))) (let ((beg (overlay-start ov)) @@ -3604,6 +3614,9 @@ ON got applied." (when (and beg end) (goto-char beg) (funcall action beg end) +(when (and mc + (not (= pos (point + (mc/create-fake-cursor-at-point)) (cl-incf n)) (when appendp (setq last-command 'kill-region))
[elpa] externals/objed ae830b8 005/166: Improve block expansion for org mode
branch: externals/objed commit ae830b81d83634208c287948ae21ea7e28873fa2 Author: Clemens Radermacher Commit: Clemens Radermacher Improve block expansion for org mode --- objed.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objed.el b/objed.el index 04efdbe..3156e42 100644 --- a/objed.el +++ b/objed.el @@ -1440,7 +1440,7 @@ If IGNORE is non-nil it should be an object of (let ((os nil)) ;; TODO: sort by object size? (dolist (o objed--block-objects (nreverse os)) - (unless (memq o '(indent textblock block)) + (unless (memq o '(indent textblock)) (push o os) ((and (derived-mode-p 'prog-mode) (objed--in-string-or-comment-p))
[elpa] externals/objed 9376f3d 004/166: Use block object for backward-element in org mode
branch: externals/objed commit 9376f3d2e95563740f723d5034dae9d516f5426b Author: Clemens Radermacher Commit: Clemens Radermacher Use block object for backward-element in org mode --- objed.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objed.el b/objed.el index 532010d..04efdbe 100644 --- a/objed.el +++ b/objed.el @@ -219,7 +219,7 @@ function should return nil if objed should not initialize." (org-forward-sentence . sentence) (backward-sentence . sentence) (org-backward-sentence . sentence) -(org-backward-element . paragraph) +(org-backward-element . block) (beginning-of-defun . defun) (end-of-defun . defun) (outline-previous-visible-heading . section)
[elpa] externals/objed 1b50645 048/166: Update docstring
branch: externals/objed commit 1b506457239950dac810f995008b2502124978dc Author: Clemens Radermacher Commit: Clemens Radermacher Update docstring --- objed.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/objed.el b/objed.el index de7fc5a..8dbfc70 100644 --- a/objed.el +++ b/objed.el @@ -181,8 +181,7 @@ See also `objed-disabled-p'" (defcustom objed-init-p-function #'objed-init-p "Function which tests if objed is allowed to initialize. -This is only used for non-interactive initialization. The -function should return nil if objed should not initialize." +The function should return nil if objed should not initialize." :type 'function)
[elpa] externals/objed b978583 055/166: add (require 'hl-line)
branch: externals/objed commit b978583fecbf81a71fba3dc400ed8f59efa08e58 Author: E. A. Barbosa <40282381+eabarb...@users.noreply.github.com> Commit: GitHub add (require 'hl-line) Fix error if user turn off line highlight setting to nil objed-use-hl bind --- objed.el | 1 + 1 file changed, 1 insertion(+) diff --git a/objed.el b/objed.el index aa888c7..0a17296 100644 --- a/objed.el +++ b/objed.el @@ -125,6 +125,7 @@ (require 'nadvice) (require 'face-remap) (require 'subword) +(require 'hl-line) (require 'objed-objects)
[elpa] externals/objed 963841d 025/166: Improve continuation object
branch: externals/objed commit 963841d0818e9e55bf77439301a85e806f66b11e Author: Clemens Radermacher Commit: Clemens Radermacher Improve continuation object --- objed.el | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/objed.el b/objed.el index 0bf1d3a..50ca624 100644 --- a/objed.el +++ b/objed.el @@ -734,8 +734,10 @@ selected one." ;; basic edit ops (define-key map "k" 'objed-kill) +(define-key map "K" 'objed-kill) (define-key map "w" 'objed-copy) (define-key map "d" 'objed-delete) +(define-key map "D" 'objed-delete) (define-key map "y" 'objed-yank) @@ -3508,15 +3510,15 @@ and RANGE hold the object position data." (defun objed--get-continuation-object (obj) - "Return continuation object for object OBJ." + "Return object for continuation OBJ." ;; white list - (cond ((memq obj '(word defun sentence)) - (objed-make-object :beg (point) -:end (objed--end (objed--get -(t - (objed--switch-to 'sexp) - (objed-make-object :beg (point) -:end (objed--end) + (let ((shifted (memq 'shift (event-modifiers last-input-event +(unless (memq obj '(word defun sentence line)) + (objed--switch-to 'sexp)) +(objed-make-object :beg (if shifted (objed--beg (objed--get-prev)) + (point)) + :end (if shifted (point) + (objed--end (objed--get)) (defun objed-quit ()
[elpa] externals/objed 2701f73 026/166: Fix backward kill for continuation
branch: externals/objed commit 2701f7379ac83b9324dad70cf349ab56b0c89490 Author: Clemens Radermacher Commit: Clemens Radermacher Fix backward kill for continuation --- objed.el | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/objed.el b/objed.el index 50ca624..f4b30b9 100644 --- a/objed.el +++ b/objed.el @@ -3515,9 +3515,8 @@ and RANGE hold the object position data." (let ((shifted (memq 'shift (event-modifiers last-input-event (unless (memq obj '(word defun sentence line)) (objed--switch-to 'sexp)) -(objed-make-object :beg (if shifted (objed--beg (objed--get-prev)) - (point)) - :end (if shifted (point) +(objed-make-object :beg (point) + :end (if shifted (objed--beg (objed--get-prev)) (objed--end (objed--get)) @@ -3620,7 +3619,11 @@ ON got applied." (range (list (set-marker (make-marker) (car range)) (set-marker (make-marker) (cadr range) (prog1 1 - (apply action range) + ;; WHY: if passing the markers, prepend check + ;; in kill-region fails. + (funcall action + (marker-position (car range)) + (marker-position (cadr range))) (objed-exit-op exit text range)) (defun objed--do-objects (action exit)
[elpa] externals/objed a16418c 040/166: Refactor object-toggle-state
branch: externals/objed commit a16418c47b7afc0d21ffeb069e480c351dd03a50 Author: Clemens Radermacher Commit: Clemens Radermacher Refactor object-toggle-state --- objed.el | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/objed.el b/objed.el index 9e17e7d..0e73751 100644 --- a/objed.el +++ b/objed.el @@ -1773,24 +1773,10 @@ to an object containing the current one." "Toggle state of object. Shrinks to inner objects on repeat if possible." - (interactive) (when (eq objed--object 'sexp) (save-excursion (objed-context-object))) - (let ((boo (eq (point) (objed--beg))) -(eoo (eq (point) (objed--end -(objed--reverse) -(cond (boo - (goto-char (objed--beg))) - ((and eoo -(not (eq objed--object 'line))) - (goto-char (objed--end))) - ((< (point) (objed--beg)) - (goto-char (objed--beg))) - ((and -(> (point) (objed--beg)) -(> (point) (objed--end))) - (goto-char (objed--end)) + (objed--reverse)) (defun objed-backward-until-context (arg) "Goto object inner beginning and activate part moved over. @@ -1924,7 +1910,20 @@ Default to sexp at point." Switches between inner and whole object state." (interactive) - (objed--toggle-state)) + (let ((boo (eq (point) (objed--beg))) +(eoo (eq (point) (objed--end +(objed--toggle-state) +(cond (boo + (goto-char (objed--beg))) + ((and eoo +(not (eq objed--object 'line))) + (goto-char (objed--end))) + ((< (point) (objed--beg)) + (goto-char (objed--beg))) + ((and +(> (point) (objed--beg)) +(> (point) (objed--end))) + (goto-char (objed--end)) (defun objed-expand-context () @@ -1950,6 +1949,7 @@ On expand move to start of object." (if (objed--inner-p) (let ((curr (objed--current))) (objed--toggle-state) + (goto-char (objed--beg)) (when (equal curr (objed--current)) (objed-context-object) (goto-char (objed--beg
[elpa] externals/objed 8babcfc 030/166: Make obj state buffer local and keep it on movement
branch: externals/objed commit 8babcfc3a7c8834a842cb09615e2c232b4e02d17 Author: Clemens Radermacher Commit: Clemens Radermacher Make obj state buffer local and keep it on movement Add subword for inner word object --- objed-objects.el | 30 ++ objed.el | 42 ++ 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 7b1c460..f0bedf5 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -27,6 +27,8 @@ ;; * Bytecomp +(require 'subword) + ;; info for byte-comp (declare-function avy--process "ext:avy") (declare-function avy--style-fn "ext:avy") @@ -343,7 +345,7 @@ Positions are stored in a list of the form: ((object-start object-end) (inner-start inner-end))") -(defvar objed--obj-state nil +(defvar-local objed--obj-state nil "The state used to get object positions. Either the symbol `whole' or `inner'.") @@ -1524,12 +1526,19 @@ comments." (bounds-of-thing-at-point 'symbol)) 'identifier) :get-obj - (if (and (bound-and-true-p subword-mode) - (eq this-command 'forward-word)) - (save-excursion -(forward-word -1) -(bounds-of-thing-at-point 'word)) -(bounds-of-thing-at-point 'word)) + (objed-make-object + :obounds (if (bound-and-true-p subword-mode) +(let ((find-word-boundary-function-table subword-empty-char-table)) + (bounds-of-thing-at-point 'word)) + (bounds-of-thing-at-point 'word)) + :ibounds (if (and (bound-and-true-p subword-mode) + (eq this-command 'forward-word)) +(save-excursion + (forward-word -1) + (bounds-of-thing-at-point 'word)) + (let ((find-word-boundary-function-table + subword-find-word-boundary-function-table)) +(bounds-of-thing-at-point 'word :try-next (re-search-forward "\\<." nil t) :try-prev @@ -2128,7 +2137,12 @@ non-nil the indentation block can contain empty lines." :atp (or (looking-at "\\_<") (looking-back "\\_>" 1)) :get-obj - (bounds-of-thing-at-point 'symbol) + (let ((bounds (bounds-of-thing-at-point 'symbol))) +(when bounds + (objed-make-object + :obounds bounds + :ibounds (bounds-of-thing-at-point 'word + :try-next (objed--next-identifier) :try-prev diff --git a/objed.el b/objed.el index 5c2f283..8510a87 100644 --- a/objed.el +++ b/objed.el @@ -124,6 +124,7 @@ (require 'cl-lib) (require 'nadvice) (require 'face-remap) +(require 'subword) (require 'objed-objects) @@ -580,7 +581,7 @@ 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--switch-to ',obj objed--obj-state) (when (or prb pre) (cond ((and prb (= (point) (region-end))) @@ -615,6 +616,10 @@ selected one." (message "Indented defun."))) (call-interactively nc +(defun objed--point-in-periphery () + "Return non-nil if point is in current lines periphery." + (<= (point) (save-excursion (back-to-indentation) (point + (defvar objed-map (let ((map (make-sparse-keymap))) ;; block unused chars by default @@ -673,9 +678,16 @@ selected one." (define-key map "F" 'objed-move-object-forward) (define-key map "B" 'objed-move-object-backward) -(define-key map "p" (objed--call-and-switch previous-line line)) +(define-key map "p" (objed--call-and-switch + previous-line line + nil + (when (objed--point-in-periphery) + (back-to-indentation (define-key map "n" (objed--call-and-switch - next-line line)) + next-line line + nil + (when (objed--point-in-periphery) + (back-to-indentation (define-key map "P" 'objed-move-line-backward) (define-key map "N" 'objed-move-line-forward) @@ -718,7 +730,7 @@ selected one." (define-key map "o" 'objed-expand-context) (define-key map "i" 'objed-del-insert) -(define-key map "t" 'objed-shrink-context) +(define-key map "t" 'objed-toggle-state) (define-key map "j" 'objed-toggle-side) ;; marking/unmarking @@ -1862,26 +1874,16 @@ Default to sexp at point." (t (goto-char (objed--beg))) - -(defun objed-shrink-context () +(defun objed-toggle-state () "Shrink current object. Switches to inner object or object inside current one." (interactive) - (if (eq objed--object 'sexp) - (save-excursion -(objed-context-object)) -(if (objed--inner-p) -(save-excurs
[elpa] externals/objed 3d6f50b 012/166: Fix some indent operation issues
branch: externals/objed commit 3d6f50b85e234678855f30e2de86441847c39da6 Author: Clemens Radermacher Commit: Clemens Radermacher Fix some indent operation issues --- objed.el | 86 1 file changed, 21 insertions(+), 65 deletions(-) diff --git a/objed.el b/objed.el index 76efa99..cbaddc6 100644 --- a/objed.el +++ b/objed.el @@ -734,8 +734,6 @@ selected one." (define-key map "y" 'objed-yank) -(define-key map (kbd "C-x TAB") 'objed-indent-rigidly) - (define-key map (kbd "\\") ;; dont exit (objed-define-op nil objed-indent ignore)) @@ -2657,52 +2655,6 @@ ARG is passed to `yank'. On repreat `yank-pop'." (indent-according-to-mode) (objed--update-current-object))) -(defvar objed--indent-map - (let ((map (make-sparse-keymap))) -(define-key map (kbd "") 'objed-indent-right) -(define-key map (kbd "") 'objed-indent-left) -(define-key map (kbd "") 'objed-indent-left) -(define-key map (kbd "") 'objed-indent-right) -(define-key map (kbd "TAB") 'objed-indent) -(define-key map (kbd "") 'objed-indent-to-left-tab-stop) -(define-key map (kbd "") 'objed-indent-to-right-tab-stop) -map) - "Map used for indentation.") - -(defvar objed--indent-map-message - (concat "Indent object further with " - "[objed-indent-right], " - "\\[objed-indent-left], \\[objed-indent-to-left-tab-stop], " - "\\[objed-indent-to-right-tab-stop], \\[objed-indent].")) - -(defvar objed--indent-commands - '(objed-indent -objed-indent-left -objed-indent-right -objed-indent-to-left-tab-stop -objed-indent-to-right-tab-stop) - "Commands for indentation.") - -(defun objed--indent (f &optional arg) - "Execute indent function F. - -If ARG is given pass it on to the indent function. Switches -temporary to `objed--indent-map'" - ;; init - (unless (memq last-command -objed--indent-commands) -(goto-char (objed--beg)) -(push-mark (objed--end) t) -(set-transient-map objed--indent-map t - (let ((obj objed--object)) - (lambda () (objed--switch-to obj) - (if arg - (funcall f (region-beginning) (region-end) arg) -(funcall f (region-beginning) (region-end))) - (objed--switch-to 'region) - (message - (substitute-command-keys objed--indent-map-message))) - (defun objed-indent (beg end) "Indent region between BEG and END. @@ -2713,31 +2665,28 @@ Moves point over any whitespace afterwards." (defun objed-indent-left (arg) "Indent all lines in object leftward by ARG space." (interactive "p") - (objed--indent #'indent-rigidly (- arg))) + (objed--do (lambda (beg end) + (indent-rigidly beg end (- arg))) + 'current)) (defun objed-indent-right (arg) "Indent all lines in object rightward by ARG space." (interactive "p") - (objed--indent #'indent-rigidly arg)) + (objed--do (lambda (beg end) + (indent-rigidly beg end arg)) + 'current)) (defun objed-indent-to-left-tab-stop () "Indent all lines in object lefttward to a tab stop." (interactive) - (objed--indent #'indent-rigidly-left-to-tab-stop)) + (objed--do #'indent-rigidly-left-to-tab-stop + 'current)) (defun objed-indent-to-right-tab-stop () "Indent all lines in object rightward to a tab stop." (interactive) - (objed--indent #'indent-rigidly-right-to-tab-stop)) - -(defun objed-indent-rigidly (_beg _end &optional arg) - "Similar to `indent-rigidly' but work on current object lines. - -Indent by ARG lines." - (interactive "r\nP") - (if arg - (objed--indent #'indent-rigidly (prefix-numeric-value arg)) -(objed--indent #'ignore))) + (objed--do #'indent-rigidly-right-to-tab-stop + 'current)) (defun objed-move-object-forward () "Move object forward. @@ -3502,6 +3451,7 @@ and RANGE hold the object position data." (cond ((eq 'keep exit) (ignore)) ((eq 'current exit) + ;; use the markers for updated object (objed--update-current-object (objed-make-object :beg (car range) :end (cadr range @@ -3635,10 +3585,15 @@ ON got applied." "Apply ACTION on current object and exit with EXIT." (let ((range (objed--current))) (when range - (let ((text (apply #'buffer-substring range)) -(range (list (set-marker (make-marker) (car range)) - (set-marker (make-marker) (cadr range) + (let* ((text (apply #'buffer-substring range)) + (range (list (set-marker (make-marker) (car range)) + (set-marker (make-marker) (cadr range + (object (list range + (list (set-marker (make-marker) (objed--alt-beg)) + (set-marker (make-marker) (objed--alt-end)) (prog1 1 +
[elpa] externals/objed be2c78c 027/166: Fix word object for subword-mode
branch: externals/objed commit be2c78c42036f028105c5458e282cda982587bc2 Author: Clemens Radermacher Commit: Clemens Radermacher Fix word object for subword-mode --- objed-objects.el | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/objed-objects.el b/objed-objects.el index 6521826..7b1c460 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1524,7 +1524,12 @@ comments." (bounds-of-thing-at-point 'symbol)) 'identifier) :get-obj - (bounds-of-thing-at-point 'word) + (if (and (bound-and-true-p subword-mode) + (eq this-command 'forward-word)) + (save-excursion +(forward-word -1) +(bounds-of-thing-at-point 'word)) +(bounds-of-thing-at-point 'word)) :try-next (re-search-forward "\\<." nil t) :try-prev
[elpa] externals/objed ef42837 003/166: Always lazy load when package name defined for object
branch: externals/objed commit ef42837dedffebeb2ceae1ec118ac2671bc8e195 Author: Clemens Radermacher Commit: Clemens Radermacher Always lazy load when package name defined for object --- objed-objects.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/objed-objects.el b/objed-objects.el index 7b63cb9..888aabf 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -303,7 +303,9 @@ defined." res) (nreverse res))) (t - (let ((res (list 'progn))) + (let ((res (if package + (list `',package 'with-eval-after-load) +(list 'progn (when noskip (push `(put ',fname 'objed-no-skip t)
[elpa] externals/objed 252a1d3 021/166: For brackets, strings and comments switch to sexp on continuation
branch: externals/objed commit 252a1d3c65f6dec91b4c2dd5bc1386c538f4df7d Author: Clemens Radermacher Commit: Clemens Radermacher For brackets,strings and comments switch to sexp on continuation --- objed.el | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/objed.el b/objed.el index ae7e4e8..e2d2df2 100644 --- a/objed.el +++ b/objed.el @@ -3508,12 +3508,12 @@ and RANGE hold the object position data." (defun objed--get-continuation-object (obj) - "Rerturn continuation object for object OBJ." + "Return continuation object for object OBJ." ;; objects which (cond ((memq obj '(bracket string comment)) - (let ((objed--object 'sexp)) - (objed-make-object :beg (point) - :end (objed--end (objed--get) + (setq objed--object 'sexp) + (objed-make-object :beg (point) +:end (objed--end (objed--get (t (objed-make-object :beg (point) :end (objed--end (objed--get))
[elpa] externals/objed 4de1520 008/166: Improve paren insertion and wrapping in lisp modes
branch: externals/objed commit 4de1520a104f3fb247c3534508c0437ea4186736 Author: Clemens Radermacher Commit: Clemens Radermacher Improve paren insertion and wrapping in lisp modes --- objed.el | 50 +++--- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/objed.el b/objed.el index 95cb723..6f8c404 100644 --- a/objed.el +++ b/objed.el @@ -1741,21 +1741,32 @@ Shrinks to inner objects on repeat if possible." (t (objed--end)) -(defun objed-backward-until-context () - "Goto object inner beginning and activate part moved over." - (interactive) - (when (save-excursion (objed-context-object) -(objed--toggle-state)) -(objed--change-to :iend (point) :end (point)) -(goto-char (objed--beg +(defun objed-backward-until-context (arg) + "Goto object inner beginning and activate part moved over. -(defun objed-forward-until-context () - "Goto object inner end and activate part moved over." - (interactive) - (when (save-excursion (objed-context-object) -(objed--toggle-state)) -(objed--change-to :ibeg (point) :beg (point)) -(goto-char (objed--end +At bracket or string self insert ARG times." + (interactive "p") + (if (or (objed--at-object-p 'bracket) + (objed--at-object-p 'string)) + (self-insert-command arg) +(when (save-excursion +(objed-context-object) +(objed--toggle-state)) + (objed--change-to :iend (point) :end (point)) + (goto-char (objed--beg) + +(defun objed-forward-until-context (arg) + "Goto object inner end and activate part moved over. + +At bracket or string self insert ARG times." + (interactive "p") + (if (or (objed--at-object-p 'bracket) + (objed--at-object-p 'string)) + (self-insert-command arg) +(when (save-excursion (objed-context-object) + (objed--toggle-state)) + (objed--change-to :ibeg (point) :beg (point)) + (goto-char (objed--end) (defun objed-current-or-previous-context (&optional arg) "Move to end of object at point and activate it. @@ -2578,7 +2589,8 @@ else query for key event and use `electric'." (goto-char beg) (insert left)) (let ((event (or objed--electric-event - (setq objed--electric-event (read-event "Wrap with: ") + (setq objed--electric-event + (read-event "Wrap with: ") (objed-electric-event beg end event @@ -2607,6 +2619,14 @@ to sourround region string representation of event." (goto-char rbeg) (objed--skip-ws) (insert last-command-event) + ;; add space after wrapping with paren in lispy modes + (when (and (or (derived-mode-p 'lisp-mode) + (derived-mode-p 'emacs-lisp-mode)) + (eq (car (electric-pair-syntax-info last-command-event)) + ?\()) + (save-excursion + (insert " ") + (objed--reset))) (setq epos (point)) (electric-pair-post-self-insert-function)) ;; leave point like electric would for region
[elpa] externals/objed updated (4798b5b -> 01f0621)
clemera pushed a change to branch externals/objed. from 4798b5b Version bump new e35d7b8 Fix objed-object-activate for the case which-key isn't active new 4fe7ed0 Improve block expansion new ef42837 Always lazy load when package name defined for object new 9376f3d Use block object for backward-element in org mode new ae830b8 Improve block expansion for org mode new c9a91b5 Rename objed-electric to objed-electric-event new 40f5799 Don't reinit when op exited objed new 4de1520 Improve paren insertion and wrapping in lisp modes new 36bddbd Fix map staying active when op exited objed new 25111a3 Dont check buffer whe objed--buffer is gone new 225267f Don't reinit on object dispatch when objed is active new 3d6f50b Fix some indent operation issues new c9d4f12 Don't always update current object with marker positions new 333b58c Change indentation object to include leading ws new a2cbe3b Create fake cursors when using insertion op for marked objects new 89e1e18 Also activate mc if only one fake cursor new 0cb2593 Tweak sexp object new 87da25e Fix mc available test on exit new cb1a6ca Add continuation object feature new f9c3819 Tweak sexp object again new 252a1d3 For brackets,strings and comments switch to sexp on continuation new dc673b8 Fix for mc counting non fake cursor as cursor new 6a91b16 Improve mc exit behavior new 0fa1ea3 Default to sexp for continuation object new 963841d Improve continuation object new 2701f73 Fix backward kill for continuation new be2c78c Fix word object for subword-mode new 09cca2c Allow numeric prefix arg for kill/delete op new 0956db5 Don't add additional undo bounds for numeric repeats new 8babcfc Make obj state buffer local and keep it on movement new 781f0ee Make word object behave correctly with superword/subword-mode new bddcb432 Fix dosctring new e6d306b Don't exclude current object for objed-ace new 6f06795 Add commands which move to prev/next object, ignoring context new 470575e Update docs. new 73b99ed Improve objed-ace new 74204af Add ability to jump to objects inside current one new 7930c68 Make word movement aware of object state new 87cdeee Improve toggle state new a16418c Refactor object-toggle-state new 32221a6 Remember object type for marked object new 6ae9bff When repeating backward/forward until proceed to object boundary new 06f4abc Improve repeat behavior for backward/forward until context new 890b8b7 Add init function for hooks new 828037d Improve init/reset checks new db01e08 Undo last commit new b3e44ca Change init policy new 1b50645 Update docstring new 58669ec Fix backward/forward until context new 43befe6 Stop weird behavior of line and char object at eob new bea49a2 Fix word object at eob, too. new 6eb0fd5 Adjust objed-append-mode new 1846dd8 Deactivate append mode on yank new 2a634b8 Make append mode global new ceeff84 Allow defining objects by regex new b978583 add (require 'hl-line) new 7b86d64 Merge pull request #45 from eabarbosa/master new 7d51f03 Merge branch 'master' of github.com:clemera/objed new 6c34f45 Change binding for objed-occur new 25714dc Don't try to be smart with electric wrap new 7e25c50 Add forward slurp/barf sexp commands new 72592a9 Change bindings for barf/slurp sexps new 6096696 Add alternate bindings for barf/slurp new db8850a Improve regex object new e6bed2e Further improve regex object new 69dcc5b Use first regex group of regex object to delemit inner part new 4d0503c Allow using rx for regex objects, too new 870d125 Update docstrings for regex objects new c086dce Make [/] context independent by default new a7b8c48 Update docs new c02f3c1 Add description for uppercase kill/delete new f01a171 Make objed-init suitable for advices new 244acd2 Allow passing object to objed-init again new 0d506fa Allow specifying a fallback object for init new fa06574 Don't init when other modes have set overriding-terminal-local-map new c666cea Fix some sexp issues new 210d3db Improve sexp object for non symetric commands new 5aa473d Reset before quit window when objed is active new 354d5fa Don't bind scrolling commands, use char object for scrolling new 752d11e Change binding for sexp object new 2a25ff2 Make toggle smarter for sexp ob
[elpa] externals/objed 4fe7ed0 002/166: Improve block expansion
branch: externals/objed commit 4fe7ed0bb60f2377bf33ba246f38116df78c178e Author: Clemens Radermacher Commit: Clemens Radermacher Improve block expansion --- objed.el | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/objed.el b/objed.el index 38cb3a3..532010d 100644 --- a/objed.el +++ b/objed.el @@ -1436,20 +1436,21 @@ Objects which are built by lines of text.") If IGNORE is non-nil it should be an object of `objed--block-objects' which should be ignored." - (let ((os (cond ((bound-and-true-p outline-minor-mode) - objed--block-objects) - ((eq major-mode 'org-mode) + (let ((os (cond ((eq major-mode 'org-mode) (let ((os nil)) ;; TODO: sort by object size? (dolist (o objed--block-objects (nreverse os)) (unless (memq o '(indent textblock block)) (push o os) + ((and (derived-mode-p 'prog-mode) +(objed--in-string-or-comment-p)) + objed--block-objects) (t ;; performance is poor on slow ;; machines when searching after ;; every char with objed--get in case ;; there are no outlines/mode not active - (remq 'section objed--block-objects) + (remq 'textblock objed--block-objects) (remq ignore (if (save-excursion (and (or (not (derived-mode-p 'text-mode))
[elpa] externals/objed 781f0ee 031/166: Make word object behave correctly with superword/subword-mode
branch: externals/objed commit 781f0eeedb8e68862a895e83f1811775eac13983 Author: Clemens Radermacher Commit: Clemens Radermacher Make word object behave correctly with superword/subword-mode --- objed-objects.el | 21 ++--- objed.el | 36 ++-- 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index f0bedf5..a4f5940 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1518,6 +1518,7 @@ comments." :try-prev (search-backward " " nil t)) + (objed-define-object nil word :atp (looking-at "\\<") @@ -1527,17 +1528,15 @@ comments." 'identifier) :get-obj (objed-make-object - :obounds (if (bound-and-true-p subword-mode) -(let ((find-word-boundary-function-table subword-empty-char-table)) - (bounds-of-thing-at-point 'word)) - (bounds-of-thing-at-point 'word)) - :ibounds (if (and (bound-and-true-p subword-mode) - (eq this-command 'forward-word)) -(save-excursion - (forward-word -1) - (bounds-of-thing-at-point 'word)) - (let ((find-word-boundary-function-table - subword-find-word-boundary-function-table)) + :obounds (bounds-of-thing-at-point 'word) + :ibounds (let* ((subword-mode t) + (superword-mode nil) + (find-word-boundary-function-table +subword-find-word-boundary-function-table)) + (if (eq this-command 'forward-word) + (save-excursion +(forward-word -1) +(bounds-of-thing-at-point 'word)) (bounds-of-thing-at-point 'word :try-next (re-search-forward "\\<." nil t) diff --git a/objed.el b/objed.el index 8510a87..4044be5 100644 --- a/objed.el +++ b/objed.el @@ -661,12 +661,32 @@ selected one." (define-key map "~" 'objed-undo-in-object) ;; general movement -(define-key map "s" (objed--call-and-switch - forward-word - word)) -(define-key map "r" (objed--call-and-switch - backward-word - word)) +(define-key map "s" (defun objed-forward-word () + "Call `forward-word' and switch to object word" + (interactive) + (if (objed--inner-p) + (let* ((subword-mode t) + (superword-mode nil) + (find-word-boundary-function-table + subword-find-word-boundary-function-table)) +(setq this-command 'forward-word) +(call-interactively 'forward-word)) +(setq this-command 'forward-word) +(call-interactively 'forward-word)) + (objed--switch-to 'word objed--obj-state))) +(define-key map "r" (defun objed-backward-word () + "Call `forward-word' and switch to object word" + (interactive) + (if (objed--inner-p) + (let* ((subword-mode t) + (superword-mode nil) + (find-word-boundary-function-table + subword-find-word-boundary-function-table)) +(setq this-command 'backward-word) +(call-interactively 'backward-word)) +(setq this-command 'backward-word) +(call-interactively 'backward-word)) + (objed--switch-to 'word objed--obj-state))) (define-key map "S" 'objed-move-word-forward) (define-key map "R" 'objed-move-word-backward) @@ -1879,10 +1899,6 @@ Default to sexp at point." Switches to inner object or object inside current one." (interactive) - (if (bound-and-true-p subword-mode) - (subword-mode -1) -(unless (objed--inner-p) - (subword-mode 1))) (objed--toggle-state))
[elpa] externals/objed 6096696 063/166: Add alternate bindings for barf/slurp
branch: externals/objed commit 609669659dda0cd06c1a106537c5abf3ae3429ce Author: Clemens Radermacher Commit: Clemens Radermacher Add alternate bindings for barf/slurp --- objed.el | 28 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/objed.el b/objed.el index cdaf5a8..ba36e2f 100644 --- a/objed.el +++ b/objed.el @@ -717,16 +717,6 @@ selected one." (objed--skip-ws t)) (objed--switch-to 'paragraph))) -(define-key map (kbd "") 'objed-indent-left) -(define-key map (kbd "") 'objed-indent-right) -(define-key map (kbd "") 'objed-indent-to-right-tab-stop) -(define-key map (kbd "") 'objed-indent-to-left-tab-stop) -(define-key map (kbd " ") 'objed-move-object-backward) -(define-key map (kbd " ") 'objed-move-object-forward) -;; for some objects up down is more intuitive -(define-key map (kbd " ") 'objed-move-object-backward) -(define-key map (kbd " ") 'objed-move-object-forward) - (define-key map (kbd "") 'objed-top-object) (define-key map (kbd "") 'objed-bottom-object) (define-key map "<" 'objed-top-object) @@ -811,6 +801,7 @@ selected one." (define-key map "|" (objed-define-op nil objed-ipipe)) +(define-key map "!" 'objed-execute) (define-key map (kbd "") (objed-define-op @@ -821,12 +812,25 @@ selected one." (objed-define-op nil objed-duplicate-down)) (define-key map (kbd "") 'objed-insert-new-object) -;; sp functionality + (define-key map "^" 'objed-raise) +;; move things +(define-key map (kbd "") 'objed-indent-left) +(define-key map (kbd "") 'objed-indent-right) +(define-key map (kbd "") 'objed-indent-to-right-tab-stop) +(define-key map (kbd "") 'objed-indent-to-left-tab-stop) + (define-key map (kbd "") 'objed-forward-barf-sexp) (define-key map (kbd "") 'objed-forward-slurp-sexp) +(define-key map (kbd "") 'objed-forward-barf-sexp) +(define-key map (kbd "") 'objed-forward-slurp-sexp) + +(define-key map (kbd " ") 'objed-move-object-backward) +(define-key map (kbd " ") 'objed-move-object-forward) +;; for some objects up down is more intuitive +(define-key map (kbd " ") 'objed-move-object-backward) +(define-key map (kbd " ") 'objed-move-object-forward) -(define-key map "!" 'objed-execute) map) "Keymap for commands when `objed' is active.")
[elpa] externals/objed 470575e 035/166: Update docs.
branch: externals/objed commit 470575e2436550a15e417d79308dffa22c6b7e80 Author: Clemens Radermacher Commit: Clemens Radermacher Update docs. --- README.asc | 2 +- objed.el | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.asc b/README.asc index 5c57b44..db7f245 100644 --- a/README.asc +++ b/README.asc @@ -233,7 +233,7 @@ example. Any whitespace after point is skipped before determining the context: |Move point to the other side of the current object. |kbd:[t] -|Shrink object in current context, switchtes to inner object or object inside the current one. +|Toggle object state. Switches between inner and whole object state. |kbd:[[/\]] |If coming from basic movement the object at point is guessed based on context. Point is moved to the beginning/end of object at point. This is useful to "jump out" of the current context. On repeat move to the previous/next instance of current object type diff --git a/objed.el b/objed.el index bc69932..fb86a52 100644 --- a/objed.el +++ b/objed.el @@ -1908,9 +1908,9 @@ Default to sexp at point." (goto-char (objed--beg))) (defun objed-toggle-state () - "Shrink current object. + "Toggle object state. -Switches to inner object or object inside current one." +Switches between inner and whole object state." (interactive) (objed--toggle-state))
[elpa] externals/objed c666cea 076/166: Fix some sexp issues
branch: externals/objed commit c666ceafcf225aae8734a215d0e75c32e52b2c06 Author: Clemens Radermacher Commit: Clemens Radermacher Fix some sexp issues --- objed-objects.el | 5 +++-- objed.el | 6 -- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 5612182..a60bd2f 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1765,8 +1765,9 @@ comments." (let ((bounds (or (objed--at-sexp-p) (save-excursion (ignore-errors -(forward-sexp 1) -(forward-sexp -1) +(let ((real-this-command 'forward-sexp)) + (forward-sexp 1) + (forward-sexp -1)) (objed--at-sexp-p)) (when bounds diff --git a/objed.el b/objed.el index 2cd2517..35325c7 100644 --- a/objed.el +++ b/objed.el @@ -1029,7 +1029,8 @@ Use `objed-define-dispatch' to define a dispatch command.") (eq (char-syntax (char-after)) ?\")) (setq stringp (objed--in-string-p nil t))) (not (ignore-errors -(call-interactively 'forward-sexp) +(let ((real-this-command 'forward-sexp)) + (call-interactively 'forward-sexp)) t (if stringp (progn (goto-char stringp) @@ -1049,7 +1050,8 @@ Use `objed-define-dispatch' to define a dispatch command.") (eq (char-syntax (char-before)) ?\")) (setq stringp (objed--in-string-p nil t))) (not (ignore-errors -(call-interactively 'backward-sexp) +(let ((real-this-command 'forward-sexp)) + (call-interactively 'backward-sexp)) t (if stringp (goto-char stringp)
[elpa] externals/objed f01a171 072/166: Make objed-init suitable for advices
branch: externals/objed commit f01a171afe04511baec8120bdd21994def6540c2 Author: Clemens Radermacher Commit: Clemens Radermacher Make objed-init suitable for advices --- objed.el | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/objed.el b/objed.el index 8eb85d0..cedac42 100644 --- a/objed.el +++ b/objed.el @@ -1258,12 +1258,12 @@ See `objed-cmd-alist'." (or (memq major-mode '(messages-buffer-mode help-mode)) (not (derived-mode-p 'comint-mode 'special-mode 'dired-mode) -(defun objed-init (&optional obj) - "Function for activating objed by hooks. +(defun objed-init (&rest _) + "Function for activating objed by hooks or advices. -Initialize with OBJ which defaults to `objed--object'." +Initialize with `objed--object' or char if unset." (when (funcall objed-init-p-function) -(objed--init (or obj objed--object 'char +(objed--init (or objed--object 'char (defun objed--init-later (&rest _) "Init after command loop returned to top level." @@ -2017,7 +2017,8 @@ back to `objed-initial-object' if no match found." (if (assq last-command objed-cmd-alist) last-command objed-initial-object)) -(objed-init obj))) +(let ((objed--object obj)) + (objed-init ;;;###autoload
[elpa] externals/objed 6ae9bff 042/166: When repeating backward/forward until proceed to object boundary
branch: externals/objed commit 6ae9bff820128d0894cb3cdf7a4f0d06c8f50dfa Author: Clemens Radermacher Commit: Clemens Radermacher When repeating backward/forward until proceed to object boundary --- objed.el | 36 +--- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/objed.el b/objed.el index 0e73751..16d529d 100644 --- a/objed.el +++ b/objed.el @@ -1783,27 +1783,33 @@ Shrinks to inner objects on repeat if possible." At bracket or string self insert ARG times." (interactive "p") - (if (or (objed--at-object-p 'bracket) - (objed--at-object-p 'string)) - (self-insert-command arg) -(when (save-excursion -(objed-context-object) -(objed--toggle-state)) - (objed--change-to :iend (point) :end (point)) - (goto-char (objed--beg) + (if (eq last-command this-command) + (progn (objed--toggle-state) + (goto-char (objed--beg))) +(if (or (objed--at-object-p 'bracket) +(objed--at-object-p 'string)) +(self-insert-command arg) + (when (save-excursion + (objed-context-object) + (objed--toggle-state)) +(objed--change-to :iend (point) :end (point)) +(goto-char (objed--beg)) (defun objed-forward-until-context (arg) "Goto object inner end and activate part moved over. At bracket or string self insert ARG times." (interactive "p") - (if (or (objed--at-object-p 'bracket) - (objed--at-object-p 'string)) - (self-insert-command arg) -(when (save-excursion (objed-context-object) - (objed--toggle-state)) - (objed--change-to :ibeg (point) :beg (point)) - (goto-char (objed--end) + (if (eq last-command this-command) + (progn (objed--toggle-state) + (goto-char (objed--end))) +(if (or (objed--at-object-p 'bracket) +(objed--at-object-p 'string)) +(self-insert-command arg) + (when (save-excursion (objed-context-object) +(objed--toggle-state)) +(objed--change-to :ibeg (point) :beg (point)) +(goto-char (objed--end)) (defun objed-current-or-previous-context (&optional arg) "Move to end of object at point and activate it.
[elpa] externals/objed c086dce 069/166: Make [/] context independent by default
branch: externals/objed commit c086dce40988382f3b61bb0f1eb71e65f3ef3d58 Author: Clemens Radermacher Commit: Clemens Radermacher Make [/] context independent by default --- objed.el | 35 +-- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/objed.el b/objed.el index ba36e2f..2fc8e2d 100644 --- a/objed.el +++ b/objed.el @@ -707,8 +707,9 @@ selected one." (define-key map "(" 'objed-backward-until-context) (define-key map ")" 'objed-forward-until-context) -(define-key map "[" 'objed-current-or-previous-context) ;;objed-previous) -(define-key map "]" 'objed-current-or-next-context) ;;objed-next) +(define-key map "O" 'objed-current-or-previous-context) +(define-key map "[" 'objed-previous) ;; objed-current-or-previous-context +(define-key map "]" 'objed-next) ;; objed-current-or-next-context (define-key map "{" (objed--call-and-switch backward-paragraph paragraph)) (define-key map "}" (defun objed-forward-paragraph () (interactive) @@ -1831,23 +1832,28 @@ postitive prefix argument ARG move to the nth previous object." (if (< (objed--beg) pos (objed--end)) (goto-char (objed--beg)) (objed--goto-previous (or arg 1 -(let ((pos (point))) - (objed--goto-previous (or arg 1)) - (when (eq pos (point)) -(error "No previous %s" objed--object) +(objed-previous arg))) (defun objed-previous (&optional arg) "Move to ARG previous object of current type." (interactive "p") - (let ((objed--basic-objects nil)) -(objed-current-or-previous-context arg))) + (let ((pos (point))) +(objed--goto-previous (or arg 1)) +(when (eq pos (point)) + (error "No previous %s" objed--object (defun objed-next (&optional arg) "Move to ARG next object of current type." (interactive "p") - (let ((objed--basic-objects nil)) -(objed-current-or-next-context arg))) + ;; on init skip current + (when (and (region-active-p) + (eq last-command 'objed-extend)) +(exchange-point-and-mark)) + (let ((pos (point))) +(objed--goto-next (or arg 1)) +(when (eq pos (point)) + (error "No next %s" objed--object (defun objed-current-or-next-context (&optional arg) @@ -1862,14 +1868,7 @@ postitive prefix argument ARG move to the nth next object." (if (< (objed--beg) pos (objed--end)) (goto-char (objed--end)) (objed--goto-next (or arg 1 -;; on init skip current -(when (and (region-active-p) - (eq last-command 'objed-extend)) - (exchange-point-and-mark)) -(let ((pos (point))) - (objed--goto-next (or arg 1)) - (when (eq pos (point)) -(error "No next %s" objed--object) +(objed-next arg))) (defun objed-top-object () "Go to first instance of current object type."
[elpa] externals/objed c9d4f12 013/166: Don't always update current object with marker positions
branch: externals/objed commit c9d4f12177db33bc9d4c028a992ac999a783ef71 Author: Clemens Radermacher Commit: Clemens Radermacher Don't always update current object with marker positions --- objed.el | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/objed.el b/objed.el index cbaddc6..38aa7eb 100644 --- a/objed.el +++ b/objed.el @@ -3587,13 +3587,8 @@ ON got applied." (when range (let* ((text (apply #'buffer-substring range)) (range (list (set-marker (make-marker) (car range)) - (set-marker (make-marker) (cadr range - (object (list range - (list (set-marker (make-marker) (objed--alt-beg)) - (set-marker (make-marker) (objed--alt-end)) + (set-marker (make-marker) (cadr range) (prog1 1 - ;; update object with marker positions - (objed--update-current-object object) (apply action range) (objed-exit-op exit text range))
[elpa] externals/objed b3e44ca 047/166: Change init policy
branch: externals/objed commit b3e44ca27ad308b77f61893e264d876e55072d00 Author: Clemens Radermacher Commit: Clemens Radermacher Change init policy --- objed.el | 87 +++- 1 file changed, 47 insertions(+), 40 deletions(-) diff --git a/objed.el b/objed.el index 11c8dca..de7fc5a 100644 --- a/objed.el +++ b/objed.el @@ -164,6 +164,11 @@ ;; * User Settings and Variables +(defcustom objed-auto-init t + "Whether to enable automatic initialization in `objed-mode'." + :type 'boolean) + + (defcustom objed-disabled-modes '() "List of modes for which objed should stay disabled. @@ -200,18 +205,12 @@ function should return nil if objed should not initialize." (backward-paragraph . paragraph) (forward-paragraph . paragraph) (fill-paragraph . textblock) -;; TODO: add list object -;; or recognize sexp type -;; improve sexp nav... (down-list . sexp) (backward-up-list . sexp) (up-list . sexp) (forward-sexp . sexp) (backward-sexp . sexp) (indent-pp-sexp . bracket) -;; just use inner line? -;; TODO: on second press check all these: -;;section defun bracket string line) (back-to-indentation . line) (org-beginning-of-line . line) (org-end-of-line . line) @@ -240,13 +239,6 @@ function should return nil if objed should not initialize." ;; editing entry commands (yank . region) (yank-pop . region) -;; misc -(which-key-C-h-dispatch . char) -(find-file . char) -;; keep object of buffer if available... -(switch-to-buffer . nil) -(xref-find-definitions . nil) -(xref-pop-marker-stack . nil) ) "Entry commands and associated objects." :type '(alist :key-type sexp @@ -1204,6 +1196,7 @@ Useful for keeping the same popup when pressing undefined keys.") See `objed-cmd-alist'." (when (and objed-mode + (funcall objed-init-p-function) (not (minibufferp)) (not objed--block-p) (eq real-this-command cmd) @@ -1250,22 +1243,22 @@ See `objed-cmd-alist'." (defun objed-init-p () "Default for `objed-init-p-function'." - (and (eq (key-binding (kbd "C-n")) - #'next-line) - (not (minibufferp)) - (not (active-minibuffer-window)) - (not (and (bobp) - (bound-and-true-p git-commit-mode))) - (not (derived-mode-p 'comint-mode)) - (not (and (bobp) (eobp))) - ;; only for modes which do not - ;; their their own modal setup - (or (memq (key-binding "f") - '(self-insert-command - org-self-insert-command - outshine-self-insert-command - outline-self-insert-command - undefined) + (and (not (minibufferp)) + (not (bobp)) + ;; TODO: add variables for those + (or (memq major-mode '(messages-buffer-mode help-mode)) + (not (derived-mode-p 'comint-mode 'special-mode 'dired-mode) + +(defun objed-init (&optional obj) + "Function for activating objed by hooks. + +Initialize with OBJ which defaults to `objed--object'." + (when (funcall objed-init-p-function) +(objed--init (or obj objed--object 'char + +(defun objed--init-later (&rest _) + "Init after command loop returned to top level." + (run-at-time 0 nil #'objed-init)) (defun objed--init (&optional sym) "Initialize `objed'. @@ -2017,12 +2010,6 @@ back to `objed-initial-object' if no match found." objed-initial-object)) (objed-init obj))) -(defun objed-init (&optional obj) - "Function for activating objed by hooks. - -Initialize with OBJ which defaults to char." - (when (objed-init-p) -(objed--init (or obj 'char ;;;###autoload (defun objed-activate-object () @@ -3620,13 +3607,14 @@ If region is active deactivate it first." (defun objed--check-buffer () "Check if current buffer is still the `objed--buffer'. -Resets objed if appropriate." +Reset and reinitilize objed if appropriate." (unless (or objed--with-allow-input (not objed--buffer)) (when (not (eq (current-buffer) objed--buffer)) (objed--reset--objed-buffer) - (select-window (get-buffer-window (current-buffer)) t) - (objed--init (or objed--object 'char) + (when (window-live-p (get-buffer-window (current-buffer))) +(with-selected-window (get-buffer-window (current-buffer)) + (objed-init)) (defun objed--reset--objed-buffer () "Reset `objed--buffer'." @@ -3817,9 +3805,28 @@ setting the user options `objed-use-which-key-if-available-p' and (require 'which-key nil t)) objed--avy-avail-p (when objed-use-avy-if-available-p (require 'avy nil t))) -(objed--install-advices objed-cmd-alist t)) +(when objed-auto-init + ;; interactive cmds + (objed--
[elpa] externals/objed 354d5fa 079/166: Don't bind scrolling commands, use char object for scrolling
branch: externals/objed commit 354d5fa4ad9517ed64978d7cba72a42bb3a93d37 Author: Clemens Radermacher Commit: Clemens Radermacher Don't bind scrolling commands, use char object for scrolling --- objed.el | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/objed.el b/objed.el index 72a5d36..98c7a3b 100644 --- a/objed.el +++ b/objed.el @@ -198,8 +198,10 @@ The function should return nil if objed should not initialize." (next-line . line) (beginning-of-buffer . buffer) (end-of-buffer . buffer) -(scroll-up-command . line) -(scroll-down-command . line) +(scroll-up-command . char) +(scroll-down-command . char) +(View-scroll-half-page-forward . char) +(View-scroll-half-page-backward . char) (move-to-window-line-top-bottom . line) (imenu . line) (backward-paragraph . paragraph) @@ -637,8 +639,6 @@ selected one." (define-key map (kbd "C-SPC") 'set-mark-command) (define-key map (kbd "C-x C-x") 'objed-exchange-point-and-mark) ;; TODO: birdview mode/scroll mode -(define-key map (kbd "C-v") 'scroll-up-command) -(define-key map "\ev" 'scroll-down-command) (define-key map (kbd "C-h k") 'objed-describe-key) (when objed-use-which-key-if-available-p
[elpa] externals/objed 0fa1ea3 024/166: Default to sexp for continuation object
branch: externals/objed commit 0fa1ea3e68f1ea5ed763912dd5fcef0086d4240a Author: Clemens Radermacher Commit: Clemens Radermacher Default to sexp for continuation object --- objed.el | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/objed.el b/objed.el index ac29d4a..0bf1d3a 100644 --- a/objed.el +++ b/objed.el @@ -3509,14 +3509,14 @@ and RANGE hold the object position data." (defun objed--get-continuation-object (obj) "Return continuation object for object OBJ." - ;; objects which - (cond ((memq obj '(bracket string comment)) - (setq objed--object 'sexp) + ;; white list + (cond ((memq obj '(word defun sentence)) (objed-make-object :beg (point) :end (objed--end (objed--get (t + (objed--switch-to 'sexp) (objed-make-object :beg (point) -:end (objed--end (objed--get)) +:end (objed--end) (defun objed-quit ()
[elpa] externals/objed 7e25c50 061/166: Add forward slurp/barf sexp commands
branch: externals/objed commit 7e25c5029695a03539525fc7daff4a6cca5e24f0 Author: Clemens Radermacher Commit: Clemens Radermacher Add forward slurp/barf sexp commands --- objed-objects.el | 15 +++ objed.el | 34 +- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/objed-objects.el b/objed-objects.el index dfd5090..51e89c3 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1007,6 +1007,21 @@ current object position data." (setq objed--current-obj range +(defun objed--markify-current-object () + "Convert current object into marker object." + (unless (markerp (objed--beg)) +(objed--update-current-object + (objed-make-object + :ibeg (set-marker (make-marker) +(objed--ibeg)) + :beg (set-marker (make-marker) + (objed--obeg)) + :iend (set-marker (make-marker) +(objed--iend)) + :end (set-marker (make-marker) + (objed--oend)) + + (defun objed--switch-to (o &optional state odata) "Switch to object O. diff --git a/objed.el b/objed.el index 0d918dd..a620617 100644 --- a/objed.el +++ b/objed.el @@ -731,7 +731,6 @@ selected one." (define-key map (kbd "") 'objed-bottom-object) (define-key map "<" 'objed-top-object) (define-key map ">" 'objed-bottom-object) - ;; block expansions (define-key map "h" 'objed-expand-block) (define-key map "a" 'objed-beg-of-block) @@ -822,7 +821,11 @@ selected one." (objed-define-op nil objed-duplicate-down)) (define-key map (kbd "") 'objed-insert-new-object) +;; sp functionality (define-key map "^" 'objed-raise) +(define-key map (kbd "") 'objed-forward-barf-sexp) +(define-key map (kbd "") 'objed-forward-slurp-sexp) + (define-key map "!" 'objed-execute) map) @@ -3492,6 +3495,35 @@ If nil ‘eval-region’ is used instead.") :end (save-excursion (insert istring) (point)) +(defun objed-forward-slurp-sexp () + "Slurp following sexp into current object." + (interactive) + (objed--markify-current-object) + (let ((iend (objed--iend)) +(oend (objed--oend))) +(goto-char oend) +(let ((sexp (delete-and-extract-region + (point) + (scan-sexps (point) 1 + (goto-char iend) + (insert sexp) + (set-marker iend (point)) + (goto-char oend + +(defun objed-forward-barf-sexp () + "Barf last sexp out of current object." + (interactive) + (objed--markify-current-object) + (let ((iend (objed--iend)) +(oend (objed--oend))) +(goto-char iend) +(let ((sexp (delete-and-extract-region + (point) + (scan-sexps (point) -1 + (goto-char oend) + (save-excursion +(insert sexp) + (defun objed-execute () "Execute object contents as shell commands."
[elpa] externals/objed bddcb432 032/166: Fix dosctring
branch: externals/objed commit bddcb4328f73b58deb26a43003bd0a14aa71ab1d Author: Clemens Radermacher Commit: Clemens Radermacher Fix dosctring --- objed.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objed.el b/objed.el index 4044be5..aedf3dc 100644 --- a/objed.el +++ b/objed.el @@ -675,7 +675,7 @@ selected one." (call-interactively 'forward-word)) (objed--switch-to 'word objed--obj-state))) (define-key map "r" (defun objed-backward-word () - "Call `forward-word' and switch to object word" + "Call `backward-word' and switch to object word" (interactive) (if (objed--inner-p) (let* ((subword-mode t)
[elpa] externals/objed e6d306b 033/166: Don't exclude current object for objed-ace
branch: externals/objed commit e6d306b85e5ea28a15f6478fed912fa53425bd99 Author: Clemens Radermacher Commit: Clemens Radermacher Don't exclude current object for objed-ace --- objed.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objed.el b/objed.el index aedf3dc..e2407df 100644 --- a/objed.el +++ b/objed.el @@ -2233,7 +2233,7 @@ textual content of an object via the content object." (avy-style 'at-full) (avy-all-windows t) (posns (objed--collect-object-positions - (window-start) (window-end + (window-start) (window-end) (point (cond (posns (if (> (length posns) 1) (avy--process
[elpa] externals/objed 74204af 037/166: Add ability to jump to objects inside current one
branch: externals/objed commit 74204afda8ed92717a25ffc979533e8c916e22f2 Author: Clemens Radermacher Commit: Clemens Radermacher Add ability to jump to objects inside current one --- objed-objects.el | 16 +--- objed.el | 21 +++-- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index dfe831c..d24c0ad 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -603,13 +603,15 @@ and after current object. The resulting list contains cons cells of the start positions of the objects and the current window." - (append (objed--collect-backward - (or fromp (objed--min)) - beg) - (objed--collect-forward - (or fromp (if (objed--no-skipper-p) - (objed--min) (objed--max))) - end))) + (save-restriction +(narrow-to-region beg end) +(append (objed--collect-backward + (or fromp (objed--min)) + beg) +(objed--collect-forward + (or fromp (if (objed--no-skipper-p) + (objed--min) (objed--max))) + end (defun objed--collect-object-lines () diff --git a/objed.el b/objed.el index e6ca0ec..1a772c2 100644 --- a/objed.el +++ b/objed.el @@ -987,6 +987,7 @@ Use `objed-define-dispatch' to define a dispatch command.") (objed-define-dispatch "#" objed--ace-switch-object) +(objed-define-dispatch "=" objed--ace-switch-in-current) (objed-define-dispatch "-" objed--backward-until) (objed-define-dispatch "+" objed--forward-until) @@ -1082,6 +1083,11 @@ Use `objed-define-dispatch' to define a dispatch command.") "Switch to objed NAME using avy." (objed-ace name)) +(defun objed--ace-switch-in-current (obj) + "Ace for OBJ inside current object." + (let ((reg (objed--current))) +(apply #'objed-ace (cons obj reg + (defun objed--until (n &optional back) "Get object N and move point accordingly. @@ -2232,10 +2238,12 @@ textual content of an object via the content object." (defvar avy-all-windows) (defvar avy-action) -(defun objed-ace (&optional obj) +(defun objed-ace (&optional obj beg end) "Jump to an object with `avy'. -OBJ defaults to current object." +OBJ defaults to current object. BEG and END limit the region +which should be searched for candidates and default to +`window-start' and `window-end.'" (interactive) (if (eq objed--object 'char) (progn (call-interactively #'avy-goto-char) @@ -2246,11 +2254,12 @@ OBJ defaults to current object." (let* ((avy-action #'goto-char) (avy-style 'at-full) (avy-all-windows t) - (posns (let* ((oo objed--object) - (objed--object (or obj objed--object))) + (posns (let* ((objed--object (or obj objed--object)) + (beg (or beg (window-start))) + (end (or end (window-end (objed--collect-object-positions - (window-start) (window-end) - (unless (eq oo objed--object) + beg end + (when obj (point)) (cond (posns (if (> (length posns) 1)
[elpa] externals/objed 43befe6 050/166: Stop weird behavior of line and char object at eob
branch: externals/objed commit 43befe6d331f1014c3efa44300d6fe8d3ade578a Author: Clemens Radermacher Commit: Clemens Radermacher Stop weird behavior of line and char object at eob --- objed-objects.el | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 9e93a2d..7a1b191 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1457,11 +1457,10 @@ comments." :atp (looking-at ".") :get-obj - (objed-make-object - :beg (point) - :ibeg (point) - :end (if (eobp) (point) (1+ (point))) - :iend (if (eobp) (point) (1+ (point + (list (list (point) + (if (eobp) (point) (1+ (point +(list (point) + (if (eobp) (point) (1+ (point) :try-next ;; current one is skipped, for chars this means we are already at ;; the next.. @@ -1773,12 +1772,13 @@ comments." (or (looking-at "^") (looking-back "^ *" (line-beginning-position))) :get-obj - (objed-make-object :beg (line-beginning-position) - :end (save-excursion + (if (eobp) + (list (list (point) (point)) +(list (point) (point))) +(objed-make-object :beg (line-beginning-position) + :end (save-excursion ;; include hidden parts... -(end-of-visible-line) -(if (eobp) -(point) + (end-of-visible-line) (1+ (point) :try-next (skip-chars-forward " \t\r\n")
[elpa] externals/objed 06f4abc 043/166: Improve repeat behavior for backward/forward until context
branch: externals/objed commit 06f4abc2703e709a19743393051a6f196a47dc57 Author: Clemens Radermacher Commit: Clemens Radermacher Improve repeat behavior for backward/forward until context --- objed.el | 48 ++-- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/objed.el b/objed.el index 16d529d..8303737 100644 --- a/objed.el +++ b/objed.el @@ -1778,38 +1778,42 @@ Shrinks to inner objects on repeat if possible." (objed-context-object))) (objed--reverse)) -(defun objed-backward-until-context (arg) +(defun objed-backward-until-context () "Goto object inner beginning and activate part moved over. At bracket or string self insert ARG times." - (interactive "p") - (if (eq last-command this-command) + (interactive) + (if (objed--inner-p) (progn (objed--toggle-state) (goto-char (objed--beg))) -(if (or (objed--at-object-p 'bracket) -(objed--at-object-p 'string)) -(self-insert-command arg) - (when (save-excursion - (objed-context-object) - (objed--toggle-state)) -(objed--change-to :iend (point) :end (point)) -(goto-char (objed--beg)) - -(defun objed-forward-until-context (arg) +(when (save-excursion +(prog1 (objed-context-object) + (unless (eq last-command this-command) +(objed--toggle-state + (unless (eq last-command this-command) +(objed--change-to :iend (point) :end (point))) + (when (eq (point) (objed--beg)) +(objed-context-object)) + (goto-char (objed--beg) + + +(defun objed-forward-until-context () "Goto object inner end and activate part moved over. At bracket or string self insert ARG times." - (interactive "p") - (if (eq last-command this-command) + (interactive) + (if (objed--inner-p) (progn (objed--toggle-state) (goto-char (objed--end))) -(if (or (objed--at-object-p 'bracket) -(objed--at-object-p 'string)) -(self-insert-command arg) - (when (save-excursion (objed-context-object) -(objed--toggle-state)) -(objed--change-to :ibeg (point) :beg (point)) -(goto-char (objed--end)) +(when (save-excursion (prog1 (objed-context-object) +(unless (eq last-command this-command) + (objed--toggle-state + (if (eq last-command this-command) + (goto-char (objed--end)) +(objed--change-to :ibeg (point) :beg (point))) + (when (eq (point) (objed--end)) +(objed-context-object)) + (goto-char (objed--end) (defun objed-current-or-previous-context (&optional arg) "Move to end of object at point and activate it.
[elpa] externals/objed 13e7829 093/166: Fix word object navigation with objed-next/prev for inner subwords
branch: externals/objed commit 13e7829b5207d7bce9aca7fefdef17d91ed8ef37 Author: Clemens Radermacher Commit: Clemens Radermacher Fix word object navigation with objed-next/prev for inner subwords --- objed-objects.el | 33 ++--- objed.el | 7 ++- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 0a02ad2..99a4fa0 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1659,6 +1659,19 @@ comments." (search-backward " " nil t)) +(defun objed--inner-word-bounds () + "Return bounds of subword at point." + (let* ((subword-mode t) + (superword-mode nil) + (find-word-boundary-function-table + subword-find-word-boundary-function-table)) +(if (eq this-command 'forward-word) +(save-excursion + (forward-word -1) + (bounds-of-thing-at-point 'word)) + (bounds-of-thing-at-point 'word + + (objed-define-object nil word :atp (looking-at "\\<") @@ -1669,17 +1682,15 @@ comments." :get-obj (if (eobp) (objed-make-empty-object) -(objed-make-object - :obounds (bounds-of-thing-at-point 'word) - :ibounds (let* ((subword-mode t) - (superword-mode nil) - (find-word-boundary-function-table - subword-find-word-boundary-function-table)) -(if (eq this-command 'forward-word) -(save-excursion - (forward-word -1) - (bounds-of-thing-at-point 'word)) - (bounds-of-thing-at-point 'word) +(if (objed--inner-p) +;; don't confuse objed-next/prev which +;; use the outer bounds for navigation +;; but a word can contain multiple innner words +(objed-make-object + :obounds (objed--inner-word-bounds)) + (objed-make-object + :obounds (bounds-of-thing-at-point 'word) + :ibounds (objed--inner-word-bounds :try-next (if (objed--inner-p) (let* ((subword-mode t) diff --git a/objed.el b/objed.el index 16d0829..0917ba7 100644 --- a/objed.el +++ b/objed.el @@ -265,7 +265,7 @@ be used to restore previous states." reposition-window eval-defun eval-last-sexp -kmacro-start-macro +kmacro-start-macrop kmacro-start-macro-or-insert-counter kmacro-end-or-call-macro kmacro-call-macro @@ -1980,6 +1980,11 @@ Switches between inner and whole object state." (let ((boo (eq (point) (objed--beg))) (eoo (eq (point) (objed--end (objed--toggle-state) +;; for words force update because +;; a word can contain multiple inner +;; objects (CamelCaseSubWords) +(when (eq objed--object 'word) + (objed--update-current-object)) (cond (boo (goto-char (objed--beg))) ((and eoo
[elpa] externals/objed 73b99ed 036/166: Improve objed-ace
branch: externals/objed commit 73b99ed10b34942db635d2f8934df90791fa61b4 Author: Clemens Radermacher Commit: Clemens Radermacher Improve objed-ace --- objed.el | 35 +-- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/objed.el b/objed.el index fb86a52..e6ca0ec 100644 --- a/objed.el +++ b/objed.el @@ -1080,8 +1080,7 @@ Use `objed-define-dispatch' to define a dispatch command.") (defun objed--ace-switch-object (name) "Switch to objed NAME using avy." - (let ((objed--object name)) -(objed-ace))) + (objed-ace name)) (defun objed--until (n &optional back) @@ -2233,8 +2232,10 @@ textual content of an object via the content object." (defvar avy-all-windows) (defvar avy-action) -(defun objed-ace () - "Jump to an object with `avy'." +(defun objed-ace (&optional obj) + "Jump to an object with `avy'. + +OBJ defaults to current object." (interactive) (if (eq objed--object 'char) (progn (call-interactively #'avy-goto-char) @@ -2245,16 +2246,22 @@ textual content of an object via the content object." (let* ((avy-action #'goto-char) (avy-style 'at-full) (avy-all-windows t) - (posns (objed--collect-object-positions - (window-start) (window-end) (point - (cond (posns - (if (> (length posns) 1) - (avy--process - posns (avy--style-fn avy-style)) - (goto-char (caar posns))) - (objed--update-current-object)) -(t - (message "No objects found.")) + (posns (let* ((oo objed--object) + (objed--object (or obj objed--object))) +(objed--collect-object-positions + (window-start) (window-end) + (unless (eq oo objed--object) + (point)) +(cond (posns + (if (> (length posns) 1) + (avy--process +posns (avy--style-fn avy-style)) + (goto-char (caar posns))) + (if obj + (objed--switch-to obj) + (objed--update-current-object))) + (t + (message "No objects found.")) (defvar ivy-sort-function-alist) (defun objed-occur ()
[elpa] externals/objed 2f3734b 095/166: Use inner word as symbol prefix
branch: externals/objed commit 2f3734baff4684d310355c690236a3877d4f05eb Author: Clemens Radermacher Commit: Clemens Radermacher Use inner word as symbol prefix --- objed-objects.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objed-objects.el b/objed-objects.el index 40ea5bb..b617203 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -2301,7 +2301,7 @@ non-nil the indentation block can contain empty lines." :ibounds (save-excursion ;; use the symbol prefix by default (goto-char (car bounds)) - (bounds-of-thing-at-point 'word) + (objed--inner-word-bounds) :try-next (objed--next-identifier)
[elpa] externals/objed 25714dc 060/166: Don't try to be smart with electric wrap
branch: externals/objed commit 25714dc406032091fa4d911d0ac8931943b9ab70 Author: Clemens Radermacher Commit: Clemens Radermacher Don't try to be smart with electric wrap --- objed.el | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/objed.el b/objed.el index 9ae5e7f..0d918dd 100644 --- a/objed.el +++ b/objed.el @@ -793,7 +793,7 @@ selected one." (define-key map "x" 'objed-op-map) (define-key map "c" 'objed-object-map) (define-key map "'" 'objed-user-map) - + (define-key map (kbd "M-g o") 'objed-occur) ;; special commands @@ -2703,14 +2703,7 @@ to sourround region string representation of event." (goto-char rbeg) (objed--skip-ws) (insert last-command-event) - ;; add space after wrapping with paren in lispy modes - (when (and (or (derived-mode-p 'lisp-mode) - (derived-mode-p 'emacs-lisp-mode)) - (eq (car (electric-pair-syntax-info last-command-event)) - ?\()) - (save-excursion - (insert " ") - (objed--reset))) + ;; todo: additional expansion/insertion (setq epos (point)) (electric-pair-post-self-insert-function)) ;; leave point like electric would for region
[elpa] externals/objed 69dcc5b 066/166: Use first regex group of regex object to delemit inner part
branch: externals/objed commit 69dcc5b89d8ea8b58fc730f042e28530f297848c Author: Clemens Radermacher Commit: Clemens Radermacher Use first regex group of regex object to delemit inner part --- objed-objects.el | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index f947c80..78fe8af 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -69,7 +69,13 @@ (eval-and-compile (defun objed--get-regex-object (bregex eregex) - "Return regex object if point is within region limited by BREGEX, EREGEX." + "Return regex object if point is within region limited by BREGEX, EREGEX. + +BREGEX is the regular expression for the start of the object. Anything +in it's first regex group is considered to be part of the inner object. + +EREGEX is the regular expression for the end of the object. Anything +in it's first regex group is considered to be part of the inner object." (let* ((obounds ()) (ibounds ()) (opos (point))) @@ -86,21 +92,19 @@ (match-beginning 0) (when (and ;; goto possible start (re-search-backward bregex nil t) - (push (or (match-end 1) + (push (or (match-beginning 1) (match-end 0)) ibounds) - (push (or (match-beginning 1) - (match-beginning 0)) + (push (match-beginning 0) obounds) ;; goto possible end (goto-char (or (match-end 1) (match-end 0))) (re-search-forward eregex nil t) - (push (or (match-beginning 1) + (push (or (match-end 1) (match-beginning 0)) ibounds) - (push (or (match-end 1) - (match-end 0)) + (push (match-end 0) obounds) ;; when point was within start and end (<= (cadr obounds) opos (car obounds)))
[elpa] externals/objed 8861388 082/166: Auto switch from sexp object only for interactive state toggle
branch: externals/objed commit 8861388e3e244ff14bbe082e1ddc7234d022b123 Author: Clemens Radermacher Commit: Clemens Radermacher Auto switch from sexp object only for interactive state toggle --- objed.el | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/objed.el b/objed.el index 739f934..d658803 100644 --- a/objed.el +++ b/objed.el @@ -1816,13 +1816,7 @@ to an object containing the current one." 'identifier (defun objed--toggle-state () - "Toggle state of object. - -Shrinks to inner objects on repeat if possible." - (when (eq objed--object 'sexp) -(let ((fallback (objed--sexp-fallback))) - (when fallback -(objed--switch-to fallback + "Toggle state of object." (objed--reverse)) (defun objed-backward-until-context () @@ -1967,6 +1961,10 @@ Default to sexp at point." Switches between inner and whole object state." (interactive) + (when (eq objed--object 'sexp) +(let ((fallback (objed--sexp-fallback))) + (when fallback +(objed--switch-to fallback (let ((boo (eq (point) (objed--beg))) (eoo (eq (point) (objed--end (objed--toggle-state)
[elpa] externals/objed 44bb1d2 116/166: Add char object to keeper objects
branch: externals/objed commit 44bb1d20b5164073cc6b9787d64530a10637d88b Author: Clemens Radermacher Commit: Clemens Radermacher Add char object to keeper objects --- objed.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objed.el b/objed.el index 2e8791a..618eb71 100644 --- a/objed.el +++ b/objed.el @@ -3695,7 +3695,7 @@ and RANGE hold the object position data." (defun objed--get-continuation (obj) "Return continuation data for OBJ." (let ((shifted (memq 'shift (event-modifiers last-input-event))) -(no (cond ((memq obj '(word defun sentence line paragraph)) +(no (cond ((memq obj '(char word defun sentence line paragraph)) ;; keepers objed--object) ((memq obj (append objed--block-objects (list 'comment)))
[elpa] externals/objed 09cca2c 028/166: Allow numeric prefix arg for kill/delete op
branch: externals/objed commit 09cca2c9f3e9e6e0f9def5a0c9297133d956f2a9 Author: Clemens Radermacher Commit: Clemens Radermacher Allow numeric prefix arg for kill/delete op --- objed.el | 31 --- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/objed.el b/objed.el index f4b30b9..c52a594 100644 --- a/objed.el +++ b/objed.el @@ -2503,15 +2503,32 @@ region command." arg (objed--do cmd rcmd))) -(defun objed-kill () - "Kill objects." - (interactive) - (objed--do #'kill-region)) +(defun objed-kill (&optional times) + "Kill object(s). + +Kill marked objects or TIMES instances of current +object (defaults to 1)." + (interactive "p") + (if objed--marked-ovs + (objed--do #'kill-region) +(let ((times (or times 1))) + (dotimes (_ times) +(objed--do #'kill-region) +(undo-boundary) +(setq last-command #'kill-region) + +(defun objed-delete (&optional times) + "Delete object(s). -(defun objed-delete () - "Delete objects." +Delete marked objects or TIMES instances of current +object (defaults to 1)." (interactive) - (objed--do #'delete-region)) + (if objed--marked-ovs + (objed--do #'delete-region) +(let ((times (or times 1))) + (dotimes (_ times) +(objed--do #'delete-region) +(undo-boundary) (defvar objed--append-do-append nil)
[elpa] externals/objed 87cdeee 039/166: Improve toggle state
branch: externals/objed commit 87cdeee440c03afcc94e46018f421c316d105d87 Author: Clemens Radermacher Commit: Clemens Radermacher Improve toggle state --- objed.el | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/objed.el b/objed.el index 1a772c2..9e17e7d 100644 --- a/objed.el +++ b/objed.el @@ -1777,13 +1777,20 @@ Shrinks to inner objects on repeat if possible." (when (eq objed--object 'sexp) (save-excursion (objed-context-object))) - (let ((sdiff (abs (- (point) (objed--beg -(ediff (abs (- (point) (objed--end) + (let ((boo (eq (point) (objed--beg))) +(eoo (eq (point) (objed--end (objed--reverse) -(goto-char (cond ((> ediff sdiff) - (objed--beg)) - (t - (objed--end)) +(cond (boo + (goto-char (objed--beg))) + ((and eoo +(not (eq objed--object 'line))) + (goto-char (objed--end))) + ((< (point) (objed--beg)) + (goto-char (objed--beg))) + ((and +(> (point) (objed--beg)) +(> (point) (objed--end))) + (goto-char (objed--end)) (defun objed-backward-until-context (arg) "Goto object inner beginning and activate part moved over.
[elpa] externals/objed 6eb0fd5 052/166: Adjust objed-append-mode
branch: externals/objed commit 6eb0fd5d371d30df3d39f075d8b8c7421c455832 Author: Clemens Radermacher Commit: Clemens Radermacher Adjust objed-append-mode On activation kill and copy should append subsequent kills. --- objed.el | 37 ++--- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/objed.el b/objed.el index b982525..0edfab3 100644 --- a/objed.el +++ b/objed.el @@ -2548,6 +2548,15 @@ state is only restored correctly if the buffer was not modified." ;; * Operation definitions +(define-minor-mode objed-append-mode + "Append kills on `objed-copy'. + +When `objed-append-mode' is active `objed-copy' and `objed-kill' +will append kills to the `kill-ring'." + :init-value nil + :lighter " >>") + + (defun objed-op-x (&optional arg) "Choose and apply an operation from region commands with completion. @@ -2568,12 +2577,17 @@ region command." Kill marked objects or TIMES instances of current object (defaults to 1)." (interactive "p") + (when objed-append-mode +(setq last-command 'kill-region)) (if objed--marked-ovs (objed--do #'kill-region) (let ((times (or times 1))) (dotimes (_ times) (objed--do #'kill-region) -(setq last-command #'kill-region) +(setq last-command #'kill-region))) +(message (if objed-append-mode + "Appended to `kill-ring'" + "Added to `kill-ring.'" (defun objed-delete (&optional times) "Delete object(s). @@ -2587,18 +2601,6 @@ object (defaults to 1)." (dotimes (_ times) (objed--do #'delete-region) - -(defvar objed--append-do-append nil) - -(define-minor-mode objed-append-mode - "Append kills on `objed-copy'. - -When `objed-append-mode' is active `objed-copy' will append kills -to the `kill-ring'." - :init-value nil - (if objed-append-mode - (setq objed--append-do-append nil))) - (defun objed-insert (&optional read) "Insert stuff. @@ -2626,8 +2628,7 @@ inserting objed-register (see `objed-copy')." On repeat add text to objed register. With prefix arg REG non nil ask for register." (interactive "P") - (when (and objed-append-mode - objed--append-do-append) + (when objed-append-mode ;; append on repeat (setq last-command 'kill-region)) (objed--do #'copy-region-as-kill 'keep) @@ -2641,11 +2642,9 @@ With prefix arg REG non nil ask for register." (message "Copied to register")) (t - (message (if (and objed-append-mode - objed--append-do-append) + (message (if objed-append-mode "Appended to `kill-ring'" -"Copied to `kill-ring.'")) - (setq objed--append-do-append t +"Copied to `kill-ring.'") (defun objed-del-insert () "Delete current object and exit to insert state."
[elpa] externals/objed 37403c1 099/166: Fallback to line object for block object continuation
branch: externals/objed commit 37403c1825434907f45eea33cf7b1e87444dbe70 Author: Clemens Radermacher Commit: Clemens Radermacher Fallback to line object for block object continuation --- objed.el | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/objed.el b/objed.el index 0917ba7..da626d8 100644 --- a/objed.el +++ b/objed.el @@ -1571,12 +1571,9 @@ order. ISTATE is the object state to use and defaults to whole." (objed--get-current-state)) states)) (pop os)) -;; TODO: use size of object for sorting + ;; use start pos for sorting... (dolist (ps (sort states (lambda (a b) - ;; ensure line comes first - (and t;(not (eq (cadr (cddr a)) 'line)) -;; TODO: when eq sort with opposite end -(<= (car a) (car b) + (<= (car a) (car b nos) (push (cdr ps) nos) @@ -3677,13 +3674,24 @@ and RANGE hold the object position data." (defun objed--get-continuation-object (obj) "Return object for continuation OBJ." - ;; white list (let ((shifted (memq 'shift (event-modifiers last-input-event -(unless (memq obj '(word defun sentence line)) - (objed--switch-to 'sexp)) -(objed-make-object :beg (point) - :end (if shifted (objed--beg (objed--get-prev)) - (objed--end (objed--get)) +(when (cond ((memq obj '(word defun sentence line)) + ;; keepers + t) +((memq obj (append objed--block-objects (list 'comment))) + ;; line based ones + (objed--switch-to 'line)) +(t + ;; sexp as default for others + (objed--switch-to 'sexp))) + (let* ((objd (if shifted (objed--get-prev) + (objed--get))) + (end (and objd + (if shifted (objed--beg objd) +(objed--end objd) +(when end + (objed-make-object :beg (point) + :end end)) (defun objed-quit ()
[elpa] externals/objed 210d3db 077/166: Improve sexp object for non symetric commands
branch: externals/objed commit 210d3db7d3eabb31bba6089a9c6b545bceedfaa0 Author: Clemens Radermacher Commit: Clemens Radermacher Improve sexp object for non symetric commands --- objed-objects.el | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index a60bd2f..7add776 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1763,12 +1763,16 @@ comments." 'identifier)) :get-obj (let ((bounds (or (objed--at-sexp-p) +;; for commands which are not symetric +;; like C-M-f at beg of python funtions (save-excursion (ignore-errors -(let ((real-this-command 'forward-sexp)) +(let* ((pos (point)) + (real-this-command 'forward-sexp)) (forward-sexp 1) - (forward-sexp -1)) -(objed--at-sexp-p)) + (when (/= pos (point)) +(cons pos + (point) (when bounds (objed-make-object
[elpa] externals/objed 7b86d64 056/166: Merge pull request #45 from eabarbosa/master
branch: externals/objed commit 7b86d64d3be48c06c0535afd48a57ceac105dddb Merge: 2a634b8 b978583 Author: Clemens Radermacher Commit: GitHub Merge pull request #45 from eabarbosa/master require hl-line by default --- objed.el | 1 + 1 file changed, 1 insertion(+) diff --git a/objed.el b/objed.el index aa888c7..0a17296 100644 --- a/objed.el +++ b/objed.el @@ -125,6 +125,7 @@ (require 'nadvice) (require 'face-remap) (require 'subword) +(require 'hl-line) (require 'objed-objects)
[elpa] externals/objed 4d0503c 067/166: Allow using rx for regex objects, too
branch: externals/objed commit 4d0503c4ca4a45fbf2f510366da562b0fb749162 Author: Clemens Radermacher Commit: Clemens Radermacher Allow using rx for regex objects, too --- objed-objects.el | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 78fe8af..561386d 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -68,6 +68,7 @@ (eval-and-compile + (require 'rx) (defun objed--get-regex-object (bregex eregex) "Return regex object if point is within region limited by BREGEX, EREGEX. @@ -165,6 +166,7 @@ in it's first regex group is considered to be part of the inner object." (t (user-error "Malformed macro" + (defun objed--get-arg-plist (keylst valid &optional wrapped) "Wraps any forms of keys in keylst in `progn' and returns property list. KEYLST is the list of keys and forms for object creation. VALID @@ -189,9 +191,12 @@ property list where each key has an associated progn." (if (and (not (cdr forms)) (stringp (car forms))) (push (car forms) wrapped) - (push `(let ((objed--block-p t)) - ,@(nreverse forms)) -wrapped))) + (if (eq (caar forms) 'rx) + (push (macroexpand-1 (car forms)) +wrapped) +(push `(let ((objed--block-p t)) + ,@(nreverse forms)) + wrapped (t ;; objed--block-p: dont run objeds advices here... (push `(let ((objed--block-p t))
[elpa] externals/objed 65823e0 103/166: Improve context fallback
branch: externals/objed commit 65823e0bf117790caa97845b748e2ba509dd5e20 Author: Clemens Radermacher Commit: Clemens Radermacher Improve context fallback --- objed.el | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/objed.el b/objed.el index e8d7f41..9ecb8f8 100644 --- a/objed.el +++ b/objed.el @@ -1802,8 +1802,13 @@ to an object containing the current one." (force-mode-line-update) (goto-char (objed--beg))) ;; fallback if nothing else found -(or (objed--switch-to 'defun 'inner) -(objed--switch-to 'line 'inner)) +(let ((fallback (objed--get-object 'defun 'whole))) + (if (and fallback + (< (objed--alt-beg fallback) + (objed--beg))) + (objed--switch-to 'defun 'inner) +(or (objed--switch-to 'defun 'whole) +(objed--switch-to 'line 'inner (defun objed--sexp-fallback (&optional pos)
[elpa] externals/objed bea49a2 051/166: Fix word object at eob, too.
branch: externals/objed commit bea49a2dd385f0b2d342c0207ce9cb774c504bf5 Author: Clemens Radermacher Commit: Clemens Radermacher Fix word object at eob, too. --- objed-objects.el | 41 - 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 7a1b191..9ca6a7b 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -812,6 +812,12 @@ Position POS defaults to point." ;; * Object creation/manipulation +(defun objed-make-empty-object (&optional pos) + "Return an empty object at POS which default to point." + (let ((pos (or pos (point +(list (list pos pos) + (list pos pos + (cl-defun objed-make-object (&key obounds beg end ibounds ibeg iend) "Helper to create internal used object format from positions. @@ -1457,10 +1463,10 @@ comments." :atp (looking-at ".") :get-obj - (list (list (point) - (if (eobp) (point) (1+ (point -(list (point) - (if (eobp) (point) (1+ (point) + (if (eobp) + (objed-make-empty-object) +(objed-make-object :beg (point) + :end (1+ (point :try-next ;; current one is skipped, for chars this means we are already at ;; the next.. @@ -1537,17 +1543,19 @@ comments." (bounds-of-thing-at-point 'symbol)) 'identifier) :get-obj - (objed-make-object - :obounds (bounds-of-thing-at-point 'word) - :ibounds (let* ((subword-mode t) - (superword-mode nil) - (find-word-boundary-function-table -subword-find-word-boundary-function-table)) - (if (eq this-command 'forward-word) - (save-excursion -(forward-word -1) -(bounds-of-thing-at-point 'word)) -(bounds-of-thing-at-point 'word + (if (eobp) + (objed-make-empty-object) +(objed-make-object + :obounds (bounds-of-thing-at-point 'word) + :ibounds (let* ((subword-mode t) + (superword-mode nil) + (find-word-boundary-function-table + subword-find-word-boundary-function-table)) +(if (eq this-command 'forward-word) +(save-excursion + (forward-word -1) + (bounds-of-thing-at-point 'word)) + (bounds-of-thing-at-point 'word) :try-next (if (objed--inner-p) (let* ((subword-mode t) @@ -1773,8 +1781,7 @@ comments." (looking-back "^ *" (line-beginning-position))) :get-obj (if (eobp) - (list (list (point) (point)) -(list (point) (point))) + (objed-make-empty-object) (objed-make-object :beg (line-beginning-position) :end (save-excursion ;; include hidden parts...
[elpa] externals/objed bade5a0 123/166: Improve slurping/barfing for sexps
branch: externals/objed commit bade5a029fdc89b109b5fe6595e521f3b0b65da6 Author: Clemens Radermacher Commit: Clemens Radermacher Improve slurping/barfing for sexps --- objed.el | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/objed.el b/objed.el index c2d5b74..60dd81a 100644 --- a/objed.el +++ b/objed.el @@ -1852,6 +1852,13 @@ to an object containing the current one." 'word 'identifier + +(defun objed--switch-to-sexp-fallback (&optional pos) + "Switch to sexp fallback at POS." + (let ((fallback (objed--sexp-fallback pos))) +(when fallback + (objed--switch-to fallback + (defun objed--toggle-state () "Toggle state of object." (objed--reverse)) @@ -1999,9 +2006,7 @@ Default to sexp at point." Switches between inner and whole object state." (interactive) (when (eq objed--object 'sexp) -(let ((fallback (objed--sexp-fallback))) - (when fallback -(objed--switch-to fallback +(objed--switch-to-sexp-fallback)) (let ((boo (eq (point) (objed--beg))) (eoo (eq (point) (objed--end (objed--toggle-state) @@ -3610,6 +3615,8 @@ If nil ‘eval-region’ is used instead.") (defun objed-forward-slurp-sexp () "Slurp following sexp into current object." (interactive) + (when (eq objed--object 'sexp) +(objed--switch-to-sexp-fallback)) (objed--markify-current-object) (let ((iend (objed--iend)) (oend (objed--oend))) @@ -3625,6 +3632,8 @@ If nil ‘eval-region’ is used instead.") (defun objed-forward-barf-sexp () "Barf last sexp out of current object." (interactive) + (when (eq objed--object 'sexp) +(objed--switch-to-sexp-fallback)) (objed--markify-current-object) (let ((iend (objed--iend)) (oend (objed--oend)))
[elpa] externals/objed 2ea1ebb 101/166: Adjust default binding scheme
branch: externals/objed commit 2ea1ebb58161140dff0d677b0805a43063b8c1ab Author: Clemens Radermacher Commit: Clemens Radermacher Adjust default binding scheme --- README.asc | 31 +--- objed.el | 31 test/tests/emacs-lisp-mode/expansion/block_2 | 2 +- test/tests/emacs-lisp-mode/expansion/block_3 | 2 +- test/tests/emacs-lisp-mode/expansion/block_4 | 2 +- test/tests/emacs-lisp-mode/expansion/block_5 | 2 +- test/tests/emacs-lisp-mode/expansion/block_6 | 2 +- 7 files changed, 32 insertions(+), 40 deletions(-) diff --git a/README.asc b/README.asc index 374eb3e..ffc7e0a 100644 --- a/README.asc +++ b/README.asc @@ -55,11 +55,11 @@ kbd:[M-SPC] by default. It uses the last command and its mapping in `objed-command-alist` to choose the initial object. Objeds modal state provides basic movement commands which move by line, sexp -or word. Those switch automatically to the corresponding object type. Other -commands only activate the part between the initial position and the new -position moved to. By repeating commands you can often expand/proceed to other -objects. This way you can compose movement and editing operations very -efficiently. +word or character. Those switch automatically to the corresponding object +type. Other commands only activate the part between the initial position and +the new position moved to. By repeating commands you can often expand/proceed +to other objects. This way you can compose movement and editing operations +very efficiently. The expansion commands distinguish between block objects (objects built out of lines of text like paragraphs or text blocks with the same level of @@ -155,7 +155,7 @@ If commands allow for numeric arguments you can input them without the use of kbd:[Ctrl] or kbd:[Meta]. kbd:[0] can be used as an alternative for the universal argument (kbd:[C-u]). To add custom commands to the modal state you can use `objed-user-map` which is available under prefix key kbd:['] and -`objed-other-user-map` bound to kbd:[-]. It's recommended to use one of these +`objed-other-user-map` bound to kbd:[?]. It's recommended to use one of these map for custom object bindings and the other one for additional operations. In addition to the commands configured in `objed-cmd-alist` you can use the @@ -195,6 +195,9 @@ Basic movement commands (switch the object type on movement): |=== |Shortcut |Purpose +|kbd:[l/h] +|Move forward/backward one char and activate the char object + |kbd:[f/b] |Move forward/backward one sexp and activate the sexp object @@ -211,7 +214,7 @@ Commands for block objects (objects built out of lines of text): |=== |Shortcut |Purpose -|kbd:[h] +|kbd:[v] |Activate (line based) object at point and move to its start. On repeat proceed to beginning of the indentation block, comment block, paragraph or other block objects. |kbd:[a] @@ -263,12 +266,6 @@ command mark all instances in current defun/buffer): |kbd:[,] |Switch to identifier object and move to previous. -|kbd:[_] -|Switch to symbol object. - -|kbd:[l] -|Switch to line object. - |kbd:[c] |Prefix to switch to other objects, see `objed-object-map` for available objects and `objed-define-object` to add your own (https://with-emacs.com/posts/objed/writing-your-own-text-objects-for-objed/[blog]). |=== @@ -399,7 +396,7 @@ Misc commands: |kbd:[M] |Add/Remove current object to marked objects and move to previous. -|kbd:[v] +|kbd:[@] |Activate region with current object (extend current object). |kbd:[Ctrl - Space] @@ -408,7 +405,7 @@ Misc commands: |kbd:[/] |Undo last edit command. -|kbd:[?] +|kbd:[C-h b] |Get key binding help (uses `which-key` if available). |kbd:[g/Ctrl - g] @@ -438,10 +435,10 @@ You can add your own prefix bindings using `objed-define-dispatch`. |kbd:[´] |Activate part from point backward until boundary of some object. -|kbd:[@] +|kbd:[-] |Extend current object by including leading whitespace. -|kbd:[_] +|kbd:[+] |Extend current object by including trailing whitespace. |=== diff --git a/objed.el b/objed.el index da626d8..e8d7f41 100644 --- a/objed.el +++ b/objed.el @@ -627,10 +627,10 @@ selected one." (define-key map (kbd (format "C-%c" n)) 'digit-argument)) ;; common emacs keys (define-key map (kbd "C-g") 'objed-quit) +(define-key map (kbd "C-h b") 'objed-show-top-level) ;; TODO: switch with q, so quit window is qq? (define-key map "g" 'objed-quit) (define-key map "q" 'objed-quit-window-or-reformat) -(define-key map (kbd "?") 'objed-show-top-level) ;; TODO: support repeated invokation (define-key map (kbd "C-u") 'universal-argument) ;; for quick access @@ -654,6 +654,10 @@ selected one." (define-key map "~" 'objed-undo-in-object) ;; general movement +(define-key map "l" (objed--call-and-switch right-char char)) +(define-ke
[elpa] externals/objed 7d51f03 058/166: Merge branch 'master' of github.com:clemera/objed
branch: externals/objed commit 7d51f03f31aa0909ea0de2e8f3378966703aaa43 Merge: ceeff84 7b86d64 Author: Clemens Radermacher Commit: Clemens Radermacher Merge branch 'master' of github.com:clemera/objed --- objed.el | 1 + 1 file changed, 1 insertion(+) diff --git a/objed.el b/objed.el index aa888c7..0a17296 100644 --- a/objed.el +++ b/objed.el @@ -125,6 +125,7 @@ (require 'nadvice) (require 'face-remap) (require 'subword) +(require 'hl-line) (require 'objed-objects)
[elpa] externals/objed c02f3c1 071/166: Add description for uppercase kill/delete
branch: externals/objed commit c02f3c1f10527bc92646a834b64c83fa9e6b40e1 Author: Clemens Radermacher Commit: Clemens Radermacher Add description for uppercase kill/delete --- README.asc | 10 -- objed.el | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.asc b/README.asc index a25af18..2514af4 100644 --- a/README.asc +++ b/README.asc @@ -309,10 +309,16 @@ once you can mark them first (see the "Misc commands" below): |Delete current object(s) and switch to insert. |kbd:[k] -|Kill current object(s). +|Kill current object(s). Continues by selecting the next instance from point. + +|kbd:[K] +|Kill current object. Continues by selecting the previous instance from point. |kbd:[d] -|Delete current object(s). +|Delete current object(s). Continues by selecting the next instance from point. + +|kbd:[D] +|Delete current object. Continues by selecting the previous instance from point. |kbd:[w] |Copy current object(s). On repeat move to next and append it to `kill-ring` diff --git a/objed.el b/objed.el index 2fc8e2d..8eb85d0 100644 --- a/objed.el +++ b/objed.el @@ -707,7 +707,6 @@ selected one." (define-key map "(" 'objed-backward-until-context) (define-key map ")" 'objed-forward-until-context) -(define-key map "O" 'objed-current-or-previous-context) (define-key map "[" 'objed-previous) ;; objed-current-or-previous-context (define-key map "]" 'objed-next) ;; objed-current-or-next-context (define-key map "{" (objed--call-and-switch backward-paragraph paragraph)) @@ -730,6 +729,7 @@ selected one." ;; context expansions (define-key map "o" 'objed-expand-context) +(define-key map "O" 'objed-current-or-previous-context) (define-key map "i" 'objed-del-insert) (define-key map "t" 'objed-toggle-state)
[elpa] externals/objed 1127d6f 111/166: Adjust default binding scheme again
branch: externals/objed commit 1127d6fdec989fb9577cb55fa6adedce7b4035e0 Author: Clemens Radermacher Commit: Clemens Radermacher Adjust default binding scheme again --- README.asc | 5 + objed.el | 11 ++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README.asc b/README.asc index c071641..651e177 100644 --- a/README.asc +++ b/README.asc @@ -155,7 +155,7 @@ If commands allow for numeric arguments you can input them without the use of kbd:[Ctrl] or kbd:[Meta]. kbd:[0] can be used as an alternative for the universal argument (kbd:[C-u]). To add custom commands to the modal state you can use `objed-user-map` which is available under prefix key kbd:['] and -`objed-other-user-map` bound to kbd:[?]. It's recommended to use one of these +`objed-other-user-map` bound to kbd:[-]. It's recommended to use one of these map for custom object bindings and the other one for additional operations. In addition to the commands configured in `objed-cmd-alist` you can use the @@ -438,9 +438,6 @@ You can add your own prefix bindings using `objed-define-dispatch`. |kbd:[´] |Activate part from point backward until boundary of some object. -|kbd:[-] -|Extend current object by including leading whitespace. - |kbd:[+] |Extend current object by including trailing whitespace. |=== diff --git a/objed.el b/objed.el index 3553bf8..ce61d8a 100644 --- a/objed.el +++ b/objed.el @@ -630,7 +630,7 @@ selected one." (define-key map (kbd (format "C-%c" n)) 'digit-argument)) ;; common emacs keys (define-key map (kbd "C-g") 'objed-quit) -(define-key map (kbd "C-h b") 'objed-show-top-level) +(define-key map (kbd "?") 'objed-show-top-level) ;; TODO: switch with q, so quit window is qq? (define-key map "g" 'objed-quit) (define-key map "q" 'objed-quit-window-or-reformat) @@ -747,9 +747,10 @@ selected one." ;; (define-key map "M" 'objed-unmark-all) (define-key map "@" 'objed-extend) -(define-key map "-" 'objed-include-leading-ws) +;; TODO: second + include more (define-key map "+" 'objed-include-trailing-ws) - +;; (define-key map "" 'objed-include-leading-ws) + ;; basic edit ops (define-key map "k" 'objed-kill) (define-key map "K" 'objed-kill) @@ -784,7 +785,7 @@ selected one." (define-key map "c" 'objed-object-map) ;; for custom user object and op commands (define-key map "'" 'objed-user-map) -(define-key map "?" 'objed-other-user-map) +(define-key map "-" 'objed-other-user-map) (define-key map (kbd "M-g o") 'objed-occur) @@ -936,7 +937,7 @@ To define new operations see `objed-define-op'.") "Keymap for custom user bindings.") (defvar objed-other-user-map - (let ((map (objed--define-prefix "?" 'objed-user-map))) + (let ((map (objed--define-prefix "-" 'objed-user-map))) map) "Keymap for custom user bindings.")
[elpa] externals/objed 752d11e 080/166: Change binding for sexp object
branch: externals/objed commit 752d11e53ce8230f8a7a37add7a49bd76ed0aaec Author: Clemens Radermacher Commit: Clemens Radermacher Change binding for sexp object --- objed.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objed.el b/objed.el index 98c7a3b..2e9fca1 100644 --- a/objed.el +++ b/objed.el @@ -951,7 +951,7 @@ To define new operations see `objed-define-op'.") (define-key map "." 'objed-sentence-object) (define-key map "{" 'objed-paragraph-object) (define-key map "q" 'objed-textblock-object) -(define-key map "\"" 'objed-sexp-object) +(define-key map "x" 'objed-sexp-object) (define-key map "i" 'objed-indent-object) (define-key map "a" 'objed-block-object)
[elpa] externals/objed db8850a 064/166: Improve regex object
branch: externals/objed commit db8850a4ed3f5eb6255b1a80c768e003a010146b Author: Clemens Radermacher Commit: Clemens Radermacher Improve regex object --- objed-objects.el | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 51e89c3..0eb1996 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -74,9 +74,12 @@ (ibounds ()) (opos (point))) (save-mark-and-excursion - (when (and (re-search-forward eregex nil t) ; possibly exit start - (goto-char (or (match-beginning 1) -(match-beginning 0))) + (when (and (if (looking-at bregex) + (re-search-forward bregex nil t) + (re-search-forward eregex nil t) + (goto-char (or (match-beginning 1) + (match-beginning 0 ; possibly exit start + ;; goto possible start (re-search-backward bregex nil t) (push (or (match-end 1)
[elpa] externals/objed d7b5768 104/166: Ignore comments for css defun object
branch: externals/objed commit d7b5768b14dcc76e8a1f8f140e9c9d77a2ecd64d Author: Clemens Radermacher Commit: Clemens Radermacher Ignore comments for css defun object --- objed-objects.el | 31 --- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 1fc371d..a708ab7 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -2451,21 +2451,22 @@ non-nil the indentation block can contain empty lines." :try-prev (search-backward "{") :get-obj - (let* ((pos (point)) - (end (and (search-forward "}" nil t) (point))) - (beg (and end - (search-backward "{" nil t) - (or (and (re-search-backward "^ *$" nil t) -(1+ (match-end 0))) - (and (re-search-backward "^" nil t) -(line-beginning-position)) -(when (and beg end - (<= beg pos end)) - (objed-make-object - :beg beg - :ibeg (search-forward "{") - :end end - :iend (1- end) + (unless (objed--in-comment-p) +(let* ((pos (point)) + (end (and (search-forward "}" nil t) (point))) + (beg (and end + (search-backward "{" nil t) + (or (and (re-search-backward "^ *$" nil t) + (1+ (match-end 0))) + (and (re-search-backward "^" nil t) + (line-beginning-position)) + (when (and beg end + (<= beg pos end)) +(objed-make-object + :beg beg + :ibeg (search-forward "{") + :end end + :iend (1- end)) (objed-define-object nil tag :atp
[elpa] externals/objed 870d125 068/166: Update docstrings for regex objects
branch: externals/objed commit 870d1250809c92b7f807431d63e98046b6daab9f Author: Clemens Radermacher Commit: Clemens Radermacher Update docstrings for regex objects --- objed-objects.el | 32 +--- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 561386d..5612182 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -70,13 +70,18 @@ (eval-and-compile (require 'rx) (defun objed--get-regex-object (bregex eregex) - "Return regex object if point is within region limited by BREGEX, EREGEX. + "Return regex object between BREGEX and EREGEX. -BREGEX is the regular expression for the start of the object. Anything -in it's first regex group is considered to be part of the inner object. +The inner object part will be the text between the matches for +those two expressions. -EREGEX is the regular expression for the end of the object. Anything -in it's first regex group is considered to be part of the inner object." +BREGEX is the regular expression for the start of the object. If +the regular expressions contains a group, any text which is part +of this group will belong to the inner object part. + +EREGEX is the regular expression for the end of the object. If +the regular expressions contains a group, any text which is part +of this group will belong to the inner object part." (let* ((obounds ()) (ibounds ()) (opos (point))) @@ -185,20 +190,22 @@ property list where each key has an associated progn." (push keyw wrapped) ;; allowed to move point (cond ((memq vkeyw '(:try-next :try-prev :ref)) -(push `(let ((objed--block-p t)) ,@(nreverse forms)) +(push `(let ((objed--block-p t)) + ,@(nreverse forms)) wrapped)) ((memq vkeyw '(:beg :end :ibeg :iend)) (if (and (not (cdr forms)) (stringp (car forms))) (push (car forms) wrapped) - (if (eq (caar forms) 'rx) + (if (and (not (cdr forms)) + (eq (caar forms) 'rx)) (push (macroexpand-1 (car forms)) wrapped) (push `(let ((objed--block-p t)) ,@(nreverse forms)) wrapped (t -;; objed--block-p: dont run objeds advices here... +;; objed--block-p: dont run objeds advices here (push `(let ((objed--block-p t)) (save-mark-and-excursion ,@(nreverse forms))) @@ -244,9 +251,12 @@ there is no object at point the code should return nil. :beg, :ibeg, :end, :iend These keywords can be used instead of :get-obj above. The value -for each is the code to run which should return point position -for corresponding keyword. Point is allword to move. The code -runs in the same order the keywords are provided. +for each is the code to run which should return the point +position corresponding to the keyword. Point is allword to move +between the keyword expression. The code runs in the same order +the keywords are provided. It is also possible to use only :beg +and :end with regular expressions to define an object. See +`objed--get-regex-object' for details of their format. :try-next (optional)
[elpa] externals/objed 7930c68 038/166: Make word movement aware of object state
branch: externals/objed commit 7930c68c191f371bf23e428ec29440f048191879 Author: Clemens Radermacher Commit: Clemens Radermacher Make word movement aware of object state --- objed-objects.el | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index d24c0ad..87c94bf 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1549,9 +1549,22 @@ comments." (bounds-of-thing-at-point 'word)) (bounds-of-thing-at-point 'word :try-next - (re-search-forward "\\<." nil t) + (if (objed--inner-p) + (let* ((subword-mode t) + (superword-mode nil) + (find-word-boundary-function-table + subword-find-word-boundary-function-table)) +(forward-word 1) +(forward-word -1)) +(re-search-forward "\\<." nil t)) :try-prev - (re-search-backward ".\\>" nil t)) + (if (objed--inner-p) + (let* ((subword-mode t) + (superword-mode nil) + (find-word-boundary-function-table + subword-find-word-boundary-function-table)) +(forward-word -1)) +(re-search-backward ".\\>" nil t))) (defun objed--next-symbol ()
[elpa] externals/objed 72592a9 062/166: Change bindings for barf/slurp sexps
branch: externals/objed commit 72592a9be0166132539769b32937705fee6151ce Author: Clemens Radermacher Commit: Clemens Radermacher Change bindings for barf/slurp sexps --- objed.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/objed.el b/objed.el index a620617..cdaf5a8 100644 --- a/objed.el +++ b/objed.el @@ -823,8 +823,8 @@ selected one." 'objed-insert-new-object) ;; sp functionality (define-key map "^" 'objed-raise) -(define-key map (kbd "") 'objed-forward-barf-sexp) -(define-key map (kbd "") 'objed-forward-slurp-sexp) +(define-key map (kbd "") 'objed-forward-barf-sexp) +(define-key map (kbd "") 'objed-forward-slurp-sexp) (define-key map "!" 'objed-execute)
[elpa] externals/objed e6bed2e 065/166: Further improve regex object
branch: externals/objed commit e6bed2ed18ba5cbeb5a62203850e812da137b77b Author: Clemens Radermacher Commit: Clemens Radermacher Further improve regex object --- objed-objects.el | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 0eb1996..f947c80 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -74,13 +74,17 @@ (ibounds ()) (opos (point))) (save-mark-and-excursion - (when (and (if (looking-at bregex) - (re-search-forward bregex nil t) - (re-search-forward eregex nil t) - (goto-char (or (match-beginning 1) - (match-beginning 0 ; possibly exit start - - ;; goto possible start + ;; try to move into object when at boundary + (if (looking-at bregex) + (goto-char (or (match-end 1) + (match-end 0))) +(if (looking-back eregex (line-beginning-position)) +(goto-char (or (match-beginning 1) + (match-beginning 0))) + (re-search-forward eregex nil t) + (goto-char (or (match-beginning 1) + (match-beginning 0) + (when (and ;; goto possible start (re-search-backward bregex nil t) (push (or (match-end 1) (match-end 0))
[elpa] externals/objed c34727c 122/166: Add open line command
branch: externals/objed commit c34727c92781aba474dd4c3b647f46e1fc608f26 Author: Clemens Radermacher Commit: Clemens Radermacher Add open line command --- objed.el | 16 1 file changed, 16 insertions(+) diff --git a/objed.el b/objed.el index 966bcc4..c2d5b74 100644 --- a/objed.el +++ b/objed.el @@ -635,6 +635,8 @@ BEFORE and AFTER are forms to execute before/after calling the command." ;; common emacs keys (define-key map (kbd "C-g") 'objed-quit) (define-key map (kbd "?") 'objed-show-top-level) +(define-key map (kbd "C-o") 'objed-open-line) + ;; TODO: switch with q, so quit window is qq? (define-key map "g" 'objed-quit) (define-key map "q" 'objed-quit-window-or-reformat) @@ -2840,6 +2842,20 @@ Moves point over any whitespace afterwards." (interactive "r") (indent-region beg end)) +(defun objed-open-line () + "Open line." + (interactive) + (back-to-indentation) + (if electric-indent-inhibit + (let ((indent (buffer-substring (line-beginning-position) + (point +(save-excursion + (insert "\n") + (insert indent))) +(save-excursion + (newline) + (indent-according-to-mode))) + (objed--reset)) (defun objed-indent-left (arg) "Indent all lines in object leftward by ARG space." (interactive "p")
[elpa] externals/objed 244acd2 073/166: Allow passing object to objed-init again
branch: externals/objed commit 244acd2ae319c54e17e8e87e9deb40a51560430e Author: Clemens Radermacher Commit: Clemens Radermacher Allow passing object to objed-init again --- objed.el | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/objed.el b/objed.el index cedac42..0cb6219 100644 --- a/objed.el +++ b/objed.el @@ -1258,12 +1258,13 @@ See `objed-cmd-alist'." (or (memq major-mode '(messages-buffer-mode help-mode)) (not (derived-mode-p 'comint-mode 'special-mode 'dired-mode) -(defun objed-init (&rest _) +(defun objed-init (&optional obj) "Function for activating objed by hooks or advices. -Initialize with `objed--object' or char if unset." +Initialize with OBJ which defaults to `objed--object' which falls +back to char if unset." (when (funcall objed-init-p-function) -(objed--init (or objed--object 'char +(objed--init (or obj objed--object 'char (defun objed--init-later (&rest _) "Init after command loop returned to top level." @@ -2017,8 +2018,7 @@ back to `objed-initial-object' if no match found." (if (assq last-command objed-cmd-alist) last-command objed-initial-object)) -(let ((objed--object obj)) - (objed-init +(objed-init obj))) ;;;###autoload
[elpa] externals/objed f0ff569 083/166: Add org field object
branch: externals/objed commit f0ff569ce2fbad78cc1cb5983b0decbd4f53d854 Author: Clemens Radermacher Commit: Clemens Radermacher Add org field object --- objed-objects.el | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/objed-objects.el b/objed-objects.el index 6648e11..e875698 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -2528,7 +2528,21 @@ non-nil the indentation block can contain empty lines." (setf (cdr bounds) (point)) (objed-make-object :obounds bounds :ibounds ibounds - +(declare-function org-table-beginning-of-field "ext:org") +(declare-function org-table-end-of-field "ext:org") +(objed-define-object org field + :beg (if (looking-back "| ?\\( *\\)" (line-beginning-position)) + (match-beginning 1) + (org-table-beginning-of-field 1) + (point)) + :end (if (looking-at "\\( *\\) |") + (match-end 1) + (org-table-end-of-field 1) + (point)) + :try-next + (org-table-end-of-field 1) + :try-prev + (org-table-beginning-of-field 1)) (defvar comint-prompt-regexp) (declare-function comint-next-prompt "ext:comint")
[elpa] externals/objed 2a25ff2 081/166: Make toggle smarter for sexp objects
branch: externals/objed commit 2a25ff215d212c20244c5bd8f1b9c8ba06c94e01 Author: Clemens Radermacher Commit: Clemens Radermacher Make toggle smarter for sexp objects --- objed-objects.el | 15 +-- objed.el | 19 +-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 7add776..6648e11 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1773,20 +1773,7 @@ comments." (when (/= pos (point)) (cons pos (point) - -(when bounds - (objed-make-object - :obounds bounds - :ibounds (when bounds - (goto-char (car bounds)) - ;; include leading punctuation - (skip-syntax-forward ".'") - (let ((beg (point))) -(goto-char (cdr bounds)) -(with-syntax-table text-mode-syntax-table - (skip-syntax-backward ".")) -(skip-syntax-backward " .'") -(cons beg (point))) +bounds) :try-next (or (ignore-errors (forward-sexp 1) diff --git a/objed.el b/objed.el index 2e9fca1..739f934 100644 --- a/objed.el +++ b/objed.el @@ -1801,13 +1801,28 @@ to an object containing the current one." (or (objed--switch-to 'defun 'inner) (objed--switch-to 'line 'inner)) + +(defun objed--sexp-fallback (&optional pos) + "Return fallback object for sexp at POS." + (let ((pos (or pos (point +(goto-char pos) +(or (objed--at-p '(bracket string tag)) +(and (or (not (= 0 (skip-syntax-forward "'"))) + (not (= 0 (skip-syntax-backward "'" + (objed--at-p '(bracket string))) +(if (equal (bounds-of-thing-at-point 'symbol) + (objed--bounds)) +'word + 'identifier + (defun objed--toggle-state () "Toggle state of object. Shrinks to inner objects on repeat if possible." (when (eq objed--object 'sexp) -(save-excursion - (objed-context-object))) +(let ((fallback (objed--sexp-fallback))) + (when fallback +(objed--switch-to fallback (objed--reverse)) (defun objed-backward-until-context ()
[elpa] externals/objed 0956db5 029/166: Don't add additional undo bounds for numeric repeats
branch: externals/objed commit 0956db56c940ac27a8961a9e57b2810e19a5c0a2 Author: Clemens Radermacher Commit: Clemens Radermacher Don't add additional undo bounds for numeric repeats --- objed.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/objed.el b/objed.el index c52a594..5c2f283 100644 --- a/objed.el +++ b/objed.el @@ -2514,7 +2514,6 @@ object (defaults to 1)." (let ((times (or times 1))) (dotimes (_ times) (objed--do #'kill-region) -(undo-boundary) (setq last-command #'kill-region) (defun objed-delete (&optional times) @@ -2527,8 +2526,7 @@ object (defaults to 1)." (objed--do #'delete-region) (let ((times (or times 1))) (dotimes (_ times) -(objed--do #'delete-region) -(undo-boundary) +(objed--do #'delete-region) (defvar objed--append-do-append nil)
[elpa] externals/objed 2a634b8 054/166: Make append mode global
branch: externals/objed commit 2a634b8cbeb36a9c5db2370ea7775acec03477ac Author: Clemens Radermacher Commit: Clemens Radermacher Make append mode global --- objed.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/objed.el b/objed.el index 864a9c7..aa888c7 100644 --- a/objed.el +++ b/objed.el @@ -2554,6 +2554,8 @@ state is only restored correctly if the buffer was not modified." When `objed-append-mode' is active `objed-copy' and `objed-kill' will append kills to the `kill-ring'." :init-value nil + :global t + :require 'objed :lighter " >>")
[elpa] externals/objed ceeff84 057/166: Allow defining objects by regex
branch: externals/objed commit ceeff84ca38431433b9b28d6c195758fb3eeef1f Author: Clemens Radermacher Commit: Clemens Radermacher Allow defining objects by regex --- objed-objects.el | 144 ++- 1 file changed, 101 insertions(+), 43 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 9ca6a7b..dfd5090 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -68,38 +68,91 @@ (eval-and-compile + (defun objed--get-regex-object (bregex eregex) + "Return regex object if point is within region limited by BREGEX, EREGEX." + (let* ((obounds ()) + (ibounds ()) + (opos (point))) +(save-mark-and-excursion + (when (and (re-search-forward eregex nil t) ; possibly exit start + (goto-char (or (match-beginning 1) +(match-beginning 0))) + ;; goto possible start + (re-search-backward bregex nil t) + (push (or (match-end 1) + (match-end 0)) + ibounds) + (push (or (match-beginning 1) + (match-beginning 0)) + obounds) + ;; goto possible end + (goto-char (or (match-end 1) +(match-end 0))) + (re-search-forward eregex nil t) + (push (or (match-beginning 1) + (match-beginning 0)) + ibounds) + (push (or (match-end 1) + (match-end 0)) + obounds) + ;; when point was within start and end + (<= (cadr obounds) opos (car obounds))) +(list (nreverse obounds) + (nreverse ibounds)) + (defun objed--transform-pos-data (plist) -(let ((np nil) - (alt nil) - (make nil) - (skip nil)) - (unless (and (plist-get plist :beg) - (plist-get plist :end)) -(user-error "Malformed macro")) - (dolist (item plist) -(if (memq item '(:beg :ibeg :end :iend)) -(progn (push item alt) - (setq skip t)) - (if (and skip - (not (keywordp item))) - (push item alt) -(push item np) -(setq skip nil - - (setq np (nreverse np)) - (setq alt (nreverse alt)) - (dolist (el alt) -(when (keywordp el) - (progn -(push el make) -(push (plist-get alt el) make - (setq make (nreverse make)) - (push 'objed-make-object make) - (append np (list :get-obj) - ;; TODO:save-mark-and-excursion still needed? - ;; is wrapped already? - (list (append (list 'save-mark-and-excursion) -(list make)) +(cond ((and (plist-get plist :beg) + (plist-get plist :end)) +(let ((np nil) + (alt nil) + (skip nil)) + ;; filter :beg :end keywords + (dolist (item plist) +(if (memq item '(:beg :ibeg :end :iend)) +(progn (push item alt) + (setq skip t)) + (if (and skip + (not (keywordp item))) + (push item alt) +(push item np) +(setq skip nil + ;; new and alternate plists + (setq np (nreverse np)) + (setq alt (nreverse alt)) + + ;; merge ... :get-obj "regex search" + (if (and (stringp (plist-get plist :beg)) + (stringp (plist-get plist :end))) + (let ((bregex (plist-get plist :beg)) +(eregex (plist-get plist :end))) +(append np +(list :try-prev) +(list `(when (re-search-backward ,eregex) + (goto-char (match-beginning 0 +(list :try-next) +(list `(when (re-search-forward ,bregex) + (goto-char (match-end 0 +(list :get-obj) +(list + `(objed--get-regex-object ,bregex + ,eregex +;; merge ... :get-obj (objed-make-object :beg ... :end...) +(let ((make nil)) + (dolist (el alt) +(when (keywordp el) + (progn +(push el make) +(push (plist-get alt el) make + (setq make (nreverse make)) + (push 'objed-make-object make) + (append np
[elpa] externals/objed 72befc8 100/166: Fix line object at end of buffer
branch: externals/objed commit 72befc868f4c68280af9e67cd779338461b2bcd2 Author: Clemens Radermacher Commit: Clemens Radermacher Fix line object at end of buffer --- objed-objects.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/objed-objects.el b/objed-objects.el index a6f1fc1..2b7441a 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1933,7 +1933,9 @@ comments." :end (save-excursion ;; include hidden parts... (end-of-visible-line) - (1+ (point) + (if (eobp) + (point) +(1+ (point)) :try-next (skip-chars-forward " \t\r\n") :try-prev
[elpa] externals/objed 5aa473d 078/166: Reset before quit window when objed is active
branch: externals/objed commit 5aa473d7c276f1ed5956e51b7f7df4e35d0ec895 Author: Clemens Radermacher Commit: Clemens Radermacher Reset before quit window when objed is active --- objed.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/objed.el b/objed.el index 35325c7..72a5d36 100644 --- a/objed.el +++ b/objed.el @@ -590,8 +590,8 @@ BEFORE and AFTER are forms to execute before/after calling the command." if KILL is non-nil kill the buffer. WINDOW defaults to the selected one." (interactive) - (let* ((overriding-terminal-local-map nil) - (nc (key-binding "q" nil t))) + (let ((nc (let ((overriding-terminal-local-map nil)) + (key-binding "q" nil t (if (and (string-match "insert" (symbol-name nc)) (not buffer-read-only)) (cond ((and (not (eq last-command this-command)) @@ -606,6 +606,7 @@ selected one." (indent-region (objed--beg) (objed--end)) (objed--update-current-object) (message "Indented defun."))) + (objed--reset) (call-interactively nc (defun objed--point-in-periphery ()
[elpa] externals/objed 107096a 092/166: Improve block expansion order in comments
branch: externals/objed commit 107096a2bcc40eea85623c4d7161a979833b53f0 Author: Clemens Radermacher Commit: Clemens Radermacher Improve block expansion order in comments --- objed.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/objed.el b/objed.el index b7cdd05..16d0829 100644 --- a/objed.el +++ b/objed.el @@ -1546,7 +1546,8 @@ If IGNORE is non-nil it should be an object of ;; for textblocks (parag. inside comments) (objed--in-comment-p (progn (unless (eolp) (objed--skip-ws)) - (append os (list 'comment))) + (append (remq 'textblock os) + (list 'comment 'textblock))) os (defun objed--get-blocks (ignore collf &optional istate)
[elpa] externals/objed 36ff680 087/166: Adjust bindings and add additional custom user map binding
branch: externals/objed commit 36ff6805fe341d2a4a596b98749e0963948058bf Author: Clemens Radermacher Commit: Clemens Radermacher Adjust bindings and add additional custom user map binding --- README.asc | 18 +++--- objed.el | 25 + 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/README.asc b/README.asc index 2514af4..237e3f9 100644 --- a/README.asc +++ b/README.asc @@ -153,7 +153,9 @@ stay the same. The following gives an overview of available keys and commands. If commands allow for numeric arguments you can input them without the use of kbd:[Ctrl] or kbd:[Meta]. kbd:[0] can be used as an alternative for the universal argument (kbd:[C-u]). To add custom commands to the modal state you -can use `objed-user-map` which is available under prefix key kbd:[']. +can use `objed-user-map` which is available under prefix key kbd:['] and +`objed-other-user-map` bound to kbd:[-]. It's recommended to use one of these +map for custom object bindings and the other one for additional operations. In addition to the commands configured in `objed-cmd-alist` you can use the following commands to enter objed (those bindings are only active if you are @@ -296,7 +298,6 @@ Indent/Move objects around: |Switch to line object and move it forward/backward. |=== - Commands to edit objects (applying operations to them). When the region is active the operation acts on the current region. To act on multiple objects at once you can mark them first (see the "Misc commands" below): @@ -427,17 +428,20 @@ You can add your own prefix bindings using `objed-define-dispatch`. |kbd:[#] |Switch to another object using `avy`. -|kbd:[+] +|kbd:[=] +|Switch to another object inside the current one using `avy`. + +|kbd:[`] |Activate part from point forward until boundary of some object. -|kbd:[-] +|kbd:[´] |Activate part from point backward until boundary of some object. |kbd:[@] -|Extend current object by including trailing whitespace. - -|kbd:[`] |Extend current object by including leading whitespace. + +|kbd:[_] +|Extend current object by including trailing whitespace. |=== diff --git a/objed.el b/objed.el index 13cd883..bbfca15 100644 --- a/objed.el +++ b/objed.el @@ -741,11 +741,16 @@ selected one." ;; mark upwards (define-key map "M" 'objed-toggle-mark-backward) ;; (define-key map "M" 'objed-unmark-all) +;; Use h block expansion now +;; TODO: bind l to something else +(define-key map "l" 'objed-line-object) + ;; "visual" (define-key map "v" 'objed-extend) -(define-key map "@" 'objed-include-trailing-ws) -(define-key map "`" 'objed-include-leading-ws) +;; TODO: more general include expansion? +(define-key map "@" 'objed-include-leading-ws) +(define-key map "_" 'objed-include-trailing-ws) ;; basic edit ops (define-key map "k" 'objed-kill) @@ -762,8 +767,6 @@ selected one." (define-key map ";" (objed-define-op nil objed-comment-or-uncomment-region)) - - (define-key map "$" (objed-define-op nil flyspell-region)) @@ -776,14 +779,15 @@ selected one." ;; direct object switches (define-key map "." 'objed-goto-next-identifier) (define-key map "," 'objed-goto-prev-identifier) -(define-key map "_" 'objed-toggle-indentifier-place) -(define-key map "l" 'objed-line-object) +;; (define-key map "_" 'objed-toggle-indentifier-place) ;;(define-key map "%" 'objed-contents-object) ;; prefix keys (define-key map "x" 'objed-op-map) (define-key map "c" 'objed-object-map) +;; for custom user object and op commands (define-key map "'" 'objed-user-map) +(define-key map "-" 'objed-other-user-map) (define-key map (kbd "M-g o") 'objed-occur) @@ -934,6 +938,11 @@ To define new operations see `objed-define-op'.") map) "Keymap for custom user bindings.") +(defvar objed-other-user-map + (let ((map (objed--define-prefix "-" 'objed-user-map))) +map) + "Keymap for custom user bindings.") + (defvar objed-object-map (let ((map (objed--define-prefix "c" 'objed-object-map))) @@ -990,8 +999,8 @@ Use `objed-define-dispatch' to define a dispatch command.") (objed-define-dispatch "#" objed--ace-switch-object) (objed-define-dispatch "=" objed--ace-switch-in-current) -(objed-define-dispatch "-" objed--backward-until) -(objed-define-dispatch "+" objed--forward-until) +(objed-define-dispatch "`" objed--backward-until) +(objed-define-dispatch "´" objed--forward-until) (defun objed--backward-until (name) "Activate part from point backward until object NAME."
[elpa] externals/objed 84b1465 112/166: Don't switch object for paragraph kill/delete
branch: externals/objed commit 84b146562ab957a39b5c4b518d025b23bb474ac2 Author: Clemens Radermacher Commit: Clemens Radermacher Don't switch object for paragraph kill/delete --- objed.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/objed.el b/objed.el index ce61d8a..7301181 100644 --- a/objed.el +++ b/objed.el @@ -750,7 +750,7 @@ selected one." ;; TODO: second + include more (define-key map "+" 'objed-include-trailing-ws) ;; (define-key map "" 'objed-include-leading-ws) - + ;; basic edit ops (define-key map "k" 'objed-kill) (define-key map "K" 'objed-kill) @@ -3692,7 +3692,7 @@ and RANGE hold the object position data." (defun objed--get-continuation-object (obj) "Return object for continuation OBJ." (let ((shifted (memq 'shift (event-modifiers last-input-event -(when (cond ((memq obj '(word defun sentence line)) +(when (cond ((memq obj '(word defun sentence line paragraph)) ;; keepers t) ((memq obj (append objed--block-objects (list 'comment)))
[elpa] externals/objed e0dde43 097/166: Improve block expansion, avoiding text block/comment duplicates
branch: externals/objed commit e0dde4348243d886cf69c371c4254f233a4e45a3 Author: Clemens Radermacher Commit: Clemens Radermacher Improve block expansion, avoiding text block/comment duplicates --- objed-objects.el | 5 +++-- test/tests/emacs-lisp-mode/expansion/block_3 | 4 +++- test/tests/emacs-lisp-mode/expansion/block_4 | 6 -- test/tests/emacs-lisp-mode/expansion/block_5 | 12 ++-- test/tests/emacs-lisp-mode/expansion/block_6 | 7 +-- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index c53341d..a6f1fc1 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1540,8 +1540,9 @@ comments." (let* ((bounds nil) (ibounds (cond ((setq bounds (objed--bounds-of-string-at-point)) (objed--inner-string bounds)) - ((setq bounds (objed--bounds-of-comment-at-point)) -(objed--inner-comment-block) +((setq bounds (objed--bounds-of-comment-at-point)) + ;; include trailing ws + (objed--comment-block) (when ibounds (narrow-to-region (car ibounds) (cdr ibounds) diff --git a/test/tests/emacs-lisp-mode/expansion/block_3 b/test/tests/emacs-lisp-mode/expansion/block_3 index 41e68c4..96bc597 100644 --- a/test/tests/emacs-lisp-mode/expansion/block_3 +++ b/test/tests/emacs-lisp-mode/expansion/block_3 @@ -17,5 +17,7 @@ hh ;; More on same level |<;; Some text -;; and more text> +;; and more text +> + diff --git a/test/tests/emacs-lisp-mode/expansion/block_4 b/test/tests/emacs-lisp-mode/expansion/block_4 index 1c8c1fa..4bd3e1a 100644 --- a/test/tests/emacs-lisp-mode/expansion/block_4 +++ b/test/tests/emacs-lisp-mode/expansion/block_4 @@ -15,7 +15,9 @@ hhh (ignore)) ;; More on same level - -|<;; Some text +|< +;; Some text ;; and more text > + + diff --git a/test/tests/emacs-lisp-mode/expansion/block_5 b/test/tests/emacs-lisp-mode/expansion/block_5 index 0c969b6..f06dd82 100644 --- a/test/tests/emacs-lisp-mode/expansion/block_5 +++ b/test/tests/emacs-lisp-mode/expansion/block_5 @@ -14,8 +14,16 @@ (defun check () (ignore)) -;; More on same level -|< +|<;; More on same level + ;; Some text ;; and more text > + + + + + + + + diff --git a/test/tests/emacs-lisp-mode/expansion/block_6 b/test/tests/emacs-lisp-mode/expansion/block_6 index c955607..dcb6fd7 100644 --- a/test/tests/emacs-lisp-mode/expansion/block_6 +++ b/test/tests/emacs-lisp-mode/expansion/block_6 @@ -10,12 +10,15 @@ h ;; and |more text - +|< (defun check () (ignore)) -|<;; More on same level +;; More on same level ;; Some text ;; and more text + > + +
[elpa] externals/objed 5c4ac71 159/166: Improve `objed-define-object` docstring
branch: externals/objed commit 5c4ac71f62185a7059ea5c480369daa3465e7ebb Author: Clemens Radermacher Commit: Clemens Radermacher Improve `objed-define-object` docstring --- objed-objects.el | 30 -- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 06702dd..9e31d2f 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -254,9 +254,15 @@ Usage: (objed-define-object package name [:keyword [code-form]...]...) + +This macro creates a command named objed--object. This +command can be used to activate objed for the defined object and +is used internally to query for information needed for objed +commands. + PACKAGE is the name of the package the object should be loaded -for. If nil you are defining a default object and need to add a -binding in variable `objed-object-map' for the object command. +for. If non-nil this will defer loading until PACKAGE is +available. NAME is a symbol which defines the name which will be used to refer to this object. ARGS is a list of keyword arguments and @@ -282,9 +288,13 @@ These keywords can be used instead of :get-obj above. The value for each is the code to run which should return the point position corresponding to the keyword. Point is allword to move between the keyword expression. The code runs in the same order -the keywords are provided. It is also possible to use only :beg -and :end with regular expressions to define an object. See -`objed--get-regex-object' for details of their format. +the keywords are provided. + +It is also possible to use only :beg and :end with regular +expressions to define an object. See `objed--get-regex-object' +for details of their format. If :end is omitted the regexp +provided by :beg separates the objects on its own. This can be +used for text objects which don't have an end marker. :try-next (optional) @@ -305,11 +315,11 @@ throw an error. :mode (optional) -Object defintions which don't use this keyword apply to all -modes. If given it should be a symbol of a `major-mode'. Any -keyword definitions used for this object will then override the -default ones when in this mode. Keywords not used fallback to use -the general definition. +Object defintions which use this keyword derive from an already +existing object with the same NAME. If given it should be a +symbol of a `major-mode'. Any keyword definitions of the mode +specific version will override the ones from the non mode +specific version. :atp (optional)
[elpa] externals/objed 4a22002 120/166: Improve reformat command
branch: externals/objed commit 4a22002ed6d7baa6fe0b5b1e3274f8a19597c33f Author: Clemens Radermacher Commit: Clemens Radermacher Improve reformat command --- objed-objects.el | 24 objed.el | 16 ++-- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index a708ab7..bead3f7 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1217,12 +1217,12 @@ OBJ defaults to `objed--current-obj'." "Move to the next object. With postitive prefix argument ARG move to the nth next object." - (let ((arg (or arg 1))) -(dotimes (_ arg) - (let ((obj (objed--get-next))) -(when obj - (objed--update-current-object obj) - (objed--goto-char (objed--beg obj))) + (let ((arg (or arg 1)) +(obj nil)) +(dotimes (_ arg obj) + (when (setq obj (objed--get-next)) +(objed--update-current-object obj) +(objed--goto-char (objed--beg obj)) (defun objed--goto-previous (&optional arg) @@ -1230,12 +1230,12 @@ With postitive prefix argument ARG move to the nth next object." With postitive prefix argument ARG move to the nth previous object." - (let ((arg (or arg 1))) -(dotimes (_ arg) - (let ((obj (objed--get-prev))) -(when obj - (objed--update-current-object obj) - (objed--goto-char (objed--beg obj))) + (let ((arg (or arg 1)) +(obj nil)) +(dotimes (_ arg obj) + (when (setq obj (objed--get-prev)) +(objed--update-current-object obj) +(objed--goto-char (objed--beg obj)) (defun objed--make-object-overlay (&optional obj) "Create an overlay to mark current object. diff --git a/objed.el b/objed.el index ab7be55..edf9e51 100644 --- a/objed.el +++ b/objed.el @@ -604,11 +604,13 @@ selected one." (not buffer-read-only)) (progn (when (eq last-command this-command) -(objed-next)) - (cond ((or (eq major-mode 'fundamental-mode) - (derived-mode-p 'text-mode) - (objed--at-comment-p) - (objed--in-string-or-comment-p)) +(or (objed--goto-next) +(objed--switch-to 'defun))) + (cond ((and (not (eq objed--object 'defun)) + (or (eq major-mode 'fundamental-mode) + (derived-mode-p 'text-mode) + (objed--at-comment-p) + (objed--in-string-or-comment-p))) (call-interactively 'fill-paragraph) (objed--switch-to 'textblock) (message "Filled paragraph.")) @@ -3720,7 +3722,9 @@ and RANGE hold the object position data." ((memq obj '(char word defun sentence line paragraph)) ;; keepers objed--object) - ((memq obj (append objed--block-objects (list 'comment))) + ((memq obj (append objed--block-objects + (list 'comment + 'region))) ;; liners 'line) (t
[elpa] externals/objed 226fd50 149/166: Update README.asc
branch: externals/objed commit 226fd50a4fa2de2384f331f93c818934a7f520eb Author: Roey Darwish Dror Commit: GitHub Update README.asc --- README.asc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.asc b/README.asc index 0f724e2..2d1348a 100644 --- a/README.asc +++ b/README.asc @@ -14,7 +14,7 @@ http://emacs-versor.sourceforge.net/[versor-mode] and other Editors like Vim or Kakoune and tries to align them with regular Emacs conventions. For more information you can read my -https://www.with-emacs.com/categories/objed/[posts] about `objed` and for +https://with-emacs.com/posts/objed/[posts] about `objed` and for changes check the https://github.com/clemera/objed/blob/master/News.asc[News] file. @@ -170,7 +170,7 @@ to bind those commands in your `global-map`): |kbd:[M-SPC] |Activate objed, choosing initial object based on `last-command` and `objed-cmd-alist`. -|kbd:[M-o] +|kbd:[M-#] |Choose an object and activate with it. |kbd:[C-,/C-.]
[elpa] externals/objed faa9fb0 158/166: Allow defining objects without ending regexp (#58)
branch: externals/objed commit faa9fb049287255f9f25bdcfc95452d61fd3763e Author: Clemens Radermacher Commit: Clemens Radermacher Allow defining objects without ending regexp (#58) --- objed-objects.el | 110 ++- 1 file changed, 69 insertions(+), 41 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 415c801..06702dd 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -70,7 +70,7 @@ (eval-and-compile (require 'rx) (defun objed--get-regex-object (bregex eregex) - "Return regex object between BREGEX and EREGEX. +"Return regex object between BREGEX and EREGEX. The inner object part will be the text between the matches for those two expressions. @@ -81,45 +81,68 @@ of this group will belong to the inner object part. EREGEX is the regular expression for the end of the object. If the regular expressions contains a group, any text which is part -of this group will belong to the inner object part." - (let* ((obounds ()) - (ibounds ()) - (opos (point))) -(save-mark-and-excursion - ;; try to move into object when at boundary - (if (looking-at bregex) - (goto-char (or (match-end 1) - (match-end 0))) -(if (looking-back eregex (line-beginning-position)) +of this group will belong to the inner object part. + +EREGEX can also be an empty string. In this case objects are +separated by the BREGEX expression and reach until the next one +or until the buffer end if no next instance can be found." +(let* ((obounds ()) + (ibounds ()) + (opos (point))) + (save-mark-and-excursion +;; try to move into object when at boundary +(if (looking-at bregex) +(goto-char (or (match-end 1) + (match-end 0))) + (if (looking-back eregex (line-beginning-position)) + (goto-char (or (match-beginning 1) + (match-beginning 0))) +(re-search-forward eregex nil t) (goto-char (or (match-beginning 1) - (match-beginning 0))) - (re-search-forward eregex nil t) - (goto-char (or (match-beginning 1) - (match-beginning 0) - (when (and ;; goto possible start - (re-search-backward bregex nil t) - (push (or (match-beginning 1) - (match-end 0)) - ibounds) - (push (match-beginning 0) - obounds) - ;; goto possible end - (goto-char (or (match-end 1) -(match-end 0))) - (re-search-forward eregex nil t) - (push (or (match-end 1) - (match-beginning 0)) - ibounds) - (push (match-end 0) - obounds) - ;; when point was within start and end - (<= (cadr obounds) opos (car obounds))) -(list (nreverse obounds) - (nreverse ibounds)) + (match-beginning 0) +(when (and ;; goto possible start + (re-search-backward bregex nil t) + (push (or (match-beginning 1) + (match-end 0)) + ibounds) + (push (match-beginning 0) + obounds) + ;; goto possible end + (goto-char (or (match-end 1) + (match-end 0))) + (cond ((string= "" eregex) + ;; no end provided, objects are separated by beginning + ;; regex + (cond ((re-search-forward bregex nil t) + (push (match-beginning 0) obounds) + ;; no way to tell so just skip ws + ;; to have a sensible default + (goto-char (car obounds)) + (objed--skip-ws t) + (push (point) ibounds)) +(t + ;; if there is no match that means the buffer is + ;; the object end + (goto-char (point-max)) + (push (point) obounds) + (objed--skip-ws t) + (push (point) ibounds + (t + (re-search-forward eregex nil t) + (push (or (match-end 1) +(match-beginning 0)) +ibounds) + (push (match-end 0) +obounds))) + ;; when point was within start and end + (<= (cadr obounds) opos (car obounds))) + (list (
[elpa] externals/objed c07df28 088/166: Rewrite align section getter function
branch: externals/objed commit c07df28b6d75c44ac2fce070d6b68bfe52c03c8f Author: Clemens Radermacher Commit: Clemens Radermacher Rewrite align section getter function --- objed-objects.el | 35 ++-- test/tests/emacs-lisp-mode/expansion/block_2 | 2 +- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 683e52c..0a02ad2 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1554,19 +1554,30 @@ comments." (nth 4 sp)) begin))) - -(defun objed--get-align-section () - "Get region bounds of current align section." +(defvar align-region-separate) +(defvar align-mode-rules-list) +(defvar align-rules-list) +(defvar align-exclude-rules-list) +(defvar align-mode-exclude-rules-list) +(declare-function align-region "ext:align") +(defun objed--get-align-sections () + "Get region bounds of align sections." (require 'align) - (let ((olddef (symbol-function 'align-region))) -(cl-letf (((symbol-function 'align-region) - (lambda (beg end &rest args) - (if (and beg end) - (throw 'region (cons beg end)) - (apply olddef beg end - args) - (catch 'region -(align nil nil) + (let ((separator + (or (if (and (symbolp align-region-separate) + (boundp align-region-separate)) + (symbol-value align-region-separate) + align-region-separate) + 'entire)) +(regions ())) +(align-region nil nil separator + (or align-mode-rules-list align-rules-list) + (or align-mode-exclude-rules-list align-exclude-rules-list) + (lambda (beg end mode) +(when (consp mode) + (push (cons beg end) +regions +regions)) ;; * Object definitions diff --git a/test/tests/emacs-lisp-mode/expansion/block_2 b/test/tests/emacs-lisp-mode/expansion/block_2 index accd044..48cb69b 100644 --- a/test/tests/emacs-lisp-mode/expansion/block_2 +++ b/test/tests/emacs-lisp-mode/expansion/block_2 @@ -17,6 +17,6 @@ h ;; More on same level ;; Some text -<;; and |more text +|<;; and more text >
[elpa] externals/objed e079d7e 132/166: Use default binding for read only toggle in op map
branch: externals/objed commit e079d7eb99694cf06651335f0c3ae7420d22e913 Author: Clemens Radermacher Commit: Clemens Radermacher Use default binding for read only toggle in op map --- objed.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/objed.el b/objed.el index b26fcb9..c7bb3a8 100644 --- a/objed.el +++ b/objed.el @@ -901,8 +901,7 @@ Other single character keys are bound to `objed-undefined'." (define-key map "e" 'objed-eval-exp) (define-key map "y" 'objed-insert) (define-key map "i" 'insert-file) -(define-key map "q" - (objed-define-op nil objed-reformat-op ignore)) +(define-key map "q" 'read-only-mode) (define-key map "r" ctl-x-r-map) (define-key map "n" 'objed-narrow)
[elpa] externals/objed 35feabb 085/166: Add function to get align section bounds
branch: externals/objed commit 35feabbe725d9795a35669260127fca5990dfe2b Author: Clemens Radermacher Commit: Clemens Radermacher Add function to get align section bounds --- objed-objects.el | 14 ++ 1 file changed, 14 insertions(+) diff --git a/objed-objects.el b/objed-objects.el index b40316b..683e52c 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -1555,6 +1555,20 @@ comments." begin))) +(defun objed--get-align-section () + "Get region bounds of current align section." + (require 'align) + (let ((olddef (symbol-function 'align-region))) +(cl-letf (((symbol-function 'align-region) + (lambda (beg end &rest args) + (if (and beg end) + (throw 'region (cons beg end)) + (apply olddef beg end + args) + (catch 'region +(align nil nil) + + ;; * Object definitions
[elpa] externals/objed b6b7c3f 144/166: Disable during a company completion
branch: externals/objed commit b6b7c3f4cda576488543d13e633c9756e17eb322 Author: Andrew Whatson Commit: Andrew Whatson Disable during a company completion --- objed.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/objed.el b/objed.el index 5531650..d11ff74 100644 --- a/objed.el +++ b/objed.el @@ -1299,6 +1299,8 @@ See `objed-cmd-alist'." (not overriding-terminal-local-map) ;; don't activate when completing the regular Emacs way (not (get-buffer-window "*Completions*" 0)) + ;; don't activate during a company completion + (not (bound-and-true-p company-candidates)) ;; FIXME: temp workaround for starting commit ;; message in insertion mode (not (eq last-command 'magit-commit-create))
[elpa] externals/objed be4c3cd 114/166: Make indenting defuns repeatable, too
branch: externals/objed commit be4c3cd3d46f7c5226f4ce4d1ee8b7831f572a6c Author: Clemens Radermacher Commit: Clemens Radermacher Make indenting defuns repeatable, too --- objed.el | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/objed.el b/objed.el index b839b53..c2e8e63 100644 --- a/objed.el +++ b/objed.el @@ -599,19 +599,20 @@ selected one." (key-binding "q" nil t (if (and (string-match "insert" (symbol-name nc)) (not buffer-read-only)) -(cond ((or (eq major-mode 'fundamental-mode) - (derived-mode-p 'text-mode) - (objed--at-comment-p) - (objed--in-string-or-comment-p)) - (when (eq last-command this-command) - (objed-next)) - (call-interactively 'fill-paragraph) - (objed--switch-to 'textblock) - (message "Filled paragraph.")) - ((objed--switch-to 'defun) - (indent-region (objed--beg) (objed--end)) - (objed--update-current-object) - (message "Indented defun."))) +(progn + (when (eq last-command this-command) +(objed-next)) + (cond ((or (eq major-mode 'fundamental-mode) + (derived-mode-p 'text-mode) + (objed--at-comment-p) + (objed--in-string-or-comment-p)) + (call-interactively 'fill-paragraph) + (objed--switch-to 'textblock) + (message "Filled paragraph.")) +((objed--switch-to 'defun) + (indent-region (objed--beg) (objed--end)) + (objed--update-current-object) + (message "Indented defun." (objed--reset) (call-interactively nc