@@ -380,6 +380,11 @@ TYPE is the return type; can be 'object or 'string."
380380 (setq is-comment-line t ))
381381 is-comment-line)))
382382
383+ (defun jcs-current-file-empty-p (&optional fn )
384+ " Check if the FN an empty file."
385+ (if fn (with-current-buffer fn (and (bobp ) (eobp )))
386+ (and (bobp ) (eobp ))))
387+
383388(defun jcs-infront-first-char-at-line-p (&optional pt )
384389 " Return non-nil if there is nothing infront of the right from the PT."
385390 (save-excursion
@@ -584,6 +589,24 @@ If optional argument REVERSE is non-nil, LIST item and ELT argument."
584589; ; (@* "String" )
585590; ;
586591
592+ (defun jcs-string-compare-p (regexp str type &optional ignore-case )
593+ " Compare STR with REGEXP by TYPE.
594+
595+ Argument TYPE can be on of the following symbol.
596+
597+ * regex - uses function `string-match-p' . (default)
598+ * strict - uses function `string=' .
599+ * prefix - uses function `string-prefix-p' .
600+ * suffix - uses function `string-suffix-p' .
601+
602+ Optional argument IGNORE-CASE is only uses when TYPE is either symbol `prefix'
603+ or `suffix' ."
604+ (cl-case type
605+ (`strict (string= regexp str))
606+ (`prefix (string-prefix-p regexp str ignore-case))
607+ (`suffix (string-suffix-p regexp str ignore-case))
608+ (t (ignore-errors (string-match-p regexp str)))))
609+
587610(defun jcs-fill-n-char-seq (ch-seq n )
588611 " Fill CH-SEQ with N length."
589612 (when-let* ((ch-out ch-seq) (n (or n 1 )))
0 commit comments