;;; completion.el --- dynamic word-completion code
+;; Copyright (C) 1990, 1993 Free Software Foundation, Inc.
-;; Maintainer: bug-completion@think.com
+;; Maintainer: FSF
;; Keywords: abbrev
+;; Author: Jim Salem <salem@think.com> and Brewster Kahle <brewster@think.com>
+;; of Thinking Machines Inc.
-;;; Commentary:
+;; This file is part of GNU Emacs.
-;;; This is a Completion system for GNU Emacs
-;;;
-;;; E-Mail:
-;;; Internet: completion@think.com, bug-completion@think.com
-;;; UUCP: {rutgers,harvard,mit-eddie}!think!completion
-;;;
-;;; If you are a new user, we'd appreciate knowing your site name and
-;;; any comments you have.
-;;;
-;;;
-;;; NO WARRANTY
-;;;
-;;; This software is distributed free of charge and is in the public domain.
-;;; Anyone may use, duplicate or modify this program. Thinking Machines
-;;; Corporation does not restrict in any way the use of this software by
-;;; anyone.
-;;;
-;;; Thinking Machines Corporation provides absolutely no warranty of any kind.
-;;; The entire risk as to the quality and performance of this program is with
-;;; you. In no event will Thinking Machines Corporation be liable to you for
-;;; damages, including any lost profits, lost monies, or other special,
-;;; incidental or consequential damages arising out of the use of this program.
-;;;
-;;; You must not restrict the distribution of this software.
-;;;
-;;; Please keep this notice and author information in any copies you make.
-;;;
-;;; 4/90
-;;;
-;;;
-;;; Advertisement
-;;;---------------
-;;; Try using this. If you are like most you will be happy you did.
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to
+;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Commentary:
;;;
;;; What to put in .emacs
;;;-----------------------
-;;; (load "completion") ;; If it's not part of the standard band.
+;;; (load "completion")
;;; (initialize-completions)
-;;;
-;;; For best results, be sure to byte-compile the file first.
-;;;
-\f
-;;; Authors
-;;;---------
-;;; Jim Salem {salem@think.com}
-;;; Brewster Kahle {brewster@think.com}
-;;; Thinking Machines Corporation
-;;; 245 First St., Cambridge MA 02142 (617) 876-1111
-;;;
-;;; Mailing Lists
-;;;---------------
-;;;
-;;; Bugs to bug-completion@think.com
-;;; Comments to completion@think.com
-;;; Requests to be added completion-request@think.com
-;;;
-;;; Availability
-;;;--------------
-;;; Anonymous FTP from think.com
-;;;
\f
;;;---------------------------------------------------------------------------
;;; Documentation [Slightly out of date]
"True iff the current window is the minibuffer."
(window-minibuffer-p (selected-window)))
+;; This used to be `(eval form)'. Eval FORM at run time now.
(defmacro cmpl-read-time-eval (form)
- ;; Like the #. reader macro
- (eval form))
-
+ form)
;;;-----------------------------------------------
;;; String case coercion
\f
(defun cmpl-hours-since-origin ()
(let ((time (current-time)))
- (+ (* (/ (car time) 3600.0) (lsh 1 16))
- (/ (nth 2 time) 3600.0))))
+ (truncate
+ (+ (* (/ (car time) 3600.0) (lsh 1 16))
+ (/ (nth 2 time) 3600.0)))))
\f
;;;---------------------------------------------------------------------------
;;; "Symbol" parsing functions
(if completion-to-accept (accept-completion))
(setq cmpl-starting-possibilities
(cmpl-prefix-entry-head
- (find-cmpl-prefix-entry (downcase (substring string 0 3))))
+ (find-cmpl-prefix-entry
+ (downcase (substring string 0 completion-prefix-min-length))))
cmpl-test-string string
cmpl-test-regexp (concat (regexp-quote string) "."))
(completion-search-reset-1)
;; Don't accept completions
(setq completion-to-accept nil)
;; print message
- (if (and print-status-p (cmpl19-sit-for 0))
+ ;; This used to call cmpl19-sit-for, an undefined function.
+ ;; I hope that sit-for does the right thing; I don't know -- rms.
+ (if (and print-status-p (sit-for 0))
(message "No %scompletions."
(if (eq this-command last-command) "more " "")))
;; statistics
))
))
+;; There is no point bothering to change this again
+;; unless the package changes so much that it matters
+;; for people that have saved completions.
+(defconst completion-version "11")
+
(defconst saved-cmpl-file-header
";;; Completion Initialization file.
;;; Version = %s
(clear-visited-file-modtime)
(erase-buffer)
;; (/ 1 0)
- (insert (format saved-cmpl-file-header *completion-version*))
+ (insert (format saved-cmpl-file-header completion-version))
(dolist (completion (list-all-completions))
(setq total-in-db (1+ total-in-db))
(setq last-use-time (completion-last-use-time completion))
(defun completion-before-command ()
(funcall (or (get this-command 'completion-function)
'use-completion-under-or-before-point)))
-(add-hook 'before-command-hook 'completion-before-command)
+(add-hook 'pre-command-hook 'completion-before-command)
;;;---------------------------------------------------------------------------