commit/cc-mode: 2 new changesets
11 years, 6 months
Bitbucket
2 new commits in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/c712669731be/
Changeset: c712669731be
User: acm
Date: 2013-04-03 18:27:08
Summary: Handle `parse-partial-sexp' landing inside a comment opener.
Also adapt to the new values of element 7 of a parse state.
cc-engine.el (c-state-pp-to-literal): New optional parameter
`not-in-delimiter'. Handle being inside comment opener.
(c-invalidate-state-cache-1): Reckon with an extra "invalid" character in
case we're typing a '*' after a '/'.
(c-literal-limits): Handle the awkward "not-in-delimiter" cond arm
instead by passing the parameter to c-state-pp-to-literal.
cc-fonts.el (c-font-lock-doc-comments): New handling for elt. 7 of a
parse state.
Affected #: 2 files
diff -r f3461758abf62bd22f7ff3cda68350b83b0b0adb -r c712669731be09479f918dcdb56cebac8fb47204 cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -2179,32 +2179,45 @@
;; reduced by buffer changes, and increased by invocations of
;; `c-state-literal-at'. FIMXE!!!
-(defsubst c-state-pp-to-literal (from to)
+(defsubst c-state-pp-to-literal (from to &optional not-in-delimiter)
;; Do a parse-partial-sexp from FROM to TO, returning either
;; (STATE TYPE (BEG . END)) if TO is in a literal; or
;; (STATE) otherwise,
;; where STATE is the parsing state at TO, TYPE is the type of the literal
;; (one of 'c, 'c++, 'string) and (BEG . END) is the boundaries of the literal.
;;
+ ;; Unless NOT-IN-DELIMITER is non-nil, when TO is inside a two-character
+ ;; comment opener, this is recognized as being in a comment literal.
+ ;;
;; Only elements 3 (in a string), 4 (in a comment), 5 (following a quote),
;; 7 (comment type) and 8 (start of comment/string) (and possibly 9) of
;; STATE are valid.
(save-excursion
(let ((s (parse-partial-sexp from to))
- ty)
- (when (or (nth 3 s) (nth 4 s)) ; in a string or comment
+ ty co-st)
+ (cond
+ ((or (nth 3 s) (nth 4 s)) ; in a string or comment
(setq ty (cond
((nth 3 s) 'string)
- ((eq (nth 7 s) t) 'c++)
+ ((nth 7 s) 'c++)
(t 'c)))
(parse-partial-sexp (point) (point-max)
- nil ; TARGETDEPTH
- nil ; STOPBEFORE
- s ; OLDSTATE
- 'syntax-table)) ; stop at end of literal
- (if ty
- `(,s ,ty (,(nth 8 s) . ,(point)))
- `(,s)))))
+ nil ; TARGETDEPTH
+ nil ; STOPBEFORE
+ s ; OLDSTATE
+ 'syntax-table) ; stop at end of literal
+ `(,s ,ty (,(nth 8 s) . ,(point))))
+
+ ((and (not not-in-delimiter) ; inside a comment starter
+ (not (bobp))
+ (progn (backward-char)
+ (looking-at c-comment-start-regexp)))
+ (setq ty (if (looking-at c-block-comment-start-regexp) 'c 'c++)
+ co-st (point))
+ (forward-comment 1)
+ `(,s ,ty (,co-st . ,(point))))
+
+ (t `(,s))))))
(defun c-state-safe-place (here)
;; Return a buffer position before HERE which is "safe", i.e. outside any
@@ -3146,10 +3159,13 @@
;; This function is called from c-after-change.
;; The caches of non-literals:
- (if (< here c-state-nonlit-pos-cache-limit)
- (setq c-state-nonlit-pos-cache-limit here))
- (if (< here c-state-semi-nonlit-pos-cache-limit)
- (setq c-state-semi-nonlit-pos-cache-limit here))
+ ;; Note that we use "<=" for the possibility of the second char of a two-char
+ ;; comment opener being typed; this would invalidate any cache position at
+ ;; HERE.
+ (if (<= here c-state-nonlit-pos-cache-limit)
+ (setq c-state-nonlit-pos-cache-limit (1- here)))
+ (if (<= here c-state-semi-nonlit-pos-cache-limit)
+ (setq c-state-semi-nonlit-pos-cache-limit (1- here)))
;; `c-state-cache':
;; Case 1: if `here' is in a literal containing point-min, everything
@@ -4467,19 +4483,12 @@
(lim (or lim (c-state-semi-safe-place pos)))
(pp-to-lit (save-restriction
(widen)
- (c-state-pp-to-literal lim pos)))
+ (c-state-pp-to-literal lim pos not-in-delimiter)))
(state (car pp-to-lit))
(lit-limits (car (cddr pp-to-lit))))
(cond
(lit-limits)
- ((and (not not-in-delimiter)
- (not (elt state 5))
- (eq (char-before) ?/)
- (looking-at "[/*]")) ; FIXME!!! use c-line/block-comment-starter. 2008-09-28.
- ;; We're standing in a comment starter.
- (backward-char 1)
- (cons (point) (progn (c-forward-single-comment) (point))))
(near
(goto-char pos)
diff -r f3461758abf62bd22f7ff3cda68350b83b0b0adb -r c712669731be09479f918dcdb56cebac8fb47204 cc-fonts.el
--- a/cc-fonts.el
+++ b/cc-fonts.el
@@ -2449,7 +2449,7 @@
(setq comment-beg nil))
(setq region-beg comment-beg))
- (if (eq (elt (parse-partial-sexp comment-beg (+ comment-beg 2)) 7) t)
+ (if (elt (parse-partial-sexp comment-beg (+ comment-beg 2)) 7)
;; Collect a sequence of doc style line comments.
(progn
(goto-char comment-beg)
https://bitbucket.org/xemacs/cc-mode/commits/2bda48113a38/
Changeset: 2bda48113a38
User: acm
Date: 2013-04-03 19:03:14
Summary: Merge.
Affected #: 3 files
diff -r c712669731be09479f918dcdb56cebac8fb47204 -r 2bda48113a380a7491c2be246e348c1be029f149 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -95,3 +95,4 @@
84035315a6ee61c74a5ebd43dab790318c1cc9a3 cc-mode-1_60
193c0f9dbfbac71e083f2974efc724a82d1106c5 cc-mode-1_62
b855e452c23959bb9efcd397f3739ba11ad97718 cc-mode-1_63
+72acccbc8a915392dd763ba2f8fc8495707caa83 cc-mode-1_64
diff -r c712669731be09479f918dcdb56cebac8fb47204 -r 2bda48113a380a7491c2be246e348c1be029f149 ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-03-06 Norbert Koch <viteno(a)xemacs.org>
+
+ * Makefile (VERSION): XEmacs package 1.64 released.
+
2013-02-08 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.63 released.
diff -r c712669731be09479f918dcdb56cebac8fb47204 -r 2bda48113a380a7491c2be246e348c1be029f149 Makefile
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-VERSION = 1.63
+VERSION = 1.64
AUTHOR_VERSION = 5.32.2
MAINTAINER = Alan Mackenzie <bug-cc-mode(a)gnu.org>
PACKAGE = cc-mode
Repository URL: https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches