diff options
| author | Simeon Simeonov | 2016-02-17 07:39:51 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2016-02-17 07:39:51 +0100 |
| commit | 481decd28b7940d1dae11fd0ff2dc06143c46ee8 (patch) | |
| tree | fca07ee06cf69f62776d74cc03087f8c71401ad5 | |
| parent | 905ddda312c1535909c64bb261d4cf2a3edcb8ae (diff) | |
Add java-mode snippets. Upgrade yasnippet and yaml-mode
36 files changed, 337 insertions, 103 deletions
| @@ -58,19 +58,19 @@ | |||
| 58 | (setq python-indent-guess-indent-offset nil) | 58 | (setq python-indent-guess-indent-offset nil) |
| 59 | 59 | ||
| 60 | ;; Enable which-function-mode for C, C++ and Python | 60 | ;; Enable which-function-mode for C, C++ and Python |
| 61 | ;;(setq which-func-modes '(python-mode c-mode c++-mode)) | 61 | (setq which-func-modes '(c-mode c++-mode java-mode python-mode)) |
| 62 | ;;(which-function-mode t) | 62 | (which-function-mode t) |
| 63 | 63 | ||
| 64 | ;; Custom plugins | 64 | ;; Custom plugins |
| 65 | (add-to-list 'load-path "~/.emacs.d/lisp/") | 65 | (add-to-list 'load-path "~/.emacs.d/lisp/") |
| 66 | 66 | ||
| 67 | ;;PHP | 67 | ;; PHP |
| 68 | ;; (autoload 'php-mode "php-mode" "Mode for editing PHP source files") | 68 | ;; (autoload 'php-mode "php-mode" "Mode for editing PHP source files") |
| 69 | ;; (add-to-list 'auto-mode-alist '("\\.\\(inc\\|php[s34]?\\)" . php-mode)) | 69 | ;; (add-to-list 'auto-mode-alist '("\\.\\(inc\\|php[s34]?\\)" . php-mode)) |
| 70 | 70 | ||
| 71 | ;; YAML | 71 | ;; YAML |
| 72 | ;;(require 'yaml-mode) | 72 | ;; (require 'yaml-mode) |
| 73 | ;;(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode)) | 73 | ;; (add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode)) |
| 74 | 74 | ||
| 75 | ;; yasnippet | 75 | ;; yasnippet |
| 76 | (require 'yasnippet) | 76 | (require 'yasnippet) |
diff --git a/.emacs.d/lisp/yaml-mode.el b/.emacs.d/lisp/yaml-mode.el index 15f3872..b932576 100644 --- a/.emacs.d/lisp/yaml-mode.el +++ b/.emacs.d/lisp/yaml-mode.el | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: Yoshiki Kurihara <clouder@gmail.com> | 5 | ;; Author: Yoshiki Kurihara <clouder@gmail.com> |
| 6 | ;; Marshall T. Vandegrift <llasram@gmail.com> | 6 | ;; Marshall T. Vandegrift <llasram@gmail.com> |
| 7 | ;; Maintainer: Vasilij Schneidermann <v.schneidermann@gmail.com> | ||
| 8 | ;; Package-Requires: ((emacs "24.1")) | ||
| 7 | ;; Keywords: data yaml | 9 | ;; Keywords: data yaml |
| 8 | ;; Version: 0.0.12 | 10 | ;; Version: 0.0.12 |
| 9 | 11 | ||
| @@ -19,10 +21,9 @@ | |||
| 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | ;; GNU General Public License for more details. | 22 | ;; GNU General Public License for more details. |
| 21 | 23 | ||
| 22 | ;; You should have received a copy of the GNU General Public License | 24 | ;; You should have received a copy of the GNU General Public License along |
| 23 | ;; along with GNU Emacs; see the file COPYING. If not, write to | 25 | ;; with this program; if not, write to the Free Software Foundation, Inc., |
| 24 | ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 26 | ;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 25 | ;; Boston, MA 02111-1307, USA. | ||
| 26 | 27 | ||
| 27 | ;;; Commentary: | 28 | ;;; Commentary: |
| 28 | 29 | ||
| @@ -144,7 +145,7 @@ that key is pressed to begin a block literal." | |||
| 144 | "Regexp matching a single YAML hash key.") | 145 | "Regexp matching a single YAML hash key.") |
| 145 | 146 | ||
| 146 | (defconst yaml-scalar-context-re | 147 | (defconst yaml-scalar-context-re |
| 147 | (concat "\\(?:^\\(?:--- \\)?\\|{\\|\\(?:[-,] +\\)+\\) *" | 148 | (concat "\\(?:^\\(?:--- \\)?\\|{\\|\\(?: *[-,] +\\)+\\) *" |
| 148 | "\\(?:" yaml-bare-scalar-re " *: \\)?") | 149 | "\\(?:" yaml-bare-scalar-re " *: \\)?") |
| 149 | "Regexp indicating the begininng of a scalar context.") | 150 | "Regexp indicating the begininng of a scalar context.") |
| 150 | 151 | ||
| @@ -162,7 +163,7 @@ that key is pressed to begin a block literal." | |||
| 162 | "Regexp matching a line beginning a YAML block literal.") | 163 | "Regexp matching a line beginning a YAML block literal.") |
| 163 | 164 | ||
| 164 | (defconst yaml-nested-sequence-re | 165 | (defconst yaml-nested-sequence-re |
| 165 | (concat "^\\(?: *- +\\)+" | 166 | (concat "^\\(?:\\(?: *- +\\)+\\|\\(:? *-$\\)\\)" |
| 166 | "\\(?:" yaml-bare-scalar-re " *:\\(?: +.*\\)?\\)?$") | 167 | "\\(?:" yaml-bare-scalar-re " *:\\(?: +.*\\)?\\)?$") |
| 167 | "Regexp matching a line containing one or more nested YAML sequences.") | 168 | "Regexp matching a line containing one or more nested YAML sequences.") |
| 168 | 169 | ||
| @@ -213,7 +214,7 @@ that key is pressed to begin a block literal." | |||
| 213 | (modify-syntax-entry ?\] ")[" yaml-mode-syntax-table)) | 214 | (modify-syntax-entry ?\] ")[" yaml-mode-syntax-table)) |
| 214 | 215 | ||
| 215 | ;;;###autoload | 216 | ;;;###autoload |
| 216 | (define-derived-mode yaml-mode fundamental-mode "YAML" | 217 | (define-derived-mode yaml-mode text-mode "YAML" |
| 217 | "Simple mode to edit YAML. | 218 | "Simple mode to edit YAML. |
| 218 | 219 | ||
| 219 | \\{yaml-mode-map}" | 220 | \\{yaml-mode-map}" |
diff --git a/.emacs.d/lisp/yasnippet.el b/.emacs.d/lisp/yasnippet.el index f13dc4f..69d6b26 100644 --- a/.emacs.d/lisp/yasnippet.el +++ b/.emacs.d/lisp/yasnippet.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; yasnippet.el --- Yet another snippet extension for Emacs. | 1 | ;;; yasnippet.el --- Yet another snippet extension for Emacs. |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2008-2013, 2015 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2008-2013, 2015 Free Software Foundation, Inc. |
| 4 | ;; Authors: pluskid <pluskid@gmail.com>, João Távora <joaotavora@gmail.com> | 4 | ;; Authors: pluskid <pluskid@gmail.com>, João Távora <joaotavora@gmail.com>, Noam Postavsky <npostavs@gmail.com> |
| 5 | ;; Maintainer: João Távora <joaotavora@gmail.com> | 5 | ;; Maintainer: Noam Postavsky <npostavs@gmail.com> |
| 6 | ;; Version: 0.8.1 | 6 | ;; Version: 0.8.1 |
| 7 | ;; Package-version: 0.8.0 | 7 | ;; Package-version: 0.8.0 |
| 8 | ;; X-URL: http://github.com/capitaomorte/yasnippet | 8 | ;; X-URL: http://github.com/capitaomorte/yasnippet |
| @@ -156,8 +156,11 @@ | |||
| 156 | (when load-file-name | 156 | (when load-file-name |
| 157 | (concat (file-name-directory load-file-name) "snippets"))) | 157 | (concat (file-name-directory load-file-name) "snippets"))) |
| 158 | 158 | ||
| 159 | (defconst yas--default-user-snippets-dir | ||
| 160 | (concat user-emacs-directory "snippets")) | ||
| 161 | |||
| 159 | (defcustom yas-snippet-dirs (remove nil | 162 | (defcustom yas-snippet-dirs (remove nil |
| 160 | (list "~/.emacs.d/snippets" | 163 | (list yas--default-user-snippets-dir |
| 161 | 'yas-installed-snippets-dir)) | 164 | 'yas-installed-snippets-dir)) |
| 162 | "List of top-level snippet directories. | 165 | "List of top-level snippet directories. |
| 163 | 166 | ||
| @@ -199,10 +202,9 @@ created with `yas-new-snippet'. " | |||
| 199 | (defvaralias 'yas/root-directory 'yas-snippet-dirs) | 202 | (defvaralias 'yas/root-directory 'yas-snippet-dirs) |
| 200 | 203 | ||
| 201 | (defcustom yas-new-snippet-default "\ | 204 | (defcustom yas-new-snippet-default "\ |
| 202 | # -*- mode: snippet; require-final-newline: nil -*- | 205 | # -*- mode: snippet -*- |
| 203 | # name: $1 | 206 | # name: $1 |
| 204 | # key: ${2:${1:$(yas--key-from-desc yas-text)}}${3: | 207 | # key: ${2:${1:$(yas--key-from-desc yas-text)}} |
| 205 | # binding: ${4:direct-keybinding}} | ||
| 206 | # -- | 208 | # -- |
| 207 | $0" | 209 | $0" |
| 208 | "Default snippet to use when creating a new snippet. | 210 | "Default snippet to use when creating a new snippet. |
| @@ -210,10 +212,9 @@ If nil, don't use any snippet." | |||
| 210 | :type 'string | 212 | :type 'string |
| 211 | :group 'yasnippet) | 213 | :group 'yasnippet) |
| 212 | 214 | ||
| 213 | (defcustom yas-prompt-functions '(yas-x-prompt | 215 | (defcustom yas-prompt-functions '(yas-dropdown-prompt |
| 214 | yas-dropdown-prompt | ||
| 215 | yas-completing-prompt | 216 | yas-completing-prompt |
| 216 | yas-ido-prompt | 217 | yas-maybe-ido-prompt |
| 217 | yas-no-prompt) | 218 | yas-no-prompt) |
| 218 | "Functions to prompt for keys, templates, etc interactively. | 219 | "Functions to prompt for keys, templates, etc interactively. |
| 219 | 220 | ||
| @@ -459,10 +460,10 @@ Attention: These hooks are not run when exiting nested/stacked snippet expansion | |||
| 459 | "Hooks to run just before expanding a snippet.") | 460 | "Hooks to run just before expanding a snippet.") |
| 460 | 461 | ||
| 461 | (defvar yas-buffer-local-condition | 462 | (defvar yas-buffer-local-condition |
| 462 | '(if (and (or (fourth (syntax-ppss)) | 463 | '(if (and (let ((ppss (syntax-ppss))) |
| 463 | (fifth (syntax-ppss))) | 464 | (or (nth 3 ppss) (nth 4 ppss))) |
| 464 | this-command | 465 | (memq this-command '(yas-expand yas-expand-from-trigger-key |
| 465 | (eq this-command 'yas-expand-from-trigger-key)) | 466 | yas-expand-from-keymap))) |
| 466 | '(require-snippet-condition . force-in-comment) | 467 | '(require-snippet-condition . force-in-comment) |
| 467 | t) | 468 | t) |
| 468 | "Snippet expanding condition. | 469 | "Snippet expanding condition. |
| @@ -728,22 +729,21 @@ defined direct keybindings to the command | |||
| 728 | (defun yas--modes-to-activate (&optional mode) | 729 | (defun yas--modes-to-activate (&optional mode) |
| 729 | "Compute list of mode symbols that are active for `yas-expand' | 730 | "Compute list of mode symbols that are active for `yas-expand' |
| 730 | and friends." | 731 | and friends." |
| 731 | (let (dfs explored) | 732 | (let* ((explored (if mode (list mode) ; Building up list in reverse. |
| 732 | (setq dfs (lambda (mode) | 733 | (cons major-mode (reverse yas--extra-modes)))) |
| 733 | (unless (memq mode explored) | 734 | (dfs |
| 734 | (push mode explored) | 735 | (lambda (mode) |
| 735 | (loop for neighbour | 736 | (cl-loop for neighbour |
| 736 | in (cl-list* (get mode 'derived-mode-parent) | 737 | in (cl-list* (get mode 'derived-mode-parent) |
| 737 | (ignore-errors (symbol-function mode)) | 738 | (ignore-errors (symbol-function mode)) |
| 738 | (gethash mode yas--parents)) | 739 | (gethash mode yas--parents)) |
| 739 | when (and neighbour | 740 | when (and neighbour |
| 740 | (not (memq neighbour explored)) | 741 | (not (memq neighbour explored)) |
| 741 | (symbolp neighbour)) | 742 | (symbolp neighbour)) |
| 742 | do (funcall dfs neighbour))))) | 743 | do (push neighbour explored) |
| 743 | (if mode | 744 | (funcall dfs neighbour))))) |
| 744 | (funcall dfs mode) | 745 | (mapcar dfs explored) |
| 745 | (mapcar dfs (cons major-mode yas--extra-modes))) | 746 | (nreverse explored))) |
| 746 | explored)) | ||
| 747 | 747 | ||
| 748 | (defvar yas-minor-mode-hook nil | 748 | (defvar yas-minor-mode-hook nil |
| 749 | "Hook run when `yas-minor-mode' is turned on.") | 749 | "Hook run when `yas-minor-mode' is turned on.") |
| @@ -1388,16 +1388,6 @@ them all in `yas--menu-table'" | |||
| 1388 | :visible (yas--show-menu-p ',mode))) | 1388 | :visible (yas--show-menu-p ',mode))) |
| 1389 | menu-keymap)) | 1389 | menu-keymap)) |
| 1390 | 1390 | ||
| 1391 | |||
| 1392 | (defmacro yas--called-interactively-p (&optional kind) | ||
| 1393 | "A backward-compatible version of `called-interactively-p'. | ||
| 1394 | |||
| 1395 | Optional KIND is as documented at `called-interactively-p' | ||
| 1396 | in GNU Emacs 24.1 or higher." | ||
| 1397 | (if (string< emacs-version "24.1") | ||
| 1398 | '(called-interactively-p) | ||
| 1399 | `(called-interactively-p ,kind))) | ||
| 1400 | |||
| 1401 | 1391 | ||
| 1402 | ;;; Template-related and snippet loading functions | 1392 | ;;; Template-related and snippet loading functions |
| 1403 | 1393 | ||
| @@ -1449,7 +1439,7 @@ Here's a list of currently recognized directives: | |||
| 1449 | (point-max))) | 1439 | (point-max))) |
| 1450 | (setq bound (point)) | 1440 | (setq bound (point)) |
| 1451 | (goto-char (point-min)) | 1441 | (goto-char (point-min)) |
| 1452 | (while (re-search-forward "^# *\\([^ ]+?\\) *: *\\(.*\\)$" bound t) | 1442 | (while (re-search-forward "^# *\\([^ ]+?\\) *: *\\(.*?\\)[[:space:]]*$" bound t) |
| 1453 | (when (string= "uuid" (match-string-no-properties 1)) | 1443 | (when (string= "uuid" (match-string-no-properties 1)) |
| 1454 | (setq uuid (match-string-no-properties 2))) | 1444 | (setq uuid (match-string-no-properties 2))) |
| 1455 | (when (string= "type" (match-string-no-properties 1)) | 1445 | (when (string= "type" (match-string-no-properties 1)) |
| @@ -1593,11 +1583,13 @@ Optional PROMPT sets the prompt to use." | |||
| 1593 | (if display-fn (mapcar display-fn choices) choices))))) | 1583 | (if display-fn (mapcar display-fn choices) choices))))) |
| 1594 | (keyboard-quit)))) | 1584 | (keyboard-quit)))) |
| 1595 | 1585 | ||
| 1586 | (defun yas-maybe-ido-prompt (prompt choices &optional display-fn) | ||
| 1587 | (when (bound-and-true-p ido-mode) | ||
| 1588 | (yas-ido-prompt prompt choices display-fn))) | ||
| 1589 | |||
| 1596 | (defun yas-ido-prompt (prompt choices &optional display-fn) | 1590 | (defun yas-ido-prompt (prompt choices &optional display-fn) |
| 1597 | (when (and (fboundp 'ido-completing-read) | 1591 | (require 'ido) |
| 1598 | (or (>= emacs-major-version 24) | 1592 | (yas-completing-prompt prompt choices display-fn #'ido-completing-read)) |
| 1599 | ido-mode)) | ||
| 1600 | (yas-completing-prompt prompt choices display-fn #'ido-completing-read))) | ||
| 1601 | 1593 | ||
| 1602 | (defun yas-dropdown-prompt (_prompt choices &optional display-fn) | 1594 | (defun yas-dropdown-prompt (_prompt choices &optional display-fn) |
| 1603 | (when (fboundp 'dropdown-list) | 1595 | (when (fboundp 'dropdown-list) |
| @@ -1751,8 +1743,8 @@ With prefix argument USE-JIT do jit-loading of snippets." | |||
| 1751 | (funcall fun))) | 1743 | (funcall fun))) |
| 1752 | ;; Look for buffers that are already in `mode-sym', and so | 1744 | ;; Look for buffers that are already in `mode-sym', and so |
| 1753 | ;; need the new snippets immediately... | 1745 | ;; need the new snippets immediately... |
| 1754 | ;; | 1746 | ;; |
| 1755 | (when use-jit | 1747 | (when use-jit |
| 1756 | (cl-loop for buffer in (buffer-list) | 1748 | (cl-loop for buffer in (buffer-list) |
| 1757 | do (with-current-buffer buffer | 1749 | do (with-current-buffer buffer |
| 1758 | (when (eq major-mode mode-sym) | 1750 | (when (eq major-mode mode-sym) |
| @@ -1760,7 +1752,7 @@ With prefix argument USE-JIT do jit-loading of snippets." | |||
| 1760 | (push buffer impatient-buffers))))))) | 1752 | (push buffer impatient-buffers))))))) |
| 1761 | ;; ...after TOP-LEVEL-DIR has been completely loaded, call | 1753 | ;; ...after TOP-LEVEL-DIR has been completely loaded, call |
| 1762 | ;; `yas--load-pending-jits' in these impatient buffers. | 1754 | ;; `yas--load-pending-jits' in these impatient buffers. |
| 1763 | ;; | 1755 | ;; |
| 1764 | (cl-loop for buffer in impatient-buffers | 1756 | (cl-loop for buffer in impatient-buffers |
| 1765 | do (with-current-buffer buffer (yas--load-pending-jits)))) | 1757 | do (with-current-buffer buffer (yas--load-pending-jits)))) |
| 1766 | (when interactive | 1758 | (when interactive |
| @@ -1779,9 +1771,9 @@ With prefix argument USE-JIT do jit-loading of snippets." | |||
| 1779 | (current-time-string))))) | 1771 | (current-time-string))))) |
| 1780 | ;; Normal case. | 1772 | ;; Normal case. |
| 1781 | (unless (file-exists-p (concat directory "/" ".yas-skip")) | 1773 | (unless (file-exists-p (concat directory "/" ".yas-skip")) |
| 1782 | (if (and (progn (yas--message 2 "Loading compiled snippets from %s" directory) t) | 1774 | (unless (and (load (expand-file-name ".yas-compiled-snippets" directory) 'noerror (<= yas-verbosity 3)) |
| 1783 | (load (expand-file-name ".yas-compiled-snippets" directory) 'noerror (<= yas-verbosity 3))) | 1775 | (progn (yas--message 2 "Loaded compiled snippets from %s" directory) t)) |
| 1784 | (yas--message 2 "Loading snippet files from %s" directory) | 1776 | (yas--message 2 "Loading snippet files from %s" directory) |
| 1785 | (yas--load-directory-2 directory mode-sym))))) | 1777 | (yas--load-directory-2 directory mode-sym))))) |
| 1786 | 1778 | ||
| 1787 | (defun yas--load-directory-2 (directory mode-sym) | 1779 | (defun yas--load-directory-2 (directory mode-sym) |
| @@ -1811,16 +1803,18 @@ With prefix argument USE-JIT do jit-loading of snippets." | |||
| 1811 | "Reload the directories listed in `yas-snippet-dirs' or | 1803 | "Reload the directories listed in `yas-snippet-dirs' or |
| 1812 | prompt the user to select one." | 1804 | prompt the user to select one." |
| 1813 | (let (errors) | 1805 | (let (errors) |
| 1814 | (if yas-snippet-dirs | 1806 | (if (null yas-snippet-dirs) |
| 1815 | (dolist (directory (reverse (yas-snippet-dirs))) | 1807 | (call-interactively 'yas-load-directory) |
| 1816 | (cond ((file-directory-p directory) | 1808 | (when (member yas--default-user-snippets-dir yas-snippet-dirs) |
| 1817 | (yas-load-directory directory (not nojit)) | 1809 | (make-directory yas--default-user-snippets-dir t)) |
| 1818 | (if nojit | 1810 | (dolist (directory (reverse (yas-snippet-dirs))) |
| 1819 | (yas--message 3 "Loaded %s" directory) | 1811 | (cond ((file-directory-p directory) |
| 1820 | (yas--message 3 "Prepared just-in-time loading for %s" directory))) | 1812 | (yas-load-directory directory (not nojit)) |
| 1821 | (t | 1813 | (if nojit |
| 1822 | (push (yas--message 0 "Check your `yas-snippet-dirs': %s is not a directory" directory) errors)))) | 1814 | (yas--message 3 "Loaded %s" directory) |
| 1823 | (call-interactively 'yas-load-directory)) | 1815 | (yas--message 3 "Prepared just-in-time loading for %s" directory))) |
| 1816 | (t | ||
| 1817 | (push (yas--message 0 "Check your `yas-snippet-dirs': %s is not a directory" directory) errors))))) | ||
| 1824 | errors)) | 1818 | errors)) |
| 1825 | 1819 | ||
| 1826 | (defun yas-reload-all (&optional no-jit interactive) | 1820 | (defun yas-reload-all (&optional no-jit interactive) |
| @@ -1946,7 +1940,7 @@ This works by stubbing a few functions, then calling | |||
| 1946 | (interactive) | 1940 | (interactive) |
| 1947 | (message (concat "yasnippet (version " | 1941 | (message (concat "yasnippet (version " |
| 1948 | yas--version | 1942 | yas--version |
| 1949 | ") -- pluskid <pluskid@gmail.com>/joaotavora <joaotavora@gmail.com>"))) | 1943 | ") -- pluskid/joaotavora/npostavs"))) |
| 1950 | 1944 | ||
| 1951 | 1945 | ||
| 1952 | ;;; Apropos snippet menu: | 1946 | ;;; Apropos snippet menu: |
| @@ -2226,12 +2220,12 @@ Common gateway for `yas-expand-from-trigger-key' and | |||
| 2226 | ;; loops when other extensions use mechanisms similar | 2220 | ;; loops when other extensions use mechanisms similar |
| 2227 | ;; to `yas--keybinding-beyond-yasnippet'. (github #525 | 2221 | ;; to `yas--keybinding-beyond-yasnippet'. (github #525 |
| 2228 | ;; and #526) | 2222 | ;; and #526) |
| 2229 | ;; | 2223 | ;; |
| 2230 | (yas-minor-mode nil) | 2224 | (yas-minor-mode nil) |
| 2231 | (beyond-yasnippet (yas--keybinding-beyond-yasnippet))) | 2225 | (beyond-yasnippet (yas--keybinding-beyond-yasnippet))) |
| 2232 | (yas--message 4 "Falling back to %s" beyond-yasnippet) | 2226 | (yas--message 4 "Falling back to %s" beyond-yasnippet) |
| 2233 | (assert (or (null beyond-yasnippet) (commandp beyond-yasnippet))) | 2227 | (assert (or (null beyond-yasnippet) (commandp beyond-yasnippet))) |
| 2234 | (setq this-original-command beyond-yasnippet) | 2228 | (setq this-command beyond-yasnippet) |
| 2235 | (when beyond-yasnippet | 2229 | (when beyond-yasnippet |
| 2236 | (call-interactively beyond-yasnippet)))) | 2230 | (call-interactively beyond-yasnippet)))) |
| 2237 | ((and (listp yas-fallback-behavior) | 2231 | ((and (listp yas-fallback-behavior) |
| @@ -2359,7 +2353,6 @@ visited file in `snippet-mode'." | |||
| 2359 | (interactive) | 2353 | (interactive) |
| 2360 | (let* ((yas-buffer-local-condition 'always) | 2354 | (let* ((yas-buffer-local-condition 'always) |
| 2361 | (templates (yas--all-templates (yas--get-snippet-tables))) | 2355 | (templates (yas--all-templates (yas--get-snippet-tables))) |
| 2362 | (yas-prompt-functions '(yas-ido-prompt yas-completing-prompt)) | ||
| 2363 | (template (and templates | 2356 | (template (and templates |
| 2364 | (or (yas--prompt-for-template templates | 2357 | (or (yas--prompt-for-template templates |
| 2365 | "Choose a snippet template to edit: ") | 2358 | "Choose a snippet template to edit: ") |
| @@ -2417,7 +2410,7 @@ where snippets of table might exist." | |||
| 2417 | (let ((main-dir (replace-regexp-in-string | 2410 | (let ((main-dir (replace-regexp-in-string |
| 2418 | "/+$" "" | 2411 | "/+$" "" |
| 2419 | (or (first (or (yas-snippet-dirs) | 2412 | (or (first (or (yas-snippet-dirs) |
| 2420 | (setq yas-snippet-dirs '("~/.emacs.d/snippets"))))))) | 2413 | (setq yas-snippet-dirs (list yas--default-user-snippets-dir))))))) |
| 2421 | (tables (or (and table | 2414 | (tables (or (and table |
| 2422 | (list table)) | 2415 | (list table)) |
| 2423 | (yas--get-snippet-tables)))) | 2416 | (yas--get-snippet-tables)))) |
| @@ -3042,11 +3035,11 @@ through the field's start point" | |||
| 3042 | 3035 | ||
| 3043 | The most recently-inserted snippets are returned first." | 3036 | The most recently-inserted snippets are returned first." |
| 3044 | (sort | 3037 | (sort |
| 3045 | (remove nil (remove-duplicates (mapcar #'(lambda (ov) | 3038 | (delq nil (delete-dups |
| 3046 | (overlay-get ov 'yas--snippet)) | 3039 | (mapcar (lambda (ov) (overlay-get ov 'yas--snippet)) |
| 3047 | (if all-snippets | 3040 | (if all-snippets (overlays-in (point-min) (point-max)) |
| 3048 | (overlays-in (point-min) (point-max)) | 3041 | (nconc (overlays-at (point)) |
| 3049 | (nconc (overlays-at (point)) (overlays-at (1- (point)))))))) | 3042 | (overlays-at (1- (point)))))))) |
| 3050 | #'(lambda (s1 s2) | 3043 | #'(lambda (s1 s2) |
| 3051 | (<= (yas--snippet-id s2) (yas--snippet-id s1))))) | 3044 | (<= (yas--snippet-id s2) (yas--snippet-id s1))))) |
| 3052 | 3045 | ||
| @@ -3159,12 +3152,6 @@ Also create some protection overlays" | |||
| 3159 | (defvar yas--inhibit-overlay-hooks nil | 3152 | (defvar yas--inhibit-overlay-hooks nil |
| 3160 | "Bind this temporarily to non-nil to prevent running `yas--on-*-modification'.") | 3153 | "Bind this temporarily to non-nil to prevent running `yas--on-*-modification'.") |
| 3161 | 3154 | ||
| 3162 | (defmacro yas--inhibit-overlay-hooks (&rest body) | ||
| 3163 | "Run BODY with `yas--inhibit-overlay-hooks' set to t." | ||
| 3164 | (declare (indent 0)) | ||
| 3165 | `(let ((yas--inhibit-overlay-hooks t)) | ||
| 3166 | ,@body)) | ||
| 3167 | |||
| 3168 | (defvar yas-snippet-beg nil "Beginning position of the last snippet committed.") | 3155 | (defvar yas-snippet-beg nil "Beginning position of the last snippet committed.") |
| 3169 | (defvar yas-snippet-end nil "End position of the last snippet committed.") | 3156 | (defvar yas-snippet-end nil "End position of the last snippet committed.") |
| 3170 | 3157 | ||
| @@ -3184,7 +3171,7 @@ This renders the snippet as ordinary text." | |||
| 3184 | (setq yas-snippet-end (overlay-end control-overlay)) | 3171 | (setq yas-snippet-end (overlay-end control-overlay)) |
| 3185 | (delete-overlay control-overlay)) | 3172 | (delete-overlay control-overlay)) |
| 3186 | 3173 | ||
| 3187 | (yas--inhibit-overlay-hooks | 3174 | (let ((yas--inhibit-overlay-hooks t)) |
| 3188 | (when yas--active-field-overlay | 3175 | (when yas--active-field-overlay |
| 3189 | (delete-overlay yas--active-field-overlay)) | 3176 | (delete-overlay yas--active-field-overlay)) |
| 3190 | (when yas--field-protection-overlays | 3177 | (when yas--field-protection-overlays |
| @@ -3396,13 +3383,28 @@ Move the overlay, or create it if it does not exit." | |||
| 3396 | (overlay-put yas--active-field-overlay 'insert-behind-hooks | 3383 | (overlay-put yas--active-field-overlay 'insert-behind-hooks |
| 3397 | '(yas--on-field-overlay-modification)))) | 3384 | '(yas--on-field-overlay-modification)))) |
| 3398 | 3385 | ||
| 3399 | (defun yas--on-field-overlay-modification (overlay after? _beg _end &optional _length) | 3386 | (defun yas--skip-and-clear-field-p (field _beg _end &optional _length) |
| 3387 | "Tell if newly modified FIELD should be cleared and skipped. | ||
| 3388 | BEG, END and LENGTH like overlay modification hooks." | ||
| 3389 | (and (not (yas--field-modified-p field)) | ||
| 3390 | (= (point) (yas--field-start field)) | ||
| 3391 | (require 'delsel) | ||
| 3392 | ;; `yank' sets `this-command' to t during execution. | ||
| 3393 | (let ((clearp (get (if (commandp this-command) this-command | ||
| 3394 | this-original-command) | ||
| 3395 | 'delete-selection))) | ||
| 3396 | (when (and (not (memq clearp '(yank supersede kill))) | ||
| 3397 | (functionp clearp)) | ||
| 3398 | (setq clearp (funcall clearp))) | ||
| 3399 | clearp))) | ||
| 3400 | |||
| 3401 | (defun yas--on-field-overlay-modification (overlay after? beg end &optional length) | ||
| 3400 | "Clears the field and updates mirrors, conditionally. | 3402 | "Clears the field and updates mirrors, conditionally. |
| 3401 | 3403 | ||
| 3402 | Only clears the field if it hasn't been modified and it point it | 3404 | Only clears the field if it hasn't been modified and point is at |
| 3403 | at field start. This hook doesn't do anything if an undo is in | 3405 | field start. This hook does nothing if an undo is in progress." |
| 3404 | progress." | ||
| 3405 | (unless (or yas--inhibit-overlay-hooks | 3406 | (unless (or yas--inhibit-overlay-hooks |
| 3407 | (not (overlayp yas--active-field-overlay)) ; Avoid Emacs bug #21824. | ||
| 3406 | (yas--undo-in-progress)) | 3408 | (yas--undo-in-progress)) |
| 3407 | (let* ((field (overlay-get overlay 'yas--field)) | 3409 | (let* ((field (overlay-get overlay 'yas--field)) |
| 3408 | (snippet (overlay-get yas--active-field-overlay 'yas--snippet))) | 3410 | (snippet (overlay-get yas--active-field-overlay 'yas--snippet))) |
| @@ -3412,11 +3414,7 @@ progress." | |||
| 3412 | (yas--field-update-display field)) | 3414 | (yas--field-update-display field)) |
| 3413 | (yas--update-mirrors snippet)) | 3415 | (yas--update-mirrors snippet)) |
| 3414 | (field | 3416 | (field |
| 3415 | (when (and (not after?) | 3417 | (when (yas--skip-and-clear-field-p field beg end) |
| 3416 | (not (yas--field-modified-p field)) | ||
| 3417 | (eq (point) (if (markerp (yas--field-start field)) | ||
| 3418 | (marker-position (yas--field-start field)) | ||
| 3419 | (yas--field-start field)))) | ||
| 3420 | (yas--skip-and-clear field)) | 3418 | (yas--skip-and-clear field)) |
| 3421 | (setf (yas--field-modified-p field) t)))))) | 3419 | (setf (yas--field-modified-p field) t)))))) |
| 3422 | 3420 | ||
| @@ -3429,7 +3427,7 @@ progress." | |||
| 3429 | ;; As of github #537 this no longer inhibits the command by issuing an | 3427 | ;; As of github #537 this no longer inhibits the command by issuing an |
| 3430 | ;; error: all the snippets at point, including nested snippets, are | 3428 | ;; error: all the snippets at point, including nested snippets, are |
| 3431 | ;; automatically commited and the current command can proceed. | 3429 | ;; automatically commited and the current command can proceed. |
| 3432 | ;; | 3430 | ;; |
| 3433 | (defun yas--make-move-field-protection-overlays (snippet field) | 3431 | (defun yas--make-move-field-protection-overlays (snippet field) |
| 3434 | "Place protection overlays surrounding SNIPPET's FIELD. | 3432 | "Place protection overlays surrounding SNIPPET's FIELD. |
| 3435 | 3433 | ||
| @@ -3443,7 +3441,7 @@ Move the overlays, or create them if they do not exit." | |||
| 3443 | ;; | 3441 | ;; |
| 3444 | (when (< (buffer-size) end) | 3442 | (when (< (buffer-size) end) |
| 3445 | (save-excursion | 3443 | (save-excursion |
| 3446 | (yas--inhibit-overlay-hooks | 3444 | (let ((yas--inhibit-overlay-hooks t)) |
| 3447 | (goto-char (point-max)) | 3445 | (goto-char (point-max)) |
| 3448 | (newline)))) | 3446 | (newline)))) |
| 3449 | ;; go on to normal overlay creation/moving | 3447 | ;; go on to normal overlay creation/moving |
| @@ -3559,7 +3557,7 @@ considered when expanding the snippet." | |||
| 3559 | ;; them mostly to make the undo information | 3557 | ;; them mostly to make the undo information |
| 3560 | ;; | 3558 | ;; |
| 3561 | (setq yas--start-column (current-column)) | 3559 | (setq yas--start-column (current-column)) |
| 3562 | (yas--inhibit-overlay-hooks | 3560 | (let ((yas--inhibit-overlay-hooks t)) |
| 3563 | (setq snippet | 3561 | (setq snippet |
| 3564 | (if expand-env | 3562 | (if expand-env |
| 3565 | (eval `(let* ,expand-env | 3563 | (eval `(let* ,expand-env |
| @@ -4241,7 +4239,7 @@ When multiple expressions are found, only the last one counts." | |||
| 4241 | (not (string= reflection (buffer-substring-no-properties (yas--mirror-start mirror) | 4239 | (not (string= reflection (buffer-substring-no-properties (yas--mirror-start mirror) |
| 4242 | (yas--mirror-end mirror))))) | 4240 | (yas--mirror-end mirror))))) |
| 4243 | (goto-char (yas--mirror-start mirror)) | 4241 | (goto-char (yas--mirror-start mirror)) |
| 4244 | (yas--inhibit-overlay-hooks | 4242 | (let ((yas--inhibit-overlay-hooks t)) |
| 4245 | (insert reflection)) | 4243 | (insert reflection)) |
| 4246 | (if (> (yas--mirror-end mirror) (point)) | 4244 | (if (> (yas--mirror-end mirror) (point)) |
| 4247 | (delete-region (point) (yas--mirror-end mirror)) | 4245 | (delete-region (point) (yas--mirror-end mirror)) |
| @@ -4260,7 +4258,7 @@ When multiple expressions are found, only the last one counts." | |||
| 4260 | (yas--field-end field))))) | 4258 | (yas--field-end field))))) |
| 4261 | (setf (yas--field-modified-p field) t) | 4259 | (setf (yas--field-modified-p field) t) |
| 4262 | (goto-char (yas--field-start field)) | 4260 | (goto-char (yas--field-start field)) |
| 4263 | (yas--inhibit-overlay-hooks | 4261 | (let ((yas--inhibit-overlay-hooks t)) |
| 4264 | (insert transformed) | 4262 | (insert transformed) |
| 4265 | (if (> (yas--field-end field) (point)) | 4263 | (if (> (yas--field-end field) (point)) |
| 4266 | (delete-region (point) (yas--field-end field)) | 4264 | (delete-region (point) (yas--field-end field)) |
diff --git a/.emacs.d/snippets/java-mode/apr_assert b/.emacs.d/snippets/java-mode/apr_assert new file mode 100644 index 0000000..a3942be --- /dev/null +++ b/.emacs.d/snippets/java-mode/apr_assert | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: apr_assert | ||
| 3 | # key: apr_assert | ||
| 4 | # -- | ||
| 5 | if (Globals.useAssertions) { | ||
| 6 | ${1:assert ..}; | ||
| 7 | } | ||
diff --git a/.emacs.d/snippets/java-mode/assert b/.emacs.d/snippets/java-mode/assert new file mode 100644 index 0000000..686ffea --- /dev/null +++ b/.emacs.d/snippets/java-mode/assert | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet; require-final-newline: nil -*- | ||
| 2 | # name: assert | ||
| 3 | # key: as | ||
| 4 | # -- | ||
| 5 | assert ${1:expression}; \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/assertEquals b/.emacs.d/snippets/java-mode/assertEquals new file mode 100644 index 0000000..ce23dae --- /dev/null +++ b/.emacs.d/snippets/java-mode/assertEquals | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet; require-final-newline: nil -*- | ||
| 2 | # name: assertEquals | ||
| 3 | # key: ae | ||
| 4 | # group: test | ||
| 5 | # -- | ||
| 6 | Assert.assertEquals($1, $2); | ||
| 7 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/cls b/.emacs.d/snippets/java-mode/cls new file mode 100644 index 0000000..88f534f --- /dev/null +++ b/.emacs.d/snippets/java-mode/cls | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: cls | ||
| 3 | # key: cls | ||
| 4 | # -- | ||
| 5 | class ${1:Class} { | ||
| 6 | $0 | ||
| 7 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/constructor b/.emacs.d/snippets/java-mode/constructor new file mode 100644 index 0000000..602e496 --- /dev/null +++ b/.emacs.d/snippets/java-mode/constructor | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet; require-final-newline: nil -*- | ||
| 2 | # name: constructor | ||
| 3 | # key: c | ||
| 4 | # -- | ||
| 5 | public ${1:Class} (${2:args}) { | ||
| 6 | $0 | ||
| 7 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/define test method b/.emacs.d/snippets/java-mode/define test method new file mode 100644 index 0000000..fd9daf6 --- /dev/null +++ b/.emacs.d/snippets/java-mode/define test method | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | # -*- mode: snippet; require-final-newline: nil -*- | ||
| 2 | # name: define test method | ||
| 3 | # key: dt | ||
| 4 | # -- | ||
| 5 | @Test | ||
| 6 | public void test${1:Name}() throws Exception { | ||
| 7 | $0 | ||
| 8 | } | ||
diff --git a/.emacs.d/snippets/java-mode/doc b/.emacs.d/snippets/java-mode/doc new file mode 100644 index 0000000..88f556e --- /dev/null +++ b/.emacs.d/snippets/java-mode/doc | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: doc | ||
| 3 | # key: /* | ||
| 4 | # -- | ||
| 5 | /** | ||
| 6 | * ${1:documentation} | ||
| 7 | */ \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/equals b/.emacs.d/snippets/java-mode/equals new file mode 100644 index 0000000..e990966 --- /dev/null +++ b/.emacs.d/snippets/java-mode/equals | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: equals | ||
| 3 | # key: eq | ||
| 4 | # -- | ||
| 5 | public boolean equals(${1:Class} other) { | ||
| 6 | $0 | ||
| 7 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/file_class b/.emacs.d/snippets/java-mode/file_class new file mode 100644 index 0000000..e0a46f6 --- /dev/null +++ b/.emacs.d/snippets/java-mode/file_class | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: file_class | ||
| 3 | # key: file | ||
| 4 | # -- | ||
| 5 | public class ${1:`(file-name-base | ||
| 6 | (or (buffer-file-name) | ||
| 7 | (buffer-name)))`} { | ||
| 8 | $0 | ||
| 9 | } | ||
diff --git a/.emacs.d/snippets/java-mode/for b/.emacs.d/snippets/java-mode/for new file mode 100644 index 0000000..833827b --- /dev/null +++ b/.emacs.d/snippets/java-mode/for | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: for | ||
| 3 | # key: for | ||
| 4 | # -- | ||
| 5 | for (${1:int i = 0}; ${2:i < N}; ${3:i++}) { | ||
| 6 | $0 | ||
| 7 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/fori b/.emacs.d/snippets/java-mode/fori new file mode 100644 index 0000000..a417f2c --- /dev/null +++ b/.emacs.d/snippets/java-mode/fori | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: fori | ||
| 3 | # key: fori | ||
| 4 | # -- | ||
| 5 | for (${1:Object el} : ${2:iterator}) { | ||
| 6 | $0 | ||
| 7 | } | ||
diff --git a/.emacs.d/snippets/java-mode/getter b/.emacs.d/snippets/java-mode/getter new file mode 100644 index 0000000..747f9f4 --- /dev/null +++ b/.emacs.d/snippets/java-mode/getter | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet; require-final-newline: nil -*- | ||
| 2 | # name: getter | ||
| 3 | # key: g | ||
| 4 | # -- | ||
| 5 | public ${1:int} get${2:Field}() { | ||
| 6 | return ${3:field}; | ||
| 7 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/if b/.emacs.d/snippets/java-mode/if new file mode 100644 index 0000000..cae545f --- /dev/null +++ b/.emacs.d/snippets/java-mode/if | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: if | ||
| 3 | # key: if | ||
| 4 | # -- | ||
| 5 | if (${1:condition}) { | ||
| 6 | $0 | ||
| 7 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/ife b/.emacs.d/snippets/java-mode/ife new file mode 100644 index 0000000..975643f --- /dev/null +++ b/.emacs.d/snippets/java-mode/ife | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: ife | ||
| 3 | # key: ife | ||
| 4 | # -- | ||
| 5 | if (${1:cond}) { | ||
| 6 | $2 | ||
| 7 | } | ||
| 8 | else { | ||
| 9 | $3 | ||
| 10 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/import b/.emacs.d/snippets/java-mode/import new file mode 100644 index 0000000..56235a2 --- /dev/null +++ b/.emacs.d/snippets/java-mode/import | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: import | ||
| 3 | # key: imp | ||
| 4 | # -- | ||
| 5 | import ${1:System.}; | ||
| 6 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/iterator b/.emacs.d/snippets/java-mode/iterator new file mode 100644 index 0000000..69fb2ac --- /dev/null +++ b/.emacs.d/snippets/java-mode/iterator | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: iterator | ||
| 3 | # key: iterator | ||
| 4 | # -- | ||
| 5 | public Iterator<${1:type}> iterator() { | ||
| 6 | $0 | ||
| 7 | } | ||
diff --git a/.emacs.d/snippets/java-mode/javadoc b/.emacs.d/snippets/java-mode/javadoc new file mode 100644 index 0000000..5bc9051 --- /dev/null +++ b/.emacs.d/snippets/java-mode/javadoc | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: javadoc | ||
| 3 | # key: doc | ||
| 4 | # -- | ||
| 5 | /** | ||
| 6 | * $0 | ||
| 7 | * | ||
| 8 | */ \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/lambda b/.emacs.d/snippets/java-mode/lambda new file mode 100644 index 0000000..a73a7a5 --- /dev/null +++ b/.emacs.d/snippets/java-mode/lambda | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet; require-final-newline: nil -*- | ||
| 2 | # name: lambda | ||
| 3 | # key: \ | ||
| 4 | # -- | ||
| 5 | (${1:args}) -> ${2:expression}; \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/main b/.emacs.d/snippets/java-mode/main new file mode 100644 index 0000000..b24e49d --- /dev/null +++ b/.emacs.d/snippets/java-mode/main | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: main | ||
| 3 | # key: main | ||
| 4 | # -- | ||
| 5 | public static void main(String[] args) { | ||
| 6 | $0 | ||
| 7 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/main_class b/.emacs.d/snippets/java-mode/main_class new file mode 100644 index 0000000..624b31c --- /dev/null +++ b/.emacs.d/snippets/java-mode/main_class | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | # contributor: L. Guruprasad <lgp171188@gmail.com> | ||
| 2 | # name: main_class | ||
| 3 | # key: main_class | ||
| 4 | # -- | ||
| 5 | class `(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))` | ||
| 6 | { | ||
| 7 | public static void main(String args[]) | ||
| 8 | { | ||
| 9 | $0 | ||
| 10 | } | ||
| 11 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/method b/.emacs.d/snippets/java-mode/method new file mode 100644 index 0000000..7a6b9ed --- /dev/null +++ b/.emacs.d/snippets/java-mode/method | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet; require-final-newline: nil -*- | ||
| 2 | # name: method | ||
| 3 | # key: m | ||
| 4 | # -- | ||
| 5 | ${1:public} ${2:void} ${3:name}(${4:args}) { | ||
| 6 | $0 | ||
| 7 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/new b/.emacs.d/snippets/java-mode/new new file mode 100644 index 0000000..f06091d --- /dev/null +++ b/.emacs.d/snippets/java-mode/new | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: new | ||
| 3 | # key: new | ||
| 4 | # -- | ||
| 5 | ${1:Type} ${2:obj} = new ${3:Constr}(${4:args}); | ||
| 6 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/override b/.emacs.d/snippets/java-mode/override new file mode 100644 index 0000000..9878c85 --- /dev/null +++ b/.emacs.d/snippets/java-mode/override | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet; require-final-newline: nil -*- | ||
| 2 | # name: override | ||
| 3 | # key: o | ||
| 4 | # -- | ||
| 5 | @Override | ||
| 6 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/param b/.emacs.d/snippets/java-mode/param new file mode 100644 index 0000000..4a1f44d --- /dev/null +++ b/.emacs.d/snippets/java-mode/param | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: param | ||
| 3 | # key: param | ||
| 4 | # -- | ||
| 5 | @param ${1:paramater} $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/printf b/.emacs.d/snippets/java-mode/printf new file mode 100644 index 0000000..f93c965 --- /dev/null +++ b/.emacs.d/snippets/java-mode/printf | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: printf | ||
| 3 | # key: printf | ||
| 4 | # -- | ||
| 5 | System.out.printf("$0%n"); \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/println b/.emacs.d/snippets/java-mode/println new file mode 100644 index 0000000..7dd8f0d --- /dev/null +++ b/.emacs.d/snippets/java-mode/println | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: println | ||
| 3 | # key: pr | ||
| 4 | # -- | ||
| 5 | System.out.println("${1:text}"); | ||
| 6 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/return b/.emacs.d/snippets/java-mode/return new file mode 100644 index 0000000..5712e0c --- /dev/null +++ b/.emacs.d/snippets/java-mode/return | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet; require-final-newline: nil -*- | ||
| 2 | # name: return | ||
| 3 | # key: r | ||
| 4 | # -- | ||
| 5 | return $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/test b/.emacs.d/snippets/java-mode/test new file mode 100644 index 0000000..a37d115 --- /dev/null +++ b/.emacs.d/snippets/java-mode/test | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: test | ||
| 3 | # key: test | ||
| 4 | # -- | ||
| 5 | @Test | ||
| 6 | public void test_${1:Case}() { | ||
| 7 | $0 | ||
| 8 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/testClass b/.emacs.d/snippets/java-mode/testClass new file mode 100644 index 0000000..b01a68f --- /dev/null +++ b/.emacs.d/snippets/java-mode/testClass | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: testClass | ||
| 3 | # key: tc | ||
| 4 | # -- | ||
| 5 | import junit.framework.*; | ||
| 6 | import junit.textui.*; | ||
| 7 | |||
| 8 | public class Test${1:Class} extends TestCase { | ||
| 9 | protected void setUp() { | ||
| 10 | $0 | ||
| 11 | } | ||
| 12 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/this b/.emacs.d/snippets/java-mode/this new file mode 100644 index 0000000..45201b4 --- /dev/null +++ b/.emacs.d/snippets/java-mode/this | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet; require-final-newline: nil -*- | ||
| 2 | # name: this | ||
| 3 | # key: . | ||
| 4 | # -- | ||
| 5 | this.$1 = $1; | ||
| 6 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/toString b/.emacs.d/snippets/java-mode/toString new file mode 100644 index 0000000..0382a9e --- /dev/null +++ b/.emacs.d/snippets/java-mode/toString | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: toString | ||
| 3 | # key: toStr | ||
| 4 | # -- | ||
| 5 | public String toString() { | ||
| 6 | $0 | ||
| 7 | } \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/java-mode/try b/.emacs.d/snippets/java-mode/try new file mode 100644 index 0000000..1a17ba3 --- /dev/null +++ b/.emacs.d/snippets/java-mode/try | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: try | ||
| 3 | # key: try | ||
| 4 | # -- | ||
| 5 | try { | ||
| 6 | $0 | ||
| 7 | } | ||
| 8 | catch (${1:Throwable e}) { | ||
| 9 | ${2:System.out.println("Error " + e.getMessage()); | ||
| 10 | e.printStackTrace();} | ||
| 11 | } | ||
diff --git a/.emacs.d/snippets/java-mode/value b/.emacs.d/snippets/java-mode/value new file mode 100644 index 0000000..7ec38ef --- /dev/null +++ b/.emacs.d/snippets/java-mode/value | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet; require-final-newline: nil -*- | ||
| 2 | # name: value | ||
| 3 | # key: val | ||
| 4 | # -- | ||
| 5 | final ${1:int} ${2:n} = $0; \ No newline at end of file | ||
