Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
marvel
GitHub Repository: marvel/qnf
Path: blob/master/elisp/auto-complete-1.3/etc/install.el
990 views
1
(require 'cl)
2
3
(when (or (not (featurep 'auto-complete))
4
(yes-or-no-p "You are trying to upgrade auto-complete within an existed Emacs which has loaded its older version.
5
It causes sometimes errors or installation fault. Are you sure? "))
6
(let* ((basedir (file-name-directory (directory-file-name (file-name-directory load-file-name))))
7
(default-dir "~/.emacs.d/")
8
(todir (or (car command-line-args-left)
9
(read-file-name "Install to: " default-dir default-dir)))
10
(basedictdir (concat basedir "/dict"))
11
(todictdir (concat todir "/ac-dict")))
12
(cond
13
((not (file-directory-p basedir))
14
(error "Base directory is not found"))
15
((or (eq (length todir) 0)
16
(not (file-directory-p todir)))
17
(error "To directory is empty or not found"))
18
(t
19
(message "Installing to %s from %s" todir basedir)
20
(add-to-list 'load-path basedir)
21
(make-directory todictdir t)
22
(loop for file in (directory-files basedir t "^.*\\.el$")
23
do (byte-compile-file file))
24
(loop for file in (directory-files basedir t "^.*\\.elc?$")
25
do (copy-file file todir t))
26
(loop for file in (directory-files basedictdir t "^[^\\.]")
27
do (copy-file file todictdir t))
28
29
(let ((msg (concat "Successfully installed!
30
31
Add the following code to your .emacs:
32
33
"
34
(if (and (not (member (expand-file-name todir) load-path))
35
(not (member (concat (expand-file-name todir) "/") load-path)))
36
(format "(add-to-list 'load-path \"%s\")\n" todir)
37
"")
38
"(require 'auto-complete-config)\n"
39
(format "(add-to-list 'ac-dictionary-directories \"%s\")\n" todictdir)
40
"(ac-config-default)\n")))
41
(if noninteractive
42
(princ-list msg)
43
(switch-to-buffer "*Installation Result*")
44
(erase-buffer)
45
(insert msg)))))))
46
47