aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/completion.el49
1 files changed, 19 insertions, 30 deletions
diff --git a/lisp/completion.el b/lisp/completion.el
index f076f0dbf19..9d478e78630 100644
--- a/lisp/completion.el
+++ b/lisp/completion.el
@@ -333,8 +333,7 @@
333 333
334(defvar *completep* t 334(defvar *completep* t
335 "*Set to nil to turn off the completion hooks. 335 "*Set to nil to turn off the completion hooks.
336(No new words added to the database or saved to the init file)." 336(No new words added to the database or saved to the init file).")
337 )
338 337
339(defvar *save-completions-p* t 338(defvar *save-completions-p* t
340 "*If non-nil, the most useful completions are saved to disk when 339 "*If non-nil, the most useful completions are saved to disk when
@@ -344,10 +343,9 @@ exiting EMACS. See *saved-completions-decay-factor*.")
344 "*The filename to save completions to.") 343 "*The filename to save completions to.")
345 344
346(defvar *saved-completion-retention-time* 336 345(defvar *saved-completion-retention-time* 336
347 "*The maximum amout of time to save a completion for if it has not been used. 346 "*The maximum amount of time to save a completion for if it has not been used.
348In hours. (1 day = 24, 1 week = 168). If this is 0, non-permanent completions 347In hours. (1 day = 24, 1 week = 168). If this is 0, non-permanent completions
349will not be saved unless these are used. Default is two weeks." 348will not be saved unless these are used. Default is two weeks.")
350 )
351 349
352(defvar *separator-character-uses-completion-p* nil 350(defvar *separator-character-uses-completion-p* nil
353 "*If non-nil, typing a separator character after a completion symbol that 351 "*If non-nil, typing a separator character after a completion symbol that
@@ -363,7 +361,7 @@ after inserting the current one."
363 ) 361 )
364 362
365(defvar *print-next-completion-does-cdabbrev-search-p* nil 363(defvar *print-next-completion-does-cdabbrev-search-p* nil
366 "*If non-NIL, the next completion prompt will also do a cdabbrev search. 364 "*If non-nil, the next completion prompt will also do a cdabbrev search.
367This can be time consuming.") 365This can be time consuming.")
368 366
369(defvar *cdabbrev-radius* 15000 367(defvar *cdabbrev-radius* 15000
@@ -371,7 +369,7 @@ This can be time consuming.")
371whole buffer is searched.") 369whole buffer is searched.")
372 370
373(defvar *modes-for-completion-find-file-hook* '(lisp c) 371(defvar *modes-for-completion-find-file-hook* '(lisp c)
374 "*A list of modes {either c or lisp}. Definitions from visited files 372 "*A list of modes {either C or Lisp}. Definitions from visited files
375of those types are automatically added to the completion database.") 373of those types are automatically added to the completion database.")
376 374
377(defvar *record-cmpl-statistics-p* nil 375(defvar *record-cmpl-statistics-p* nil
@@ -396,8 +394,7 @@ DON'T CHANGE WITHOUT RECOMPILING ! This is used by macros.")
396(defmacro eval-when-compile-load-eval (&rest body) 394(defmacro eval-when-compile-load-eval (&rest body)
397 ;; eval everything before expanding 395 ;; eval everything before expanding
398 (mapcar 'eval body) 396 (mapcar 'eval body)
399 (cons 'progn body) 397 (cons 'progn body))
400 )
401 398
402(defun completion-eval-when () 399(defun completion-eval-when ()
403 (eval-when-compile-load-eval 400 (eval-when-compile-load-eval
@@ -406,8 +403,7 @@ DON'T CHANGE WITHOUT RECOMPILING ! This is used by macros.")
406 (setq *completion-max-length* 200) 403 (setq *completion-max-length* 200)
407 (setq *completion-prefix-min-length* 3) 404 (setq *completion-prefix-min-length* 3)
408 ;; Need this file around too 405 ;; Need this file around too
409 (require 'cl) 406 (require 'cl)))
410 )) ;; eval-when
411 407
412(completion-eval-when) 408(completion-eval-when)
413 409
@@ -416,8 +412,8 @@ DON'T CHANGE WITHOUT RECOMPILING ! This is used by macros.")
416;;;--------------------------------------------------------------------------- 412;;;---------------------------------------------------------------------------
417 413
418(defvar cmpl-initialized-p nil 414(defvar cmpl-initialized-p nil
419 "Set to t when the completion system is initialized. Indicates that the old 415 "Set to t when the completion system is initialized. Indicates that the
420completion file has been read in.") 416old completion file has been read in.")
421 417
422(defvar cmpl-completions-accepted-p nil 418(defvar cmpl-completions-accepted-p nil
423 "Set to T as soon as the first completion has been accepted. Used to 419 "Set to T as soon as the first completion has been accepted. Used to
@@ -434,8 +430,7 @@ decide whether to save completions.")
434 430
435(defun remove (item list) 431(defun remove (item list)
436 (setq list (copy-sequence list)) 432 (setq list (copy-sequence list))
437 (delq item list) 433 (delq item list))
438 )
439 434
440(defun minibuffer-window-selected-p () 435(defun minibuffer-window-selected-p ()
441 "True iff the current window is the minibuffer." 436 "True iff the current window is the minibuffer."
@@ -447,18 +442,15 @@ decide whether to save completions.")
447 ;; autoloaded. 442 ;; autoloaded.
448 (and (listp (symbol-function symbol)) 443 (and (listp (symbol-function symbol))
449 (eq 'autoload (car (symbol-function symbol))) 444 (eq 'autoload (car (symbol-function symbol)))
450 )) 445 )))
451) ;; eval-when
452 446
453(defun function-defined-and-loaded (symbol) 447(defun function-defined-and-loaded (symbol)
454 ;; True iff symbol is bound to a loaded function. 448 ;; True iff symbol is bound to a loaded function.
455 (and (fboundp symbol) (not (function-needs-autoloading-p symbol))) 449 (and (fboundp symbol) (not (function-needs-autoloading-p symbol))))
456 )
457 450
458(defmacro read-time-eval (form) 451(defmacro read-time-eval (form)
459 ;; Like the #. reader macro 452 ;; Like the #. reader macro
460 (eval form) 453 (eval form))
461 )
462 454
463;;;----------------------------------------------- 455;;;-----------------------------------------------
464;;; Emacs Version 19 compatibility 456;;; Emacs Version 19 compatibility
@@ -626,7 +618,7 @@ WHERE is either :BEFORE or :AFTER."
626(defvar cmpl-emacs-idle-process nil) 618(defvar cmpl-emacs-idle-process nil)
627 619
628(defvar cmpl-emacs-idle-interval 150 620(defvar cmpl-emacs-idle-interval 150
629 "Seconds between running the emacs idle process.") 621 "Seconds between running the Emacs idle process.")
630 622
631(defun init-cmpl-emacs-idle-process () 623(defun init-cmpl-emacs-idle-process ()
632 "Initialize the emacs idle process." 624 "Initialize the emacs idle process."
@@ -667,7 +659,7 @@ WHERE is either :BEFORE or :AFTER."
667 )) 659 ))
668 660
669(defvar cmpl-emacs-idle-time 0 661(defvar cmpl-emacs-idle-time 0
670 "The idle time of emacs in seconds.") 662 "The idle time of Emacs in seconds.")
671 663
672(defvar inside-cmpl-emacs-idle-filter nil) 664(defvar inside-cmpl-emacs-idle-filter nil)
673(defvar cmpl-emacs-idle-time-hooks nil) 665(defvar cmpl-emacs-idle-time-hooks nil)
@@ -696,7 +688,7 @@ WHERE is either :BEFORE or :AFTER."
696;;;----------------------------------------------- 688;;;-----------------------------------------------
697;;; Time 689;;; Time
698;;;----------------------------------------------- 690;;;-----------------------------------------------
699;;; What a backwards way to get the time ! Unfortunately, GNU Emacs 691;;; What a backwards way to get the time! Unfortunately, GNU Emacs
700;;; doesn't have an accessible time function. 692;;; doesn't have an accessible time function.
701 693
702(defconst cmpl-hours-per-day 24) 694(defconst cmpl-hours-per-day 24)
@@ -708,8 +700,7 @@ WHERE is either :BEFORE or :AFTER."
708(defconst cmpl-days-since-start-of-leap-year 700(defconst cmpl-days-since-start-of-leap-year
709 '(0 31 60 91 121 152 182 213 244 274 305 335)) 701 '(0 31 60 91 121 152 182 213 244 274 305 335))
710(defconst cmpl-months 702(defconst cmpl-months
711 '("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec") 703 '("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"))
712 )
713 704
714(defun cmpl-hours-since-1900-internal (month day year hours) 705(defun cmpl-hours-since-1900-internal (month day year hours)
715 "Month is an integer from 1 to 12. Year is a two digit integer (19XX)" 706 "Month is an integer from 1 to 12. Year is a two digit integer (19XX)"
@@ -723,8 +714,7 @@ WHERE is either :BEFORE or :AFTER."
723 cmpl-days-since-start-of-leap-year 714 cmpl-days-since-start-of-leap-year
724 cmpl-days-since-start-of-year))) 715 cmpl-days-since-start-of-year)))
725 (* (1- day) cmpl-hours-per-day) 716 (* (1- day) cmpl-hours-per-day)
726 hours 717 hours))
727 ))
728 718
729(defun cmpl-month-from-string (month-string) 719(defun cmpl-month-from-string (month-string)
730 "Month string is a three char. month string" 720 "Month string is a three char. month string"
@@ -745,8 +735,7 @@ WHERE is either :BEFORE or :AFTER."
745 (year (string-to-int (substring string 22 24))) 735 (year (string-to-int (substring string 22 24)))
746 (hour (string-to-int (substring string 11 13))) 736 (hour (string-to-int (substring string 11 13)))
747 ) 737 )
748 (cmpl-hours-since-1900-internal month day year hour) 738 (cmpl-hours-since-1900-internal month day year hour)))
749 ))
750 739
751;;; Tests - 740;;; Tests -
752;;;(cmpl-hours-since-1900 "Wed Jan 1 00:00:28 1900") --> 35040 741;;;(cmpl-hours-since-1900 "Wed Jan 1 00:00:28 1900") --> 35040