X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fgnus-util.el;h=8c46c948879bda22262882e9b6fa1022e3741ec5;hb=f9e54240fc63f1ead8962e2afbc9b75e53994cd5;hp=38c253e79c635bfbd277ce1cabb442d04a37028f;hpb=361fe574ceb300e11ab838842c0f3c675c07b10b;p=elisp%2Fgnus.git- diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index 38c253e..8c46c94 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -1,5 +1,5 @@ ;;; gnus-util.el --- utility functions for Semi-gnus -;; Copyright (C) 1996, 1997, 1998, 1999, 2000 +;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 ;; Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen @@ -32,7 +32,10 @@ ;;; Code: -(eval-when-compile (require 'cl)) +(eval-when-compile + (require 'cl) + ;; Fixme: this should be a gnus variable, not nnmail-. + (defvar nnmail-pathname-coding-system)) (eval-when-compile (require 'static)) (require 'custom) @@ -411,7 +414,7 @@ jabbering all the time." "Return a list of Message-IDs in REFERENCES." (let ((beg 0) ids) - (while (string-match "<[^>]+>" references beg) + (while (string-match "<[^> \t]+>" references beg) (push (substring references (match-beginning 0) (setq beg (match-end 0))) ids)) (nreverse ids))) @@ -557,6 +560,7 @@ Bind `print-quoted' and `print-readably' to t while printing." (defun gnus-make-directory (directory) "Make DIRECTORY (and all its parents) if it doesn't exist." + (require 'nnmail) (let ((file-name-coding-system nnmail-pathname-coding-system) (pathname-coding-system nnmail-pathname-coding-system)) (when (and directory @@ -952,12 +956,15 @@ Entries without port tokens default to DEFAULTPORT." (pop list)) (nreverse out))) -(defun gnus-delete-alist (key alist) - "Delete all entries in ALIST that have a key eq to KEY." - (let (entry) - (while (setq entry (assq key alist)) - (setq alist (delq entry alist))) - alist)) +(if (fboundp 'assq-delete-all) + (defalias 'gnus-delete-alist 'assq-delete-all) + (defun gnus-delete-alist (key alist) + "Delete from ALIST all elements whose car is KEY. +Return the modified alist." + (let (entry) + (while (setq entry (assq key alist)) + (setq alist (delq entry alist))) + alist))) (defmacro gnus-pull (key alist &optional assoc-p) "Modify ALIST to be without KEY." @@ -1039,7 +1046,7 @@ Entries without port tokens default to DEFAULTPORT." (property value start end properties &optional object) "Like `gnus-add-text-properties', only applied on where PROPERTY is VALUE." (let (point) - (while (and start + (while (and start (< start end) ;; XEmacs will loop for every when start=end. (setq point (text-property-not-all start end property value))) (gnus-add-text-properties start point properties object) @@ -1051,7 +1058,7 @@ Entries without port tokens default to DEFAULTPORT." (property value start end properties &optional object) "Like `remove-text-properties', only applied on where PROPERTY is VALUE." (let (point) - (while (and start + (while (and start (< start end) (setq point (text-property-not-all start end property value))) (remove-text-properties start point properties object) @@ -1060,6 +1067,12 @@ Entries without port tokens default to DEFAULTPORT." (remove-text-properties start end properties object)) t)) +(defun gnus-string-equal (x y) + "Like `string-equal', except it compares case-insensitively." + (and (= (length x) (length y)) + (or (string-equal x y) + (string-equal (downcase x) (downcase y))))) + (provide 'gnus-util) ;;; gnus-util.el ends here