X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=blobdiff_plain;f=lisp%2Fgnus-compat.el;h=b96a6acd547cab1c27795fdacb70bec7e10d5ef8;hp=4e9b970025eab4e9343c2ea83597273026a745d4;hb=d588ae3db11ee057d2fc3dfa5364dcfe3f84e368;hpb=3107075e84653c5f05cf94353595a66bbf8cd768 diff --git a/lisp/gnus-compat.el b/lisp/gnus-compat.el index 4e9b97002..b96a6acd5 100644 --- a/lisp/gnus-compat.el +++ b/lisp/gnus-compat.el @@ -1,6 +1,6 @@ ;;; gnus-compat.el --- Compatability functions for Gnus -;; Copyright (C) 2012 Free Software Foundation, Inc. +;; Copyright (C) 2012-2015 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; Keywords: compat @@ -129,10 +129,39 @@ TRASH is ignored." (forward-line arg)) (beginning-of-line))) -;; XEmacs 21.5 -(unless (fboundp 'set-buffer-multibyte) - (defun set-buffer-multibyte (flag) - nil)) +(unless (fboundp 'delete-dups) + (defun delete-dups (list) + "Destructively remove `equal' duplicates from LIST. +Store the result in LIST and return it. LIST must be a proper list. +Of several `equal' occurrences of an element in LIST, the first +one is kept." + (let ((tail list)) + (while tail + (setcdr tail (delete (car tail) (cdr tail))) + (setq tail (cdr tail)))) + list)) + +(unless (fboundp 'declare-function) + (defmacro declare-function (&rest r))) + +(unless (fboundp 'string-bytes) + (defun string-bytes (string) + (length (if (or (mm-coding-system-p 'utf-8) + (ignore-errors + (let (mucs-ignore-version-incompatibilities) + (require 'un-define)))) + (mm-encode-coding-string string 'utf-8) + string)))) + +(unless (fboundp 'process-live-p) + (defun process-live-p (process) + "Returns non-nil if PROCESS is alive. +A process is considered alive if its status is `run', `open', +`listen', `connect' or `stop'. Value is nil if PROCESS is not a +process." + (and (processp process) + (memq (process-status process) + '(run open listen connect stop))))) (provide 'gnus-compat)