From 42601d2ff8ff0071a099c50d4afab0ca7945e6af Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 28 Jan 2016 14:30:15 -0500 Subject: [PATCH] Apply changes from GNU ELPA * doc/yas-doc-helper.el: * yasnippet-debug.el: * yasnippet-tests.el: Fix up copyright headers. * yasnippet-tests.el: Fix lexical-binding cookie. * yasnippet-debug.el: Require cl. * yasnippet-tests.el: Silence byte-compiler. (yas-saving-variables, yas-with-snippet-dirs): Move macros before their use. (yas--barbaz, yas--foobarbaz): Declare. (yas--phony-c-mode, yas--test-mode, yas--another-test-mode): Move out of deftest, so the byte-compiler understands they're defined. --- doc/yas-doc-helper.el | 2 +- yasnippet-debug.el | 3 ++- yasnippet-tests.el | 36 ++++++++++++++++++++---------------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/doc/yas-doc-helper.el b/doc/yas-doc-helper.el index ab172b6d7..f4cd49bfd 100755 --- a/doc/yas-doc-helper.el +++ b/doc/yas-doc-helper.el @@ -1,6 +1,6 @@ ;;; yas-doc-helper.el --- Help generate documentation for YASnippet -;; Copyright (C) 2012 João Távora +;; Copyright (C) 2012, 2013 Free Software Foundation, Inc. ;; Author: João Távora ;; Keywords: convenience diff --git a/yasnippet-debug.el b/yasnippet-debug.el index c5dd06aed..b12bcd4ba 100644 --- a/yasnippet-debug.el +++ b/yasnippet-debug.el @@ -1,6 +1,6 @@ ;;; yasnippet-debug.el --- debug functions for yasnippet -;; Copyright (C) 2010 João Távora +;; Copyright (C) 2010, 2013, 2014 Free Software Foundation, Inc. ;; Author: João Távora ;; Keywords: emulations, convenience @@ -25,6 +25,7 @@ ;;; Code: (require 'yasnippet) +(require 'cl) (defun yas-debug-snippet-vars () "Debug snippets, fields, mirrors and the `buffer-undo-list'." diff --git a/yasnippet-tests.el b/yasnippet-tests.el index cf8ace986..844cd943b 100644 --- a/yasnippet-tests.el +++ b/yasnippet-tests.el @@ -1,6 +1,6 @@ -;;; yasnippet-tests.el --- some yasnippet tests +;;; yasnippet-tests.el --- some yasnippet tests -*- lexical-binding: t -*- -;; Copyright (C) 2012 João Távora +;; Copyright (C) 2012, 2013, 2014, 2015 Free Software Foundation, Inc. ;; Author: João Távora ;; Keywords: emulations, convenience @@ -27,6 +27,7 @@ (require 'yasnippet) (require 'ert) (require 'ert-x) +(require 'cl) ;;; Snippet mechanics @@ -275,6 +276,15 @@ (and (buffer-name ,temp-buffer) (kill-buffer ,temp-buffer)))))))) +(defmacro yas-saving-variables (&rest body) + `(yas-call-with-saving-variables #'(lambda () ,@body))) + +(defmacro yas-with-snippet-dirs (dirs &rest body) + (declare (indent defun)) + `(yas-call-with-snippet-dirs ,dirs + #'(lambda () + ,@body))) + (ert-deftest example-for-issue-474 () (yas--with-font-locked-temp-buffer (c-mode) @@ -365,6 +375,9 @@ TODO: correct this bug!" "brother from another mother") ;; no newline should be here! ))) +(defvar yas--barbaz) +(defvar yas--foobarbaz) + ;; See issue #497. To understand this test, follow the example of the ;; `yas-key-syntaxes' docstring. ;; @@ -569,8 +582,9 @@ TODO: correct this bug!" (should (equal (sort expected-rest #'string<) (sort (cl-subseq observed (length expected-first)) #'string<)))))))) +(defalias 'yas--phony-c-mode 'c-mode) + (ert-deftest issue-492-and-494 () - (defalias 'yas--phony-c-mode 'c-mode) (define-derived-mode yas--test-mode yas--phony-c-mode "Just a test mode") (yas-with-snippet-dirs '((".emacs.d/snippets" ("yas--test-mode"))) @@ -587,9 +601,10 @@ TODO: correct this bug!" (should (= (length expected) (length observed))))))) +(define-derived-mode yas--test-mode c-mode "Just a test mode") +(define-derived-mode yas--another-test-mode c-mode "Another test mode") + (ert-deftest issue-504-tricky-jit () - (define-derived-mode yas--test-mode c-mode "Just a test mode") - (define-derived-mode yas--another-test-mode c-mode "Another test mode") (yas-with-snippet-dirs '((".emacs.d/snippets" ("yas--another-test-mode" @@ -880,10 +895,6 @@ add the snippets associated with the given mode." for saved in saved-values do (set var saved))))) -(defmacro yas-saving-variables (&rest body) - `(yas-call-with-saving-variables #'(lambda () ,@body))) - - (defun yas-call-with-snippet-dirs (dirs fn) (let* ((default-directory (make-temp-file "yasnippet-fixture" t)) (yas-snippet-dirs (mapcar #'car dirs))) @@ -895,12 +906,6 @@ add the snippets associated with the given mode." (when (>= emacs-major-version 24) (delete-directory default-directory 'recursive)))))) -(defmacro yas-with-snippet-dirs (dirs &rest body) - (declare (indent defun)) - `(yas-call-with-snippet-dirs ,dirs - #'(lambda () - ,@body))) - ;;; Older emacsen ;;; (unless (fboundp 'special-mode) @@ -939,7 +944,6 @@ attention to case differences." (provide 'yasnippet-tests) ;; Local Variables: ;; indent-tabs-mode: nil -;; lexical-binding: t ;; byte-compile-warnings: (not cl-functions) ;; End: ;;; yasnippet-tests.el ends here -- 2.39.2