X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/b578f267af27af50e3c091f8c9c9eee939b69978..dcb6bf2b6fd0f4dc2aa3b57efde1badaf1717bd3:/lisp/completion.el diff --git a/lisp/completion.el b/lisp/completion.el index 15274bdc50..e17b01d437 100644 --- a/lisp/completion.el +++ b/lisp/completion.el @@ -1,9 +1,9 @@ ;;; completion.el --- dynamic word-completion code -;; Copyright (C) 1990, 1993, 1995 Free Software Foundation, Inc. +;; Copyright (C) 1990, 1993, 1995, 1997 Free Software Foundation, Inc. ;; Maintainer: FSF -;; Keywords: abbrev +;; Keywords: abbrev convenience ;; Author: Jim Salem of Thinking Machines Inc. ;; (ideas suggested by Brewster Kahle) @@ -214,7 +214,7 @@ ;; ;; ;;----------------------------------------------- -;; Change Log: +;;; Change Log: ;;----------------------------------------------- ;; Sometime in '84 Brewster implemented a somewhat buggy version for ;; Symbolics LISPMs. @@ -279,44 +279,70 @@ ;; User changeable parameters ;;--------------------------------------------------------------------------- -(defvar enable-completion t +(defgroup completion nil + "Dynamic word-completion code." + :group 'matching + :group 'convenience) + + +(defcustom enable-completion t "*Non-nil means enable recording and saving of completions. -If nil, no new words added to the database or saved to the init file.") +If nil, no new words added to the database or saved to the init file." + :type 'boolean + :group 'completion) -(defvar save-completions-flag t +(defcustom save-completions-flag t "*Non-nil means save most-used completions when exiting Emacs. -See also `saved-completions-retention-time'.") +See also `save-completions-retention-time'." + :type 'boolean + :group 'completion) -(defvar save-completions-file-name (convert-standard-filename "~/.completions") - "*The filename to save completions to.") +(defcustom save-completions-file-name (convert-standard-filename "~/.completions") + "*The filename to save completions to." + :type 'file + :group 'completion) -(defvar save-completions-retention-time 336 +(defcustom save-completions-retention-time 336 "*Discard a completion if unused for this many hours. \(1 day = 24, 1 week = 168). If this is 0, non-permanent completions -will not be saved unless these are used. Default is two weeks.") +will not be saved unless these are used. Default is two weeks." + :type 'integer + :group 'completion) -(defvar completion-on-separator-character nil +(defcustom completion-on-separator-character nil "*Non-nil means separator characters mark previous word as used. -This means the word will be saved as a completion.") +This means the word will be saved as a completion." + :type 'boolean + :group 'completion) -(defvar completions-file-versions-kept kept-new-versions - "*Number of versions to keep for the saved completions file.") +(defcustom completions-file-versions-kept kept-new-versions + "*Number of versions to keep for the saved completions file." + :type 'integer + :group 'completion) -(defvar completion-prompt-speed-threshold 4800 - "*Minimum output speed at which to display next potential completion.") +(defcustom completion-prompt-speed-threshold 4800 + "*Minimum output speed at which to display next potential completion." + :type 'integer + :group 'completion) -(defvar completion-cdabbrev-prompt-flag nil +(defcustom completion-cdabbrev-prompt-flag nil "*If non-nil, the next completion prompt does a cdabbrev search. -This can be time consuming.") +This can be time consuming." + :type 'boolean + :group 'completion) -(defvar completion-search-distance 15000 +(defcustom completion-search-distance 15000 "*How far to search in the buffer when looking for completions. -In number of characters. If nil, search the whole buffer.") +In number of characters. If nil, search the whole buffer." + :type 'integer + :group 'completion) -(defvar completions-merging-modes '(lisp c) +(defcustom completions-merging-modes '(lisp c) "*List of modes {`c' or `lisp'} for automatic completions merging. Definitions from visited files which have these modes -are automatically added to the completion database.") +are automatically added to the completion database." + :type '(set (const lisp) (const c)) + :group 'completion) ;;(defvar *record-cmpl-statistics-p* nil ;; "*If non-nil, record completion statistics.") @@ -470,9 +496,7 @@ Used to decide whether to save completions.") (defun cmpl-hours-since-origin () (let ((time (current-time))) - (truncate - (+ (* (/ (car time) 3600.0) (lsh 1 16)) - (/ (nth 2 time) 3600.0))))) + (floor (+ (* 65536.0 (nth 0 time)) (nth 1 time)) 3600))) ;;--------------------------------------------------------------------------- ;; "Symbol" parsing functions @@ -528,8 +552,13 @@ Used to decide whether to save completions.") ;;----------------------------------------------- (defun cmpl-make-standard-completion-syntax-table () - (let ((table (make-syntax-table)) ;; default syntax is whitespace + (let ((table (make-syntax-table)) i) + ;; Default syntax is whitespace. + (setq i 0) + (while (< i 256) + (modify-syntax-entry i " " table) + (setq i (1+ i))) ;; alpha chars (setq i 0) (while (< i 26) @@ -2612,6 +2641,10 @@ TYPE is the type of the wrapper to be added. Can be :before or :under." (define-key lisp-mode-map "=" 'self-insert-command) (define-key lisp-mode-map "^" 'self-insert-command) +;; Avoid warnings. +(defvar c-mode-map) +(defvar fortran-mode-map) + ;; C mode diffs. (defun completion-c-mode-hook () (def-completion-wrapper electric-c-semi :separator) @@ -2671,4 +2704,6 @@ TYPE is the type of the wrapper to be added. Can be :before or :under." (cmpl-statistics-block (record-completion-file-loaded)) +(provide 'completion) + ;;; completion.el ends here