diff options
| author | Simeon Simeonov | 2017-08-01 12:02:49 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2017-08-01 12:02:49 +0200 |
| commit | 05b4f4ce4d6d2d655ed94c9de91cb530372eec0c (patch) | |
| tree | 1f03656620515fee58ba0320d62f3689eaa41dba | |
| parent | d3897e6921d636fca903af39cc1516fe97aa8560 (diff) | |
Upgrade php-mode.el yaml-mode.el yasnippet.el
| -rw-r--r-- | .emacs.d/lisp/php-mode.el | 22 | ||||
| -rw-r--r-- | .emacs.d/lisp/yaml-mode.el | 2 | ||||
| -rw-r--r-- | .emacs.d/lisp/yasnippet.el | 76 |
3 files changed, 57 insertions, 43 deletions
diff --git a/.emacs.d/lisp/php-mode.el b/.emacs.d/lisp/php-mode.el index b586891..c666cc5 100644 --- a/.emacs.d/lisp/php-mode.el +++ b/.emacs.d/lisp/php-mode.el | |||
| @@ -53,7 +53,7 @@ | |||
| 53 | 53 | ||
| 54 | ;;; Commentary: | 54 | ;;; Commentary: |
| 55 | 55 | ||
| 56 | ;; PHP mode is a major mode for editing PHP source code. It's an | 56 | ;; PHP Mode is a major mode for editing PHP source code. It's an |
| 57 | ;; extension of C mode; thus it inherits all C mode's navigation | 57 | ;; extension of C mode; thus it inherits all C mode's navigation |
| 58 | ;; functionality. But it colors according to the PHP grammar and | 58 | ;; functionality. But it colors according to the PHP grammar and |
| 59 | ;; indents according to the PEAR coding guidelines. It also includes | 59 | ;; indents according to the PEAR coding guidelines. It also includes |
| @@ -376,9 +376,9 @@ This variable can take one of the following symbol values: | |||
| 376 | (php-enable-psr2-coding-style))))) | 376 | (php-enable-psr2-coding-style))))) |
| 377 | 377 | ||
| 378 | (defun php-mode-version () | 378 | (defun php-mode-version () |
| 379 | "Display string describing the version of PHP mode." | 379 | "Display string describing the version of PHP Mode." |
| 380 | (interactive) | 380 | (interactive) |
| 381 | (message "PHP mode %s of %s" | 381 | (message "PHP Mode %s of %s" |
| 382 | php-mode-version-number php-mode-modified)) | 382 | php-mode-version-number php-mode-modified)) |
| 383 | 383 | ||
| 384 | (defvar php-mode-map | 384 | (defvar php-mode-map |
| @@ -393,7 +393,7 @@ This variable can take one of the following symbol values: | |||
| 393 | ;; (define-key map [menu-bar php search-documentation] | 393 | ;; (define-key map [menu-bar php search-documentation] |
| 394 | ;; '("Search documentation" . php-search-documentation)) | 394 | ;; '("Search documentation" . php-search-documentation)) |
| 395 | 395 | ||
| 396 | ;; By default PHP mode binds C-M-h to c-mark-function, which it | 396 | ;; By default PHP Mode binds C-M-h to c-mark-function, which it |
| 397 | ;; inherits from cc-mode. But there are situations where | 397 | ;; inherits from cc-mode. But there are situations where |
| 398 | ;; c-mark-function fails to properly mark a function. For | 398 | ;; c-mark-function fails to properly mark a function. For |
| 399 | ;; example, if we use c-mark-function within a method definition | 399 | ;; example, if we use c-mark-function within a method definition |
| @@ -1039,7 +1039,7 @@ PHP heredoc." | |||
| 1039 | "PHP Mode face used to highlight variable names." | 1039 | "PHP Mode face used to highlight variable names." |
| 1040 | :group 'php-faces) | 1040 | :group 'php-faces) |
| 1041 | 1041 | ||
| 1042 | (defface php-property-name '((t (:inherit php-variable-name-face))) | 1042 | (defface php-property-name '((t (:inherit php-variable-name))) |
| 1043 | "PHP Mode face used to highlight property names." | 1043 | "PHP Mode face used to highlight property names." |
| 1044 | :group 'php-faces) | 1044 | :group 'php-faces) |
| 1045 | 1045 | ||
| @@ -1506,10 +1506,10 @@ a completion list." | |||
| 1506 | php-phpdoc-font-lock-doc-comments))))) | 1506 | php-phpdoc-font-lock-doc-comments))))) |
| 1507 | 1507 | ||
| 1508 | (defconst php-font-lock-keywords-1 (c-lang-const c-matchers-1 php) | 1508 | (defconst php-font-lock-keywords-1 (c-lang-const c-matchers-1 php) |
| 1509 | "Basic highlighting for PHP mode.") | 1509 | "Basic highlighting for PHP Mode.") |
| 1510 | 1510 | ||
| 1511 | (defconst php-font-lock-keywords-2 (c-lang-const c-matchers-2 php) | 1511 | (defconst php-font-lock-keywords-2 (c-lang-const c-matchers-2 php) |
| 1512 | "Medium level highlighting for PHP mode.") | 1512 | "Medium level highlighting for PHP Mode.") |
| 1513 | 1513 | ||
| 1514 | (defconst php-font-lock-keywords-3 | 1514 | (defconst php-font-lock-keywords-3 |
| 1515 | (append | 1515 | (append |
| @@ -1600,10 +1600,10 @@ a completion list." | |||
| 1600 | ;; Note that starting a file with <% breaks indentation, a | 1600 | ;; Note that starting a file with <% breaks indentation, a |
| 1601 | ;; limitation we can/should live with. | 1601 | ;; limitation we can/should live with. |
| 1602 | (,(regexp-opt '("?>" "<?" "<%" "%>")) 0 'php-php-tag))) | 1602 | (,(regexp-opt '("?>" "<?" "<%" "%>")) 0 'php-php-tag))) |
| 1603 | "Detailed highlighting for PHP mode.") | 1603 | "Detailed highlighting for PHP Mode.") |
| 1604 | 1604 | ||
| 1605 | (defvar php-font-lock-keywords php-font-lock-keywords-3 | 1605 | (defvar php-font-lock-keywords php-font-lock-keywords-3 |
| 1606 | "Default expressions to highlight in PHP mode.") | 1606 | "Default expressions to highlight in PHP Mode.") |
| 1607 | 1607 | ||
| 1608 | ;;; Provide support for Flymake so that users can see warnings and | 1608 | ;;; Provide support for Flymake so that users can see warnings and |
| 1609 | ;;; errors in real-time as they write code. | 1609 | ;;; errors in real-time as they write code. |
| @@ -1664,7 +1664,7 @@ The output will appear in the buffer *PHP*." | |||
| 1664 | ;;; Correct the behavior of `delete-indentation' by modifying the | 1664 | ;;; Correct the behavior of `delete-indentation' by modifying the |
| 1665 | ;;; logic of `fixup-whitespace'. | 1665 | ;;; logic of `fixup-whitespace'. |
| 1666 | (defadvice fixup-whitespace (after php-mode-fixup-whitespace) | 1666 | (defadvice fixup-whitespace (after php-mode-fixup-whitespace) |
| 1667 | "Remove whitespace before certain characters in PHP mode." | 1667 | "Remove whitespace before certain characters in PHP Mode." |
| 1668 | (let* ((no-behind-space ";\\|,\\|->\\|::") | 1668 | (let* ((no-behind-space ";\\|,\\|->\\|::") |
| 1669 | (no-front-space "->\\|::")) | 1669 | (no-front-space "->\\|::")) |
| 1670 | (when (and (eq major-mode 'php-mode) | 1670 | (when (and (eq major-mode 'php-mode) |
| @@ -1723,7 +1723,7 @@ The output will appear in the buffer *PHP*." | |||
| 1723 | 1723 | ||
| 1724 | ;;;###autoload | 1724 | ;;;###autoload |
| 1725 | (defun php-current-namespace () | 1725 | (defun php-current-namespace () |
| 1726 | "Insert current namespace if cursor in in namespace context." | 1726 | "Insert current namespace if cursor in namespace context." |
| 1727 | (interactive) | 1727 | (interactive) |
| 1728 | (let ((matched (php-get-current-element php--re-namespace-pattern))) | 1728 | (let ((matched (php-get-current-element php--re-namespace-pattern))) |
| 1729 | (when matched | 1729 | (when matched |
diff --git a/.emacs.d/lisp/yaml-mode.el b/.emacs.d/lisp/yaml-mode.el index 90e2109..e257379 100644 --- a/.emacs.d/lisp/yaml-mode.el +++ b/.emacs.d/lisp/yaml-mode.el | |||
| @@ -125,7 +125,7 @@ that key is pressed to begin a block literal." | |||
| 125 | (defconst yaml-directive-re "^\\(?:--- \\)? *%\\(\\w+\\)" | 125 | (defconst yaml-directive-re "^\\(?:--- \\)? *%\\(\\w+\\)" |
| 126 | "Regexp matching a line contatining a YAML directive.") | 126 | "Regexp matching a line contatining a YAML directive.") |
| 127 | 127 | ||
| 128 | (defconst yaml-document-delimiter-re "^ *\\(?:---\\|[.][.][.]\\)" | 128 | (defconst yaml-document-delimiter-re "^\\(?:---\\|[.][.][.]\\)" |
| 129 | "Rexexp matching a YAML document delimiter line.") | 129 | "Rexexp matching a YAML document delimiter line.") |
| 130 | 130 | ||
| 131 | (defconst yaml-node-anchor-alias-re "[&*][a-zA-Z0-9_-]+" | 131 | (defconst yaml-node-anchor-alias-re "[&*][a-zA-Z0-9_-]+" |
diff --git a/.emacs.d/lisp/yasnippet.el b/.emacs.d/lisp/yasnippet.el index 69f7381..94ccffb 100644 --- a/.emacs.d/lisp/yasnippet.el +++ b/.emacs.d/lisp/yasnippet.el | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | ;;; yasnippet.el --- Yet another snippet extension for Emacs. | 1 | ;;; yasnippet.el --- Yet another snippet extension for Emacs. |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2008-2016 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2008-2017 Free Software Foundation, Inc. |
| 4 | ;; Authors: pluskid <pluskid@gmail.com>, | 4 | ;; Authors: pluskid <pluskid@gmail.com>, |
| 5 | ;; João Távora <joaotavora@gmail.com>, | 5 | ;; João Távora <joaotavora@gmail.com>, |
| 6 | ;; Noam Postavsky <npostavs@gmail.com> | 6 | ;; Noam Postavsky <npostavs@gmail.com> |
| 7 | ;; Maintainer: Noam Postavsky <npostavs@gmail.com> | 7 | ;; Maintainer: Noam Postavsky <npostavs@gmail.com> |
| 8 | ;; Version: 0.11.0 | 8 | ;; Version: 0.12.1 |
| 9 | ;; X-URL: http://github.com/joaotavora/yasnippet | 9 | ;; X-URL: http://github.com/joaotavora/yasnippet |
| 10 | ;; Keywords: convenience, emulation | 10 | ;; Keywords: convenience, emulation |
| 11 | ;; URL: http://github.com/joaotavora/yasnippet | 11 | ;; URL: http://github.com/joaotavora/yasnippet |
| @@ -132,6 +132,7 @@ | |||
| 132 | ;;; Code: | 132 | ;;; Code: |
| 133 | 133 | ||
| 134 | (require 'cl-lib) | 134 | (require 'cl-lib) |
| 135 | (declare-function cl-progv-after "cl-extra") ; Needed for 23.4. | ||
| 135 | (require 'easymenu) | 136 | (require 'easymenu) |
| 136 | (require 'help-mode) | 137 | (require 'help-mode) |
| 137 | 138 | ||
| @@ -535,7 +536,7 @@ override bindings from other packages (e.g., `company-mode')." | |||
| 535 | 536 | ||
| 536 | ;;; Internal variables | 537 | ;;; Internal variables |
| 537 | 538 | ||
| 538 | (defconst yas--version "0.11.0") | 539 | (defconst yas--version "0.12.1") |
| 539 | 540 | ||
| 540 | (defvar yas--menu-table (make-hash-table) | 541 | (defvar yas--menu-table (make-hash-table) |
| 541 | "A hash table of MAJOR-MODE symbols to menu keymaps.") | 542 | "A hash table of MAJOR-MODE symbols to menu keymaps.") |
| @@ -585,6 +586,8 @@ override bindings from other packages (e.g., `company-mode')." | |||
| 585 | (defvar yas--minor-mode-menu nil | 586 | (defvar yas--minor-mode-menu nil |
| 586 | "Holds the YASnippet menu.") | 587 | "Holds the YASnippet menu.") |
| 587 | 588 | ||
| 589 | (defvar yas--condition-cache-timestamp nil) | ||
| 590 | |||
| 588 | (defun yas--maybe-expand-key-filter (cmd) | 591 | (defun yas--maybe-expand-key-filter (cmd) |
| 589 | (when (let ((yas--condition-cache-timestamp (current-time))) | 592 | (when (let ((yas--condition-cache-timestamp (current-time))) |
| 590 | (yas--templates-for-key-at-point)) | 593 | (yas--templates-for-key-at-point)) |
| @@ -2183,7 +2186,6 @@ Just put this function in `hippie-expand-try-functions-list'." | |||
| 2183 | ;;; | 2186 | ;;; |
| 2184 | ;;; | 2187 | ;;; |
| 2185 | ;;; | 2188 | ;;; |
| 2186 | (defvar yas--condition-cache-timestamp nil) | ||
| 2187 | (defmacro yas-define-condition-cache (func doc &rest body) | 2189 | (defmacro yas-define-condition-cache (func doc &rest body) |
| 2188 | "Define a function FUNC with doc DOC and body BODY. | 2190 | "Define a function FUNC with doc DOC and body BODY. |
| 2189 | BODY is executed at most once every snippet expansion attempt, to check | 2191 | BODY is executed at most once every snippet expansion attempt, to check |
| @@ -3028,9 +3030,16 @@ DEPTH is a count of how many nested mirrors can affect this mirror" | |||
| 3028 | 3030 | ||
| 3029 | (defmacro yas--letenv (env &rest body) | 3031 | (defmacro yas--letenv (env &rest body) |
| 3030 | "Evaluate BODY with bindings from ENV. | 3032 | "Evaluate BODY with bindings from ENV. |
| 3031 | ENV is a list of elements with the form (VAR FORM)." | 3033 | ENV is a lisp expression that evaluates to list of elements with |
| 3034 | the form (VAR FORM), where VAR is a symbol and FORM is a lisp | ||
| 3035 | expression that evaluates to its value." | ||
| 3032 | (declare (debug (form body)) (indent 1)) | 3036 | (declare (debug (form body)) (indent 1)) |
| 3033 | `(eval (cl-list* 'let* ,env ',body))) | 3037 | (let ((envvar (make-symbol "envvar"))) |
| 3038 | `(let ((,envvar ,env)) | ||
| 3039 | (cl-progv | ||
| 3040 | (mapcar #'car ,envvar) | ||
| 3041 | (mapcar (lambda (v-f) (eval (cadr v-f))) ,envvar) | ||
| 3042 | ,@body)))) | ||
| 3034 | 3043 | ||
| 3035 | (defun yas--snippet-map-markers (fun snippet) | 3044 | (defun yas--snippet-map-markers (fun snippet) |
| 3036 | "Apply FUN to all marker (sub)fields in SNIPPET. | 3045 | "Apply FUN to all marker (sub)fields in SNIPPET. |
| @@ -3635,7 +3644,10 @@ field start. This hook does nothing if an undo is in progress." | |||
| 3635 | (narrow-to-region beg end) | 3644 | (narrow-to-region beg end) |
| 3636 | (mapc #'yas--restore-marker-location remarkers) | 3645 | (mapc #'yas--restore-marker-location remarkers) |
| 3637 | (mapc #'yas--restore-overlay-location reoverlays)) | 3646 | (mapc #'yas--restore-overlay-location reoverlays)) |
| 3638 | (mapc #'yas--update-mirrors snippets)))) | 3647 | (mapc (lambda (snippet) |
| 3648 | (yas--letenv (yas--snippet-expand-env snippet) | ||
| 3649 | (yas--update-mirrors snippet))) | ||
| 3650 | snippets)))) | ||
| 3639 | 3651 | ||
| 3640 | 3652 | ||
| 3641 | ;;; Apropos protection overlays: | 3653 | ;;; Apropos protection overlays: |
| @@ -3828,7 +3840,7 @@ considered when expanding the snippet." | |||
| 3828 | (sit-for 0) ;; fix issue 125 | 3840 | (sit-for 0) ;; fix issue 125 |
| 3829 | (yas--letenv (yas--snippet-expand-env snippet) | 3841 | (yas--letenv (yas--snippet-expand-env snippet) |
| 3830 | (yas--move-to-field snippet first-field)))) | 3842 | (yas--move-to-field snippet first-field)))) |
| 3831 | (yas--message 4 "snippet expanded.") | 3843 | (yas--message 4 "snippet %d expanded." (yas--snippet-id snippet)) |
| 3832 | (setq deactivate-mark nil) | 3844 | (setq deactivate-mark nil) |
| 3833 | t)))) | 3845 | t)))) |
| 3834 | 3846 | ||
| @@ -4540,7 +4552,7 @@ When multiple expressions are found, only the last one counts." | |||
| 4540 | (when parent-field | 4552 | (when parent-field |
| 4541 | (yas--advance-start-maybe mirror (yas--fom-start parent-field)))) | 4553 | (yas--advance-start-maybe mirror (yas--fom-start parent-field)))) |
| 4542 | ;; Update this mirror. | 4554 | ;; Update this mirror. |
| 4543 | do (yas--mirror-update-display mirror field snippet) | 4555 | do (yas--mirror-update-display mirror field) |
| 4544 | ;; Delay indenting until we're done all mirrors. We must do | 4556 | ;; Delay indenting until we're done all mirrors. We must do |
| 4545 | ;; this to avoid losing whitespace between fields that are | 4557 | ;; this to avoid losing whitespace between fields that are |
| 4546 | ;; still empty (i.e., they will be non-empty after updating). | 4558 | ;; still empty (i.e., they will be non-empty after updating). |
| @@ -4557,7 +4569,7 @@ When multiple expressions are found, only the last one counts." | |||
| 4557 | (cl-loop for (beg . end) in (cl-sort indent-regions #'< :key #'car) | 4569 | (cl-loop for (beg . end) in (cl-sort indent-regions #'< :key #'car) |
| 4558 | do (yas--indent-region beg end snippet))))))) | 4570 | do (yas--indent-region beg end snippet))))))) |
| 4559 | 4571 | ||
| 4560 | (defun yas--mirror-update-display (mirror field snippet) | 4572 | (defun yas--mirror-update-display (mirror field) |
| 4561 | "Update MIRROR according to FIELD (and mirror transform)." | 4573 | "Update MIRROR according to FIELD (and mirror transform)." |
| 4562 | 4574 | ||
| 4563 | (let* ((mirror-parent-field (yas--mirror-parent-field mirror)) | 4575 | (let* ((mirror-parent-field (yas--mirror-parent-field mirror)) |
| @@ -4601,27 +4613,29 @@ When multiple expressions are found, only the last one counts." | |||
| 4601 | ;; | 4613 | ;; |
| 4602 | (defun yas--post-command-handler () | 4614 | (defun yas--post-command-handler () |
| 4603 | "Handles various yasnippet conditions after each command." | 4615 | "Handles various yasnippet conditions after each command." |
| 4604 | (yas--finish-moving-snippets) | 4616 | (condition-case err |
| 4605 | (cond ((eq 'undo this-command) | 4617 | (progn (yas--finish-moving-snippets) |
| 4606 | ;; | 4618 | (cond ((eq 'undo this-command) |
| 4607 | ;; After undo revival the correct field is sometimes not | 4619 | ;; |
| 4608 | ;; restored correctly, this condition handles that | 4620 | ;; After undo revival the correct field is sometimes not |
| 4609 | ;; | 4621 | ;; restored correctly, this condition handles that |
| 4610 | (let* ((snippet (car (yas-active-snippets))) | 4622 | ;; |
| 4611 | (target-field | 4623 | (let* ((snippet (car (yas-active-snippets))) |
| 4612 | (and snippet | 4624 | (target-field |
| 4613 | (cl-find-if-not | 4625 | (and snippet |
| 4614 | (lambda (field) | 4626 | (cl-find-if-not |
| 4615 | (yas--field-probably-deleted-p snippet field)) | 4627 | (lambda (field) |
| 4616 | (remq nil | 4628 | (yas--field-probably-deleted-p snippet field)) |
| 4617 | (cons (yas--snippet-active-field snippet) | 4629 | (remq nil |
| 4618 | (yas--snippet-fields snippet))))))) | 4630 | (cons (yas--snippet-active-field snippet) |
| 4619 | (when target-field | 4631 | (yas--snippet-fields snippet))))))) |
| 4620 | (yas--move-to-field snippet target-field)))) | 4632 | (when target-field |
| 4621 | ((not (yas--undo-in-progress)) | 4633 | (yas--move-to-field snippet target-field)))) |
| 4622 | ;; When not in an undo, check if we must commit the snippet | 4634 | ((not (yas--undo-in-progress)) |
| 4623 | ;; (user exited it). | 4635 | ;; When not in an undo, check if we must commit the snippet |
| 4624 | (yas--check-commit-snippet)))) | 4636 | ;; (user exited it). |
| 4637 | (yas--check-commit-snippet)))) | ||
| 4638 | ((debug error) (signal (car err) (cdr err))))) | ||
| 4625 | 4639 | ||
| 4626 | ;;; Fancy docs: | 4640 | ;;; Fancy docs: |
| 4627 | ;; | 4641 | ;; |
