branch: externals/cm-mode
commit b6ee65752bb879fd83c6ae5f78ea5d399703999d
Author: Joost Kremers <[email protected]>
Commit: Joost Kremers <[email protected]>
Do not show "(q)uit" as an option when accepting/rejecting a single change.
---
README.md | 6 +++---
cm-mode.el | 19 ++++++++++---------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 627eefde63..0be46ae2b7 100644
--- a/README.md
+++ b/README.md
@@ -51,11 +51,11 @@ You can jump to the previous/next change with the commands
`C-c * b` and `C-c *
## Accepting or rejecting changes ##
-You can interactively accept or reject a change by putting the cursor inside
it and hitting `C-c * i`. For additions, deletions and substitutions, you get a
choice between `a` to accept the change or `r` to reject it. There are two
other choices, `s` to skip this change or `q` to quit, which both leave the
change untouched. If you're just dealing with the change at point, they are
essentially identical, but they have different functions when accepting or
rejecting all changes interactively.
+You can interactively accept or reject a change by putting the cursor inside
it and hitting `C-c * i`. For additions, deletions and substitutions, you get a
choice between `a` to accept the change or `r` to reject it, or `s` to skip
this change, which leaves the change untouched.
-For comments and highlights, the choices are different: `d` to delete the
comment or highlight (whereby the latter of course retains the highlighted
text, but the comment and the markup are removed), or `s` to skip the comment
or highlight. Again `q` quits and is essentially identical to `s`.
+For comments and highlights, the choices are different: `d` to delete the
comment or highlight (the text of the highlight is retained, of course), or `s`
to skip the comment or highlight.
-You can interactively accept or reject all changes with `C-c * I` (that is a
capital `i`). This will go through each change asking you what you want to do
with it. Here, `s` skips the current change and moves on to the next one, while
typing `q` leaves the current change alone and quits the accept/reject session.
+You can interactively accept or reject all changes with `C-c * I` (that is a
capital `i`). This will go through each change asking you what you want to do
with it. Here, `s` skips the current change and moves on to the next one. In
addition, you can type `q`, leaves the current change alone and quits the
accept/reject session.
## Key bindings ##
diff --git a/cm-mode.el b/cm-mode.el
index 7458924ae8..c5ec0e659f 100644
--- a/cm-mode.el
+++ b/cm-mode.el
@@ -809,11 +809,10 @@ it."
(defun cm-accept/reject-change-at-point (&optional interactive)
"Accept or reject change at point interactively.
-
-Return point if the change is accepted or rejected or the
-position after the change if it is skipped (point is not changed
-in that case). If no change is found at point, the return value
-is nil.
+If the change is accepted or rejected, return point. If the
+change it is skipped, return or the position after the
+change (point is not altered in that case). If no change is
+found at point, the return value is nil.
INTERACTIVE is used to determine whether the function was called
interactively or not."
@@ -824,12 +823,14 @@ interactively or not."
(move-overlay cm-current-markup-overlay (cl-third change) (cl-fourth
change))
(let ((action (cond
((memq (car change) '(cm-addition cm-deletion
cm-substitution))
- (read-char-choice (format "%s:
(a)ccept/(r)eject/(s)kip/(q)uit? "
- (capitalize (substring
(symbol-name (car change)) 3)))
+ (read-char-choice (format "%s:
(a)ccept/(r)eject/(s)kip%s? "
+ (capitalize (substring
(symbol-name (car change)) 3))
+ (if interactive "" "/(q)uit"))
'(?a ?r ?s ?q) t))
((memq (car change) '(cm-comment cm-highlight))
- (read-char-choice (format "%s: (d)elete/(s)kip/(q)uit? "
- (capitalize (substring
(symbol-name (car change)) 3)))
+ (read-char-choice (format "%s: (d)elete/(s)kip%s? "
+ (capitalize (substring
(symbol-name (car change)) 3))
+ (if interactive "" "/(q)uit"))
'(?d ?s ?q) t)))))
(delete-overlay cm-current-markup-overlay)
(when (and (not interactive) (eq action ?q)) ; if the user aborted