emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/objed 042c3bb 051/216: Change some bindings


From: Stefan Monnier
Subject: [elpa] externals/objed 042c3bb 051/216: Change some bindings
Date: Tue, 8 Jan 2019 12:29:10 -0500 (EST)

branch: externals/objed
commit 042c3bb1e86edfff4964c86580968fbbb02665fc
Author: Clemera <address@hidden>
Commit: Clemera <address@hidden>

    Change some bindings
---
 README.asc       | 22 +++++++++++++++++-----
 objed-objects.el | 13 +++++++------
 objed.el         |  4 +++-
 3 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/README.asc b/README.asc
index 93e6f11..b4a4ca6 100644
--- a/README.asc
+++ b/README.asc
@@ -74,7 +74,7 @@ now continue to the end of the paragraph by pressing kbd:[e] 
again.
 Now s?he is able to proceed even further by pressing kbd:[e] again OR
 to continue by adding new text to the end of the paragraph OR to
 continue by acting on the text moved over, for example killing it by
-pressing kbd:[k]. 
+pressing kbd:[k].
 
 To kill text from point upto a closing parentheses or string quote
 etc. you would use kbd:[u] followed by kbd:[k]
@@ -156,6 +156,19 @@ Although some features are still experimental the basic 
user interface
 will stay the same. The following gives an overview of available keys
 and commands.
 
+In addition to the commands configured in `objed-cmd-alist` you can
+use the following commands.
+
+|===
+|Shortcut |Purpose
+|kbd:[M-n/p]
+|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.
+|===
+
+
 Basic movement commands (switch the object type on movement):
 
 [`objed-map`]
@@ -357,7 +370,7 @@ Misc commands:
 |kbd:[Ctrl - Space]
 |Set mark.
 
-|kbd:[Ctrl - h]
+|kbd:[?]
 |Get key binding help (uses `which-key` if available).
 
 |kbd:[g/Ctrl - g]
@@ -401,8 +414,8 @@ Add this to your init file:
 ```elisp
 (add-to-list 'load-path "/<path-to>/objed")
 (require 'objed)
-;; activating the mode is optional, you can activate objed 
-;; always manually using `objed-activate' 
+;; activating the mode is optional, you can activate objed
+;; always manually using `objed-activate'
 (objed-mode)
 ```
 
@@ -417,4 +430,3 @@ aren't to many problems using modes for other languages, I 
tried my
 best to write text objects in a language agnostic way by using Emacs
 syntax information. Testing this and writing tests in general would be
 an important next step.
-
diff --git a/objed-objects.el b/objed-objects.el
index 453ac28..6b416ab 100644
--- a/objed-objects.el
+++ b/objed-objects.el
@@ -1775,12 +1775,13 @@ non-nil the indentation block can contain empty lines."
         (re-search-forward  "\\_<" nil t)
       (let ((sym (and (or bds (setq bds (bounds-of-thing-at-point 'symbol)))
                       (buffer-substring (car bds) (cdr bds)))))
-        (unless (looking-at "\\_<")
+        (when bds
           (goto-char (cdr bds)))
         (if (re-search-forward (format "\\_<%s\\_>" sym) nil t)
             (goto-char (match-beginning 0))
           (goto-char (car bds))
-          (when (eq real-this-command #'objed-current-or-next-context)
+          (when (or (eq real-this-command #'objed-current-or-next-context)
+                    (eq real-this-command #'objed-next-identifier))
             (run-at-time 0 nil (apply-partially #'message "Last one!"))))))))
 
 (defun objed-prev-identifier ()
@@ -1792,14 +1793,14 @@ non-nil the indentation block can contain empty lines."
       (let ((sym (and (or bds (setq bds (bounds-of-thing-at-point 'symbol)))
                       (buffer-substring (car bds) (cdr bds)))))
         (when bds
-          (unless (looking-back "\\_>" 1)
+          (when (looking-back "\\_>" 1)
             (goto-char (car bds)))
           (if (re-search-backward (format "\\_<%s\\_>" sym) nil t)
               (goto-char (match-beginning 0))
             (goto-char (car bds))
-            (when (eq real-this-command #'objed-current-or-previous-context)
-              (run-at-time 0 nil
-                           (apply-partially #'message "First one!")))))))))
+            (when (or (eq real-this-command 
#'objed-current-or-previous-context)
+                      (eq real-this-command #'objed-prev-identifier))
+              (run-at-time 0 nil (apply-partially #'message "First 
one!")))))))))
 
 
 (objed-define-object nil section
diff --git a/objed.el b/objed.el
index 95de977..547087c 100644
--- a/objed.el
+++ b/objed.el
@@ -362,6 +362,8 @@ See also `objed-disabled-p'"
     (org-previous-visible-heading . section)
     (comint-previous-prompt . output)
     (comint-next-prompt . output)
+    (objed-next-identifier . identifier)
+    (objed-prev-identifier . identifier)
     ;; editing entry commands
     (delete-char . char)
     (kill-line . char)
@@ -642,7 +644,7 @@ object as an argument."
     ;; common emacs keys
     (define-key map (kbd "C-g") 'objed-quit)
     (define-key map "g" 'objed-quit)
-    (define-key map (kbd "C-h") 'objed-show-top-level)
+    (define-key map (kbd "?") 'objed-show-top-level)
     ;; TODO: support repeated invokation
     (define-key map (kbd "C-u") 'universal-argument)
     (define-key map (kbd "C-SPC") 'set-mark-command)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]