ruby_learner 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +58 -0
- data/LICENSE.txt +21 -0
- data/README.md +65 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/new_terminal +25 -0
- data/bin/setup +8 -0
- data/docs/happy_ruby/RussOlsen_EloquentRuby_c1.pdf +0 -0
- data/docs/happy_ruby/RussOlsen_EloquentRuby_c5.pdf +0 -0
- data/docs/happy_ruby/TanoshiiRuby_v3_c23.pdf +0 -0
- data/docs/happy_ruby/TanoshiiRuby_v5_c1.pdf +0 -0
- data/docs/happy_ruby/TanoshiiRuby_v5_c2-3.pdf +0 -0
- data/docs/happy_ruby/c2.ipynb +479 -0
- data/docs/happy_ruby/c3_4.ipynb +237 -0
- data/docs/seminar/8-1.org +18 -0
- data/exe/ruby_learner +5 -0
- data/lib/ruby_learner/h.rb +14 -0
- data/lib/ruby_learner/methods.rb +131 -0
- data/lib/ruby_learner/random_h.rb +16 -0
- data/lib/ruby_learner/ruby_learner.rb +43 -0
- data/lib/ruby_learner/sequential_h.rb +15 -0
- data/lib/ruby_learner/typing_practice.rb +21 -0
- data/lib/ruby_learner/version.rb +3 -0
- data/questions/random_check/.rspec +1 -0
- data/questions/random_check/random_h.rb +16 -0
- data/questions/random_check/section_1/.rspec +1 -0
- data/questions/random_check/section_1/lib/answer.rb +15 -0
- data/questions/random_check/section_1/lib/sentence.org +9 -0
- data/questions/random_check/section_1/lib/workplace.rb +5 -0
- data/questions/random_check/section_1/spec/spec_helper.rb +100 -0
- data/questions/random_check/section_1/spec/workplace_spec.rb +10 -0
- data/questions/random_check/section_2/.rspec +1 -0
- data/questions/random_check/section_2/lib/answer.rb +17 -0
- data/questions/random_check/section_2/lib/sentence.org +12 -0
- data/questions/random_check/section_2/lib/workplace.rb +5 -0
- data/questions/random_check/section_2/spec/.rspec +1 -0
- data/questions/random_check/section_2/spec/spec_helper.rb +100 -0
- data/questions/random_check/section_2/spec/workplace_spec.rb +11 -0
- data/questions/sequential_check/section_1/part_1/lib/answer.rb +9 -0
- data/questions/sequential_check/section_1/part_1/lib/sentence.org +9 -0
- data/questions/sequential_check/section_1/part_1/lib/workplace.rb +5 -0
- data/questions/sequential_check/section_1/part_1/spec/spec_helper.rb +100 -0
- data/questions/sequential_check/section_1/part_1/spec/workplace_spec.rb +10 -0
- data/questions/sequential_check/section_1/part_2/lib/answer.rb +16 -0
- data/questions/sequential_check/section_1/part_2/lib/sentence.org +12 -0
- data/questions/sequential_check/section_1/part_2/lib/workplace.rb +5 -0
- data/questions/sequential_check/section_1/part_2/spec/.rspec +1 -0
- data/questions/sequential_check/section_1/part_2/spec/spec_helper.rb +100 -0
- data/questions/sequential_check/section_1/part_2/spec/workplace_spec.rb +11 -0
- data/ruby_learner.gemspec +41 -0
- data/takahashi/docs/README.org +139 -0
- data/takahashi/docs/drill.html +875 -0
- data/takahashi/docs/drill.html~ +877 -0
- data/takahashi/docs/drill.org +446 -0
- data/takahashi/docs/ruby_for_beginner.html +2642 -0
- data/takahashi/docs/ruby_for_beginner.org +1430 -0
- data/takahashi/sample_prog/answer/10_1.rb +5 -0
- data/takahashi/sample_prog/answer/11_1.rb +5 -0
- data/takahashi/sample_prog/answer/11_2.rb +4 -0
- data/takahashi/sample_prog/answer/1_1.rb +1 -0
- data/takahashi/sample_prog/answer/1_2.rb +1 -0
- data/takahashi/sample_prog/answer/1_3.rb +1 -0
- data/takahashi/sample_prog/answer/2_1.rb +5 -0
- data/takahashi/sample_prog/answer/2_2.rb +12 -0
- data/takahashi/sample_prog/answer/3_1.rb +10 -0
- data/takahashi/sample_prog/answer/4_1.rb +7 -0
- data/takahashi/sample_prog/answer/5_1.rb +6 -0
- data/takahashi/sample_prog/answer/5_2.rb +3 -0
- data/takahashi/sample_prog/answer/6_1.rb +3 -0
- data/takahashi/sample_prog/answer/6_2.rb +5 -0
- data/takahashi/sample_prog/answer/6_3.rb +5 -0
- data/takahashi/sample_prog/answer/6_4.rb +7 -0
- data/takahashi/sample_prog/answer/7_1.rb +3 -0
- data/takahashi/sample_prog/answer/7_2.rb +8 -0
- data/takahashi/sample_prog/answer/9_1.rb +3 -0
- data/takahashi/sample_prog/answer/9_2.rb +5 -0
- data/takahashi/sample_prog/answer/9_3.rb +10 -0
- data/takahashi/sample_prog/answer/hello.rb +3 -0
- data/workshop/.rspec +1 -0
- data/workshop/emacs.d/ac-comphist.dat +50 -0
- data/workshop/emacs.d/cp5022x.el +156 -0
- data/workshop/emacs.d/elpa/archives/gnu/archive-contents +1240 -0
- data/workshop/emacs.d/elpa/archives/melpa/archive-contents +2 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/auto-complete-autoloads.el +65 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/auto-complete-config.el +551 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/auto-complete-config.elc +0 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/auto-complete-pkg.el +6 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/auto-complete.el +2164 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/auto-complete.elc +0 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/ada-mode +72 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/c++-mode +99 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/c-mode +55 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/caml-mode +231 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/clojure-mode +580 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/clojurescript-mode +475 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/coq-mode +278 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/css-mode +874 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/erlang-mode +216 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/ess-julia-mode +37 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/go-mode +25 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/haskell-mode +679 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/java-mode +53 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/js-mode +148 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/julia-mode +37 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/lua-mode +21 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/nim-mode +70 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/objc-mode +161 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/octave-mode +46 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/php-mode +6144 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/python-mode +379 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/qml-mode +183 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/ruby-mode +181 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/scala-mode +1347 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/scheme-mode +216 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/sclang-mode +1481 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/sh-mode +182 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/swift-mode +87 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/tcl-mode +172 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/ts-mode +797 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/tuareg-mode +231 -0
- data/workshop/emacs.d/elpa/auto-complete-20170124.1845/dict/verilog-mode +313 -0
- data/workshop/emacs.d/elpa/better-defaults-20170613.2104/better-defaults-autoloads.el +16 -0
- data/workshop/emacs.d/elpa/better-defaults-20170613.2104/better-defaults-pkg.el +2 -0
- data/workshop/emacs.d/elpa/better-defaults-20170613.2104/better-defaults.el +90 -0
- data/workshop/emacs.d/elpa/better-defaults-20170613.2104/better-defaults.elc +0 -0
- data/workshop/emacs.d/elpa/haml-mode-20170923.2153/haml-mode-autoloads.el +26 -0
- data/workshop/emacs.d/elpa/haml-mode-20170923.2153/haml-mode-pkg.el +2 -0
- data/workshop/emacs.d/elpa/haml-mode-20170923.2153/haml-mode.el +877 -0
- data/workshop/emacs.d/elpa/haml-mode-20170923.2153/haml-mode.elc +0 -0
- data/workshop/emacs.d/elpa/haml-mode-readme.txt +8 -0
- data/workshop/emacs.d/elpa/material-theme-20171123.1040/material-light-theme.el +918 -0
- data/workshop/emacs.d/elpa/material-theme-20171123.1040/material-light-theme.elc +0 -0
- data/workshop/emacs.d/elpa/material-theme-20171123.1040/material-theme-autoloads.el +32 -0
- data/workshop/emacs.d/elpa/material-theme-20171123.1040/material-theme-pkg.el +8 -0
- data/workshop/emacs.d/elpa/material-theme-20171123.1040/material-theme.el +912 -0
- data/workshop/emacs.d/elpa/material-theme-20171123.1040/material-theme.elc +0 -0
- data/workshop/emacs.d/elpa/ox-bibtex-chinese-readme.txt +21 -0
- data/workshop/emacs.d/elpa/popup-20160709.729/popup-autoloads.el +15 -0
- data/workshop/emacs.d/elpa/popup-20160709.729/popup-pkg.el +2 -0
- data/workshop/emacs.d/elpa/popup-20160709.729/popup.el +1432 -0
- data/workshop/emacs.d/elpa/popup-20160709.729/popup.elc +0 -0
- data/workshop/emacs.d/elpa/yaml-mode-20180212.1556/yaml-mode-autoloads.el +33 -0
- data/workshop/emacs.d/elpa/yaml-mode-20180212.1556/yaml-mode-pkg.el +2 -0
- data/workshop/emacs.d/elpa/yaml-mode-20180212.1556/yaml-mode.el +470 -0
- data/workshop/emacs.d/elpa/yaml-mode-20180212.1556/yaml-mode.elc +0 -0
- data/workshop/emacs.d/elpa/yaml-mode-readme.txt +25 -0
- data/workshop/emacs.d/haml-mode-master/.gitignore +1 -0
- data/workshop/emacs.d/haml-mode-master/.mailmap +2 -0
- data/workshop/emacs.d/haml-mode-master/MIT-LICENSE +20 -0
- data/workshop/emacs.d/haml-mode-master/README.md +47 -0
- data/workshop/emacs.d/haml-mode-master/haml-mode.el +887 -0
- data/workshop/emacs.d/iceberg_theme.el +202 -0
- data/workshop/emacs.d/init-open-recentf.el +133 -0
- data/workshop/emacs.d/init.el +229 -0
- data/workshop/emacs.d/inits/line-num.el +264 -0
- data/workshop/emacs.d/install-elisp.el +366 -0
- data/workshop/emacs.d/markdown-mode/markdown-mode.el +5978 -0
- data/workshop/emacs.d/notes +12 -0
- data/workshop/emacs.d/processing-mode/processing-mode.el +275 -0
- data/workshop/emacs.d/recentf +31 -0
- data/workshop/emacs.d/ruby-mode/inf-ruby.el +416 -0
- data/workshop/emacs.d/ruby-mode/rdoc-mode.el +130 -0
- data/workshop/emacs.d/ruby-mode/ruby-electric.el +205 -0
- data/workshop/emacs.d/ruby-mode/ruby-mode.el +1496 -0
- data/workshop/emacs.d/ruby-mode/ruby-style.el +78 -0
- data/workshop/emacs.d/ruby-mode/rubydb2x.el +104 -0
- data/workshop/emacs.d/ruby-mode/rubydb3x.el +115 -0
- data/workshop/emacs.d/ruby_learner_init.el +244 -0
- data/workshop/emacs.d/themes/dracula-theme.el +431 -0
- data/workshop/emacs.d/themes/iceberg-theme.el +205 -0
- data/workshop/emacs.d/themes/my-misterioso-theme.el +109 -0
- data/workshop/emacs.d/themes/my-wombat-theme.el +121 -0
- data/workshop/emacs.d/wiki-mode/wiki.el +976 -0
- data/workshop/emacs_help.org +34 -0
- data/workshop/lib/answer.rb +1 -0
- data/workshop/lib/sentence.org +1 -0
- data/workshop/lib/workplace.rb +1 -0
- data/workshop/restore/empty.rb +0 -0
- data/workshop/spec/spec_helper.rb +100 -0
- data/workshop/spec/workplace_spec.rb +1 -0
- data/workshop/training_data.txt +3 -0
- metadata +343 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
;;; auto-complete-autoloads.el --- automatically extracted autoloads
|
2
|
+
;;
|
3
|
+
;;; Code:
|
4
|
+
(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
|
5
|
+
|
6
|
+
;;;### (autoloads nil "auto-complete" "auto-complete.el" (23223 10762
|
7
|
+
;;;;;; 698347 514000))
|
8
|
+
;;; Generated autoloads from auto-complete.el
|
9
|
+
|
10
|
+
(autoload 'auto-complete "auto-complete" "\
|
11
|
+
Start auto-completion at current point.
|
12
|
+
|
13
|
+
\(fn &optional SOURCES)" t nil)
|
14
|
+
|
15
|
+
(autoload 'auto-complete-mode "auto-complete" "\
|
16
|
+
AutoComplete mode
|
17
|
+
|
18
|
+
\(fn &optional ARG)" t nil)
|
19
|
+
|
20
|
+
(defvar global-auto-complete-mode nil "\
|
21
|
+
Non-nil if Global Auto-Complete mode is enabled.
|
22
|
+
See the `global-auto-complete-mode' command
|
23
|
+
for a description of this minor mode.
|
24
|
+
Setting this variable directly does not take effect;
|
25
|
+
either customize it (see the info node `Easy Customization')
|
26
|
+
or call the function `global-auto-complete-mode'.")
|
27
|
+
|
28
|
+
(custom-autoload 'global-auto-complete-mode "auto-complete" nil)
|
29
|
+
|
30
|
+
(autoload 'global-auto-complete-mode "auto-complete" "\
|
31
|
+
Toggle Auto-Complete mode in all buffers.
|
32
|
+
With prefix ARG, enable Global Auto-Complete mode if ARG is positive;
|
33
|
+
otherwise, disable it. If called from Lisp, enable the mode if
|
34
|
+
ARG is omitted or nil.
|
35
|
+
|
36
|
+
Auto-Complete mode is enabled in all buffers where
|
37
|
+
`auto-complete-mode-maybe' would do it.
|
38
|
+
See `auto-complete-mode' for more information on Auto-Complete mode.
|
39
|
+
|
40
|
+
\(fn &optional ARG)" t nil)
|
41
|
+
|
42
|
+
;;;***
|
43
|
+
|
44
|
+
;;;### (autoloads nil "auto-complete-config" "auto-complete-config.el"
|
45
|
+
;;;;;; (23223 10762 775499 769000))
|
46
|
+
;;; Generated autoloads from auto-complete-config.el
|
47
|
+
|
48
|
+
(autoload 'ac-config-default "auto-complete-config" "\
|
49
|
+
|
50
|
+
|
51
|
+
\(fn)" nil nil)
|
52
|
+
|
53
|
+
;;;***
|
54
|
+
|
55
|
+
;;;### (autoloads nil nil ("auto-complete-pkg.el") (23223 10762 695743
|
56
|
+
;;;;;; 886000))
|
57
|
+
|
58
|
+
;;;***
|
59
|
+
|
60
|
+
;; Local Variables:
|
61
|
+
;; version-control: never
|
62
|
+
;; no-byte-compile: t
|
63
|
+
;; no-update-autoloads: t
|
64
|
+
;; End:
|
65
|
+
;;; auto-complete-autoloads.el ends here
|
@@ -0,0 +1,551 @@
|
|
1
|
+
;;; auto-complete-config.el --- auto-complete additional configuations
|
2
|
+
|
3
|
+
;; Copyright (C) 2009, 2010 Tomohiro Matsuyama
|
4
|
+
|
5
|
+
;; Author: Tomohiro Matsuyama <m2ym.pub@gmail.com>
|
6
|
+
;; Keywords: convenience
|
7
|
+
;; Version: 1.5.0
|
8
|
+
|
9
|
+
;; This program is free software; you can redistribute it and/or modify
|
10
|
+
;; it under the terms of the GNU General Public License as published by
|
11
|
+
;; the Free Software Foundation, either version 3 of the License, or
|
12
|
+
;; (at your option) any later version.
|
13
|
+
|
14
|
+
;; This program is distributed in the hope that it will be useful,
|
15
|
+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
+
;; GNU General Public License for more details.
|
18
|
+
|
19
|
+
;; You should have received a copy of the GNU General Public License
|
20
|
+
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
21
|
+
|
22
|
+
;;; Commentary:
|
23
|
+
|
24
|
+
;;
|
25
|
+
|
26
|
+
;;; Code:
|
27
|
+
|
28
|
+
(require 'cl-lib)
|
29
|
+
(require 'auto-complete)
|
30
|
+
|
31
|
+
(declare-function semantic-analyze-current-context "semantic/analyze")
|
32
|
+
(declare-function semantic-tag-class "semantic/tag")
|
33
|
+
(declare-function semantic-tag-function-arguments "semantic/tag")
|
34
|
+
(declare-function semantic-format-tag-type "semantic/format")
|
35
|
+
(declare-function semantic-format-tag-name "semantic/format")
|
36
|
+
(declare-function yas-expand-snippet "yasnippet")
|
37
|
+
(declare-function oref "eieio" (obj slot))
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
;;;; Additional sources
|
42
|
+
|
43
|
+
;; imenu
|
44
|
+
|
45
|
+
(defvar ac-imenu-index nil)
|
46
|
+
|
47
|
+
(ac-clear-variable-every-10-minutes 'ac-imenu-index)
|
48
|
+
|
49
|
+
(defun ac-imenu-candidates ()
|
50
|
+
(cl-loop with i = 0
|
51
|
+
with stack = (progn
|
52
|
+
(unless (local-variable-p 'ac-imenu-index)
|
53
|
+
(make-local-variable 'ac-imenu-index))
|
54
|
+
(or ac-imenu-index
|
55
|
+
(setq ac-imenu-index
|
56
|
+
(ignore-errors
|
57
|
+
(with-no-warnings
|
58
|
+
(imenu--make-index-alist))))))
|
59
|
+
with result
|
60
|
+
while (and stack (or (not (integerp ac-limit))
|
61
|
+
(< i ac-limit)))
|
62
|
+
for node = (pop stack)
|
63
|
+
if (consp node)
|
64
|
+
do
|
65
|
+
(let ((car (car node))
|
66
|
+
(cdr (cdr node)))
|
67
|
+
(if (consp cdr)
|
68
|
+
(mapc (lambda (child)
|
69
|
+
(push child stack))
|
70
|
+
cdr)
|
71
|
+
(when (and (stringp car)
|
72
|
+
(string-match (concat "^" (regexp-quote ac-prefix)) car))
|
73
|
+
;; Remove extra characters
|
74
|
+
(if (string-match "^.*\\(()\\|=\\|<>\\)$" car)
|
75
|
+
(setq car (substring car 0 (match-beginning 1))))
|
76
|
+
(push car result)
|
77
|
+
(cl-incf i))))
|
78
|
+
finally return (nreverse result)))
|
79
|
+
|
80
|
+
(ac-define-source imenu
|
81
|
+
'((depends imenu)
|
82
|
+
(candidates . ac-imenu-candidates)
|
83
|
+
(symbol . "s")))
|
84
|
+
|
85
|
+
;; gtags
|
86
|
+
|
87
|
+
(defface ac-gtags-candidate-face
|
88
|
+
'((t (:inherit ac-candidate-face :foreground "navy")))
|
89
|
+
"Face for gtags candidate"
|
90
|
+
:group 'auto-complete)
|
91
|
+
|
92
|
+
(defface ac-gtags-selection-face
|
93
|
+
'((t (:inherit ac-selection-face :background "navy")))
|
94
|
+
"Face for the gtags selected candidate."
|
95
|
+
:group 'auto-complete)
|
96
|
+
|
97
|
+
(defun ac-gtags-candidate ()
|
98
|
+
(ignore-errors
|
99
|
+
(split-string (shell-command-to-string (format "global -ciq %s" ac-prefix)) "\n")))
|
100
|
+
|
101
|
+
(ac-define-source gtags
|
102
|
+
'((candidates . ac-gtags-candidate)
|
103
|
+
(candidate-face . ac-gtags-candidate-face)
|
104
|
+
(selection-face . ac-gtags-selection-face)
|
105
|
+
(requires . 3)
|
106
|
+
(symbol . "s")))
|
107
|
+
|
108
|
+
;; yasnippet
|
109
|
+
|
110
|
+
(defface ac-yasnippet-candidate-face
|
111
|
+
'((t (:inherit ac-candidate-face
|
112
|
+
:background "sandybrown" :foreground "black")))
|
113
|
+
"Face for yasnippet candidate."
|
114
|
+
:group 'auto-complete)
|
115
|
+
|
116
|
+
(defface ac-yasnippet-selection-face
|
117
|
+
'((t (:inherit ac-selection-face :background "coral3")))
|
118
|
+
"Face for the yasnippet selected candidate."
|
119
|
+
:group 'auto-complete)
|
120
|
+
|
121
|
+
(defun ac-yasnippet-table-hash (table)
|
122
|
+
(cond
|
123
|
+
((fboundp 'yas/snippet-table-hash)
|
124
|
+
(yas/snippet-table-hash table))
|
125
|
+
((fboundp 'yas/table-hash)
|
126
|
+
(yas/table-hash table))))
|
127
|
+
|
128
|
+
(defun ac-yasnippet-table-parent (table)
|
129
|
+
(cond
|
130
|
+
((fboundp 'yas/snippet-table-parent)
|
131
|
+
(yas/snippet-table-parent table))
|
132
|
+
((fboundp 'yas/table-parent)
|
133
|
+
(yas/table-parent table))))
|
134
|
+
|
135
|
+
(defun ac-yasnippet-candidate-1 (table)
|
136
|
+
(with-no-warnings
|
137
|
+
(let ((hashtab (ac-yasnippet-table-hash table))
|
138
|
+
(parent (ac-yasnippet-table-parent table))
|
139
|
+
candidates)
|
140
|
+
(maphash (lambda (key value)
|
141
|
+
(push key candidates))
|
142
|
+
hashtab)
|
143
|
+
(setq candidates (all-completions ac-prefix (nreverse candidates)))
|
144
|
+
(if parent
|
145
|
+
(setq candidates
|
146
|
+
(append candidates (ac-yasnippet-candidate-1 parent))))
|
147
|
+
candidates)))
|
148
|
+
|
149
|
+
(defun ac-yasnippet-candidates ()
|
150
|
+
(with-no-warnings
|
151
|
+
(cond (;; 0.8 onwards
|
152
|
+
(fboundp 'yas-active-keys)
|
153
|
+
(all-completions ac-prefix (yas-active-keys)))
|
154
|
+
(;; >0.6.0
|
155
|
+
(fboundp 'yas/get-snippet-tables)
|
156
|
+
(apply 'append (mapcar 'ac-yasnippet-candidate-1
|
157
|
+
(condition-case nil
|
158
|
+
(yas/get-snippet-tables major-mode)
|
159
|
+
(wrong-number-of-arguments
|
160
|
+
(yas/get-snippet-tables)))))
|
161
|
+
)
|
162
|
+
(t
|
163
|
+
(let ((table
|
164
|
+
(if (fboundp 'yas/snippet-table)
|
165
|
+
;; <0.6.0
|
166
|
+
(yas/snippet-table major-mode)
|
167
|
+
;; 0.6.0
|
168
|
+
(yas/current-snippet-table))))
|
169
|
+
(if table
|
170
|
+
(ac-yasnippet-candidate-1 table)))))))
|
171
|
+
|
172
|
+
(ac-define-source yasnippet
|
173
|
+
'((depends yasnippet)
|
174
|
+
(candidates . ac-yasnippet-candidates)
|
175
|
+
(action . yas/expand)
|
176
|
+
(candidate-face . ac-yasnippet-candidate-face)
|
177
|
+
(selection-face . ac-yasnippet-selection-face)
|
178
|
+
(symbol . "a")))
|
179
|
+
|
180
|
+
;; semantic
|
181
|
+
|
182
|
+
(defun ac-semantic-candidates (prefix)
|
183
|
+
(with-no-warnings
|
184
|
+
(delete "" ; semantic sometimes returns an empty string
|
185
|
+
(mapcar (lambda (elem)
|
186
|
+
(cons (semantic-tag-name elem)
|
187
|
+
(semantic-tag-clone elem)))
|
188
|
+
(ignore-errors
|
189
|
+
(or (semantic-analyze-possible-completions
|
190
|
+
(semantic-analyze-current-context))
|
191
|
+
(senator-find-tag-for-completion prefix)))))))
|
192
|
+
|
193
|
+
(defun ac-semantic-doc (symbol)
|
194
|
+
(with-no-warnings
|
195
|
+
(let* ((proto (semantic-format-tag-summarize-with-file symbol nil t))
|
196
|
+
(doc (semantic-documentation-for-tag symbol))
|
197
|
+
(res proto))
|
198
|
+
(when doc
|
199
|
+
(setq res (concat res "\n\n" doc)))
|
200
|
+
res)))
|
201
|
+
|
202
|
+
(defun ac-semantic-action ()
|
203
|
+
(when (and (boundp 'yas-minor-mode) yas-minor-mode)
|
204
|
+
(let* ((tag (car (last (oref (semantic-analyze-current-context) prefix))))
|
205
|
+
(class (semantic-tag-class tag))
|
206
|
+
(args))
|
207
|
+
(when (eq class 'function)
|
208
|
+
(setq args (semantic-tag-function-arguments tag))
|
209
|
+
(yas-expand-snippet
|
210
|
+
(concat "("
|
211
|
+
(mapconcat
|
212
|
+
(lambda (arg)
|
213
|
+
(let ((arg-type (semantic-format-tag-type arg nil))
|
214
|
+
(arg-name (semantic-format-tag-name arg nil)))
|
215
|
+
(concat "${"
|
216
|
+
(if (string= arg-name "")
|
217
|
+
arg-type
|
218
|
+
(concat arg-type " " arg-name))
|
219
|
+
"}")))
|
220
|
+
args
|
221
|
+
", ")
|
222
|
+
")$0"))))))
|
223
|
+
|
224
|
+
(ac-define-source semantic
|
225
|
+
'((available . (or (require 'semantic-ia nil t)
|
226
|
+
(require 'semantic/ia nil t)))
|
227
|
+
(candidates . (ac-semantic-candidates ac-prefix))
|
228
|
+
(document . ac-semantic-doc)
|
229
|
+
(action . ac-semantic-action)
|
230
|
+
(prefix . cc-member)
|
231
|
+
(requires . 0)
|
232
|
+
(symbol . "m")))
|
233
|
+
|
234
|
+
(ac-define-source semantic-raw
|
235
|
+
'((available . (or (require 'semantic-ia nil t)
|
236
|
+
(require 'semantic/ia nil t)))
|
237
|
+
(candidates . (ac-semantic-candidates ac-prefix))
|
238
|
+
(document . ac-semantic-doc)
|
239
|
+
(action . ac-semantic-action)
|
240
|
+
(symbol . "s")))
|
241
|
+
|
242
|
+
;; eclim
|
243
|
+
|
244
|
+
(defun ac-eclim-candidates ()
|
245
|
+
(with-no-warnings
|
246
|
+
(cl-loop for c in (eclim/java-complete)
|
247
|
+
collect (nth 1 c))))
|
248
|
+
|
249
|
+
(ac-define-source eclim
|
250
|
+
'((candidates . ac-eclim-candidates)
|
251
|
+
(prefix . c-dot)
|
252
|
+
(requires . 0)
|
253
|
+
(symbol . "f")))
|
254
|
+
|
255
|
+
;; css
|
256
|
+
|
257
|
+
;; Copied from company-css.el
|
258
|
+
(defconst ac-css-property-alist
|
259
|
+
;; see http://www.w3.org/TR/CSS21/propidx.html
|
260
|
+
'(("azimuth" angle "left-side" "far-left" "left" "center-left" "center"
|
261
|
+
"center-right" "right" "far-right" "right-side" "behind" "leftwards"
|
262
|
+
"rightwards")
|
263
|
+
("background" background-color background-image background-repeat
|
264
|
+
background-attachment background-position)
|
265
|
+
("background-attachment" "scroll" "fixed")
|
266
|
+
("background-color" color "transparent")
|
267
|
+
("background-image" uri "none")
|
268
|
+
("background-position" percentage length "left" "center" "right" percentage
|
269
|
+
length "top" "center" "bottom" "left" "center" "right" "top" "center"
|
270
|
+
"bottom")
|
271
|
+
("background-repeat" "repeat" "repeat-x" "repeat-y" "no-repeat")
|
272
|
+
("border" border-width border-style border-color)
|
273
|
+
("border-bottom" border)
|
274
|
+
("border-bottom-color" border-color)
|
275
|
+
("border-bottom-style" border-style)
|
276
|
+
("border-bottom-width" border-width)
|
277
|
+
("border-collapse" "collapse" "separate")
|
278
|
+
("border-color" color "transparent")
|
279
|
+
("border-left" border)
|
280
|
+
("border-left-color" border-color)
|
281
|
+
("border-left-style" border-style)
|
282
|
+
("border-left-width" border-width)
|
283
|
+
("border-right" border)
|
284
|
+
("border-right-color" border-color)
|
285
|
+
("border-right-style" border-style)
|
286
|
+
("border-right-width" border-width)
|
287
|
+
("border-spacing" length length)
|
288
|
+
("border-style" border-style)
|
289
|
+
("border-top" border)
|
290
|
+
("border-top-color" border-color)
|
291
|
+
("border-top-style" border-style)
|
292
|
+
("border-top-width" border-width)
|
293
|
+
("border-width" border-width)
|
294
|
+
("bottom" length percentage "auto")
|
295
|
+
("caption-side" "top" "bottom")
|
296
|
+
("clear" "none" "left" "right" "both")
|
297
|
+
("clip" shape "auto")
|
298
|
+
("color" color)
|
299
|
+
("content" "normal" "none" string uri counter "attr()" "open-quote"
|
300
|
+
"close-quote" "no-open-quote" "no-close-quote")
|
301
|
+
("counter-increment" identifier integer "none")
|
302
|
+
("counter-reset" identifier integer "none")
|
303
|
+
("cue" cue-before cue-after)
|
304
|
+
("cue-after" uri "none")
|
305
|
+
("cue-before" uri "none")
|
306
|
+
("cursor" uri "*" "auto" "crosshair" "default" "pointer" "move" "e-resize"
|
307
|
+
"ne-resize" "nw-resize" "n-resize" "se-resize" "sw-resize" "s-resize"
|
308
|
+
"w-resize" "text" "wait" "help" "progress")
|
309
|
+
("direction" "ltr" "rtl")
|
310
|
+
("display" "inline" "block" "list-item" "run-in" "inline-block" "table"
|
311
|
+
"inline-table" "table-row-group" "table-header-group" "table-footer-group"
|
312
|
+
"table-row" "table-column-group" "table-column" "table-cell"
|
313
|
+
"table-caption" "none")
|
314
|
+
("elevation" angle "below" "level" "above" "higher" "lower")
|
315
|
+
("empty-cells" "show" "hide")
|
316
|
+
("float" "left" "right" "none")
|
317
|
+
("font" font-style font-variant font-weight font-size "/" line-height
|
318
|
+
font-family "caption" "icon" "menu" "message-box" "small-caption"
|
319
|
+
"status-bar")
|
320
|
+
("font-family" family-name generic-family)
|
321
|
+
("font-size" absolute-size relative-size length percentage)
|
322
|
+
("font-style" "normal" "italic" "oblique")
|
323
|
+
("font-variant" "normal" "small-caps")
|
324
|
+
("font-weight" "normal" "bold" "bolder" "lighter" "100" "200" "300" "400"
|
325
|
+
"500" "600" "700" "800" "900")
|
326
|
+
("height" length percentage "auto")
|
327
|
+
("left" length percentage "auto")
|
328
|
+
("letter-spacing" "normal" length)
|
329
|
+
("line-height" "normal" number length percentage)
|
330
|
+
("list-style" list-style-type list-style-position list-style-image)
|
331
|
+
("list-style-image" uri "none")
|
332
|
+
("list-style-position" "inside" "outside")
|
333
|
+
("list-style-type" "disc" "circle" "square" "decimal" "decimal-leading-zero"
|
334
|
+
"lower-roman" "upper-roman" "lower-greek" "lower-latin" "upper-latin"
|
335
|
+
"armenian" "georgian" "lower-alpha" "upper-alpha" "none")
|
336
|
+
("margin" margin-width)
|
337
|
+
("margin-bottom" margin-width)
|
338
|
+
("margin-left" margin-width)
|
339
|
+
("margin-right" margin-width)
|
340
|
+
("margin-top" margin-width)
|
341
|
+
("max-height" length percentage "none")
|
342
|
+
("max-width" length percentage "none")
|
343
|
+
("min-height" length percentage)
|
344
|
+
("min-width" length percentage)
|
345
|
+
("orphans" integer)
|
346
|
+
("outline" outline-color outline-style outline-width)
|
347
|
+
("outline-color" color "invert")
|
348
|
+
("outline-style" border-style)
|
349
|
+
("outline-width" border-width)
|
350
|
+
("overflow" "visible" "hidden" "scroll" "auto")
|
351
|
+
("padding" padding-width)
|
352
|
+
("padding-bottom" padding-width)
|
353
|
+
("padding-left" padding-width)
|
354
|
+
("padding-right" padding-width)
|
355
|
+
("padding-top" padding-width)
|
356
|
+
("page-break-after" "auto" "always" "avoid" "left" "right")
|
357
|
+
("page-break-before" "auto" "always" "avoid" "left" "right")
|
358
|
+
("page-break-inside" "avoid" "auto")
|
359
|
+
("pause" time percentage)
|
360
|
+
("pause-after" time percentage)
|
361
|
+
("pause-before" time percentage)
|
362
|
+
("pitch" frequency "x-low" "low" "medium" "high" "x-high")
|
363
|
+
("pitch-range" number)
|
364
|
+
("play-during" uri "mix" "repeat" "auto" "none")
|
365
|
+
("position" "static" "relative" "absolute" "fixed")
|
366
|
+
("quotes" string string "none")
|
367
|
+
("richness" number)
|
368
|
+
("right" length percentage "auto")
|
369
|
+
("speak" "normal" "none" "spell-out")
|
370
|
+
("speak-header" "once" "always")
|
371
|
+
("speak-numeral" "digits" "continuous")
|
372
|
+
("speak-punctuation" "code" "none")
|
373
|
+
("speech-rate" number "x-slow" "slow" "medium" "fast" "x-fast" "faster"
|
374
|
+
"slower")
|
375
|
+
("stress" number)
|
376
|
+
("table-layout" "auto" "fixed")
|
377
|
+
("text-align" "left" "right" "center" "justify")
|
378
|
+
("text-decoration" "none" "underline" "overline" "line-through" "blink")
|
379
|
+
("text-indent" length percentage)
|
380
|
+
("text-transform" "capitalize" "uppercase" "lowercase" "none")
|
381
|
+
("top" length percentage "auto")
|
382
|
+
("unicode-bidi" "normal" "embed" "bidi-override")
|
383
|
+
("vertical-align" "baseline" "sub" "super" "top" "text-top" "middle"
|
384
|
+
"bottom" "text-bottom" percentage length)
|
385
|
+
("visibility" "visible" "hidden" "collapse")
|
386
|
+
("voice-family" specific-voice generic-voice "*" specific-voice
|
387
|
+
generic-voice)
|
388
|
+
("volume" number percentage "silent" "x-soft" "soft" "medium" "loud"
|
389
|
+
"x-loud")
|
390
|
+
("white-space" "normal" "pre" "nowrap" "pre-wrap" "pre-line")
|
391
|
+
("widows" integer)
|
392
|
+
("width" length percentage "auto")
|
393
|
+
("word-spacing" "normal" length)
|
394
|
+
("z-index" "auto" integer))
|
395
|
+
"A list of CSS properties and their possible values.")
|
396
|
+
|
397
|
+
(defconst ac-css-value-classes
|
398
|
+
'((absolute-size "xx-small" "x-small" "small" "medium" "large" "x-large"
|
399
|
+
"xx-large")
|
400
|
+
(border-style "none" "hidden" "dotted" "dashed" "solid" "double" "groove"
|
401
|
+
"ridge" "inset" "outset")
|
402
|
+
(color "aqua" "black" "blue" "fuchsia" "gray" "green" "lime" "maroon" "navy"
|
403
|
+
"olive" "orange" "purple" "red" "silver" "teal" "white" "yellow"
|
404
|
+
"rgb")
|
405
|
+
(counter "counter")
|
406
|
+
(family-name "Courier" "Helvetica" "Times")
|
407
|
+
(generic-family "serif" "sans-serif" "cursive" "fantasy" "monospace")
|
408
|
+
(generic-voice "male" "female" "child")
|
409
|
+
(margin-width "auto") ;; length percentage
|
410
|
+
(relative-size "larger" "smaller")
|
411
|
+
(shape "rect")
|
412
|
+
(uri "url"))
|
413
|
+
"A list of CSS property value classes and their contents.")
|
414
|
+
|
415
|
+
(defconst ac-css-pseudo-classes
|
416
|
+
'("active" "after" "before" "first" "first-child" "first-letter" "first-line"
|
417
|
+
"focus" "hover" "lang" "left" "link" "right" "visited")
|
418
|
+
"Identifiers for CSS pseudo-elements and pseudo-classes.")
|
419
|
+
|
420
|
+
(defvar ac-css-property nil
|
421
|
+
"Current editing property.")
|
422
|
+
|
423
|
+
(defun ac-css-prefix ()
|
424
|
+
(when (save-excursion (re-search-backward "\\_<\\(.+?\\)\\_>\\s *:[^;]*\\=" nil t))
|
425
|
+
(setq ac-css-property (match-string 1))
|
426
|
+
(or (ac-prefix-symbol) (point))))
|
427
|
+
|
428
|
+
(defun ac-css-property-candidates ()
|
429
|
+
(let ((list (assoc-default ac-css-property ac-css-property-alist)))
|
430
|
+
(if list
|
431
|
+
(cl-loop with seen
|
432
|
+
with value
|
433
|
+
while (setq value (pop list))
|
434
|
+
if (symbolp value)
|
435
|
+
do (unless (memq value seen)
|
436
|
+
(push value seen)
|
437
|
+
(setq list
|
438
|
+
(append list
|
439
|
+
(or (assoc-default value ac-css-value-classes)
|
440
|
+
(assoc-default (symbol-name value) ac-css-property-alist)))))
|
441
|
+
else collect value)
|
442
|
+
ac-css-pseudo-classes)))
|
443
|
+
|
444
|
+
(ac-define-source css-property
|
445
|
+
'((candidates . ac-css-property-candidates)
|
446
|
+
(prefix . ac-css-prefix)
|
447
|
+
(requires . 0)))
|
448
|
+
|
449
|
+
;; slime
|
450
|
+
(ac-define-source slime
|
451
|
+
'((depends slime)
|
452
|
+
(candidates . (car (slime-simple-completions ac-prefix)))
|
453
|
+
(symbol . "s")
|
454
|
+
(cache)))
|
455
|
+
|
456
|
+
;; ghc-mod
|
457
|
+
(ac-define-source ghc-mod
|
458
|
+
'((depends ghc)
|
459
|
+
(candidates . (ghc-select-completion-symbol))
|
460
|
+
(symbol . "s")
|
461
|
+
(cache)))
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
;;;; Not maintained sources
|
466
|
+
|
467
|
+
;; ropemacs
|
468
|
+
|
469
|
+
(defvar ac-ropemacs-loaded nil)
|
470
|
+
(defun ac-ropemacs-require ()
|
471
|
+
(with-no-warnings
|
472
|
+
(unless ac-ropemacs-loaded
|
473
|
+
(pymacs-load "ropemacs" "rope-")
|
474
|
+
(if (boundp 'ropemacs-enable-autoimport)
|
475
|
+
(setq ropemacs-enable-autoimport t))
|
476
|
+
(setq ac-ropemacs-loaded t))))
|
477
|
+
|
478
|
+
(defun ac-ropemacs-setup ()
|
479
|
+
(ac-ropemacs-require)
|
480
|
+
;(setq ac-sources (append (list 'ac-source-ropemacs) ac-sources))
|
481
|
+
(setq ac-omni-completion-sources '(("\\." ac-source-ropemacs))))
|
482
|
+
|
483
|
+
(defun ac-ropemacs-initialize ()
|
484
|
+
(autoload 'pymacs-apply "pymacs")
|
485
|
+
(autoload 'pymacs-call "pymacs")
|
486
|
+
(autoload 'pymacs-eval "pymacs" nil t)
|
487
|
+
(autoload 'pymacs-exec "pymacs" nil t)
|
488
|
+
(autoload 'pymacs-load "pymacs" nil t)
|
489
|
+
(add-hook 'python-mode-hook 'ac-ropemacs-setup)
|
490
|
+
t)
|
491
|
+
|
492
|
+
(defvar ac-ropemacs-completions-cache nil)
|
493
|
+
(defvar ac-source-ropemacs
|
494
|
+
'((init
|
495
|
+
. (lambda ()
|
496
|
+
(setq ac-ropemacs-completions-cache
|
497
|
+
(mapcar
|
498
|
+
(lambda (completion)
|
499
|
+
(concat ac-prefix completion))
|
500
|
+
(ignore-errors
|
501
|
+
(rope-completions))))))
|
502
|
+
(candidates . ac-ropemacs-completions-cache)))
|
503
|
+
|
504
|
+
;; rcodetools
|
505
|
+
|
506
|
+
(defvar ac-source-rcodetools
|
507
|
+
'((init . (lambda ()
|
508
|
+
(require 'rcodetools)
|
509
|
+
(condition-case x
|
510
|
+
(save-excursion
|
511
|
+
(rct-exec-and-eval rct-complete-command-name "--completion-emacs-icicles"))
|
512
|
+
(error) (setq rct-method-completion-table nil))))
|
513
|
+
(candidates . (lambda ()
|
514
|
+
(all-completions
|
515
|
+
ac-prefix
|
516
|
+
(mapcar
|
517
|
+
(lambda (completion)
|
518
|
+
(replace-regexp-in-string "\t.*$" "" (car completion)))
|
519
|
+
rct-method-completion-table))))))
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
;;;; Default settings
|
524
|
+
|
525
|
+
(defun ac-common-setup ()
|
526
|
+
;(add-to-list 'ac-sources 'ac-source-filename)
|
527
|
+
)
|
528
|
+
|
529
|
+
(defun ac-emacs-lisp-mode-setup ()
|
530
|
+
(setq ac-sources (append '(ac-source-features ac-source-functions ac-source-yasnippet ac-source-variables ac-source-symbols) ac-sources)))
|
531
|
+
|
532
|
+
(defun ac-cc-mode-setup ()
|
533
|
+
(setq ac-sources (append '(ac-source-yasnippet ac-source-gtags) ac-sources)))
|
534
|
+
|
535
|
+
(defun ac-ruby-mode-setup ())
|
536
|
+
|
537
|
+
(defun ac-css-mode-setup ()
|
538
|
+
(setq ac-sources (append '(ac-source-css-property) ac-sources)))
|
539
|
+
|
540
|
+
;;;###autoload
|
541
|
+
(defun ac-config-default ()
|
542
|
+
(setq-default ac-sources '(ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers))
|
543
|
+
(add-hook 'emacs-lisp-mode-hook 'ac-emacs-lisp-mode-setup)
|
544
|
+
(add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
|
545
|
+
(add-hook 'ruby-mode-hook 'ac-ruby-mode-setup)
|
546
|
+
(add-hook 'css-mode-hook 'ac-css-mode-setup)
|
547
|
+
(add-hook 'auto-complete-mode-hook 'ac-common-setup)
|
548
|
+
(global-auto-complete-mode t))
|
549
|
+
|
550
|
+
(provide 'auto-complete-config)
|
551
|
+
;;; auto-complete-config.el ends here
|