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/yasnippet.el | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to '.emacs.d/lisp/yasnippet.el') 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