emacs-diffs
[Top][All Lists]
Advanced

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

master 1b6bd97: Bug #41061 patch: Fix typos and amend code slightly


From: Alan Mackenzie
Subject: master 1b6bd97: Bug #41061 patch: Fix typos and amend code slightly
Date: Mon, 1 Jun 2020 11:22:51 -0400 (EDT)

branch: master
commit 1b6bd97440349954ee310da0523c436985971ea9
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    Bug #41061 patch: Fix typos and amend code slightly
    
    * lisp/progmodes/cc-align.el (c-lineup-ternary-bodies)
    * doc/misc/cc-mode.texi (Operator Line-Up): Fix typos and amend code.
---
 doc/misc/cc-mode.texi      |  4 ++--
 lisp/progmodes/cc-align.el | 22 +++++++++++-----------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi
index 16eac48..10bbf8f 100644
--- a/doc/misc/cc-mode.texi
+++ b/doc/misc/cc-mode.texi
@@ -6399,8 +6399,8 @@ function is the same as specifying a list 
@code{(c-lineup-assignments
 @findex lineup-ternary-bodies @r{(c-)}
 Line up true and false branches of a ternary operator
 (i.e. @code{?:}).  More precisely, if the line starts with a colon
-which is a part of a said operator it with corresponding question
-mark.  For example:
+which is a part of a said operator, align it with corresponding
+question mark.  For example:
 
 @example
 @group
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el
index c49bdc5..6172afe 100644
--- a/lisp/progmodes/cc-align.el
+++ b/lisp/progmodes/cc-align.el
@@ -791,32 +791,32 @@ arglist-cont-nonempty."
       c-basic-offset))
 
 (defun c-lineup-ternary-bodies (langelem)
-  "Line up true and false branches of a ternary operator (i.e. ‘?:’).
+  "Line up true and false branches of a ternary operator (i.e. `?:').
 More precisely, if the line starts with a colon which is a part of
-a said operator it with corresponding question mark; otherwise return
-nil.  For example:
+a said operator, align it with corresponding question mark; otherwise
+return nil.  For example:
 
     return arg % 2 == 0 ? arg / 2
                         : (3 * arg + 1);    <- c-lineup-ternary-bodies
 
-Works with: arglist-cont, arglist-cont-nonempty and statement-cont.
-"
+Works with: arglist-cont, arglist-cont-nonempty and statement-cont."
   (save-excursion
     (back-to-indentation)
     (when (and (eq ?: (char-after))
                (not (eq ?: (char-after (1+ (point))))))
       (let ((limit (c-langelem-pos langelem)) (depth 1))
         (catch 'done
-          (while (c-syntactic-skip-backward "^?:" limit t)
-            (goto-char (1- (point)))
+          (while (and (c-syntactic-skip-backward "^?:" limit t)
+                     (not (bobp)))
+            (backward-char)
             (cond ((eq (char-after) ??)
-                   ;; If we’ve found a question mark, decrease depth.  If we’re
-                   ;; reached zero, we’ve found the one we were looking for.
+                   ;; If we've found a question mark, decrease depth.  If we've
+                   ;; reached zero, we've found the one we were looking for.
                    (when (zerop (setq depth (1- depth)))
                      (throw 'done (vector (current-column)))))
                   ((or (eq ?: (char-before)) (eq ?? (char-before)))
-                   ;; Step over ‘::’ and ‘?:’ operators.  We don’t have to
-                   ;; handle ‘?:’ here but doing so saves an iteration.
+                   ;; Step over `::' and `?:' operators.  We don't have to
+                   ;; handle `?:' here but doing so saves an iteration.
                    (if (eq (point) limit)
                        (throw 'done nil)
                      (goto-char (1- (point)))))



reply via email to

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