root/trunk/lisp/gnus/compface.el
| Revision 4220, 2.2 kB (checked in by miyoshi, 9 months ago) |
|---|
| Line | |
|---|---|
| 1 | ;;; compface.el --- functions for converting X-Face headers |
| 2 | |
| 3 | ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
| 4 | |
| 5 | ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 6 | ;; Keywords: news |
| 7 | |
| 8 | ;; This file is part of GNU Emacs. |
| 9 | |
| 10 | ;; GNU Emacs 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 3, or (at your option) |
| 13 | ;; any later version. |
| 14 | |
| 15 | ;; GNU Emacs 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., 51 Franklin Street, Fifth Floor, |
| 23 | ;; Boston, MA 02110-1301, USA. |
| 24 | |
| 25 | ;;; Commentary: |
| 26 | |
| 27 | ;;; Code: |
| 28 | |
| 29 | ;;;### |
| 30 | (defun uncompface (face) |
| 31 | "Convert FACE to pbm. |
| 32 | Requires the external programs `uncompface', and `icontopbm'. On a |
| 33 | GNU/Linux system these might be in packages with names like `compface' |
| 34 | or `faces-xface' and `netpbm' or `libgr-progs', for instance." |
| 35 | (with-temp-buffer |
| 36 | (insert face) |
| 37 | (let ((coding-system-for-read 'raw-text) |
| 38 | ;; At least "icontopbm" doesn't work with Windows because |
| 39 | ;; the line-break code is converted into CRLF by default. |
| 40 | (coding-system-for-write 'binary)) |
| 41 | (and (eq 0 (apply 'call-process-region (point-min) (point-max) |
| 42 | "uncompface" |
| 43 | 'delete '(t nil) nil)) |
| 44 | (progn |
| 45 | (goto-char (point-min)) |
| 46 | (insert "/* Width=48, Height=48 */\n") |
| 47 | ;; I just can't get "icontopbm" to work correctly on its |
| 48 | ;; own in XEmacs. And Emacs doesn't understand un-raw pbm |
| 49 | ;; files. |
| 50 | (if (not (featurep 'xemacs)) |
| 51 | (eq 0 (call-process-region (point-min) (point-max) |
| 52 | "icontopbm" |
| 53 | 'delete '(t nil))) |
| 54 | (shell-command-on-region (point-min) (point-max) |
| 55 | "icontopbm | pnmnoraw" |
| 56 | (current-buffer) t) |
| 57 | t)) |
| 58 | (buffer-string))))) |
| 59 | |
| 60 | (provide 'compface) |
| 61 | |
| 62 | ;;; arch-tag: f9c78e84-98c0-4142-9682-8ba4cf4c3441 |
| 63 | ;;; compface.el ends here |
| 64 |
Note: See TracBrowser for help on using the browser.
