emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 041821a 22/60: * yasnippet-tests.el (string-suffix-p): Def


From: João Távora
Subject: [elpa] master 041821a 22/60: * yasnippet-tests.el (string-suffix-p): Define for older Emacsen.
Date: Thu, 21 Jan 2016 22:35:55 +0000

branch: master
commit 041821a21018271189948a6c77cb532017324a3e
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    * yasnippet-tests.el (string-suffix-p): Define for older Emacsen.
---
 yasnippet-tests.el |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]