]> git.eshelyaron.com Git - emacs.git/commitdiff
(add-completions-from-c-buffer):
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 7 Oct 2006 15:57:36 +0000 (15:57 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 7 Oct 2006 15:57:36 +0000 (15:57 +0000)
Don't presume an error's second element is a string.
Use looking-at rather than buffer-substring + member.

lisp/ChangeLog
lisp/completion.el

index 1360dc3617c2ffc91300912e6ae32ea3dc799afa..db715a299064287a62b6a6945db689e00147d929 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * completion.el (add-completions-from-c-buffer):
+       Don't presume an error's second element is a string.
+       Use looking-at rather than buffer-substring + member.
+
 2006-10-07  Eli Zaretskii  <eliz@gnu.org>
 
        * mail/rmail.el (rmail-redecode-body): If the old encoding is
@@ -19,8 +25,8 @@
 
 2006-10-07  Johan Bockg\e,be\e(Brd  <bojohan@dd.chalmers.se>
 
-       * mouse-sel.el (mouse-insert-selection-internal): Use
-       insert-for-yank, so that yank handlers are run.
+       * mouse-sel.el (mouse-insert-selection-internal):
+       Use insert-for-yank, so that yank handlers are run.
 
 2006-10-07  Kim F. Storm  <storm@cua.dk>
 
index 64bf8026e9d2c13de100d91108eef4efee49fff8..53dfd7521a595c1687235d98c757ab3d355214d0 100644 (file)
@@ -1885,7 +1885,7 @@ Prefix args ::
     (save-excursion
       (goto-char (point-min))
       (catch 'finish-add-completions
-       (with-syntax-table completion-c-def-syntax-table
+        (with-syntax-table completion-c-def-syntax-table
           (while t
             ;; we loop here only when scan-sexps fails
             ;; (i.e. unbalance exps.)
@@ -1895,8 +1895,7 @@ Prefix args ::
                   (cond
                    ((= (preceding-char) ?#)
                     ;; preprocessor macro, see if it's one we handle
-                    (setq string (buffer-substring (point) (+ (point) 6)))
-                    (cond ((member string '("define" "ifdef "))
+                    (cond ((looking-at "\\(define\\|ifdef\\)\\>")
                            ;; skip forward over definition symbol
                            ;; and add it to database
                            (and (forward-word 2)
@@ -1944,9 +1943,9 @@ Prefix args ::
                (throw 'finish-add-completions t))
               (error
                ;; Check for failure in scan-sexps
-               (if (or (string-equal (nth 1 e)
-                                     "Containing expression ends prematurely")
-                       (string-equal (nth 1 e) "Unbalanced parentheses"))
+               (if (member (nth 1 e)
+                           '("Containing expression ends prematurely"
+                             "Unbalanced parentheses"))
                    ;; unbalanced paren., keep going
                    ;;(ding)
                    (forward-line 1)