# HG changeset patch # User Stefan Monnier # Date 1160236656 0 # Node ID 8eaa51e867d91f51c0de3c4564337bc7eda500aa # Parent 5dfa0d3db0767c6af096d8b6ccee26f9eaaf6a39 (add-completions-from-c-buffer): Don't presume an error's second element is a string. Use looking-at rather than buffer-substring + member. diff -r 5dfa0d3db076 -r 8eaa51e867d9 lisp/ChangeLog --- a/lisp/ChangeLog Sat Oct 07 13:30:41 2006 +0000 +++ b/lisp/ChangeLog Sat Oct 07 15:57:36 2006 +0000 @@ -1,3 +1,9 @@ +2006-10-07 Stefan Monnier + + * 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 * mail/rmail.el (rmail-redecode-body): If the old encoding is @@ -19,8 +25,8 @@ 2006-10-07 Johan Bockg,be(Brd - * 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 diff -r 5dfa0d3db076 -r 8eaa51e867d9 lisp/completion.el --- a/lisp/completion.el Sat Oct 07 13:30:41 2006 +0000 +++ b/lisp/completion.el Sat Oct 07 15:57:36 2006 +0000 @@ -1885,7 +1885,7 @@ (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 @@ (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 @@ (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)