[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/gnus-cloud 5a962af 28/61: Merge branch 'master' of
From: |
Teodor Zlatanov |
Subject: |
[Emacs-diffs] scratch/gnus-cloud 5a962af 28/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs |
Date: |
Fri, 1 Jul 2016 17:37:54 +0000 (UTC) |
branch: scratch/gnus-cloud
commit 5a962af7b820d2fe842cb1c5f5b21d8d851ebb43
Merge: 4d95c44 a4750b3
Author: Ted Zlatanov <address@hidden>
Commit: Ted Zlatanov <address@hidden>
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
lisp/progmodes/cc-langs.el | 17 +++++--
lisp/progmodes/cc-mode.el | 118 +++++++++++++++++++++++++++++++++++++-------
2 files changed, 113 insertions(+), 22 deletions(-)
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index ba05e81..4d36684 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -477,6 +477,7 @@ so that all identifiers are recognized as words.")
c-before-change-check-raw-strings
c-before-change-check-<>-operators
c-depropertize-CPP
+ c-before-after-change-digit-quote
c-invalidate-macro-cache)
(c objc) '(c-extend-region-for-CPP
c-depropertize-CPP
@@ -508,18 +509,24 @@ parameters \(point-min) and \(point-max).")
(c-lang-defconst c-before-font-lock-functions
;; For documentation see the following c-lang-defvar of the same name.
;; The value here may be a list of functions or a single function.
- t 'c-change-expand-fl-region
- (c objc) '(c-extend-font-lock-region-for-macros
+ t '(c-depropertize-new-text
+ c-change-expand-fl-region)
+ (c objc) '(c-depropertize-new-text
+ c-extend-font-lock-region-for-macros
c-neutralize-syntax-in-and-mark-CPP
c-change-expand-fl-region)
- c++ '(c-extend-font-lock-region-for-macros
+ c++ '(c-depropertize-new-text
+ c-extend-font-lock-region-for-macros
+ c-before-after-change-digit-quote
c-after-change-re-mark-raw-strings
c-neutralize-syntax-in-and-mark-CPP
c-restore-<>-properties
c-change-expand-fl-region)
- java '(c-restore-<>-properties
+ java '(c-depropertize-new-text
+ c-restore-<>-properties
c-change-expand-fl-region)
- awk 'c-awk-extend-and-syntax-tablify-region)
+ awk '(c-depropertize-new-text
+ c-awk-extend-and-syntax-tablify-region))
(c-lang-defvar c-before-font-lock-functions
(let ((fs (c-lang-const c-before-font-lock-functions)))
(if (listp fs)
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index dd8d771..80ac08f 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -892,23 +892,24 @@ Note that the style variables are always made local to
the buffer."
;; This function is in the C/C++/ObjC values of
;; `c-get-state-before-change-functions' and is called exclusively as a
;; before change function.
- (goto-char c-new-BEG)
- (while (and (< (point) beg)
- (search-forward-regexp c-anchored-cpp-prefix beg t))
- (goto-char (match-beginning 1))
- (let ((m-beg (point)))
- (c-end-of-macro)
- (c-clear-char-property-with-value
- m-beg (min (point) beg) 'syntax-table '(1))))
-
- (goto-char end)
- (while (and (< (point) c-new-END)
- (search-forward-regexp c-anchored-cpp-prefix c-new-END t))
- (goto-char (match-beginning 1))
- (let ((m-beg (point)))
- (c-end-of-macro)
- (c-clear-char-property-with-value
- m-beg (min (point) c-new-END) 'syntax-table '(1)))))
+ (c-save-buffer-state ()
+ (goto-char c-new-BEG)
+ (while (and (< (point) beg)
+ (search-forward-regexp c-anchored-cpp-prefix beg t))
+ (goto-char (match-beginning 1))
+ (let ((m-beg (point)))
+ (c-end-of-macro)
+ (c-clear-char-property-with-value
+ m-beg (min (point) beg) 'syntax-table '(1))))
+
+ (goto-char end)
+ (while (and (< (point) c-new-END)
+ (search-forward-regexp c-anchored-cpp-prefix c-new-END t))
+ (goto-char (match-beginning 1))
+ (let ((m-beg (point)))
+ (c-end-of-macro)
+ (c-clear-char-property-with-value
+ m-beg (min (point) c-new-END) 'syntax-table '(1))))))
(defun c-extend-region-for-CPP (beg end)
;; Adjust `c-new-BEG', `c-new-END' respectively to the beginning and end of
@@ -932,6 +933,25 @@ Note that the style variables are always made local to the
buffer."
; with a c-cpp-delimiter category property
(setq c-new-END (point)))
+(defun c-depropertize-new-text (beg end old-len)
+ ;; Remove from the new text in (BEG END) any and all text properties which
+ ;; might interfere with CC Mode's proper working.
+ ;;
+ ;; This function is called exclusively as an after-change function. It
+ ;; appears in the value (for all languages) of
+ ;; `c-before-font-lock-functions'. The value of point is undefined both on
+ ;; entry and exit, and the return value has no significance. The parameters
+ ;; BEG, END, and OLD-LEN are the standard ones supplied to all after-change
+ ;; functions.
+ (c-save-buffer-state ()
+ (when (> end beg)
+ (c-clear-char-properties beg end 'syntax-table)
+ (c-clear-char-properties beg end 'category)
+ (c-clear-char-properties beg end 'c-is-sws)
+ (c-clear-char-properties beg end 'c-in-sws)
+ (c-clear-char-properties beg end 'c-type)
+ (c-clear-char-properties beg end 'c-awk-NL-prop))))
+
(defun c-extend-font-lock-region-for-macros (begg endd old-len)
;; Extend the region (c-new-BEG c-new-END) to cover all (possibly changed)
;; preprocessor macros; The return value has no significance.
@@ -1042,6 +1062,70 @@ Note that the style variables are always made local to
the buffer."
(forward-line)) ; no infinite loop with, e.g., "#//"
)))))
+(defun c-before-after-change-digit-quote (beg end &optional old-len)
+ ;; This function either removes or applies the punctuation value ('(1)) of
+ ;; the `syntax-table' text property on single quote marks which are
+ ;; separator characters in long integer literals, e.g. "4'294'967'295". It
+ ;; applies to both decimal/octal and hex literals. (FIXME (2016-06-10): it
+ ;; should also apply to binary literals.)
+ ;;
+ ;; In both uses of the function, the `syntax-table' properties are
+ ;; removed/applied only on quote marks which appear to be digit separators.
+ ;;
+ ;; Point is undefined on both entry and exit to this function, and the
+ ;; return value has no significance. The function is called solely as a
+ ;; before-change function (see `c-get-state-before-change-functions') and as
+ ;; an after change function (see `c-before-font-lock-functions', with the
+ ;; parameters BEG, END, and (optionally) OLD-LEN being given the standard
+ ;; values for before/after-change functions.
+ (c-save-buffer-state ((num-begin c-new-BEG) digit-re try-end)
+ (goto-char c-new-END)
+ (when (looking-at "\\(x\\)?[0-9a-fA-F']+")
+ (setq c-new-END (match-end 0)))
+ (goto-char c-new-BEG)
+ (when (looking-at "\\(x?\\)[0-9a-fA-F']")
+ (if (re-search-backward "\\(0x\\)?[0-9a-fA-F]*\\=" nil t)
+ (setq c-new-BEG (point))))
+
+ (while
+ (re-search-forward "[0-9a-fA-F]'[0-9a-fA-F]" c-new-END t)
+ (setq try-end (1- (point)))
+ (re-search-backward "[^0-9a-fA-F']" num-begin t)
+ (setq digit-re
+ (cond
+ ((and (not (bobp)) (eq (char-before) ?0) (memq (char-after) '(?x
?X)))
+ "[0-9a-fA-F]")
+ ((and (eq (char-after (1+ (point))) ?0)
+ (memq (char-after (+ 2 (point))) '(?b ?B)))
+ "[01]")
+ ((memq (char-after (1+ (point))) '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9))
+ "[0-9]")
+ (t nil)))
+ (when digit-re
+ (cond ((eq (char-after) ?x) (forward-char))
+ ((looking-at ".?0[Bb]") (goto-char (match-end 0)))
+ ((looking-at digit-re))
+ (t (forward-char)))
+ (when (not (c-in-literal))
+ (let ((num-end ; End of valid sequence of digits/quotes.
+ (save-excursion
+ (re-search-forward
+ (concat "\\=\\(" digit-re "+'\\)*" digit-re "+") nil t)
+ (point))))
+ (setq try-end ; End of sequence of digits/quotes
+ (save-excursion
+ (re-search-forward
+ (concat "\\=\\(" digit-re "\\|'\\)+") nil t)
+ (point)))
+ (while (re-search-forward
+ (concat digit-re "\\('\\)" digit-re) num-end t)
+ (if old-len ; i.e. are we in an after-change function?
+ (c-put-char-property (match-beginning 1) 'syntax-table '(1))
+ (c-clear-char-property (match-beginning 1) 'syntax-table))
+ (backward-char)))))
+ (goto-char try-end)
+ (setq num-begin (point)))))
+
(defun c-before-change (beg end)
;; Function to be put on `before-change-functions'. Primarily, this calls
;; the language dependent `c-get-state-before-change-functions'. It is
- [Emacs-diffs] scratch/gnus-cloud 3d35d2f 24/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, (continued)
- [Emacs-diffs] scratch/gnus-cloud 3d35d2f 24/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud 3ae2fbf 35/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud d4ac0c3 31/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud b8566e0 25/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud d23e30b 36/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud b66705b 34/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud 9a642a0 18/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud 4d95c44 27/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud ffefeea 43/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud 378a387 48/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud 5a962af 28/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs,
Teodor Zlatanov <=
- [Emacs-diffs] scratch/gnus-cloud c332287 53/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud 2ee3993 50/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud 513812e 52/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud 1b3c761 37/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud 1bf1008 54/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud 0703c56 55/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud 07f3078 60/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud b003459 58/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud f7975bf 14/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01
- [Emacs-diffs] scratch/gnus-cloud f4ddee5 23/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs, Teodor Zlatanov, 2016/07/01