| 1 |
;; Copyright 2013 The Closure Library Authors. All Rights Reserved. |
| 2 |
;; |
| 3 |
;; Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
;; you may not use this file except in compliance with the License. |
| 5 |
;; You may obtain a copy of the License at |
| 6 |
;; |
| 7 |
;; http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
;; |
| 9 |
;; Unless required `by applicable law or agreed to in writing, software |
| 10 |
;; distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
;; See the License for the specific language governing permissions and |
| 13 |
;; limitations under the License. |
| 14 |
|
| 15 |
;; Closure JS code editing functions for emacs. |
| 16 |
|
| 17 |
;; Author: [email protected] (Nathan Naze) |
| 18 |
|
| 19 |
;; Remember the path of this file, as we will base our paths on it. |
| 20 |
(setq closure-el-path load-file-name) |
| 21 |
|
| 22 |
(defun closure-el-directory () |
| 23 |
"Get the directory the closure.el file lives in." |
| 24 |
(file-name-directory closure-el-path)) |
| 25 |
|
| 26 |
(defun closure-generate-jsdoc-path() |
| 27 |
"The path of the generate_jsdoc.py script." |
| 28 |
(concat (closure-el-directory) "generate_jsdoc.py")) |
| 29 |
|
| 30 |
(defun closure-insert-jsdoc () |
| 31 |
"Insert JSDoc for the next function after the cursor." |
| 32 |
(interactive) |
| 33 |
(save-excursion ; Remembers cursor location |
| 34 |
(call-process-region |
| 35 |
(point) (point-max) |
| 36 |
(closure-generate-jsdoc-path) |
| 37 |
t t))) |
| 38 |
|
| 39 |
(provide 'closure) |