From 5d93450f3556da77dbc70812884a6be207bbfbca Mon Sep 17 00:00:00 2001 From: Pierre Courtieu Date: Wed, 24 Dec 2014 00:57:13 +0000 Subject: fixed the use of >= 24.4 function string-suffix-p. --- coq/coq-smie.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'coq/coq-smie.el') diff --git a/coq/coq-smie.el b/coq/coq-smie.el index 7c93f392..fcc2ff83 100644 --- a/coq/coq-smie.el +++ b/coq/coq-smie.el @@ -30,6 +30,21 @@ (require 'coq-indent) (require 'smie nil 'noerror) +(defun coq-string-suffix-p (str1 str2 &optional ignore-case) + "Return non-nil if STR1 is a prefix of STR2. +If IGNORE-CASE is non-nil, the comparison is done without paying +attention to case differences." + (let ((begin2 (- (length str2) (length str1))) + (end2 (length str2))) + (when (< begin2 0) (setq begin2 0)) ; to avoid negative begin2 + (eq t (compare-strings str1 nil nil str2 begin2 end2 ignore-case)))) + +;; Replacement for emacs < 24.4, borrowed from sindikat at +;; stackoverflow efficient if bytecompiled, builtin version is +;; probably better when it exists +(unless (fboundp 'string-suffix-p) + (fset 'string-suffix-p 'coq-string-suffix-p)) + ;; As any user defined notation ending with "." will break ;; proofgeneral synchronization anyway, let us consider that any ;; combination of symbols ending with "." is an end of command for -- cgit v1.2.3