[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 80e200c: Fix bug in yesterday's CC Mode commit.
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] master 80e200c: Fix bug in yesterday's CC Mode commit. |
Date: |
Sun, 2 Jul 2017 09:02:16 -0400 (EDT) |
branch: master
commit 80e200c0a08805771d1c709546d79088be188021
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>
Fix bug in yesterday's CC Mode commit.
* lisp/progmodes/cc-mode.el (c-quoted-number-head-before-point): Check a
search has succeded before using the match data.
(c-quoted-number-head-before-point, c-quoted-number-head-after-point):
Specify that the position of the extremity of the head or tail is in the
match data.
---
lisp/progmodes/cc-mode.el | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index c5ee60f..ef93f75 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1113,18 +1113,22 @@ Note that the style variables are always made local to
the buffer."
(defun c-quoted-number-head-before-point ()
;; Return non-nil when the head of a possibly quoted number is found
;; immediately before point. The value returned in this case is the buffer
- ;; position of the start of the head.
+ ;; position of the start of the head. That position is also in
+ ;; (match-beginning 0).
(when c-has-quoted-numbers
(save-excursion
(let ((here (point))
- )
+ found)
(skip-chars-backward "0-9a-fA-F'")
(if (and (memq (char-before) '(?x ?X))
(eq (char-before (1- (point))) ?0))
(backward-char 2))
- (while (and (search-forward-regexp c-maybe-quoted-number-head here t)
- (< (match-end 0) here)))
- (and (eq (match-end 0) here) (match-beginning 0))))))
+ (while
+ (and
+ (setq found
+ (search-forward-regexp c-maybe-quoted-number-head here t))
+ (< found here)))
+ (and (eq found here) (match-beginning 0))))))
(defconst c-maybe-quoted-number-tail
(concat
@@ -1141,7 +1145,7 @@ Note that this is a strict tail, so won't match, e.g.
\"0x....\".")
(defun c-quoted-number-tail-after-point ()
;; Return non-nil when a proper tail of a possibly quoted number is found
;; immediately after point. The value returned in this case is the buffer
- ;; position of the end of the tail.
+ ;; position of the end of the tail. That position is also in (match-end 0).
(when c-has-quoted-numbers
(and (looking-at c-maybe-quoted-number-tail)
(match-end 0))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 80e200c: Fix bug in yesterday's CC Mode commit.,
Alan Mackenzie <=