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.
This commit is contained in:
Stefan Monnier 2016-01-28 14:30:15 -05:00 committed by Noam Postavsky
parent 80941c077f
commit 42601d2ff8
3 changed files with 23 additions and 18 deletions

View File

@ -1,6 +1,6 @@
;;; yas-doc-helper.el --- Help generate documentation for YASnippet ;;; 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 <joaotavora@gmail.com> ;; Author: João Távora <joaotavora@gmail.com>
;; Keywords: convenience ;; Keywords: convenience

View File

@ -1,6 +1,6 @@
;;; yasnippet-debug.el --- debug functions for yasnippet ;;; 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 ;; Author: João Távora
;; Keywords: emulations, convenience ;; Keywords: emulations, convenience
@ -25,6 +25,7 @@
;;; Code: ;;; Code:
(require 'yasnippet) (require 'yasnippet)
(require 'cl)
(defun yas-debug-snippet-vars () (defun yas-debug-snippet-vars ()
"Debug snippets, fields, mirrors and the `buffer-undo-list'." "Debug snippets, fields, mirrors and the `buffer-undo-list'."

View File

@ -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 <joaot@siscog.pt> ;; Author: João Távora <joaot@siscog.pt>
;; Keywords: emulations, convenience ;; Keywords: emulations, convenience
@ -27,6 +27,7 @@
(require 'yasnippet) (require 'yasnippet)
(require 'ert) (require 'ert)
(require 'ert-x) (require 'ert-x)
(require 'cl)
;;; Snippet mechanics ;;; Snippet mechanics
@ -275,6 +276,15 @@
(and (buffer-name ,temp-buffer) (and (buffer-name ,temp-buffer)
(kill-buffer ,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 () (ert-deftest example-for-issue-474 ()
(yas--with-font-locked-temp-buffer (yas--with-font-locked-temp-buffer
(c-mode) (c-mode)
@ -365,6 +375,9 @@ TODO: correct this bug!"
"brother from another mother") ;; no newline should be here! "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 ;; See issue #497. To understand this test, follow the example of the
;; `yas-key-syntaxes' docstring. ;; `yas-key-syntaxes' docstring.
;; ;;
@ -569,8 +582,9 @@ TODO: correct this bug!"
(should (equal (sort expected-rest #'string<) (should (equal (sort expected-rest #'string<)
(sort (cl-subseq observed (length expected-first)) #'string<)))))))) (sort (cl-subseq observed (length expected-first)) #'string<))))))))
(ert-deftest issue-492-and-494 ()
(defalias 'yas--phony-c-mode 'c-mode) (defalias 'yas--phony-c-mode 'c-mode)
(ert-deftest issue-492-and-494 ()
(define-derived-mode yas--test-mode yas--phony-c-mode "Just a test mode") (define-derived-mode yas--test-mode yas--phony-c-mode "Just a test mode")
(yas-with-snippet-dirs '((".emacs.d/snippets" (yas-with-snippet-dirs '((".emacs.d/snippets"
("yas--test-mode"))) ("yas--test-mode")))
@ -587,9 +601,10 @@ TODO: correct this bug!"
(should (= (length expected) (should (= (length expected)
(length observed))))))) (length observed)))))))
(ert-deftest issue-504-tricky-jit ()
(define-derived-mode yas--test-mode c-mode "Just a test mode") (define-derived-mode yas--test-mode c-mode "Just a test mode")
(define-derived-mode yas--another-test-mode c-mode "Another test mode") (define-derived-mode yas--another-test-mode c-mode "Another test mode")
(ert-deftest issue-504-tricky-jit ()
(yas-with-snippet-dirs (yas-with-snippet-dirs
'((".emacs.d/snippets" '((".emacs.d/snippets"
("yas--another-test-mode" ("yas--another-test-mode"
@ -880,10 +895,6 @@ add the snippets associated with the given mode."
for saved in saved-values for saved in saved-values
do (set var saved))))) 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) (defun yas-call-with-snippet-dirs (dirs fn)
(let* ((default-directory (make-temp-file "yasnippet-fixture" t)) (let* ((default-directory (make-temp-file "yasnippet-fixture" t))
(yas-snippet-dirs (mapcar #'car dirs))) (yas-snippet-dirs (mapcar #'car dirs)))
@ -895,12 +906,6 @@ add the snippets associated with the given mode."
(when (>= emacs-major-version 24) (when (>= emacs-major-version 24)
(delete-directory default-directory 'recursive)))))) (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 ;;; Older emacsen
;;; ;;;
(unless (fboundp 'special-mode) (unless (fboundp 'special-mode)
@ -939,7 +944,6 @@ attention to case differences."
(provide 'yasnippet-tests) (provide 'yasnippet-tests)
;; Local Variables: ;; Local Variables:
;; indent-tabs-mode: nil ;; indent-tabs-mode: nil
;; lexical-binding: t
;; byte-compile-warnings: (not cl-functions) ;; byte-compile-warnings: (not cl-functions)
;; End: ;; End:
;;; yasnippet-tests.el ends here ;;; yasnippet-tests.el ends here