commit/cc-mode: acm: Handle C++17's constexpr keyword in if statements
                
            
            
                7 years, 7 months
            
            
                
                    
                    
                    
                    
                    Bitbucket
                
 
                
                    
                        
                            1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/948df39cfb8a/
Changeset:   948df39cfb8a
User:        acm
Date:        2018-03-28 19:28:44+00:00
Summary:     Handle C++17's constexpr keyword in if statements
* cc-engine.el (c-after-conditional): Test for matches to
  c-block-stmt-hangon-key.
* cc-langs.el (c-block-stmt-hangon-kwds): New lang const.
(c-block-stmt-hangon-key): New lang const/var matching any element of the
above.
Affected #:  2 files
diff -r bb8af6c225af -r 948df39cfb8a cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -9856,9 +9856,15 @@
   ;; This function might do hidden buffer changes.
   (save-excursion
     (and (zerop (c-backward-token-2 1 t lim))
+	 (if (looking-at c-block-stmt-hangon-key)
+	     (zerop (c-backward-token-2 1 t lim))
+	   t)
 	 (or (looking-at c-block-stmt-1-key)
 	     (and (eq (char-after) ?\()
 		  (zerop (c-backward-token-2 1 t lim))
+		  (if (looking-at c-block-stmt-hangon-key)
+		      (zerop (c-backward-token-2 1 t lim))
+		    t)
 		  (or (looking-at c-block-stmt-2-key)
 		      (looking-at c-block-stmt-1-2-key))))
 	 (point))))
diff -r bb8af6c225af -r 948df39cfb8a cc-langs.el
--- a/cc-langs.el
+++ b/cc-langs.el
@@ -2568,6 +2568,17 @@
 				  (c-lang-const c-block-stmt-2-kwds))
 			  :test 'string-equal))
 
+(c-lang-defconst c-block-stmt-hangon-kwds
+  "Keywords which may directly follow a member of `c-block-stmt-1/2-kwds'."
+  t nil
+  c++ '("constexpr"))
+
+(c-lang-defconst c-block-stmt-hangon-key
+  ;; Regexp matching a "hangon" keyword in a `c-block-stmt-1/2-kwds'
+  ;; construct.
+  t (c-make-keywords-re t (c-lang-const c-block-stmt-hangon-kwds)))
+(c-lang-defvar c-block-stmt-hangon-key (c-lang-const c-block-stmt-hangon-key))
+
 (c-lang-defconst c-opt-block-stmt-key
   ;; Regexp matching the start of any statement that has a
   ;; substatement (except a bare block).  Nil in languages that
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.
                        
                     
                    
                 
             
         
        
        
            
        
        
            
                
                    
                    
                    commit/cc-mode: acm: Replace faulty non-matching regexp "\\<\\>" with
 "a\\`"
                
            
            
                7 years, 7 months
            
            
                
                    
                    
                    
                    
                    Bitbucket
                
 
                
                    
                        
                            1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/bb8af6c225af/
Changeset:   bb8af6c225af
User:        acm
Date:        2018-03-28 18:29:49+00:00
Summary:     Replace faulty non-matching regexp "\\<\\>" with "a\\`"
The regexp "\\<\\>", which is supposed never to match, actually matches, for
instance, where a Chinese character is directly followed by an ASCII letter.
So, replace it with "a\\`".
* cc-defs.el (cc-fix, c-make-keywords-re)
* cc-engine.el (c-beginning-of-statement-1, c-forward-<>-arglist-recur)
(c-forward-decl-or-cast-1, c-looking-at-decl-block)
* cc-fix.el (top-level)
* cc-langs.el (c-assignment-op-regexp, c-block-comment-ender-regexp)
(c-block-comment-start-regexp, c-line-comment-start-regexp)
(c-doc-comment-start-regexp, c-decl-start-colon-kwd-re)
(c-type-decl-prefix-key, c-type-decl-operator-prefix-key)
(c-pre-id-bracelist-key, c-enum-clause-introduction-re)
(c-nonlabel-token-2-key)
* cc-vars.el (c-noise-macro-with-parens-name-re, c-make-noise-macro-regexps):
Replace "\\<\\>" by "a\\`".
Affected #:  5 files
diff -r 0e6c805bb3ae -r bb8af6c225af cc-defs.el
--- a/cc-defs.el
+++ b/cc-defs.el
@@ -84,7 +84,7 @@
   (progn
     (require 'font-lock)
     (let (font-lock-keywords)
-      (font-lock-compile-keywords '("\\<\\>"))
+      (font-lock-compile-keywords '("a\\`"))
       font-lock-keywords))))
 
 
@@ -1775,8 +1775,8 @@
 
     ;; Produce a regexp that matches nothing.
     (if adorn
-	"\\(\\<\\>\\)"
-      "\\<\\>")))
+	"\\(a\\`\\)"
+      "a\\`")))
 
 (put 'c-make-keywords-re 'lisp-indent-function 1)
 
diff -r 0e6c805bb3ae -r bb8af6c225af cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -874,7 +874,7 @@
 	stack
 	;; Regexp which matches "for", "if", etc.
 	(cond-key (or c-opt-block-stmt-key
-		      "\\<\\>"))	; Matches nothing.
+		      "a\\`"))	; Matches nothing.
 	;; Return value.
 	(ret 'same)
 	;; Positions of the last three sexps or bounds we've stopped at.
@@ -7158,7 +7158,7 @@
 		(progn
 		  (c-forward-syntactic-ws)
 		  (when (or (and c-record-type-identifiers all-types)
-			    (not (equal c-inside-<>-type-key "\\(\\<\\>\\)")))
+			    (not (equal c-inside-<>-type-key "\\(a\\`\\)")))
 		    (c-forward-syntactic-ws)
 		    (cond
 		     ((eq (char-after) ??)
@@ -8566,7 +8566,7 @@
       ;; Skip over type decl prefix operators.  (Note similar code in
       ;; `c-forward-declarator'.)
       (if (and c-recognize-typeless-decls
-	       (equal c-type-decl-prefix-key "\\<\\>"))
+	       (equal c-type-decl-prefix-key "a\\`"))
 	  (when (eq (char-after) ?\()
 	    (progn
 	      (setq paren-depth (1+ paren-depth))
@@ -10192,7 +10192,7 @@
 	      ;; legal because it's part of a "compound keyword" like
 	      ;; "enum class".	Of course, if c-after-brace-list-key
 	      ;; is nil, we can skip the test.
-	      (or (equal c-after-brace-list-key "\\<\\>")
+	      (or (equal c-after-brace-list-key "a\\`")
 		  (save-match-data
 		    (save-excursion
 		      (not
diff -r 0e6c805bb3ae -r bb8af6c225af cc-fix.el
--- a/cc-fix.el
+++ b/cc-fix.el
@@ -122,7 +122,7 @@
   '(when (and (featurep 'xemacs) ; There is now (2005/12) code in GNU Emacs CVS
 				 ; to make the call to f-l-c-k throw an error.
 	      (let (font-lock-keywords)
-		(font-lock-compile-keywords '("\\<\\>"))
+		(font-lock-compile-keywords '("a\\`"))
 		font-lock-keywords))	; did the previous call foul this up?
      (defun font-lock-compile-keywords (keywords)
        "Compile KEYWORDS (a list) and return the list of compiled keywords.
diff -r 0e6c805bb3ae -r bb8af6c225af cc-langs.el
--- a/cc-langs.el
+++ b/cc-langs.el
@@ -1262,7 +1262,7 @@
 	   (c--set-difference (c-lang-const c-assignment-operators)
 			      '("=")
 			      :test 'string-equal)))
-      "\\<\\>"))
+      "a\\`"))
 (c-lang-defvar c-assignment-op-regexp
   (c-lang-const c-assignment-op-regexp))
 
@@ -1485,7 +1485,7 @@
   ;; language)
   t (if (c-lang-const c-block-comment-ender)
 	(regexp-quote (c-lang-const c-block-comment-ender))
-      "\\<\\>"))
+      "a\\`"))
 (c-lang-defvar c-block-comment-ender-regexp
 	       (c-lang-const c-block-comment-ender-regexp))
 
@@ -1504,7 +1504,7 @@
   ;; language)
   t (if (c-lang-const c-block-comment-starter)
 	(regexp-quote (c-lang-const c-block-comment-starter))
-      "\\<\\>"))
+      "a\\`"))
 (c-lang-defvar c-block-comment-start-regexp
   (c-lang-const c-block-comment-start-regexp))
 
@@ -1513,7 +1513,7 @@
   ;; language; it does in all 7 CC Mode languages).
   t (if (c-lang-const c-line-comment-starter)
 	(regexp-quote (c-lang-const c-line-comment-starter))
-      "\\<\\>"))
+      "a\\`"))
 (c-lang-defvar c-line-comment-start-regexp
 	       (c-lang-const c-line-comment-start-regexp))
 
@@ -1528,7 +1528,7 @@
 
 (c-lang-defconst c-doc-comment-start-regexp
   "Regexp to match the start of documentation comments."
-  t    "\\<\\>"
+  t    "a\\`"
   ;; From font-lock.el: `doxygen' uses /*! while others use /**.
   (c c++ objc) "/\\*[*!]"
   java "/\\*\\*"
@@ -2977,7 +2977,7 @@
   "Regexp matching a keyword that is followed by a colon, where
   the whole construct can precede a declaration.
   E.g. \"public:\" in C++."
-  t "\\<\\>"
+  t "a\\`"
   c++ (c-make-keywords-re t (c-lang-const c-protection-kwds)))
 (c-lang-defvar c-decl-start-colon-kwd-re
   (c-lang-const c-decl-start-colon-kwd-re))
@@ -3158,7 +3158,7 @@
   t (if (c-lang-const c-type-modifier-kwds)
 	(concat (regexp-opt (c-lang-const c-type-modifier-kwds) t) "\\>")
       ;; Default to a regexp that never matches.
-      "\\<\\>")
+      "a\\`")
   ;; Check that there's no "=" afterwards to avoid matching tokens
   ;; like "*=".
   (c objc) (concat "\\("
@@ -3196,7 +3196,7 @@
 as the end of the operator.  Identifier syntax is in effect when
 this is matched \(see `c-identifier-syntax-table')."
   t ;; Default to a regexp that never matches.
-    "\\<\\>"
+    "a\\`"
   ;; Check that there's no "=" afterwards to avoid matching tokens
   ;; like "*=".
   (c objc) (concat "\\(\\*\\)"
@@ -3355,7 +3355,7 @@
 (c-lang-defconst c-pre-id-bracelist-key
   "A regexp matching tokens which, preceding an identifier, signify a bracelist.
 "
-  t "\\<\\>"
+  t "a\\`"
   c++ "new\\([^[:alnum:]_$]\\|$\\)\\|&&?\\(\\S.\\|$\\)")
 (c-lang-defvar c-pre-id-bracelist-key (c-lang-const c-pre-id-bracelist-key))
 
@@ -3411,7 +3411,7 @@
 	 ;; before the '{' of the enum list, to avoid searching too far.
 	 "[^][{};/#=]*"
 	 "{")
-      "\\<\\>"))
+      "a\\`"))
 (c-lang-defvar c-enum-clause-introduction-re
 	       (c-lang-const c-enum-clause-introduction-re))
 
@@ -3527,7 +3527,7 @@
   "Regexp matching things that can't occur two symbols before a colon in
 a label construct.  This catches C++'s inheritance construct \"class foo
 : bar\".  Only used if `c-recognize-colon-labels' is set."
-  t "\\<\\>"				; matches nothing
+  t "a\\`"				; matches nothing
   c++ (c-make-keywords-re t '("class")))
 (c-lang-defvar c-nonlabel-token-2-key (c-lang-const c-nonlabel-token-2-key))
 
diff -r 0e6c805bb3ae -r bb8af6c225af cc-vars.el
--- a/cc-vars.el
+++ b/cc-vars.el
@@ -1645,8 +1645,8 @@
   :type 'boolean
   :group 'c)
 
-(defvar c-noise-macro-with-parens-name-re "\\<\\>")
-(defvar c-noise-macro-name-re "\\<\\>")
+(defvar c-noise-macro-with-parens-name-re "a\\`")
+(defvar c-noise-macro-name-re "a\\`")
 
 (defcustom c-noise-macro-names nil
   "A list of names of macros which expand to nothing, or compiler extensions
@@ -1673,7 +1673,7 @@
   ;; Convert `c-noise-macro-names' and `c-noise-macro-with-parens-names' into
   ;; `c-noise-macro-name-re' and `c-noise-macro-with-parens-name-re'.
   (setq c-noise-macro-with-parens-name-re
-	(cond ((null c-noise-macro-with-parens-names) "\\<\\>")
+	(cond ((null c-noise-macro-with-parens-names) "a\\`")
 	      ((consp c-noise-macro-with-parens-names)
 	       (concat (regexp-opt c-noise-macro-with-parens-names t)
 		       "\\([^[:alnum:]_$]\\|$\\)"))
@@ -1682,7 +1682,7 @@
 	      (t (error "c-make-noise-macro-regexps: \
 c-noise-macro-with-parens-names is invalid: %s" c-noise-macro-with-parens-names))))
   (setq c-noise-macro-name-re
-	(cond ((null c-noise-macro-names) "\\<\\>")
+	(cond ((null c-noise-macro-names) "a\\`")
 	      ((consp c-noise-macro-names)
 	       (concat (regexp-opt c-noise-macro-names t)
 		       "\\([^[:alnum:]_$]\\|$\\)"))
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.
                        
                     
                    
                 
             
         
        
        
            
        
        
            
                
                    
                    
                    commit/XEmacs: kehoea: Use `string-match-p' more consistently,
 simple.el.
                
            
            
                7 years, 7 months
            
            
                
                    
                    
                    
                    
                    Bitbucket
                
 
                
                    
                        
                            1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/d6fdd3ac1276/
Changeset:   d6fdd3ac1276
User:        kehoea
Date:        2018-02-18 21:18:52+00:00
Summary:     Use `string-match-p' more consistently, simple.el.
lisp/ChangeLog addition:
2018-02-18  Aidan Kehoe  <kehoea(a)parhasard.net>
	* simple.el (no-case-regexp-p):
	* simple.el (with-search-caps-disable-folding):
	* simple.el (with-interactive-search-caps-disable-folding):
	* simple.el (log-message-filter):
	Use `string-match-p' in these functions, no need to save the match
	data with same.
	* simple.el (clone-process):
	* simple.el (clone-buffer):
	* simple.el (clone-indirect-buffer):
	Ditto; use the same idiom throughout the file when stripping
	trailing <DIGIT+> patterns from strings.
Affected #:  2 files
diff -r 92757c2b823956466492eb913941e96b2cd65c35 -r d6fdd3ac1276b343476887b4e12d0537c9370702 lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
+2018-02-18  Aidan Kehoe  <kehoea(a)parhasard.net>
+
+	* simple.el (no-case-regexp-p):
+	* simple.el (with-search-caps-disable-folding):
+	* simple.el (with-interactive-search-caps-disable-folding):
+	* simple.el (log-message-filter):
+	Use `string-match-p' in these functions, no need to save the match
+	data with same.
+	* simple.el (clone-process):
+	* simple.el (clone-buffer):
+	* simple.el (clone-indirect-buffer):
+	Ditto; use the same idiom throughout the file when stripping
+	trailing <DIGIT+> patterns from strings.
+
 2017-12-25  Aidan Kehoe  <kehoea(a)parhasard.net>
 
 	* hyper-apropos.el (hyper-apropos-grok-variables):
diff -r 92757c2b823956466492eb913941e96b2cd65c35 -r d6fdd3ac1276b343476887b4e12d0537c9370702 lisp/simple.el
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -111,17 +111,16 @@
 
 This is intended to be used by interactive searching code to decide, in a
 do-what-I-mean fashion, whether a given search should be case-sensitive."
-  (let ((case-fold-search nil))
-    (save-match-data
-      (not (or (string-match "\\(^\\|\\\\\\\\\\|[^\\]\\)[[:upper:]]" regexp)
-               (and (string-match "\\[:\\(upp\\|low\\)er:]" regexp)
-                    (condition-case err
-                        (progn
-                          (string-match (substring regexp 0
-                                                   (match-beginning 0)) "")
-                          nil)
-                      (invalid-regexp
-                       (equal "Unmatched [ or [^" (cadr err))))))))))
+  (let ((case-fold-search nil) start)
+    (not (or (string-match-p "\\(^\\|\\\\\\\\\\|[^\\]\\)[[:upper:]]" regexp)
+             (and (setq start (string-match-p "\\[:\\(upp\\|low\\)er:]"
+                                              regexp))
+                  (condition-case err
+                      (progn
+                        (string-match-p (substring regexp 0 start) "")
+                        nil)
+                    (invalid-regexp
+                     (equal "Unmatched [ or [^" (cadr err)))))))))
 
 (defmacro* with-search-caps-disable-folding (string regexp-p &body body)
   "Execute the forms in BODY, respecting `search-caps-disable-folding'.
@@ -138,9 +137,8 @@
           (if (and case-fold-search search-caps-disable-folding)
               (if ,regexp-p
                   (no-case-regexp-p ,string)
-                (save-match-data
-                  (let (case-fold-search)
-                    (not (string-match "[[:upper:]]" ,string)))))
+                (let (case-fold-search)
+                  (not (string-match-p "[[:upper:]]" ,string))))
             case-fold-search)))
      ,@body))
 (put 'with-search-caps-disable-folding 'lisp-indent-function 2)
@@ -155,9 +153,8 @@
                    search-caps-disable-folding)
               (if ,regexp-p
                   (no-case-regexp-p ,string)
-                (save-match-data
-                  (let (case-fold-search)
-                    (not (string-match "[[:upper:]]" ,string)))))
+                (let (case-fold-search)
+                  (not (string-match-p "[[:upper:]]" ,string))))
             case-fold-search)))
      ,@body))
 (put 'with-interactive-search-caps-disable-folding 'lisp-indent-function 2)
@@ -3743,9 +3740,8 @@
 If PROCESS is associated with a buffer, the new process will be associated
   with the current buffer instead.
 Returns nil if PROCESS has already terminated."
-  (setq newname (or newname (process-name process)))
-  (if (string-match "<[0-9]+>\\'" newname)
-      (setq newname (substring newname 0 (match-beginning 0))))
+  (setq newname (or newname (process-name process))
+        newname (subseq newname 0 (string-match-p "<[0-9]+>\\'" newname)))
   (when (memq (process-status process) '(run stop open))
     (let* ((process-connection-type (process-tty-name process))
 	   (old-kwoq (process-kill-without-query process nil))
@@ -3784,9 +3780,8 @@
       (error "Cannot clone a file-visiting buffer"))
   (if (get major-mode 'no-clone)
       (error "Cannot clone a buffer in %s mode" mode-name))
-  (setq newname (or newname (buffer-name)))
-  (if (string-match "<[0-9]+>\\'" newname)
-      (setq newname (substring newname 0 (match-beginning 0))))
+  (setq newname (or newname (buffer-name))
+        newname (subseq newname 0 (string-match-p "<[0-9]+>\\'" newname)))
   (let ((buf (current-buffer))
 	(ptmin (point-min))
 	(ptmax (point-max))
@@ -3796,7 +3791,7 @@
 	(mode major-mode)
 	(lvars (buffer-local-variables))
 	(process (get-buffer-process (current-buffer)))
-	(new (generate-new-buffer (or newname (buffer-name)))))
+	(new (generate-new-buffer newname)))
     (save-restriction
       (widen)
       (with-current-buffer new
@@ -3846,9 +3841,8 @@
   (interactive (list (if current-prefix-arg
 			 (read-string "BName of indirect buffer: "))
 		     t))
-  (setq newname (or newname (buffer-name)))
-  (if (string-match "<[0-9]+>\\'" newname)
-      (setq newname (substring newname 0 (match-beginning 0))))
+  (setq newname (or newname (buffer-name))
+        newname (subseq newname 0 (string-match-p "<[0-9]+>\\'" newname)))
   (let* ((name (generate-new-buffer-name newname))
 	 (buffer (make-indirect-buffer (current-buffer) name t)))
     (when display-flag
@@ -4320,11 +4314,10 @@
 or whose label appears in `log-message-ignore-labels' are not saved."
   (let ((r  log-message-ignore-regexps)
 	(ok (not (memq label log-message-ignore-labels))))
-    (save-match-data
-      (while (and r ok)
-	(when (string-match (car r) message)
-	  (setq ok nil))
-	(setq r (cdr r))))
+    (while (and r ok)
+      (when (string-match-p (car r) message)
+        (setq ok nil))
+      (setq r (cdr r)))
     ok))
 
 (defun log-message-filter-errors-only (label message)
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.