diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2006-10-07 15:57:36 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2006-10-07 15:57:36 +0000 |
commit | 612f91f027769219cc008abec1a8be3bb0c1b668 (patch) | |
tree | 5c708ef4f62edf1067bb30301403db56ff85bc6f /lisp/completion.el | |
parent | 0736daff192c99532171587b6f81ee0304a9e06b (diff) | |
download | emacs-612f91f027769219cc008abec1a8be3bb0c1b668.tar.gz |
(add-completions-from-c-buffer):
Don't presume an error's second element is a string.
Use looking-at rather than buffer-substring + member.
Diffstat (limited to 'lisp/completion.el')
-rw-r--r-- | lisp/completion.el | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lisp/completion.el b/lisp/completion.el index 64bf8026e9d..53dfd7521a5 100644 --- a/lisp/completion.el +++ b/lisp/completion.el @@ -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) |