[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/objed 4a22002 120/166: Improve reformat command
From: |
Clemens Radermacher |
Subject: |
[elpa] externals/objed 4a22002 120/166: Improve reformat command |
Date: |
Sun, 29 Dec 2019 08:21:12 -0500 (EST) |
branch: externals/objed
commit 4a22002ed6d7baa6fe0b5b1e3274f8a19597c33f
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>
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 dcea2bc 124/166: Add window resize commands, (continued)
- [elpa] externals/objed dcea2bc 124/166: Add window resize commands, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed fc93d49 134/166: Improve error object when flymake is used, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed d111035 140/166: Require mc if necessary, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 6a2663e 138/166: Don't bind C-o by default, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed dc23da4 153/166: Add objed-exit-hook #57, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed faa9fb0 158/166: Allow defining objects without ending regexp (#58), Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 2a25ff2 081/166: Make toggle smarter for sexp objects, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 2f50485 102/166: Add css defun object, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed d3ab36c 108/166: Add kill-this-buffer to command alist, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed be4c3cd 114/166: Make indenting defuns repeatable, too, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 4a22002 120/166: Improve reformat command,
Clemens Radermacher <=
- [elpa] externals/objed 9267f38 125/166: Improve open line command, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed cab7cee 130/166: Update hl init, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 7374a35 128/166: Improve sexp fallback, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 42a553e 139/166: Don't override M-o binding, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 4d1a445 141/166: Add public object bounds functions, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed b6b7c3f 144/166: Disable during a company completion, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 70cf23e 145/166: Merge pull request #51 from flatwhatson/fix-company, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 2a06126 143/166: Add functions to map over objects, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed fea1148 148/166: Fixes #54, identifier movement for symbols with regex chars, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed cc46438 146/166: Syntactic changes, Clemens Radermacher, 2019/12/29