* configure.in (VERSION): Bump up to 1.4.9.
[elisp/liece.git] / lisp / liece-inlines.el
index e572b9e..416d24c 100644 (file)
@@ -44,8 +44,8 @@
 (defmacro string-join (strlst &optional del)
   `(mapconcat #'identity ,strlst ,del))
 
-(defsubst string-equal-ignore-case (s1 s2)
-  (string-equal (upcase s1) (upcase s2)))
+(defmacro string-equal-ignore-case (s1 s2)
+  `(string-equal (upcase ,s1) (upcase ,s2)))
 
 (defsubst string-list-member-ignore-case (thing list)
   "Returns t if thing is member of list, not funcallable"
      (and (stringp item) (string-equal-ignore-case thing item)))
    list))
 
-(defsubst string-list-member (thing list)
-  "Returns t if thing is member of list, not funcallable"
-  (member-if
-   (lambda (item)
-     (and (stringp item) (string-equal thing item)))
-   list))
-
 (defsubst string-list-remove-ignore-case (thing list)
-  (remove-if
-   (lambda (item)
-     (and (stringp item) (string-equal-ignore-case item thing)))
-   list))
+  (let ((element (string-list-member-ignore-case thing list)))
+    (if element
+       (remq (car element) list)
+      list)))
 
 (defsubst string-list-delete-ignore-case (thing list)
-  (delete-if
-   (lambda (item)
-     (and (stringp item) (string-equal-ignore-case item thing)))
-   list))
+  (let ((element (string-list-member-ignore-case thing list)))
+    (if element
+       (delq (car element) list)
+      list)))
 
 (defsubst string-list-remove (thing list)
-  (remove-if
-   (lambda (item)
-     (and (stringp item) (string-equal item thing)))
-   list))
+  (let ((element (member thing list)))
+    (if element
+       (remq (car element) list)
+      list)))
 
 (defsubst string-list-delete (thing list)
-  (delete-if
-   (lambda (item)
-     (and (stringp item) (string-equal item thing)))
-   list))
+  (let ((element (member thing list)))
+    (if element
+       (delq (car element) list)
+      list)))
 
 (defsubst string-list-modify-ignore-case (modifiers list)
   (dolist (modifier modifiers)
        (setq p (cdr p)))))
   list)
 
-(defsubst string-assoc-ignore-case (key list)
-  (assoc-if
-   (lambda (item) (string-equal-ignore-case item key))
-   list))
+(static-if (fboundp 'assoc-ignore-case)
+    (defalias 'string-assoc-ignore-case 'assoc-ignore-case)
+  (defsubst string-assoc-ignore-case (key list)
+    (assoc-if
+     (lambda (item) (string-equal-ignore-case item key))
+     list)))
 
 (defsubst regexp-assoc-ignore-case (key list)
   "Assoc with REGEXP-KEY from LIST."
        (concat dir subdir)))))
 
 (defun liece-locate-icon-file (filename)
-  (if (null liece-icon-directory)
+  (or liece-icon-directory
       (setq liece-icon-directory (liece-locate-path "icons")))
-  (setq filename (expand-file-name filename liece-icon-directory))
-  (if (and filename (file-exists-p filename))
-      filename))
+  (expand-file-name filename liece-icon-directory))
 
 (defmacro liece-next-line (arg)
   `(let ((i 0))