shr: Render td content with shr-descend
[gnus] / lisp / gnus-picon.el
index 4c5a015..d24f04e 100644 (file)
 ;;; gnus-picon.el --- displaying pretty icons in Gnus
 
 ;;; gnus-picon.el --- displaying pretty icons in Gnus
 
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000
-;;      Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 
-;; Author: Wes Hardaker <hardaker@ece.ucdavis.edu>
+;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news xpm annotation glyph faces
 
 ;; This file is part of GNU Emacs.
 
 ;; Keywords: news xpm annotation glyph faces
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
 ;; GNU General Public License for more details.
 
 ;; 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.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 
 ;;; Commentary:
 
+;; There are three picon types relevant to Gnus:
+;;
+;; Persons: person@subdomain.dom
+;;          users/dom/subdomain/person/face.gif
+;;          usenix/dom/subdomain/person/face.gif
+;;          misc/MISC/person/face.gif
+;; Domains: subdomain.dom
+;;          domain/dom/subdomain/unknown/face.gif
+;; Groups:  comp.lang.lisp
+;;          news/comp/lang/lisp/unknown/face.gif
+;;
+;; Original implementation by Wes Hardaker <hardaker@ece.ucdavis.edu>.
+;;
 ;;; Code:
 
 ;;; Code:
 
+;; For Emacs <22.2 and XEmacs.
+(eval-and-compile
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+
+(eval-when-compile (require 'cl))
+
 (require 'gnus)
 (require 'gnus)
-;; (require 'xpm)
-;; (require 'annotations)
-(require 'custom)
 (require 'gnus-art)
 (require 'gnus-art)
-(require 'gnus-win)
 
 ;;; User variables:
 
 
 ;;; User variables:
 
-(defgroup picons nil
-  "Show pictures of people, domains, and newsgroups (XEmacs).
-For this to work, you must switch on the `gnus-treat-display-picons'
-variable."
-  :group 'gnus-visual)
-
-(defcustom gnus-picons-display-where 'picons
-  "Where to display the group and article icons.
-Valid values are `article' and `picons'."
-  :type '(choice symbol string)
-  :group 'picons)
-
-(defcustom gnus-picons-has-modeline-p t
-  "*Whether the picons window should have a modeline.
-This is only useful if `gnus-picons-display-where' is `picons'."
-  :type 'boolean
-  :group 'picons)
-
-(defcustom gnus-picons-database '("/usr/local/faces" "/usr/lib/picon")
-  "*Defines the location of the faces database.
-For information on obtaining this database of pretty pictures, please
-see http://www.cs.indiana.edu/picons/ftp/index.html"
-  :type 'directory
-  :group 'picons)
-
-(defcustom gnus-picons-news-directories '("news")
+(defcustom gnus-picon-news-directories '("news")
   "*List of directories to search for newsgroups faces."
   :type '(repeat string)
   "*List of directories to search for newsgroups faces."
   :type '(repeat string)
-  :group 'picons)
+  :group 'gnus-picon)
 
 
-(defcustom gnus-picons-user-directories '("local" "users" "usenix" "misc")
+(defcustom gnus-picon-user-directories '("users" "usenix" "local" "misc")
   "*List of directories to search for user faces."
   :type '(repeat string)
   "*List of directories to search for user faces."
   :type '(repeat string)
-  :group 'picons)
+  :group 'gnus-picon)
 
 
-(defcustom gnus-picons-domain-directories '("domains")
+(defcustom gnus-picon-domain-directories '("domains")
   "*List of directories to search for domain faces.
 Some people may want to add \"unknown\" to this list."
   :type '(repeat string)
   "*List of directories to search for domain faces.
 Some people may want to add \"unknown\" to this list."
   :type '(repeat string)
-  :group 'picons)
-
-(defcustom gnus-picons-refresh-before-display nil
-  "*If non-nil, display the article buffer before computing the picons."
-  :type 'boolean
-  :group 'picons)
-
-(defcustom gnus-picons-group-excluded-groups nil
-  "*If this regexp matches the group name, group picons will be disabled."
-  :type 'regexp
-  :group 'picons)
-
-(defcustom gnus-picons-display-as-address t
-  "*If t display textual email addresses along with pictures."
-  :type 'boolean
-  :group 'picons)
-
-(defcustom gnus-picons-file-suffixes
-  (when (featurep 'x)
-    (let ((types (list "xbm")))
-      (when (featurep 'gif)
-       (push "gif" types))
-      (when (featurep 'xpm)
-       (push "xpm" types))
-      types))
+  :group 'gnus-picon)
+
+(defcustom gnus-picon-file-types
+  (let ((types (list "xbm")))
+    (when (gnus-image-type-available-p 'gif)
+      (push "gif" types))
+    (when (gnus-image-type-available-p 'xpm)
+      (push "xpm" types))
+    types)
   "*List of suffixes on picon file names to try."
   :type '(repeat string)
   "*List of suffixes on picon file names to try."
   :type '(repeat string)
-  :group 'picons)
-
-(defcustom gnus-picons-display-article-move-p nil
-  "*Whether to move point to first empty line when displaying picons.
-This has only an effect if `gnus-picons-display-where' has value `article'."
-  :type 'boolean
-  :group 'picons)
-
-(defcustom gnus-picons-clear-cache-on-shutdown t
-  "*Whether to clear the picons cache when exiting gnus.
-Gnus caches every picons it finds while it is running.  This saves
-some time in the search process but eats some memory.  If this
-variable is set to nil, Gnus will never clear the cache itself; you
-will have to manually call `gnus-picons-clear-cache' to clear it.
-Otherwise the cache will be cleared every time you exit Gnus."
+  :group 'gnus-picon)
+
+(defcustom gnus-picon-style 'inline
+  "How should picons be displayed.
+If `inline', the textual representation is replaced.  If `right', picons are