summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-11-24 22:20:07 +0000
committerRichard M. Stallman <rms@gnu.org>1995-11-24 22:20:07 +0000
commitc95dbbc81aac0a5996489b9c06d126645b10c84e (patch)
treef9b9a0bcec604720de543252295674cf812193c4
parent423fc49af7e7b302cb73e41153f38be1c05970db (diff)
downloademacs-c95dbbc81aac0a5996489b9c06d126645b10c84e.tar.gz
(cmpl-make-standard-completion-syntax-table)
(cmpl-make-c-def-completion-syntax-table): Use make-syntax-table. (completion-c-mode-hook): Encapsulate C-mode changes in new function. Either call it now or put it on c-mode-hook.
-rw-r--r--lisp/completion.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/completion.el b/lisp/completion.el
index 2c304c15013..55c65a92015 100644
--- a/lisp/completion.el
+++ b/lisp/completion.el
@@ -3,7 +3,7 @@
;; Maintainer: FSF
;; Keywords: abbrev
-;; Author: Jim Salem <salem@think.com> of Thinking Machines Inc.
+;; Author: Jim Salem <alem@bbnplanet.com> of Thinking Machines Inc.
;; (ideas suggested by Brewster Kahle)
;; This file is part of GNU Emacs.
@@ -526,7 +526,7 @@ Used to decide whether to save completions.")
;;;-----------------------------------------------
(defun cmpl-make-standard-completion-syntax-table ()
- (let ((table (make-vector 256 0)) ;; default syntax is whitespace
+ (let ((table (make-syntax-table)) ;; default syntax is whitespace
i)
;; alpha chars
(setq i 0)
@@ -2041,7 +2041,7 @@ Prefix args ::
;;; Everything else has word syntax
(defun cmpl-make-c-def-completion-syntax-table ()
- (let ((table (make-vector 256 0))
+ (let ((table (make-syntax-table))
(whitespace-chars '(? ?\n ?\t ?\f ?\v ?\r))
;; unfortunately the ?( causes the parens to appear unbalanced
(separator-chars '(?, ?* ?= ?\( ?\;
@@ -2624,10 +2624,15 @@ TYPE is the type of the wrapper to be added. Can be :before or :under."
(define-key lisp-mode-map "^" 'self-insert-command)
;;; C mode diffs.
-(def-completion-wrapper electric-c-semi :separator)
-(define-key c-mode-map "+" 'completion-separator-self-insert-command)
-(define-key c-mode-map "*" 'completion-separator-self-insert-command)
-(define-key c-mode-map "/" 'completion-separator-self-insert-command)
+(defun completion-c-mode-hook ()
+ (def-completion-wrapper electric-c-semi :separator)
+ (define-key c-mode-map "+" 'completion-separator-self-insert-command)
+ (define-key c-mode-map "*" 'completion-separator-self-insert-command)
+ (define-key c-mode-map "/" 'completion-separator-self-insert-command))
+;; Do this either now or whenever C mode is loaded.
+(if (featurep 'cc-mode)
+ (completion-c-mode-hook)
+ (add-hook 'c-mode-hook 'completion-c-mode-hook))
;;; FORTRAN mode diffs. (these are defined when fortran is called)
(defun completion-setup-fortran-mode ()