[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/objed fe78a97: Adjust some default bindings to be more
From: |
Clemens Radermacher |
Subject: |
[elpa] externals/objed fe78a97: Adjust some default bindings to be more emacsy |
Date: |
Sun, 27 Jan 2019 06:36:02 -0500 (EST) |
branch: externals/objed
commit fe78a978f5d61c93da49e3745fb74163376368ab
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>
Adjust some default bindings to be more emacsy
---
News.asc | 19 ++++++
README.asc | 32 ++++-----
objed.el | 79 +++++++++++------------
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 | 4 +-
test/tests/emacs-lisp-mode/navigate-objects/defun | 2 +-
9 files changed, 81 insertions(+), 63 deletions(-)
diff --git a/News.asc b/News.asc
index 35457e9..d7f8cbd 100644
--- a/News.asc
+++ b/News.asc
@@ -1,5 +1,24 @@
= Changes
+== 0.4.0 (2019-01-27)
+
+* Adjust more default bindings to be more emacsy. Most important changes are:
+
+ Don't just insert pairs using (/[/{. Those keys should be mapped to commands
+ and surrounding objects is done via kbd:['].
+
+ Use kbd:[t] to toggle the object state and kbd:[h] to expand line objects
+ (analog to Emacs kbd:[M-h]). kbd:[l] gives direct access to line-object now.
+
+ Moving between objects of current object type is done using kbd:[[] and
+ kbd:[\]]. kbd:[<] and kbd:[>] move to first/last instance of current object
+ type. kbd:[(] and kbd:[)] are used for objed-forward/backward-until.
+
+ Use kbd:[S-left/S-right] to move current object type around.
+
+
+* Minor code changes
+
== 0.3.0 (2019-01-25)
* Adjust/Add some default bindings:
diff --git a/README.asc b/README.asc
index e720f77..c041a59 100644
--- a/README.asc
+++ b/README.asc
@@ -90,8 +90,9 @@ descriptions below, the commentary section or the docstrings
and
bindings defined in `objed-map`. To define your own operations and
text objects see `objed-define-op` and `objed-define-object`.
-Note that `objed` is still evolving, some bindings might change
-in this process.
+Note that `objed` is *still evolving*, some *bindings might change*
+in this process. Because of that the following screencasts might not
+always show up to date key bindings.
## Examples of usage
@@ -169,11 +170,11 @@ use the following commands to enter objed:
|Move to next/prev identifier. Not bound by default, recommended to bind in
`global-map`.
|kbd:[M-SPC]
-|Activate objed with `objed-initial-object`. Bound in `objed-mode-map` by
default.
+|Activate objed, choosing initial object based on `last-command`. Bound in
`objed-mode-map` by default.
|===
If you don't like the automatic activation provided by `objed-mode` I
-recommend to bind `objed-activate` to M-SPC in your `global-map`.
+recommend to bind `objed-activate` to kbd:[M-SPC] in your `global-map`.
Basic movement commands (switch the object type on movement):
@@ -210,7 +211,7 @@ Commands for block objects (objects built out of lines of
text):
|===
|Shortcut |Purpose
-|kbd:[l]
+|kbd:[h]
|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]
@@ -229,10 +230,10 @@ determining the context:
|===
|Shortcut |Purpose
-|kbd:[t/h]
+|kbd:[[\]]
|If coming from basic movement the object at point is guessed based on
context. Point is moved to the beginning/end of object. This is useful to
"jump out" of the current context. On repeat move to the previous/next instance
of current object type
-|kbd:[`/´ or home/end]
+|kbd:[</>]
|Goto first/last instance of current object type.
|kbd:[o]
@@ -244,7 +245,7 @@ determining the context:
|kbd:[j]
|Move point to the other side of the current object.
-|kbd:[:/=]
+|kbd:[t]
|Toggle the state of the current object (inner/whole).
|===
@@ -261,6 +262,9 @@ object command mark all instances in current defun/buffer):
|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.
|===
@@ -278,6 +282,9 @@ Indent/Move objects around:
|kbd:[M-left/M-right]
|Move/indent all lines in object to right/leftward to tab stop.
+|kbd:[S-left/S-right]
+|Move current object forward/backward.
+
|kbd:[F/B]
|Switch to char object and move it forward/backward.
@@ -287,8 +294,6 @@ Indent/Move objects around:
|kbd:[N/P]
|Switch to line object and move it forward/backward.
-|kbd:[T/H]
-|Move current object forward/backward.
|===
@@ -352,9 +357,6 @@ commands" below):
|kbd:[']
|Add surroundings to object(s) with any pair using `electric` (built-in).
-|kbd:["/(/[/{]
-|Surround object with corresponding chars using `electric`,
-
|kbd:[x]
|Prefix to access other operations, see `objed-op-map` for available
operations and `objed-define-op` to add your own.
@@ -414,10 +416,10 @@ You can add your own prefix bindings using
`objed-define-dispatch`.
|kbd:[#]
|Switch to another object using `avy`.
-|kbd:[<]
+|kbd:[(]
|Activate part from point backward until boundary of some object.
-|kbd:[>]
+|kbd:[)]
|Activate part from point forward until boundary of some object.
|kbd:[-/+]
diff --git a/objed.el b/objed.el
index 1129f0b..68ff73e 100644
--- a/objed.el
+++ b/objed.el
@@ -3,7 +3,7 @@
;; Author: Clemens Radermacher <address@hidden>
;; Package-Requires: ((emacs "25") (cl-lib "0.5"))
-;; Version: 0.3.1
+;; Version: 0.4.0
;; Keywords: convenience
;; URL: https://github.com/clemera/objed
@@ -619,9 +619,7 @@ BEFORE and AFTER are forms to execute before/after calling
the command."
(define-key map (kbd "C-v") 'scroll-up-command)
(define-key map "\ev" 'scroll-down-command)
-
- ;;(define-key map (kbd "C-h") which-key-C-h-map)
- (define-key map (kbd "C-h k") 'describe-key)
+ (define-key map (kbd "C-h k") 'objed-describe-key)
(when objed-use-which-key-if-available-p
(define-key map (kbd "C-h n") 'which-key-show-next-page-cycle)
(define-key map (kbd "C-h p") 'which-key-show-previous-page-cycle))
@@ -664,28 +662,28 @@ BEFORE and AFTER are forms to execute before/after
calling the command."
(define-key map (kbd "<C-right>") 'objed-indent-right)
(define-key map (kbd "<M-right>") 'objed-indent-to-right-tab-stop)
(define-key map (kbd "<M-left>") 'objed-indent-to-left-tab-stop)
+ (define-key map (kbd " <S-left>") 'objed-move-object-backward)
+ (define-key map (kbd " <S-right>") 'objed-move-object-forward)
(define-key map (kbd "<home>") 'objed-top-object)
(define-key map (kbd "<end>") 'objed-bottom-object)
- (define-key map "`" 'objed-top-object);'objed-backward-symbol)
- (define-key map "´" 'objed-bottom-object);'objed-forward-symbol)
+ (define-key map "<" 'objed-top-object)
+ (define-key map ">" 'objed-bottom-object)
+
;; block expansions
- (define-key map "l" 'objed-expand-block)
+ (define-key map "h" 'objed-expand-block)
(define-key map "a" 'objed-beg-of-block)
(define-key map "e" 'objed-end-of-block)
;; context expansions
- (define-key map "t" 'objed-current-or-previous-context)
- (define-key map "h" 'objed-current-or-next-context)
- (define-key map "T" 'objed-move-object-backward)
- (define-key map "H" 'objed-move-object-forward)
+ (define-key map "[" 'objed-current-or-previous-context)
+ (define-key map "]" 'objed-current-or-next-context)
(define-key map "o" 'objed-expand-context)
(define-key map "u" 'objed-upto-context)
(define-key map "i" 'objed-del-insert)
- (define-key map ":" 'objed-toggle-state)
- (define-key map "=" 'objed-toggle-state)
+ (define-key map "t" 'objed-toggle-state)
(define-key map "j" 'objed-toggle-side)
;; marking/unmarking
@@ -719,18 +717,12 @@ BEFORE and AFTER are forms to execute before/after
calling the command."
(define-key map "$"
(objed-define-op nil flyspell-region))
- (dolist (str (split-string "\"([{" "" t))
- (define-key map (kbd str)
- (objed-define-op nil objed-electric)))
-
;; quote op
(define-key map "'"
(objed-define-op nil objed-electric-pair))
;; all the usual quoting signs
(define-key map "~" 'objed-undo)
-
-
;; special commands
(define-key map "," 'objed-last)
;; jump to objects with avy
@@ -767,6 +759,7 @@ BEFORE and AFTER are forms to execute before/after calling
the command."
;; direct object switches
(define-key map "." 'objed-identifier-object)
(define-key map "_" 'objed-symbol-object)
+ (define-key map "l" 'objed-line-object)
;;(define-key map "%" 'objed-contents-object)
;; not regular objects, selection
@@ -794,21 +787,21 @@ Other single character keys are bound to
`objed-undefined'."
(let ((map (define-prefix-command cmd)))
;; init as prefix
(define-key objed-map (kbd key) map)
- ;; basic bindings
- (dolist (seq (list (number-sequence ?a ?z)
- (number-sequence ?A ?Z)))
- (dolist (char seq)
- (define-key map (kbd (format "%c" char)) 'objed-undefined)))
- (let (loop)
- (define-key map "-" 'negative-argument)
- ;; Make plain numbers do numeric args.
- (setq loop ?0)
- (while (<= loop ?9)
- (define-key map (char-to-string loop) 'digit-argument)
- (setq loop (1+ loop))))
-
- (define-key map (kbd "C-h") 'objed-describe-prefix-bindings)
- map))
+ ;; basic bindings
+ (dolist (seq (list (number-sequence ?a ?z)
+ (number-sequence ?A ?Z)))
+ (dolist (char seq)
+ (define-key map (kbd (format "%c" char)) 'objed-undefined)))
+ (let (loop)
+ (define-key map "-" 'negative-argument)
+ ;; Make plain numbers do numeric args.
+ (setq loop ?0)
+ (while (<= loop ?9)
+ (define-key map (char-to-string loop) 'digit-argument)
+ (setq loop (1+ loop))))
+
+ (define-key map (kbd "C-h") 'objed-describe-prefix-bindings)
+ map))
(defvar objed-op-map
@@ -816,7 +809,7 @@ Other single character keys are bound to `objed-undefined'."
(define-key map "x" 'objed-op-x)
(define-key map "c"
- ;; upcase, downcase, capitalize, reformat
+ ;; upcase, downcase, capitalize, reformat
(objed-define-op nil objed-case-op))
;; experimental
@@ -858,12 +851,9 @@ To define new operations see `objed-define-op'.")
(define-key map "t" 'objed-tag-object)
(define-key map "f" 'objed-file-object)
- (define-key map "[" 'objed-section-object)
+ (define-key map "*" 'objed-section-object)
(define-key map "j" 'objed-output-object)
(define-key map "h" 'objed-buffer-object)
- ;; TODO: inner buffer/beg-end
- (define-key map "<" 'objed-buffer-object)
- (define-key map ">" 'objed-buffer-object)
(define-key map "z" 'objed-ace-object)
map)
@@ -881,8 +871,8 @@ To define new objects see `objed-define-object'.")
Use `objed-define-dispatch' to define a dispatch command.")
-(objed-define-dispatch "<" objed--backward-until)
-(objed-define-dispatch ">" objed--forward-until)
+(objed-define-dispatch "(" objed--backward-until)
+(objed-define-dispatch ")" objed--forward-until)
(objed-define-dispatch "*" objed--mark-all-inside)
(objed-define-dispatch "#" objed--ace-switch-object)
@@ -1263,6 +1253,13 @@ non-nil which is the case when called interactively."
(objed--exit-objed))
+(defun objed-describe-key ()
+ "Like `describe-key' but also exit objed."
+ (interactive)
+ (call-interactively 'describe-key)
+ (objed--exit-objed))
+
+
(defvar objed--avy-err-msg
"Package `avy' is not available.
Add `avy' to your load path and restart `objed-mode' with a
diff --git a/test/tests/emacs-lisp-mode/expansion/block_2
b/test/tests/emacs-lisp-mode/expansion/block_2
index f56baf0..29eff50 100644
--- a/test/tests/emacs-lisp-mode/expansion/block_2
+++ b/test/tests/emacs-lisp-mode/expansion/block_2
@@ -1,4 +1,4 @@
-ll
+hh
;;;;
(defun check ()
diff --git a/test/tests/emacs-lisp-mode/expansion/block_3
b/test/tests/emacs-lisp-mode/expansion/block_3
index 10fe538..aa83147 100644
--- a/test/tests/emacs-lisp-mode/expansion/block_3
+++ b/test/tests/emacs-lisp-mode/expansion/block_3
@@ -1,4 +1,4 @@
-lll
+hhh
;;;;
(defun check ()
diff --git a/test/tests/emacs-lisp-mode/expansion/block_4
b/test/tests/emacs-lisp-mode/expansion/block_4
index b00b5f3..0c969b6 100644
--- a/test/tests/emacs-lisp-mode/expansion/block_4
+++ b/test/tests/emacs-lisp-mode/expansion/block_4
@@ -1,4 +1,4 @@
-llll
+hhhh
;;;;
(defun check ()
diff --git a/test/tests/emacs-lisp-mode/expansion/block_5
b/test/tests/emacs-lisp-mode/expansion/block_5
index e46a675..c955607 100644
--- a/test/tests/emacs-lisp-mode/expansion/block_5
+++ b/test/tests/emacs-lisp-mode/expansion/block_5
@@ -1,4 +1,4 @@
-lllll
+hhhhh
;;;;
(defun check ()
diff --git a/test/tests/emacs-lisp-mode/expansion/block_6
b/test/tests/emacs-lisp-mode/expansion/block_6
index 3d592ea..3fa965e 100644
--- a/test/tests/emacs-lisp-mode/expansion/block_6
+++ b/test/tests/emacs-lisp-mode/expansion/block_6
@@ -1,4 +1,4 @@
-llllll
+hhhhhh
;;;;
(defun check ()
@@ -20,4 +20,4 @@ llllll
;; Some text
;; and more text
->
\ No newline at end of file
+>
diff --git a/test/tests/emacs-lisp-mode/navigate-objects/defun
b/test/tests/emacs-lisp-mode/navigate-objects/defun
index 2b433fd..700bdd2 100644
--- a/test/tests/emacs-lisp-mode/navigate-objects/defun
+++ b/test/tests/emacs-lisp-mode/navigate-objects/defun
@@ -1,4 +1,4 @@
-cdthh
+cd[]]
;;;;
(defun objed--save-start-position (&rest _)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/objed fe78a97: Adjust some default bindings to be more emacsy,
Clemens Radermacher <=