From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/62064 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.mail.mh-e.devel,gmane.emacs.gnus.general Subject: image-load-path/load-path function (was: Customizable tool bars) Date: Wed, 22 Feb 2006 13:19:57 +0100 Message-ID: References: Reply-To: Reiner Steib NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1140610880 3776 80.91.229.2 (22 Feb 2006 12:21:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 22 Feb 2006 12:21:20 +0000 (UTC) Original-X-From: mh-e-devel-admin@lists.sourceforge.net Wed Feb 22 13:21:17 2006 Return-path: Envelope-to: gmmd-mh-e-devel@m.gmane.org Original-Received: from lists-outbound.sourceforge.net ([66.35.250.225]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FBszQ-0007jX-U9 for gmmd-mh-e-devel@m.gmane.org; Wed, 22 Feb 2006 13:21:05 +0100 Original-Received: from sc8-sf-list1-b.sourceforge.net (sc8-sf-list1-b.sourceforge.net [10.3.1.7]) by sc8-sf-spam1.sourceforge.net (Postfix) with ESMTP id 3187E33EE3; Wed, 22 Feb 2006 04:21:04 -0800 (PST) Original-Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.91] helo=mail.sourceforge.net) by sc8-sf-list1.sourceforge.net with esmtp (Exim 4.30) id 1FBsyV-0000TB-Ld for mh-e-devel@lists.sourceforge.net; Wed, 22 Feb 2006 04:20:07 -0800 Original-Received: from mail.uni-ulm.de ([134.60.1.1]) by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.44) id 1FBsyS-0001rj-VX for mh-e-devel@lists.sourceforge.net; Wed, 22 Feb 2006 04:20:07 -0800 Original-Received: from bridgekeeper.physik.uni-ulm.de (bridgekeeper.physik.uni-ulm.de [134.60.10.123]) by mail.uni-ulm.de (8.13.4/8.13.4) with ESMTP id k1MCJvZG014262; Wed, 22 Feb 2006 13:19:58 +0100 (MET) Original-Received: by bridgekeeper.physik.uni-ulm.de (Postfix, from userid 170) id B710511308; Wed, 22 Feb 2006 13:19:57 +0100 (CET) Original-To: ding@gnus.org, mh-e-devel@lists.sourceforge.net Mail-Followup-To: ding@gnus.org, mh-e-devel@lists.sourceforge.net X-Face: P05mdcZT&lL[-s2=mw~RsllZ0zZAb?vdE}.s, List-Id: Forum for the MH-E developers List-Post: List-Help: List-Subscribe: , List-Archive: X-Original-Date: Wed, 22 Feb 2006 13:19:57 +0100 Xref: news.gmane.org gmane.mail.mh-e.devel:11730 gmane.emacs.gnus.general:62064 Archived-At: [ Adding mh-e-devel. The function is intended to be shared by MH-E and Gnus and such problems may also arise for MH-E users. Maybe they already have an idea concerning this problem. For previous discussion about this function, see http://thread.gmane.org/v964n9ybgs.fsf%40marauder.physik.uni-ulm.de ] On Wed, Feb 22 2006, Katsumi Yamaoka wrote: > In addition, there was another problem. I don't customize > `gmm-image-load-path' (because its docstring doesn't begin with > "*") but add the proper image path to `image-load-path' as > follows: > > (push "/usr/local/share/emacs/etc/images/" image-load-path) > > However, `gmm-image-load-path' was set to > "/usr/local/share/emacs/etc/images/gnus/". I've fixed the > `gmm-image-load-path' function so as to remove subdirectories > which the second argument `image' might have. The reason that I > need to modify `image-load-path' is that I use the configure > options > > --with-lispdir=/usr/local/share/emacs/EMACS-VERSION/site-lisp/gnus > --with-etcdir=/usr/local/share/emacs/etc > > when installing Gnus. So, the icon files are installed under > the "/usr/local/share/emacs/etc/images/" directory, not the > "/usr/local/share/emacs/EMACS-VERSION/site-lisp/gnus/../../etc/images" > directory. I also added "/usr/local/share/emacs/etc/images/" to > `load-path' for Emacs 21. Below is the current version including this fix. Comments? --8<---------------cut here---------------start------------->8--- ;; From MH-E with modifications: (defvar gmm-image-load-path nil "Directory where images are found. See the function `gmm-image-load-path'.") (defun gmm-image-load-path (library image &optional 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 (error "No image specified.")) (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)))) ((let ((img image) (dir (or ;; Images in image-load-path. (gmm-image-search-load-path image) ;; Images in load-path. (locate-library image))) parent) (and dir (setq dir (file-name-directory dir)) (progn ;; Remove subdirectories. (while (setq parent (file-name-directory img)) (setq img (directory-file-name parent) dir (expand-file-name "../" dir))) (setq gmm-image-load-path dir)))))) ;; (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) (delete gmm-image-load-path (if (boundp path) (symbol-value path) nil)))) (t (nconc (list gmm-image-load-path) (delete 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