mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
* yasnippet-tests.el (string-suffix-p): Define for older Emacsen.
This commit is contained in:
parent
e3f03cabe0
commit
041821a210
@ -836,6 +836,17 @@ add the snippets associated with the given mode."
|
|||||||
;; FIXME: Why provide this default definition here?!?
|
;; FIXME: Why provide this default definition here?!?
|
||||||
(defalias 'special-mode 'fundamental))
|
(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:
|
;;; 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.el
|
||||||
;;; curl -L -O https://github.com/mirrors/emacs/raw/master/lisp/emacs-lisp/ert-x.el
|
;;; curl -L -O https://github.com/mirrors/emacs/raw/master/lisp/emacs-lisp/ert-x.el
|
||||||
|
Loading…
x
Reference in New Issue
Block a user