X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fgnus-util.el;h=8a65702a980e8713cea3545275e1b8c432f849d6;hb=5835aa3205a79608e81c5534e73826f3d6823c03;hp=7bf5f1add80eb2d503703aa62ae137aa7bf54801;hpb=e73469f6f91827c3f44afb707bb250cf711aa9a3;p=elisp%2Fgnus.git- diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index 7bf5f1a..8a65702 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -1,4 +1,5 @@ ;;; gnus-util.el --- utility functions for Semi-gnus + ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 ;; Free Software Foundation, Inc. @@ -20,8 +21,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Commentary: @@ -39,9 +40,12 @@ (require 'cl) ;; Fixme: this should be a gnus variable, not nnmail-. (defvar nnmail-pathname-coding-system) + (defvar nnmail-active-file-coding-system) ;; Inappropriate references to other parts of Gnus. (defvar gnus-emphasize-whitespace-regexp) + (defvar gnus-original-article-buffer) + (defvar gnus-user-agent) ) (require 'time-date) @@ -312,8 +316,8 @@ is slower." (defun gnus-completing-read-with-default (default prompt &rest args) ;; Like `completing-read', except that DEFAULT is the default argument. (let* ((prompt (if default - (concat prompt " (default " default ") ") - (concat prompt " "))) + (concat prompt " (default " default "): ") + (concat prompt ": "))) (answer (apply 'completing-read prompt args))) (if (or (null answer) (zerop (length answer))) default @@ -1033,6 +1037,13 @@ ARG is passed to the first function." (save-current-buffer (apply 'run-hooks funcs))) +(defun gnus-run-mode-hooks (&rest funcs) + "Run `run-mode-hooks' if it is available, otherwise `run-hooks'. +This function saves the current buffer." + (if (fboundp 'run-mode-hooks) + (save-current-buffer (apply 'run-mode-hooks funcs)) + (save-current-buffer (apply 'run-hooks funcs)))) + ;;; Various (defvar gnus-group-buffer) ; Compiler directive @@ -1044,14 +1055,6 @@ ARG is passed to the first function." (set-buffer gnus-group-buffer) (eq major-mode 'gnus-group-mode)))) -(defun gnus-remove-duplicates (list) - (let (new) - (while list - (or (member (car list) new) - (setq new (cons (car list) new))) - (setq list (cdr list))) - (nreverse new))) - (defun gnus-remove-if (predicate list) "Return a copy of LIST with all items satisfying PREDICATE removed." (let (out) @@ -1143,7 +1146,7 @@ Return the modified alist." (standard-output (lambda (c) (aset ,buffer ,leng c) - + (if (= ,size (setq ,leng (1+ ,leng))) (progn (write-region ,buffer nil ,file ,append 'no-msg) (setq ,leng 0 @@ -1212,7 +1215,7 @@ Return the modified alist." Setting it to nil has no effect after the first time `gnus-byte-compile' is run." :type 'boolean - :version "21.4" + :version "22.1" :group 'gnus-various) (defun gnus-byte-compile (form) @@ -1580,8 +1583,8 @@ empty directories from OLD-PATH." (setq temp (cdr temp))) (= (length temp) 0)) (delete-directory old-dir) - (setq old-dir (file-name-as-directory - (file-truename + (setq old-dir (file-name-as-directory + (file-truename (concat old-dir ".."))))))))) (defun gnus-set-file-modes (filename mode) @@ -1589,6 +1592,12 @@ empty directories from OLD-PATH." (ignore-errors (set-file-modes filename mode))) +(if (fboundp 'set-process-query-on-exit-flag) + (defalias 'gnus-set-process-query-on-exit-flag + 'set-process-query-on-exit-flag) + (defalias 'gnus-set-process-query-on-exit-flag + 'process-kill-without-query)) + (provide 'gnus-util) ;;; gnus-util.el ends here