From eeee6220a7d0fcd8cfa9be2381ed95dca96350b6 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Mon, 12 Mar 2018 11:06:20 +0100 Subject: Update php-project.el and yasnippet.el --- .emacs.d/lisp/php-mode.el | 4 ++-- .emacs.d/lisp/yasnippet.el | 31 +++++++++++++++++-------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.emacs.d/lisp/php-mode.el b/.emacs.d/lisp/php-mode.el index 2e23642..70e7efc 100644 --- a/.emacs.d/lisp/php-mode.el +++ b/.emacs.d/lisp/php-mode.el @@ -934,13 +934,13 @@ this ^ lineup" (eval-and-compile (defconst php-heredoc-start-re - "<<<\\(?:\\w+\\|'\\w+'\\)$" + "<<<\\(?:\\_<.+?\\_>\\|'\\_<.+?\\_>'\\|\"\\_<.+?\\_>\"\\)$" "Regular expression for the start of a PHP heredoc.")) (defun php-heredoc-end-re (heredoc-start) "Build a regular expression for the end of a heredoc started by the string HEREDOC-START." ;; Extract just the identifier without <<< and quotes. - (string-match "\\w+" heredoc-start) + (string-match "\\_<.+?\\_>" heredoc-start) (concat "^\\(" (match-string 0 heredoc-start) "\\)\\W")) (defun php-syntax-propertize-function (start end) diff --git a/.emacs.d/lisp/yasnippet.el b/.emacs.d/lisp/yasnippet.el index 5f17465..b36c422 100644 --- a/.emacs.d/lisp/yasnippet.el +++ b/.emacs.d/lisp/yasnippet.el @@ -4302,23 +4302,26 @@ The SNIPPET's markers are preserved." (setq yas--indent-markers nil)) ;; Now do stuff for `fixed' and `auto'. (save-excursion + ;; We need to be at end of line, so that `forward-line' will only + ;; report 0 if it actually moves over a newline. + (end-of-line) (cond ((eq yas-indent-line 'fixed) - (forward-line 1) - (let ((indent-line-function - (lambda () - ;; We need to be at beginning of line in order to - ;; indent existing whitespace correctly. - (beginning-of-line) - (indent-to-column yas--indent-original-column)))) + (when (= (forward-line 1) 0) + (let ((indent-line-function + (lambda () + ;; We need to be at beginning of line in order to + ;; indent existing whitespace correctly. + (beginning-of-line) + (indent-to-column yas--indent-original-column)))) + (yas--indent-region (line-beginning-position) + (point-max) + snippet)))) + ((eq yas-indent-line 'auto) + (when (or yas-also-auto-indent-first-line + (= (forward-line 1) 0)) (yas--indent-region (line-beginning-position) (point-max) - snippet))) - ((eq yas-indent-line 'auto) - (unless yas-also-auto-indent-first-line - (forward-line 1)) - (yas--indent-region (line-beginning-position) - (point-max) - snippet))))) + snippet)))))) (defun yas--collect-snippet-markers (snippet) "Make a list of all the markers used by SNIPPET." -- cgit v1.3