ruby_learner 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,275 @@
|
|
1
|
+
;;; processing-mode.el --- major mode for processing language
|
2
|
+
|
3
|
+
;; Processing.org language based on Java mode. Adds keyword
|
4
|
+
;; highlighting for all recognized Processing language functions.
|
5
|
+
;; Allows compilation of buffers and "sketches" from within Emacs but
|
6
|
+
;; only for more recent versions of Processing.
|
7
|
+
|
8
|
+
;; Copyright (C) 2008, 2009 Rudolf Olah <omouse@gmail.com>
|
9
|
+
|
10
|
+
;; This program is free software: you can redistribute it and/or modify
|
11
|
+
;; it under the terms of the GNU General Public License as published by
|
12
|
+
;; the Free Software Foundation, either version 3 of the License, or
|
13
|
+
;; (at your option) any later version.
|
14
|
+
|
15
|
+
;; This program is distributed in the hope that it will be useful,
|
16
|
+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
+
;; GNU General Public License for more details.
|
19
|
+
|
20
|
+
;; You should have received a copy of the GNU General Public License
|
21
|
+
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
22
|
+
|
23
|
+
(eval-when-compile
|
24
|
+
(require 'compile)
|
25
|
+
(require 'cl))
|
26
|
+
|
27
|
+
(define-derived-mode processing-mode
|
28
|
+
java-mode "Processing"
|
29
|
+
"Major mode for Processing.
|
30
|
+
\\{java-mode-map}")
|
31
|
+
|
32
|
+
(defvar processing-location nil
|
33
|
+
"The directory where Processing can be found. Assumes you have
|
34
|
+
downloaded the standalone package.")
|
35
|
+
|
36
|
+
(defconst processing-platform
|
37
|
+
(cond ((string= system-type "gnu/linux")
|
38
|
+
"linux")
|
39
|
+
((or (string= system-type "darwin") (string= system-type "macos"))
|
40
|
+
"macosx")
|
41
|
+
((or (string= system-type "ms-dos") (string= system-type "windows-nt")
|
42
|
+
(string= system-type "cygwin"))
|
43
|
+
"windows"))
|
44
|
+
"The platform that Processing is running on. It can be `linux', `macosx' or `windows'.")
|
45
|
+
|
46
|
+
;; Functions
|
47
|
+
(defun make-java-classpath (&rest args)
|
48
|
+
"Returns a string that is a Java CLASSPATH. Each arg is a
|
49
|
+
folder containing .class files or a .jar. The delimiter is based
|
50
|
+
on the platform, with MS Windows using \";\", and other platforms
|
51
|
+
using \":\"."
|
52
|
+
(reduce (lambda (x y) (concat x (if (string= processing-platform "windows") ";" ":")
|
53
|
+
y))
|
54
|
+
args))
|
55
|
+
|
56
|
+
(defvar processing-import-libraries
|
57
|
+
'((minim "jl1.0" "mp3spi1.9.4" "tritonus_share" "tritonus_aos"
|
58
|
+
"minim-spi" "minim" "jsminim"))
|
59
|
+
"An alist of library names and the JAR (Java ARchive) files
|
60
|
+
required for their use. Each element looks like (library-name
|
61
|
+
&REST jar-files) where library-name is a SYMBOL and jar-files are
|
62
|
+
strings.")
|
63
|
+
|
64
|
+
(defun processing-import-library (library-name)
|
65
|
+
"Generates a STRING that is a Java classpath. The paths are
|
66
|
+
constructed from the REST of the library found in the alist
|
67
|
+
``processing-import-libraries''. The suffix \".jar\" is added to
|
68
|
+
each string."
|
69
|
+
(make-java-classpath (mapcar (lambda (x) (expand-file-name (concat processing-location
|
70
|
+
"libraries/"
|
71
|
+
(symbol-name library-name)
|
72
|
+
"/library/" x ".jar")))
|
73
|
+
(rest (assoc library-name processing-import-libraries)))))
|
74
|
+
|
75
|
+
(defun processing-read-libraries (sketch-dir)
|
76
|
+
"Returns a LIST of SYMBOLS that are the names of Processing
|
77
|
+
libraries. This list if stored in the \"libraries_required.txt\"
|
78
|
+
file found in the Processing sketch directory ``sketch-dir''.
|
79
|
+
|
80
|
+
If the file does not exist, it is assumed that there are no
|
81
|
+
libraries required and NIL is returned.
|
82
|
+
|
83
|
+
A general error is signalled if the library is not supported.
|
84
|
+
Check the variable ``processing-import-libraries'' to see which
|
85
|
+
libraries are supported."
|
86
|
+
(let ((file-name (expand-file-name (concat sketch-dir "libraries_required.txt"))))
|
87
|
+
(if (and (file-exists-p file-name) (file-readable-p file-name))
|
88
|
+
(let ((temp-buf (generate-new-buffer "libraries-required-by-sketch")))
|
89
|
+
(set-buffer temp-buf)
|
90
|
+
(insert-file-contents file-name)
|
91
|
+
(unwind-protect
|
92
|
+
(loop while (< (point) (buffer-size))
|
93
|
+
for library-name = (read temp-buf) then (read-temp-buf)
|
94
|
+
if (assoc library-name processing-import-libraries)
|
95
|
+
collect library-name
|
96
|
+
else do (error "Processing-mode does not know how to handle the library %s"
|
97
|
+
library-name)
|
98
|
+
do (forward-line))
|
99
|
+
(kill-buffer temp-buf)))
|
100
|
+
nil)))
|
101
|
+
|
102
|
+
(defun processing-make-compile-command (sketch-dir output-dir cmd &optional platform)
|
103
|
+
"Returns a string which is the compile-command for Processing
|
104
|
+
sketches, targetting the sketch files found in ``sketch-dir'',
|
105
|
+
with the output being stored in ``output-dir''. The command flag
|
106
|
+
that is executed on the sketch depends on the type of ``cmd''.
|
107
|
+
|
108
|
+
Valid types of commands are:
|
109
|
+
|
110
|
+
- \"preprocess\"
|
111
|
+
- \"build\"
|
112
|
+
- \"run\"
|
113
|
+
- \"present\"
|
114
|
+
- \"export-applet\"
|
115
|
+
- \"export-application\"
|
116
|
+
|
117
|
+
When ``cmd'' is set to \"export-application\", the ``platform''
|
118
|
+
must be set to one of \"windows\", \"macosx\", or \"linux\". If
|
119
|
+
no platform is selected, the default platform that Emacs is
|
120
|
+
running on will be selected."
|
121
|
+
(concat (file-name-as-directory processing-location)
|
122
|
+
"java/bin/java -classpath \""
|
123
|
+
(apply 'make-java-classpath
|
124
|
+
(mapcar (lambda (x) (expand-file-name (concat processing-location x)))
|
125
|
+
'("java/lib/rt.jar"
|
126
|
+
"java/lib/tools.jar"
|
127
|
+
"lib/antlr.jar" "lib/core.jar"
|
128
|
+
"lib/ecj.jar" "lib/jna.jar"
|
129
|
+
"lib/pde.jar")))
|
130
|
+
"\" processing.app.Commander"
|
131
|
+
" --sketch=\"" (expand-file-name sketch-dir)
|
132
|
+
"\" --output=\"" (expand-file-name output-dir)
|
133
|
+
;; Remove this comment when Processing implements the --preferences=??? command-line option.
|
134
|
+
;;"\" --preferences=\"" (expand-file-name "~/.processing/preferences.txt")
|
135
|
+
"\" --" cmd
|
136
|
+
(if (string= cmd "export-application")
|
137
|
+
(concat " --platform="
|
138
|
+
(if platform platform (processing-platform))))))
|
139
|
+
|
140
|
+
(defun processing-commander (sketch-dir output-dir cmd &optional platform)
|
141
|
+
"Runs the Processing compiler, using a compile-command
|
142
|
+
constructed using the ``processing-make-compile-command''
|
143
|
+
function."
|
144
|
+
(let ((compilation-error-regexp-alist '(processing)))
|
145
|
+
(compile (processing-make-compile-command sketch-dir output-dir cmd platform))))
|
146
|
+
|
147
|
+
(defun processing-sketch-compile (&optional cmd)
|
148
|
+
"Runs the Processing Commander application with the current
|
149
|
+
buffer. The output directory is the sub-directory ``output''
|
150
|
+
which will be found in the parent directory of the buffer file."
|
151
|
+
(interactive)
|
152
|
+
;; TODO: Add support for temporary sketches
|
153
|
+
(let ((sketch-dir (file-name-directory buffer-file-name)))
|
154
|
+
(processing-commander sketch-dir (concat sketch-dir "output") (if cmd cmd "run"))))
|
155
|
+
|
156
|
+
(defun processing-sketch-present ()
|
157
|
+
(interactive)
|
158
|
+
(processing-sketch-compile "present"))
|
159
|
+
|
160
|
+
(defun processing-sketch-build ()
|
161
|
+
"Runs the build command for a Processing sketch. Processing
|
162
|
+
will process the sketch into .java files and then compile them
|
163
|
+
into .class files."
|
164
|
+
(interactive)
|
165
|
+
(processing-sketch-compile "build"))
|
166
|
+
|
167
|
+
(defun processing-export-application ()
|
168
|
+
"Turns the Processing sketch into a Java application. Assumes
|
169
|
+
that the platform target is whatever platform Emacs is running
|
170
|
+
on."
|
171
|
+
t)
|
172
|
+
|
173
|
+
;; Add hook so that when processing-mode is loaded, the local variable
|
174
|
+
;; 'compile-command is set.
|
175
|
+
(add-hook 'processing-mode-hook
|
176
|
+
(lambda ()
|
177
|
+
(let ((sketch-dir (file-name-directory buffer-file-name)))
|
178
|
+
(set (make-local-variable 'compile-command)
|
179
|
+
(processing-make-compile-command sketch-dir
|
180
|
+
(concat sketch-dir "output")
|
181
|
+
"build")))))
|
182
|
+
|
183
|
+
;; Key bindings
|
184
|
+
(define-key processing-mode-map "\C-c\C-r" 'processing-sketch-compile)
|
185
|
+
(define-key processing-mode-map "\C-c\C-p" 'processing-sketch-present)
|
186
|
+
(define-key processing-mode-map "\C-c\C-b" 'processing-sketch-build)
|
187
|
+
|
188
|
+
;; Regular expressions
|
189
|
+
;; Compilation
|
190
|
+
(pushnew
|
191
|
+
;; Mode name, REGEXP FILE LINE COLUMN TYPE HYPERLINK HIGHLIGHT
|
192
|
+
'(processing "^\\([[:alnum:]]+.pde\\):\\([0-9]+\\):\\([0-9]+\\):.*$"
|
193
|
+
1 2 3)
|
194
|
+
compilation-error-regexp-alist-alist)
|
195
|
+
|
196
|
+
;; Font-lock, keywords
|
197
|
+
(defconst processing-font-lock-keywords-1
|
198
|
+
(eval-when-compile
|
199
|
+
`( ;; Shape functions
|
200
|
+
(,(concat
|
201
|
+
(regexp-opt '("triangle" "line" "arc" "point" "quad" "ellipse"
|
202
|
+
"rect" "curve" "bezier")
|
203
|
+
t)
|
204
|
+
"(") 1 font-lock-function-name-face t)
|
205
|
+
(,(concat
|
206
|
+
(regexp-opt '("strokeWeight" "smooth" "strokeJoin" "noSmooth"
|
207
|
+
"ellipseMode" "rectMode" "background" "stroke")
|
208
|
+
t)
|
209
|
+
"(") 1 font-lock-doc-face t)
|
210
|
+
(,(regexp-opt '("width" "height" "frameRate" "frameCount" "noCursor()" "cursor()")
|
211
|
+
t)
|
212
|
+
. font-lock-constant-face)
|
213
|
+
(,(concat "screen." (regexp-opt '("width" "height") t))
|
214
|
+
1 font-lock-constant-face t)
|
215
|
+
))
|
216
|
+
"Subdued level highlighting for Processing mode.")
|
217
|
+
|
218
|
+
;;(defconst processing-font-lock-keywords-2
|
219
|
+
;; (append processing-font-lock-keywords-1
|
220
|
+
;; (eval-when-compile
|
221
|
+
;; `(
|
222
|
+
|
223
|
+
(defvar processing-font-lock-keywords processing-font-lock-keywords-1
|
224
|
+
"Default expressions to highlight in Processing mode.")
|
225
|
+
|
226
|
+
;; YASnippets
|
227
|
+
(if (fboundp 'yas/minor-mode)
|
228
|
+
(progn
|
229
|
+
(require 'yasnippet)
|
230
|
+
(message "processing-mode: defining YASnippets")
|
231
|
+
(yas/define-snippets
|
232
|
+
'processing-mode
|
233
|
+
'(
|
234
|
+
;; (key template name condition)
|
235
|
+
("tri" "triangle(${x1}, ${y1}, ${x2}, ${y2}, ${x3}, ${y3});"
|
236
|
+
"triangle" nil)
|
237
|
+
("l(" "line(${x1}, ${y1}, ${x2}, ${y2});" "line 2d" nil)
|
238
|
+
("l(.3d" "line(${x1}, ${y1}, ${z1}, ${x2}, ${y2}, ${z2});" "line 3d" nil)
|
239
|
+
("arc" "arc(${x}, ${y}, ${width}, ${height}, ${start}, ${stop});" "arc" nil)
|
240
|
+
("p(" "point(${x}, ${y});" "point 2d" nil)
|
241
|
+
("p(.3d" "point(${x}, ${y}, ${z});" "point 3d" nil)
|
242
|
+
("quad" "quad(${x1}, ${y1}, ${x2}, ${y2}, ${x3}, ${y3}, ${x4}, ${y4});"
|
243
|
+
"quad" nil)
|
244
|
+
("ell" "ellipse(${x}, ${y}, ${width}, ${height});" "ellipse" nil)
|
245
|
+
("rect" "rect(${x}, ${y}, ${width}, ${height});" "rect" nil)
|
246
|
+
|
247
|
+
;; Color Setting
|
248
|
+
("background" "background(${gray_or_color_or_hex});" "background .." nil)
|
249
|
+
("background.ca" "background(${gray_or_color_or_hex}, ${alpha});"
|
250
|
+
"background .. alpha" nil)
|
251
|
+
("background.rgb" "background(${red}, ${green}, ${blue});" "background RGB" nil)
|
252
|
+
("background.rgba" "background(${red}, ${green}, ${blue}, ${alpha});"
|
253
|
+
"background RGBA" nil)
|
254
|
+
("colorm" "colorMode(${RGB_or_HSV});" "color mode" nil)
|
255
|
+
("colorm.r" "colorMode(${RGB_or_HSV}, ${range});" "color mode range" nil)
|
256
|
+
("colorm.rgb" "colorMode(${RGB_or_HSV}, ${range1}, ${range2}, ${range3});"
|
257
|
+
"color mode RGB/HSV range" nil)
|
258
|
+
("colorm.rgba" "colorMode(${RGB_or_HSV}, ${range1}, ${range2}, ${range3}, ${range4});"
|
259
|
+
"color mode RGB/HSV, A range" nil)
|
260
|
+
("stroke" "stroke(${gray_or_color_or_hex});" "stroke .." nil)
|
261
|
+
("stroke.ca" "stroke(${gray_or_color_or_hex}, ${alpha});" "stroke .. alpha" nil)
|
262
|
+
("stroke.rgb" "stroke(${red}, ${green}, ${blue});" "stroke RGB" nil)
|
263
|
+
("stroke.rgba" "stroke(${red}, ${green}, ${blue}, ${alpha});" "stroke RGBA" nil)
|
264
|
+
("fill" "fill(${gray_or_color_or_hex});" "fill .." nil)
|
265
|
+
("fill.ca" "fill(${gray_or_color_or_hex}, ${alpha});" "fill .. alpha" nil)
|
266
|
+
("fill.rgb" "fill(${red}, ${green}, ${blue});" "fill RGB" nil)
|
267
|
+
("fill.rgba" "fill(${red}, ${green}, ${blue}, ${alpha});" "fill RGBA" nil)
|
268
|
+
)
|
269
|
+
'java-mode)
|
270
|
+
t)
|
271
|
+
(progn
|
272
|
+
(message "processing-mode: YASnippets not installed. Not defining any snippets.")
|
273
|
+
nil))
|
274
|
+
|
275
|
+
(provide 'processing-mode)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
;;; Automatically generated by ‘recentf’ on Sat Jul 28 11:56:46 2018.
|
2
|
+
|
3
|
+
(setq recentf-list
|
4
|
+
'(
|
5
|
+
"/Users/takakiotsu/ruby_learner/workshop/answer.rb"
|
6
|
+
"/Users/takakiotsu/ruby_learner/workshop/question.org"
|
7
|
+
"/Users/takakiotsu/.emacs.d/ruby_learner_init.el"
|
8
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/lib/ruby_learner/methods.rb"
|
9
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/lib/ruby_learner/ruby_learner.rb"
|
10
|
+
"/Users/takakiotsu/.emacs.d/init.el"
|
11
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/.emacs.d/ruby_learner_init.el"
|
12
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/lib/ruby_learner/typing_practice.rb"
|
13
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/bin/new_terminal"
|
14
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/questions/random_check_question/section_1/sentence.org"
|
15
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/questions/random_check_question/section_1/answer.rb"
|
16
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/questions/random_check_question/section_1/workplace.rb"
|
17
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/workshop/question.org"
|
18
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/ruby_learner.gemspec"
|
19
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/questions/random_check_question/random_h.rb"
|
20
|
+
"/Users/takakiotsu/ruby_learner/workshop/question.rb"
|
21
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/questions/random_check_question/section_2/workplace.rb"
|
22
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/questions/random_check_question/section_2/sentence.org"
|
23
|
+
"/Users/takakiotsu/NishitaniLab/ruby_learner/questions/random_check_question/section_2/answer.rb"
|
24
|
+
))
|
25
|
+
|
26
|
+
(setq recentf-filter-changer-current 'nil)
|
27
|
+
|
28
|
+
|
29
|
+
;; Local Variables:
|
30
|
+
;; coding: utf-8-emacs
|
31
|
+
;; End:
|