Gnus development mailing list
 help / color / mirror / Atom feed
From: Reiner Steib <reinersteib+gmane@imap.cc>
Cc: ding@gnus.org
Subject: Re: Sharing mail icons between MH-E and Gnus
Date: Mon, 20 Feb 2006 22:19:47 +0100	[thread overview]
Message-ID: <v964n9ybgs.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <16231.1140316818@olgas.newt.com> (Bill Wohler's message of "Sat, 18 Feb 2006 18:40:18 -0800")

On Sun, Feb 19 2006, Bill Wohler wrote:

> mh-image-load-path has morphed a bit in the past week. I have yet to
> give some thought to generalizing it.

I modified MH-E's new `mh-image-load-path' a bit to use it in Gnus.  I
didn't do much testing but to avoid duplicate work, I'll post it here.
So please consider it as a draft.

I don't like that `mh-image-load-path' changes the variables
`load-path' or `image-load-path'.  Assume you have unbundled versions
of Gnus and MH-E installed using Emacs 21.  Which path should win, if
we both use the same variable?

`mm-image-load-path' doesn't modify anything.  It just returns a new
path.  Then it was typically used like this:

             (let ((load-path (mm-image-load-path)))
               (setup-the-toolbar-...))

Catering for Emacs 22 (`image-load-path') and Emacs 21 we can use this
in Gnus...

      (let ((load-path (gmm-image-load-path "message" nil 'load-path))
	    (image-load-path
	     (gmm-image-load-path "message" nil 'image-load-path)))
	    (gmm-tool-bar-from-list message-tool-bar
				    message-tool-bar-zap-list
				    'message-mode-map))

--8<---------------cut here---------------start------------->8---
;; From MH-E without modifications:

(defmacro gmm-defun-compat (name function arg-list &rest body)
  "Create function NAME.
If FUNCTION exists, then NAME becomes an alias for FUNCTION.
Otherwise, create function NAME with ARG-LIST and BODY."
  (let ((defined-p (fboundp function)))
    (if defined-p
        `(defalias ',name ',function)
      `(defun ,name ,arg-list ,@body))))

(gmm-defun-compat gmm-image-search-load-path
  image-search-load-path (file &optional path)
  "Emacs 21 and XEmacs don't have `image-search-load-path'.
This function returns nil on those systems."
  nil)

;; From MH-E with modifications:

(defvar gmm-image-load-path nil
  "Directory where images for MH-E are found.
See function `gmm-image-load-path'.")

;; (defvar image-load-path)
(defun gmm-image-load-path (library &optional image path)
  "Return a suitable search path for images of LIBRARY.

Images for LIBRARY are found in \"../../etc/images\" relative to
the files in \"lisp/LIBRARY\", in `image-load-path', or in
`load-path'.

This function returns value of `load-path' augmented with the
path to IMAGE.  If PATH is given, it is used instead of
`load-path'."
  (unless library (error "No library specified."))
  (unless image
    (setq image ;; DWIM
	  (cond ((string-match "^gnus\\>\\|^message" library)
		 "describe.xpm")
		((string-match "^mh-" library)
		 "mh-logo.xpm")
		(t ;; Which icon should be used here?
		 "contact.xpm"))))
  (cond (gmm-image-load-path) ;; User setting exists.
	((let (gmm-library-name) ;; Try relative setting
	   ;; First, find library in the load-path.
	   (setq gmm-library-name (locate-library library))
	   (if (not gmm-library-name)
	       (error "Cannot find library `%s' in load-path" library))
	   ;; And then set gmm-image-load-path relative to that.
	   (setq gmm-image-load-path
		 (expand-file-name (concat
				    (file-name-directory gmm-library-name)
				    "../../etc/images")))
	   (file-exists-p (expand-file-name image gmm-image-load-path))))
	((gmm-image-search-load-path image)
	 ;; Images in image-load-path.
	 (setq gmm-image-load-path
	       (file-name-directory (gmm-image-search-load-path image))))
	((locate-library image)
	 ;; Images in load-path.
	 (setq gmm-image-load-path
	       (file-name-directory (locate-library image)))))
  ;;
  (unless (file-exists-p gmm-image-load-path)
    (error "Directory `%s' in gmm-image-load-path does not exist"
	     gmm-image-load-path))
  (unless (file-exists-p (expand-file-name image gmm-image-load-path))
    (error "Directory `%s' in gmm-image-load-path does not contain image `%s'."
	   gmm-image-load-path image))
  ;; Return augmented `image-load-path' or `load-path'.
  (cond ((and path (symbolp path))
	 (nconc (list gmm-image-load-path) (symbol-value path)))
	(t
	 (nconc (list gmm-image-load-path) load-path))))
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

  parent reply	other threads:[~2006-02-20 21:19 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1EQxwu-00028T-D0@mail.sourceforge.net>
     [not found] ` <28928.1129483226@olgas.newt.com>
2005-10-17 13:27   ` Sharing mail icons between MH-E and Gnus (was: debian changelog,1.39,1.40 control,1.29,1.30 dirs,1.2,1.3 emacsen-install,1.5,1.6 emacsen-startup,1.12,1.13 rules,1.12,1.13) Reiner Steib
2005-10-17 15:32     ` Sharing mail icons between MH-E and Gnus Bill Wohler
2006-01-19 21:37       ` Reiner Steib
2006-01-23 17:46         ` Bill Wohler
2006-02-19  2:40         ` Bill Wohler
2006-02-20  1:26           ` Reiner Steib
2006-02-20 19:57             ` Bill Wohler
2006-02-20 22:04               ` Reiner Steib
2006-02-21  0:30                 ` Bill Wohler
2006-02-21 11:37                   ` Icons for frequently used sort commands (was: Sharing mail icons between MH-E and Gnus) Reiner Steib
2006-02-21 22:22                     ` Bill Wohler
2006-02-22  0:30                       ` Icons for frequently used sort commands Reiner Steib
2006-02-20 15:58           ` Sharing mail icons between MH-E and Gnus Reiner Steib
2006-02-20 21:23             ` Adam Sjøgren
2006-02-21 11:30               ` Reiner Steib
2006-02-21 22:11                 ` Bill Wohler
2006-02-22  0:30                   ` Reiner Steib
2006-02-22  5:09                     ` Bill Wohler
2006-02-22  6:43                     ` Adam Sjøgren
2006-03-06 16:46                     ` Bill Wohler
2006-03-06 19:15                       ` Reiner Steib
2006-03-06 21:40                         ` Bill Wohler
2006-03-06 23:21                           ` Reiner Steib
2006-03-07  0:06                             ` Bill Wohler
2006-02-20 21:19           ` Reiner Steib [this message]
2006-02-20 22:53             ` Bill Wohler
2006-02-21 21:22               ` Reiner Steib
2006-02-21 22:29                 ` Bill Wohler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v964n9ybgs.fsf@marauder.physik.uni-ulm.de \
    --to=reinersteib+gmane@imap.cc \
    --cc=Reiner.Steib@gmx.de \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).