From 05b4f4ce4d6d2d655ed94c9de91cb530372eec0c Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Tue, 1 Aug 2017 12:02:49 +0200 Subject: Upgrade php-mode.el yaml-mode.el yasnippet.el --- .emacs.d/lisp/php-mode.el | 22 +++++++------- .emacs.d/lisp/yaml-mode.el | 2 +- .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 @@ ;;; Commentary: -;; PHP mode is a major mode for editing PHP source code. It's an +;; PHP Mode is a major mode for editing PHP source code. It's an ;; extension of C mode; thus it inherits all C mode's navigation ;; functionality. But it colors according to the PHP grammar and ;; indents according to the PEAR coding guidelines. It also includes @@ -376,9 +376,9 @@ This variable can take one of the following symbol values: (php-enable-psr2-coding-style))))) (defun php-mode-version () - "Display string describing the version of PHP mode." + "Display string describing the version of PHP Mode." (interactive) - (message "PHP mode %s of %s" + (message "PHP Mode %s of %s" php-mode-version-number php-mode-modified)) (defvar php-mode-map @@ -393,7 +393,7 @@ This variable can take one of the following symbol values: ;; (define-key map [menu-bar php search-documentation] ;; '("Search documentation" . php-search-documentation)) - ;; By default PHP mode binds C-M-h to c-mark-function, which it + ;; By default PHP Mode binds C-M-h to c-mark-function, which it ;; inherits from cc-mode. But there are situations where ;; c-mark-function fails to properly mark a function. For ;; example, if we use c-mark-function within a method definition @@ -1039,7 +1039,7 @@ PHP heredoc." "PHP Mode face used to highlight variable names." :group 'php-faces) -(defface php-property-name '((t (:inherit php-variable-name-face))) +(defface php-property-name '((t (:inherit php-variable-name))) "PHP Mode face used to highlight property names." :group 'php-faces) @@ -1506,10 +1506,10 @@ a completion list." php-phpdoc-font-lock-doc-comments))))) (defconst php-font-lock-keywords-1 (c-lang-const c-matchers-1 php) - "Basic highlighting for PHP mode.") + "Basic highlighting for PHP Mode.") (defconst php-font-lock-keywords-2 (c-lang-const c-matchers-2 php) - "Medium level highlighting for PHP mode.") + "Medium level highlighting for PHP Mode.") (defconst php-font-lock-keywords-3 (append @@ -1600,10 +1600,10 @@ a completion list." ;; Note that starting a file with <% breaks indentation, a ;; limitation we can/should live with. (,(regexp-opt '("?>" "")) 0 'php-php-tag))) - "Detailed highlighting for PHP mode.") + "Detailed highlighting for PHP Mode.") (defvar php-font-lock-keywords php-font-lock-keywords-3 - "Default expressions to highlight in PHP mode.") + "Default expressions to highlight in PHP Mode.") ;;; Provide support for Flymake so that users can see warnings and ;;; errors in real-time as they write code. @@ -1664,7 +1664,7 @@ The output will appear in the buffer *PHP*." ;;; Correct the behavior of `delete-indentation' by modifying the ;;; logic of `fixup-whitespace'. (defadvice fixup-whitespace (after php-mode-fixup-whitespace) - "Remove whitespace before certain characters in PHP mode." + "Remove whitespace before certain characters in PHP Mode." (let* ((no-behind-space ";\\|,\\|->\\|::") (no-front-space "->\\|::")) (when (and (eq major-mode 'php-mode) @@ -1723,7 +1723,7 @@ The output will appear in the buffer *PHP*." ;;;###autoload (defun php-current-namespace () - "Insert current namespace if cursor in in namespace context." + "Insert current namespace if cursor in namespace context." (interactive) (let ((matched (php-get-current-element php--re-namespace-pattern))) (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." (defconst yaml-directive-re "^\\(?:--- \\)? *%\\(\\w+\\)" "Regexp matching a line contatining a YAML directive.") -(defconst yaml-document-delimiter-re "^ *\\(?:---\\|[.][.][.]\\)" +(defconst yaml-document-delimiter-re "^\\(?:---\\|[.][.][.]\\)" "Rexexp matching a YAML document delimiter line.") (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 @@ ;;; yasnippet.el --- Yet another snippet extension for Emacs. -;; Copyright (C) 2008-2016 Free Software Foundation, Inc. +;; Copyright (C) 2008-2017 Free Software Foundation, Inc. ;; Authors: pluskid , ;; João Távora , ;; Noam Postavsky ;; Maintainer: Noam Postavsky -;; Version: 0.11.0 +;; Version: 0.12.1 ;; X-URL: http://github.com/joaotavora/yasnippet ;; Keywords: convenience, emulation ;; URL: http://github.com/joaotavora/yasnippet @@ -132,6 +132,7 @@ ;;; Code: (require 'cl-lib) +(declare-function cl-progv-after "cl-extra") ; Needed for 23.4. (require 'easymenu) (require 'help-mode) @@ -535,7 +536,7 @@ override bindings from other packages (e.g., `company-mode')." ;;; Internal variables -(defconst yas--version "0.11.0") +(defconst yas--version "0.12.1") (defvar yas--menu-table (make-hash-table) "A hash table of MAJOR-MODE symbols to menu keymaps.") @@ -585,6 +586,8 @@ override bindings from other packages (e.g., `company-mode')." (defvar yas--minor-mode-menu nil "Holds the YASnippet menu.") +(defvar yas--condition-cache-timestamp nil) + (defun yas--maybe-expand-key-filter (cmd) (when (let ((yas--condition-cache-timestamp (current-time))) (yas--templates-for-key-at-point)) @@ -2183,7 +2186,6 @@ Just put this function in `hippie-expand-try-functions-list'." ;;; ;;; ;;; -(defvar yas--condition-cache-timestamp nil) (defmacro yas-define-condition-cache (func doc &rest body) "Define a function FUNC with doc DOC and body BODY. 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" (defmacro yas--letenv (env &rest body) "Evaluate BODY with bindings from ENV. -ENV is a list of elements with the form (VAR FORM)." +ENV is a lisp expression that evaluates to list of elements with +the form (VAR FORM), where VAR is a symbol and FORM is a lisp +expression that evaluates to its value." (declare (debug (form body)) (indent 1)) - `(eval (cl-list* 'let* ,env ',body))) + (let ((envvar (make-symbol "envvar"))) + `(let ((,envvar ,env)) + (cl-progv + (mapcar #'car ,envvar) + (mapcar (lambda (v-f) (eval (cadr v-f))) ,envvar) + ,@body)))) (defun yas--snippet-map-markers (fun snippet) "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." (narrow-to-region beg end) (mapc #'yas--restore-marker-location remarkers) (mapc #'yas--restore-overlay-location reoverlays)) - (mapc #'yas--update-mirrors snippets)))) + (mapc (lambda (snippet) + (yas--letenv (yas--snippet-expand-env snippet) + (yas--update-mirrors snippet))) + snippets)))) ;;; Apropos protection overlays: @@ -3828,7 +3840,7 @@ considered when expanding the snippet." (sit-for 0) ;; fix issue 125 (yas--letenv (yas--snippet-expand-env snippet) (yas--move-to-field snippet first-field)))) - (yas--message 4 "snippet expanded.") + (yas--message 4 "snippet %d expanded." (yas--snippet-id snippet)) (setq deactivate-mark nil) t)))) @@ -4540,7 +4552,7 @@ When multiple expressions are found, only the last one counts." (when parent-field (yas--advance-start-maybe mirror (yas--fom-start parent-field)))) ;; Update this mirror. - do (yas--mirror-update-display mirror field snippet) + do (yas--mirror-update-display mirror field) ;; Delay indenting until we're done all mirrors. We must do ;; this to avoid losing whitespace between fields that are ;; 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." (cl-loop for (beg . end) in (cl-sort indent-regions #'< :key #'car) do (yas--indent-region beg end snippet))))))) -(defun yas--mirror-update-display (mirror field snippet) +(defun yas--mirror-update-display (mirror field) "Update MIRROR according to FIELD (and mirror transform)." (let* ((mirror-parent-field (yas--mirror-parent-field mirror)) @@ -4601,27 +4613,29 @@ When multiple expressions are found, only the last one counts." ;; (defun yas--post-command-handler () "Handles various yasnippet conditions after each command." - (yas--finish-moving-snippets) - (cond ((eq 'undo this-command) - ;; - ;; After undo revival the correct field is sometimes not - ;; restored correctly, this condition handles that - ;; - (let* ((snippet (car (yas-active-snippets))) - (target-field - (and snippet - (cl-find-if-not - (lambda (field) - (yas--field-probably-deleted-p snippet field)) - (remq nil - (cons (yas--snippet-active-field snippet) - (yas--snippet-fields snippet))))))) - (when target-field - (yas--move-to-field snippet target-field)))) - ((not (yas--undo-in-progress)) - ;; When not in an undo, check if we must commit the snippet - ;; (user exited it). - (yas--check-commit-snippet)))) + (condition-case err + (progn (yas--finish-moving-snippets) + (cond ((eq 'undo this-command) + ;; + ;; After undo revival the correct field is sometimes not + ;; restored correctly, this condition handles that + ;; + (let* ((snippet (car (yas-active-snippets))) + (target-field + (and snippet + (cl-find-if-not + (lambda (field) + (yas--field-probably-deleted-p snippet field)) + (remq nil + (cons (yas--snippet-active-field snippet) + (yas--snippet-fields snippet))))))) + (when target-field + (yas--move-to-field snippet target-field)))) + ((not (yas--undo-in-progress)) + ;; When not in an undo, check if we must commit the snippet + ;; (user exited it). + (yas--check-commit-snippet)))) + ((debug error) (signal (car err) (cdr err))))) ;;; Fancy docs: ;; -- cgit v1.3