* riece.el (riece-command-mode): Set default value of riece-freeze
[riece] / lisp / riece-inlines.el
1 ;;; riece-inlines.el --- inline functions
2 ;; Copyright (C) 1998-2003 Daiki Ueno
3
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
5 ;; Created: 1998-09-28
6 ;; Keywords: IRC, riece
7
8 ;; This file is part of Riece.
9
10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Code:
26
27 (defsubst string-equal-ignore-case (s1 s2)
28   (string-equal (upcase s1) (upcase s2)))
29
30 (defsubst string-list-member-ignore-case (thing list)
31   (catch 'found
32     (while list
33       (if (and (stringp (car list))
34                (string-equal-ignore-case (car list) thing))
35           (throw 'found list)
36         (setq list (cdr list))))))
37
38 (defsubst string-list-delete-ignore-case (thing list)
39   (let ((pointer (string-list-member-ignore-case thing list)))
40     (if pointer
41         (delq (car pointer) list)
42       list)))
43
44 (defsubst string-list-delete (thing list)
45   (let ((pointer (member thing list)))
46     (if pointer
47         (delq (car pointer) list)
48       list)))
49
50 (defsubst string-list-modify-ignore-case (modifiers list)
51   (while modifiers
52     (let ((pointer (string-list-member-ignore-case
53                     (car (car modifiers)) list)))
54       (if pointer
55           (setcar pointer (cdr (car modifiers))))
56       (setq modifiers (cdr modifiers)))))
57
58 (defsubst string-assoc-ignore-case (key list)
59   (catch 'found
60     (while list
61       (if (and (car-safe (car list))
62                (string-equal-ignore-case key (car (car list))))
63           (throw 'found (car list))
64         (setq list (cdr list))))))
65
66 (provide 'riece-inlines)
67
68 ;;; riece-inlines.el ends here