From 041821a21018271189948a6c77cb532017324a3e Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 5 Sep 2015 16:20:04 -0400 Subject: [PATCH] * yasnippet-tests.el (string-suffix-p): Define for older Emacsen. --- yasnippet-tests.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/yasnippet-tests.el b/yasnippet-tests.el index a59cdf7..fbf79f8 100644 --- a/yasnippet-tests.el +++ b/yasnippet-tests.el @@ -836,6 +836,17 @@ add the snippets associated with the given mode." ;; FIXME: Why provide this default definition here?!? (defalias 'special-mode 'fundamental)) +(unless (fboundp 'string-suffix-p) + ;; introduced in Emacs 24.4 + (defun string-suffix-p (suffix string &optional ignore-case) + "Return non-nil if SUFFIX is a suffix of STRING. +If IGNORE-CASE is non-nil, the comparison is done without paying +attention to case differences." + (let ((start-pos (- (length string) (length suffix)))) + (and (>= start-pos 0) + (eq t (compare-strings suffix nil nil + string start-pos nil ignore-case)))))) + ;;; btw to test this in emacs22 mac osx: ;;; curl -L -O https://github.com/mirrors/emacs/raw/master/lisp/emacs-lisp/ert.el ;;; curl -L -O https://github.com/mirrors/emacs/raw/master/lisp/emacs-lisp/ert-x.el