diff options
| author | Simeon Simeonov | 2018-03-06 13:11:32 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2018-03-06 13:11:32 +0100 |
| commit | de9d904f4a4a7b3df8d536bc3dc964c1b2c61786 (patch) | |
| tree | 8f99a32d9f188355f6bca32f829c84e81a3afc67 | |
| parent | 361ce94b7639413592ec8d75d1abbc4a0990170c (diff) | |
Upgrade php-mode, yasnippet and add glib_false glib_print glib_printf glib_true
| -rw-r--r-- | .emacs.d/lisp/php-mode.el | 104 | ||||
| -rw-r--r-- | .emacs.d/lisp/php-project.el | 143 | ||||
| -rw-r--r-- | .emacs.d/lisp/yasnippet.el | 22 | ||||
| -rw-r--r-- | .emacs.d/snippets/c-mode/glib_false | 5 | ||||
| -rw-r--r-- | .emacs.d/snippets/c-mode/glib_print | 5 | ||||
| -rw-r--r-- | .emacs.d/snippets/c-mode/glib_printf | 5 | ||||
| -rw-r--r-- | .emacs.d/snippets/c-mode/glib_true | 5 |
7 files changed, 209 insertions, 80 deletions
diff --git a/.emacs.d/lisp/php-mode.el b/.emacs.d/lisp/php-mode.el index 629c974..2e23642 100644 --- a/.emacs.d/lisp/php-mode.el +++ b/.emacs.d/lisp/php-mode.el | |||
| @@ -8,14 +8,14 @@ | |||
| 8 | ;; Maintainer: USAMI Kenta <tadsan@zonu.me> | 8 | ;; Maintainer: USAMI Kenta <tadsan@zonu.me> |
| 9 | ;; URL: https://github.com/ejmr/php-mode | 9 | ;; URL: https://github.com/ejmr/php-mode |
| 10 | ;; Keywords: languages php | 10 | ;; Keywords: languages php |
| 11 | ;; Version: 1.18.4 | 11 | ;; Version: 1.19.0 |
| 12 | ;; Package-Requires: ((emacs "24") (cl-lib "0.5")) | 12 | ;; Package-Requires: ((emacs "24") (cl-lib "0.5")) |
| 13 | ;; License: GPL-3.0-or-later | 13 | ;; License: GPL-3.0-or-later |
| 14 | 14 | ||
| 15 | (defconst php-mode-version-number "1.18.4" | 15 | (defconst php-mode-version-number "1.19.0" |
| 16 | "PHP Mode version number.") | 16 | "PHP Mode version number.") |
| 17 | 17 | ||
| 18 | (defconst php-mode-modified "2018-01-30" | 18 | (defconst php-mode-modified "2018-03-05" |
| 19 | "PHP Mode build date.") | 19 | "PHP Mode build date.") |
| 20 | 20 | ||
| 21 | ;; This file is free software; you can redistribute it and/or | 21 | ;; This file is free software; you can redistribute it and/or |
| @@ -83,9 +83,11 @@ | |||
| 83 | (require 'etags) | 83 | (require 'etags) |
| 84 | (require 'speedbar) | 84 | (require 'speedbar) |
| 85 | (require 'imenu) | 85 | (require 'imenu) |
| 86 | (require 'php-project nil t) | ||
| 86 | 87 | ||
| 87 | (require 'cl-lib) | 88 | (require 'cl-lib) |
| 88 | (require 'mode-local) | 89 | (require 'mode-local) |
| 90 | (require 'php-project) | ||
| 89 | 91 | ||
| 90 | (eval-when-compile | 92 | (eval-when-compile |
| 91 | (require 'regexp-opt) | 93 | (require 'regexp-opt) |
| @@ -373,14 +375,15 @@ This variable can take one of the following symbol values: | |||
| 373 | (const :tag "WordPress" wordpress) | 375 | (const :tag "WordPress" wordpress) |
| 374 | (const :tag "Symfony2" symfony2) | 376 | (const :tag "Symfony2" symfony2) |
| 375 | (const :tag "PSR-2" psr2)) | 377 | (const :tag "PSR-2" psr2)) |
| 376 | :set 'php-mode-custom-coding-style-set | ||
| 377 | :initialize 'custom-initialize-default) | 378 | :initialize 'custom-initialize-default) |
| 378 | 379 | ||
| 379 | (defun php-mode-custom-coding-style-set (sym value) | 380 | |
| 380 | (when (eq major-mode 'php-mode) | 381 | (defcustom php-mode-enable-project-coding-style t |
| 381 | (set sym value) | 382 | "When set to true override php-mode-coding-style by php-project-coding-style. |
| 382 | (set-default sym value) | 383 | |
| 383 | (php-set-style (symbol-name value)))) | 384 | If you want to suppress styles from being overwritten by directory / file |
| 385 | local variables, set NIL." | ||
| 386 | :type 'boolean) | ||
| 384 | 387 | ||
| 385 | (defun php-mode-version () | 388 | (defun php-mode-version () |
| 386 | "Display string describing the version of PHP Mode." | 389 | "Display string describing the version of PHP Mode." |
| @@ -388,30 +391,8 @@ This variable can take one of the following symbol values: | |||
| 388 | (message "PHP Mode %s of %s" | 391 | (message "PHP Mode %s of %s" |
| 389 | php-mode-version-number php-mode-modified)) | 392 | php-mode-version-number php-mode-modified)) |
| 390 | 393 | ||
| 391 | (defvar php-available-project-root-files | ||
| 392 | '((projectile ".projectile") | ||
| 393 | (composer "composer.json" "composer.lock") | ||
| 394 | (git ".git") | ||
| 395 | (mercurial ".hg") | ||
| 396 | (subversion ".svn") | ||
| 397 | ;; NOTICE: This method does not detect the top level of .editorconfig | ||
| 398 | ;; However, we can integrate it by adding the editorconfig.el's API. | ||
| 399 | ;;(editorconfig . ".editorconfig") | ||
| 400 | )) | ||
| 401 | |||
| 402 | ;;;###autoload | 394 | ;;;###autoload |
| 403 | (progn | 395 | (define-obsolete-variable-alias 'php-available-project-root-files 'php-project-available-root-files "1.19.0") |
| 404 | (defvar php-project-root 'auto | ||
| 405 | "Method of searching for the top level directory. | ||
| 406 | |||
| 407 | `auto' (default) | ||
| 408 | Try to search file in order of `php-available-project-root-files'. | ||
| 409 | |||
| 410 | SYMBOL | ||
| 411 | Key of `php-available-project-root-files'.") | ||
| 412 | (make-variable-buffer-local 'php-project-root) | ||
| 413 | (put 'php-project-root 'safe-local-variable | ||
| 414 | #'(lambda (v) (assq v php-available-project-root-files)))) | ||
| 415 | 396 | ||
| 416 | (defvar php-mode-map | 397 | (defvar php-mode-map |
| 417 | (let ((map (make-sparse-keymap))) | 398 | (let ((map (make-sparse-keymap))) |
| @@ -441,11 +422,8 @@ SYMBOL | |||
| 441 | ;; | 422 | ;; |
| 442 | ;; https://www.gnu.org/software/emacs/manual/html_node/ccmode/Subword-Movement.html | 423 | ;; https://www.gnu.org/software/emacs/manual/html_node/ccmode/Subword-Movement.html |
| 443 | ;; | 424 | ;; |
| 444 | ;; for more information about Submode Word. | 425 | ;; for more information about Subword mode. |
| 445 | (if (boundp 'subword-mode) | 426 | (define-key map (kbd "C-c C-w") 'subword-mode) |
| 446 | (if subword-mode | ||
| 447 | (subword-mode nil) | ||
| 448 | (subword-mode t))) | ||
| 449 | 427 | ||
| 450 | ;; We inherit c-beginning-of-defun and c-end-of-defun from CC Mode | 428 | ;; We inherit c-beginning-of-defun and c-end-of-defun from CC Mode |
| 451 | ;; but we have two replacement functions specifically for PHP. We | 429 | ;; but we have two replacement functions specifically for PHP. We |
| @@ -595,7 +573,6 @@ PHP does not have an \"enum\"-like keyword." | |||
| 595 | "iterable" | 573 | "iterable" |
| 596 | "as" | 574 | "as" |
| 597 | "break" | 575 | "break" |
| 598 | "catch all" | ||
| 599 | "catch" | 576 | "catch" |
| 600 | "clone" | 577 | "clone" |
| 601 | "default" | 578 | "default" |
| @@ -682,7 +659,6 @@ but only if the setting is enabled" | |||
| 682 | (indent-tabs-mode . nil) | 659 | (indent-tabs-mode . nil) |
| 683 | (tab-width . ,(default-value 'tab-width)) | 660 | (tab-width . ,(default-value 'tab-width)) |
| 684 | (fill-column . ,(default-value 'fill-column)) | 661 | (fill-column . ,(default-value 'fill-column)) |
| 685 | (require-final-newline . ,(default-value 'require-final-newline)) | ||
| 686 | (show-trailing-whitespace . ,(default-value 'show-trailing-whitespace)) | 662 | (show-trailing-whitespace . ,(default-value 'show-trailing-whitespace)) |
| 687 | (php-style-delete-trailing-whitespace . nil))) | 663 | (php-style-delete-trailing-whitespace . nil))) |
| 688 | 664 | ||
| @@ -736,8 +712,7 @@ but only if the setting is enabled" | |||
| 736 | '("php" | 712 | '("php" |
| 737 | (c-offsets-alist . ((statement-cont . php-lineup-hanging-semicolon))) | 713 | (c-offsets-alist . ((statement-cont . php-lineup-hanging-semicolon))) |
| 738 | (c-indent-comments-syntactically-p . t) | 714 | (c-indent-comments-syntactically-p . t) |
| 739 | (fill-column . 78) | 715 | (fill-column . 78))) |
| 740 | (require-final-newline . t))) | ||
| 741 | 716 | ||
| 742 | (defun php-enable-symfony2-coding-style () | 717 | (defun php-enable-symfony2-coding-style () |
| 743 | "Make php-mode use coding styles that are preferable for working with Symfony2." | 718 | "Make php-mode use coding styles that are preferable for working with Symfony2." |
| @@ -750,7 +725,6 @@ but only if the setting is enabled" | |||
| 750 | (c-offsets-alist . ((statement-cont . +))) | 725 | (c-offsets-alist . ((statement-cont . +))) |
| 751 | (c-indent-comments-syntactically-p . t) | 726 | (c-indent-comments-syntactically-p . t) |
| 752 | (fill-column . 78) | 727 | (fill-column . 78) |
| 753 | (require-final-newline . t) | ||
| 754 | (show-trailing-whitespace . t) | 728 | (show-trailing-whitespace . t) |
| 755 | (php-style-delete-trailing-whitespace . t))) | 729 | (php-style-delete-trailing-whitespace . t))) |
| 756 | 730 | ||
| @@ -1148,15 +1122,24 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1148 | 1122 | ||
| 1149 | (put 'php-set-style 'interactive-form (interactive-form 'c-set-style)) | 1123 | (put 'php-set-style 'interactive-form (interactive-form 'c-set-style)) |
| 1150 | 1124 | ||
| 1125 | (defun php-mode-set-style-delay () | ||
| 1126 | "Set the current `php-mode' buffer to use the style by custom or local variables." | ||
| 1127 | (let ((coding-style (or (and (boundp 'php-project-coding-style) php-project-coding-style) | ||
| 1128 | php-mode-coding-style))) | ||
| 1129 | (prog1 (php-set-style (symbol-name coding-style)) | ||
| 1130 | (remove-hook 'hack-local-variables-hook #'php-mode-set-style-delay)))) | ||
| 1131 | |||
| 1151 | (defun php-mode-debug () | 1132 | (defun php-mode-debug () |
| 1152 | "Display informations useful for debugging PHP Mode." | 1133 | "Display informations useful for debugging PHP Mode." |
| 1153 | (interactive) | 1134 | (interactive) |
| 1154 | (message "--- PHP-MODE DEBUG BEGIN ---") | 1135 | (message "--- PHP-MODE DEBUG BEGIN ---") |
| 1155 | (message "versions: %s; %s" (emacs-version) (php-mode-version)) | 1136 | (message "versions: %s; %s" (emacs-version) (php-mode-version)) |
| 1156 | (message "major-mode: %s" major-mode) | 1137 | (message "major-mode: %s" major-mode) |
| 1157 | (message "minor-modes: %s" (cl-remove-if | 1138 | (message "minor-modes: %s" |
| 1158 | (lambda (s) (string-match-p "global" (symbol-name s))) | 1139 | (cl-loop for s in minor-mode-list |
| 1159 | minor-mode-list)) | 1140 | unless (string-match-p "global" (symbol-name s)) |
| 1141 | if (and (boundp s) (symbol-value s)) | ||
| 1142 | collect s)) | ||
| 1160 | (message "variables: %s" | 1143 | (message "variables: %s" |
| 1161 | (cl-loop for v in '(indent-tabs-mode tab-width) | 1144 | (cl-loop for v in '(indent-tabs-mode tab-width) |
| 1162 | collect (list v (symbol-value v)))) | 1145 | collect (list v (symbol-value v)))) |
| @@ -1203,13 +1186,12 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1203 | ;; PHP vars are case-sensitive | 1186 | ;; PHP vars are case-sensitive |
| 1204 | (setq case-fold-search t) | 1187 | (setq case-fold-search t) |
| 1205 | 1188 | ||
| 1206 | ;; Do not force newline at end of file. Such newlines can cause | 1189 | ;; When php-mode-enable-project-coding-style is set, it is delayed by hook. |
| 1207 | ;; trouble if the PHP file is included in another file before calls | 1190 | ;; Since it depends on the timing at which the file local variable is set. |
| 1208 | ;; to header() or cookie(). | 1191 | ;; File local variables are set after initialization of major mode except `run-hook' is complete. |
| 1209 | (set (make-local-variable 'require-final-newline) nil) | 1192 | (if php-mode-enable-project-coding-style |
| 1210 | (set (make-local-variable 'next-line-add-newlines) nil) | 1193 | (add-hook 'hack-local-variables-hook #'php-mode-set-style-delay t t) |
| 1211 | 1194 | (php-set-style (symbol-name php-mode-coding-style))) | |
| 1212 | (php-set-style (symbol-name php-mode-coding-style)) | ||
| 1213 | 1195 | ||
| 1214 | (when (or php-mode-force-pear | 1196 | (when (or php-mode-force-pear |
| 1215 | (and (stringp buffer-file-name) | 1197 | (and (stringp buffer-file-name) |
| @@ -1599,12 +1581,6 @@ a completion list." | |||
| 1599 | ;; already fontified by another pattern. Note that using OVERRIDE | 1581 | ;; already fontified by another pattern. Note that using OVERRIDE |
| 1600 | ;; is usually overkill. | 1582 | ;; is usually overkill. |
| 1601 | `( | 1583 | `( |
| 1602 | ;; Highlight variables, e.g. 'var' in '$var' and '$obj->var', but | ||
| 1603 | ;; not in $obj->var() | ||
| 1604 | ("->\\(\\sw+\\)\\s-*(" 1 'php-method-call) | ||
| 1605 | |||
| 1606 | ("\\(\\$\\|->\\)\\([a-zA-Z0-9_]+\\)" 2 'php-property-name) | ||
| 1607 | |||
| 1608 | ;; Highlight all upper-cased symbols as constant | 1584 | ;; Highlight all upper-cased symbols as constant |
| 1609 | ("\\<\\([A-Z_][A-Z0-9_]+\\)\\>" 1 'php-constant) | 1585 | ("\\<\\([A-Z_][A-Z0-9_]+\\)\\>" 1 'php-constant) |
| 1610 | 1586 | ||
| @@ -1753,18 +1729,6 @@ The output will appear in the buffer *PHP*." | |||
| 1753 | (match-string-no-properties 1)))) | 1729 | (match-string-no-properties 1)))) |
| 1754 | 1730 | ||
| 1755 | ;;;###autoload | 1731 | ;;;###autoload |
| 1756 | (defun php-project-get-root-dir () | ||
| 1757 | "Return path to current PHP project." | ||
| 1758 | (let ((detect-method (if (stringp php-project-root) | ||
| 1759 | (list php-project-root) | ||
| 1760 | (if (eq php-project-root 'auto) | ||
| 1761 | (cl-loop for m in php-available-project-root-files | ||
| 1762 | append (cdr m)) | ||
| 1763 | (cdr-safe (assq php-project-root php-available-project-root-files)))))) | ||
| 1764 | (cl-loop for m in detect-method | ||
| 1765 | thereis (locate-dominating-file default-directory m)))) | ||
| 1766 | |||
| 1767 | ;;;###autoload | ||
| 1768 | (defun php-current-class () | 1732 | (defun php-current-class () |
| 1769 | "Insert current class name if cursor in class context." | 1733 | "Insert current class name if cursor in class context." |
| 1770 | (interactive) | 1734 | (interactive) |
diff --git a/.emacs.d/lisp/php-project.el b/.emacs.d/lisp/php-project.el new file mode 100644 index 0000000..cb04341 --- /dev/null +++ b/.emacs.d/lisp/php-project.el | |||
| @@ -0,0 +1,143 @@ | |||
| 1 | ;;; php-project.el --- Project support for PHP application -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2018 Friends of Emacs-PHP development | ||
| 4 | |||
| 5 | ;; Author: USAMI Kenta <tadsan@zonu.me> | ||
| 6 | ;; Keywords: tools, files | ||
| 7 | ;; URL: https://github.com/ejmr/php-mode | ||
| 8 | ;; Version: 1.19.0 | ||
| 9 | ;; Package-Requires: ((emacs "24") (cl-lib "0.5")) | ||
| 10 | ;; License: GPL-3.0-or-later | ||
| 11 | |||
| 12 | ;; This program is free software; you can redistribute it and/or modify | ||
| 13 | ;; it under the terms of the GNU General Public License as published by | ||
| 14 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 15 | ;; (at your option) any later version. | ||
| 16 | |||
| 17 | ;; This program is distributed in the hope that it will be useful, | ||
| 18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | ;; GNU General Public License for more details. | ||
| 21 | |||
| 22 | ;; You should have received a copy of the GNU General Public License | ||
| 23 | ;; along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| 24 | |||
| 25 | ;;; Commentary: | ||
| 26 | |||
| 27 | ;; Define project specific functions and variables for PHP application. | ||
| 28 | ;; | ||
| 29 | ;; ## API | ||
| 30 | ;; | ||
| 31 | ;; ### `php-project-get-root-dir()' | ||
| 32 | ;; | ||
| 33 | ;; Return root directory of current buffer file. The root directory is | ||
| 34 | ;; determined by several marker file or directory. | ||
| 35 | ;; | ||
| 36 | ;; ### `php-project-get-bootstrap-scripts()' | ||
| 37 | ;; | ||
| 38 | ;; Return list of path to bootstrap script file. | ||
| 39 | ;; | ||
| 40 | ;; ## `.dir-locals.el' support | ||
| 41 | ;; | ||
| 42 | ;; - `php-project-coding-style' | ||
| 43 | ;; - Symbol value of the coding style. (ex. `pear', `psr2') | ||
| 44 | ;; - `php-project-root' | ||
| 45 | ;; - Symbol of marker file of project root. (ex. `git', `composer') | ||
| 46 | ;; - Full path to project root directory. (ex. "/path/to/your-project") | ||
| 47 | ;; - `php-project-bootstrap-scripts' | ||
| 48 | ;; - List of path to bootstrap file of project. | ||
| 49 | ;; (ex. (((root . "vendor/autoload.php") (root . "inc/bootstrap.php"))) | ||
| 50 | ;; | ||
| 51 | |||
| 52 | ;;; Code: | ||
| 53 | (require 'cl-lib) | ||
| 54 | |||
| 55 | ;; Constants | ||
| 56 | (defconst php-project-composer-autoloader "vendor/autoload.php") | ||
| 57 | |||
| 58 | ;; Variables | ||
| 59 | (defvar php-project-available-root-files | ||
| 60 | '((projectile ".projectile") | ||
| 61 | (composer "composer.json" "composer.lock") | ||
| 62 | (git ".git") | ||
| 63 | (mercurial ".hg") | ||
| 64 | (subversion ".svn") | ||
| 65 | ;; NOTICE: This method does not detect the top level of .editorconfig | ||
| 66 | ;; However, we can integrate it by adding the editorconfig.el's API. | ||
| 67 | ;;(editorconfig . ".editorconfig") | ||
| 68 | )) | ||
| 69 | |||
| 70 | ;; Buffer local variables | ||
| 71 | |||
| 72 | ;;;###autoload | ||
| 73 | (progn | ||
| 74 | (defvar php-project-root 'auto | ||
| 75 | "Method of searching for the top level directory. | ||
| 76 | |||
| 77 | `auto' (default) | ||
| 78 | Try to search file in order of `php-project-available-root-files'. | ||
| 79 | |||
| 80 | SYMBOL | ||
| 81 | Key of `php-project-available-root-files'.") | ||
| 82 | (make-variable-buffer-local 'php-project-root) | ||
| 83 | (put 'php-project-root 'safe-local-variable | ||
| 84 | #'(lambda (v) (assq v php-project-available-root-files)))) | ||
| 85 | |||
| 86 | ;;;###autoload | ||
| 87 | (progn | ||
| 88 | (defvar php-project-bootstrap-scripts nil | ||
| 89 | "List of path to bootstrap php script file. | ||
| 90 | |||
| 91 | The ideal bootstrap file is silent, it only includes dependent files, | ||
| 92 | defines constants, and sets the class loaders.") | ||
| 93 | (make-variable-buffer-local 'php-project-bootstrap-scripts) | ||
| 94 | (put 'php-project-bootstrap-scripts 'safe-local-variable #'php-project--eval-bootstrap-scripts)) | ||
| 95 | |||
| 96 | ;;;###autoload | ||
| 97 | (progn | ||
| 98 | (defvar php-project-coding-style nil | ||
| 99 | "Symbol value of the coding style of the project that PHP major mode refers to. | ||
| 100 | |||
| 101 | Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.") | ||
| 102 | (make-variable-buffer-local 'php-project-coding-style) | ||
| 103 | (put 'php-project-coding-style 'safe-local-variable #'symbolp)) | ||
| 104 | |||
| 105 | |||
| 106 | ;; Functions | ||
| 107 | |||
| 108 | (defun php-project--eval-bootstrap-scripts (val) | ||
| 109 | "Return T when `VAL' is valid list of safe bootstrap php script." | ||
| 110 | (cond | ||
| 111 | ((stringp val) (and (file-exists-p val) val)) | ||
| 112 | ((eq 'composer val) | ||
| 113 | (let ((path (expand-file-name php-project-composer-autoloader (php-project-get-root-dir)))) | ||
| 114 | (and (file-exists-p path) path))) | ||
| 115 | ((and (consp val) (eq 'root (car val)) (stringp (cdr val))) | ||
| 116 | (let ((path (expand-file-name (cdr val) (php-project-get-root-dir)))) | ||
| 117 | (and (file-exists-p path) path))) | ||
| 118 | ((null val) nil) | ||
| 119 | ((listp val) | ||
| 120 | (cl-loop for v in val collect (php-project--eval-bootstrap-scripts v))) | ||
| 121 | (t nil))) | ||
| 122 | |||
| 123 | ;;;###autoload | ||
| 124 | (defun php-project-get-bootstrap-scripts () | ||
| 125 | "Return list of bootstrap script." | ||
| 126 | (let ((scripts (php-project--eval-bootstrap-scripts php-project-bootstrap-scripts))) | ||
| 127 | (if (stringp scripts) (list scripts) scripts))) | ||
| 128 | |||
| 129 | ;;;###autoload | ||
| 130 | (defun php-project-get-root-dir () | ||
| 131 | "Return path to current PHP project." | ||
| 132 | (let ((detect-method | ||
| 133 | (cond | ||
| 134 | ((stringp php-project-root) (list php-project-root)) | ||
| 135 | ((eq php-project-root 'auto) | ||
| 136 | (cl-loop for m in php-project-available-root-files | ||
| 137 | append (cdr m))) | ||
| 138 | (t (cdr-safe (assq php-project-root php-project-available-root-files)))))) | ||
| 139 | (cl-loop for m in detect-method | ||
| 140 | thereis (locate-dominating-file default-directory m)))) | ||
| 141 | |||
| 142 | (provide 'php-project) | ||
| 143 | ;;; php-project.el ends here | ||
diff --git a/.emacs.d/lisp/yasnippet.el b/.emacs.d/lisp/yasnippet.el index 69b880a..1f92adc 100644 --- a/.emacs.d/lisp/yasnippet.el +++ b/.emacs.d/lisp/yasnippet.el | |||
| @@ -237,7 +237,7 @@ nil. | |||
| 237 | - To signal that the user quit the prompting process, you can | 237 | - To signal that the user quit the prompting process, you can |
| 238 | signal `quit' with | 238 | signal `quit' with |
| 239 | 239 | ||
| 240 | (signal \\='quit \"user quit!\")." | 240 | (signal \\='quit \"user quit!\")" |
| 241 | :type '(repeat function)) | 241 | :type '(repeat function)) |
| 242 | 242 | ||
| 243 | (defcustom yas-indent-line 'auto | 243 | (defcustom yas-indent-line 'auto |
| @@ -984,11 +984,8 @@ Honour `yas-dont-activate-functions', which see." | |||
| 984 | Meaning it's visiting a file under one of the mode directories in | 984 | Meaning it's visiting a file under one of the mode directories in |
| 985 | `yas-snippet-dirs'." | 985 | `yas-snippet-dirs'." |
| 986 | (when buffer-file-name | 986 | (when buffer-file-name |
| 987 | (member | 987 | (cl-member buffer-file-name (yas-snippet-dirs) |
| 988 | (expand-file-name | 988 | :test #'file-in-directory-p))) |
| 989 | ".." | ||
| 990 | (file-name-directory buffer-file-name)) | ||
| 991 | (yas-snippet-dirs)))) | ||
| 992 | 989 | ||
| 993 | ;; We're abusing `magic-fallback-mode-alist' here because | 990 | ;; We're abusing `magic-fallback-mode-alist' here because |
| 994 | ;; `auto-mode-alist' doesn't support function matchers. | 991 | ;; `auto-mode-alist' doesn't support function matchers. |
| @@ -2949,7 +2946,8 @@ Otherwise signal `yas-exception'." | |||
| 2949 | (defun yas-field-value (number) | 2946 | (defun yas-field-value (number) |
| 2950 | "Get the string for field with NUMBER. | 2947 | "Get the string for field with NUMBER. |
| 2951 | 2948 | ||
| 2952 | Use this in primary and mirror transformations to tget." | 2949 | Use this in primary and mirror transformations to get the text of |
| 2950 | other fields." | ||
| 2953 | (let* ((snippet (car (yas-active-snippets))) | 2951 | (let* ((snippet (car (yas-active-snippets))) |
| 2954 | (field (and snippet | 2952 | (field (and snippet |
| 2955 | (yas--snippet-find-field snippet number)))) | 2953 | (yas--snippet-find-field snippet number)))) |
| @@ -4305,9 +4303,13 @@ The SNIPPET's markers are preserved." | |||
| 4305 | ;; Now do stuff for `fixed' and `auto'. | 4303 | ;; Now do stuff for `fixed' and `auto'. |
| 4306 | (save-excursion | 4304 | (save-excursion |
| 4307 | (cond ((eq yas-indent-line 'fixed) | 4305 | (cond ((eq yas-indent-line 'fixed) |
| 4308 | (while (and (zerop (forward-line)) | 4306 | (forward-line 1) |
| 4309 | (zerop (current-column))) | 4307 | (let ((indent-line-function |
| 4310 | (indent-to-column yas--indent-original-column))) | 4308 | (lambda () |
| 4309 | (indent-to-column yas--indent-original-column)))) | ||
| 4310 | (yas--indent-region (line-beginning-position) | ||
| 4311 | (point-max) | ||
| 4312 | snippet))) | ||
| 4311 | ((eq yas-indent-line 'auto) | 4313 | ((eq yas-indent-line 'auto) |
| 4312 | (unless yas-also-auto-indent-first-line | 4314 | (unless yas-also-auto-indent-first-line |
| 4313 | (forward-line 1)) | 4315 | (forward-line 1)) |
diff --git a/.emacs.d/snippets/c-mode/glib_false b/.emacs.d/snippets/c-mode/glib_false new file mode 100644 index 0000000..de9015d --- /dev/null +++ b/.emacs.d/snippets/c-mode/glib_false | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: glib_false | ||
| 3 | # key: GF | ||
| 4 | # -- | ||
| 5 | FALSE \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/c-mode/glib_print b/.emacs.d/snippets/c-mode/glib_print new file mode 100644 index 0000000..23adaab --- /dev/null +++ b/.emacs.d/snippets/c-mode/glib_print | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: glib_print | ||
| 3 | # key: gp | ||
| 4 | # -- | ||
| 5 | g_printf("$0"); \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/c-mode/glib_printf b/.emacs.d/snippets/c-mode/glib_printf new file mode 100644 index 0000000..06107db --- /dev/null +++ b/.emacs.d/snippets/c-mode/glib_printf | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: glib_printf | ||
| 3 | # key: gpf | ||
| 4 | # -- | ||
| 5 | g_printf("${1:format string}"$2); \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/c-mode/glib_true b/.emacs.d/snippets/c-mode/glib_true new file mode 100644 index 0000000..0baf8e8 --- /dev/null +++ b/.emacs.d/snippets/c-mode/glib_true | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: glib_true | ||
| 3 | # key: GT | ||
| 4 | # -- | ||
| 5 | TRUE \ No newline at end of file | ||
