• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/

Lines Matching +defs:file +defs:tail

11 ;; This file is part of GNU Emacs.
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
61 ;; You automatically save the completions you use to a file between
77 ;; When you load this file, completion will be on. I suggest you use the
87 ;; a completions database for a saved completions file
90 ;; the saved completion file.
102 ;; versions kept of the saved completions file is controlled by
103 ;; completions-file-versions-kept.
126 ;; m-x add-completions-from-lisp-file
127 ;; Parses all the definition names from a C or Lisp mode file and
148 ;; site's standard site-init file.
186 ;; Loads the completions file and sets up so that exiting emacs will
189 ;; save-completions-to-file &optional filename
190 ;; load-completions-from-file &optional filename
247 ;; - Fix broken completion merging (in save-completions-to-file)
261 ;; - Fixed bug with saving out .completion file the first time
276 ;; - added backup protection to save-completions-to-file (prevents
294 If nil, no new words are added to the database or saved to the init file."
304 (defcustom save-completions-file-name
307 ((file-readable-p olddef) olddef)
308 ((file-directory-p (convert-standard-filename "~/.emacs.d/"))
310 (expand-file-name "completions" "~/.emacs.d/")))
313 :type 'file
329 (defcustom completions-file-versions-kept kept-new-versions
330 "Number of versions to keep for the saved completions file."
383 Indicates that the old completion file has been read in.")
722 (defconst cmpl-source-init-file 1)
723 (defconst cmpl-source-file-parsing 2)
743 ;; We simply search backwards through the file looking for words which
758 ;; "Return t if the cdabbrev search has wrapped around the file.")
920 ;; the value of the symbol is nil or a cons of head and tail pointers
992 ;; A cons of (head . tail)
998 (defalias 'cmpl-prefix-entry-tail 'cdr)
1005 (defmacro set-cmpl-prefix-entry-tail (prefix-entry new-tail)
1006 (list 'setcdr prefix-entry new-tail))
1149 (defun add-completion-to-tail-if-new (string)
1169 (setcdr (cmpl-prefix-entry-tail prefix-entry) entry)
1170 (set-cmpl-prefix-entry-tail prefix-entry entry))
1205 ;; fix up tail if necessary
1206 (set-cmpl-prefix-entry-tail prefix-entry splice-ptr))
1248 ;; fix up tail if necessary
1249 (set-cmpl-prefix-entry-tail prefix-entry splice-ptr)))
1291 ;; (add-completion-to-tail-if-new "banana") --> ("banana" 0 nil 0)
1294 ;; (add-completion-to-tail-if-new "banish") --> ("banish" 0 nil 0)
1715 (defun add-completions-from-file (file)
1718 (setq file (expand-file-name file))
1719 (let* ((buffer (get-file-buffer file))
1723 (setq buffer (find-file-noselect file))))
1732 (let ((current-completion-source cmpl-source-file-parsing)
1735 (aref completion-add-count-vector cmpl-source-file-parsing)))
1747 (record-cmpl-parse-file
1749 (- (aref completion-add-count-vector cmpl-source-file-parsing)
1752 ;; Find file hook
1753 (defun completion-find-file-hook ()
1779 (add-completion-to-tail-if-new string))
1816 (add-completion-to-tail-if-new string)))
1822 ;; C file completion parsing
1922 (add-completion-to-tail-if-new string)))))
1941 (add-completion-to-tail-if-new string)
1948 (add-completion-to-tail-if-new string)))
1979 ;; The version of save-completions-to-file called at kill-emacs time.
1986 (save-completions-to-file))))
1994 (defconst saved-cmpl-file-header
1995 ";;; Completion Initialization file.
2000 ;; If it is t, the completion will never be pruned from the file.
2007 (defun save-completions-to-file (&optional filename)
2008 "Save completions in init file FILENAME.
2009 If file name is not specified, use `save-completions-file-name'."
2011 (setq filename (expand-file-name (or filename save-completions-file-name)))
2012 (if (file-writable-p filename)
2016 (message "Saving completions to file %s" filename)
2020 (kept-new-versions completions-file-versions-kept)
2029 (setq buffer-file-name filename)
2031 (if (not (verify-visited-file-modtime (current-buffer)))
2033 ;; file has changed on disk. Bring us up-to-date
2034 (message "Completion file has changed. Merging. . .")
2035 (load-completions-from-file filename t)
2036 (message "Merging finished. Saving completions to file %s" filename)))
2039 (clear-visited-file-modtime)
2042 (insert (format saved-cmpl-file-header completion-version))
2046 ;; Update num uses and maybe write completion to a file
2047 (cond ((or;; Write to file if
2062 ;; write to file
2069 (let ((file-exists-p (file-exists-p filename)))
2070 (if file-exists-p
2072 ;; If file exists . . .
2074 ;; (GNU leaves a 0 length file if it gets a disk full error!)
2077 ;; {If backup exists the primary file is probably messed up}
2078 (or (file-exists-p backup-filename)
2079 (rename-file filename backup-filename))
2082 (copy-file backup-filename filename t)))
2085 (if file-exists-p
2087 (delete-file backup-filename)))
2090 (message "Couldn't save completion file `%s'" filename)))
2101 ;; (save-completions-to-file)))
2105 (defun load-completions-from-file (&optional filename no-message-p)
2106 "Load a completion init file FILENAME.
2107 If file is not specified, then use `save-completions-file-name'."
2109 (setq filename (expand-file-name (or filename save-completions-file-name)))
2111 (backup-readable-p (file-readable-p backup-filename)))
2113 (if (file-readable-p filename)
2119 (setq buffer-file-name filename)
2121 (clear-visited-file-modtime)
2128 (current-completion-source cmpl-source-init-file)
2131 (aref completion-add-count-vector cmpl-source-file-parsing)))
2132 (total-in-file 0) (total-perm 0))
2133 ;; insert the file into a buffer
2135 (progn (insert-file-contents filename t)
2138 (file-error
2139 (message "File error trying to load completion file %s."
2149 (setq total-in-file (1+ total-in-file))
2166 (add-completion-to-tail-if-new string))))
2182 (message "End of file while reading completions."))
2183 (end-of-file
2186 (message "Loading completions from file %s . . . Done."
2188 (message "End of file while reading completions."))))))
2192 total-in-file total-perm
2193 (- (aref completion-add-count-vector cmpl-source-init-file)
2198 "Load the default completions file.
2199 Also sets up so that exiting Emacs will automatically save the file."
2202 (load-completions-from-file)
2368 (dolist (x '((find-file-hook . completion-find-file-hook)
2451 (record-completion-file-loaded))