From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/62079 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general,gmane.mail.mh-e.devel Subject: Re: image-load-path/load-path function Date: Fri, 24 Feb 2006 17:03:42 +0900 Organization: Emacsen advocacy group Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1140768530 23255 80.91.229.2 (24 Feb 2006 08:08:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Feb 2006 08:08:50 +0000 (UTC) Cc: mh-e-devel@lists.sourceforge.net Original-X-From: ding-owner+m10607@lists.math.uh.edu Fri Feb 24 09:08:45 2006 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FCY07-0007UM-Bw for ding-account@gmane.org; Fri, 24 Feb 2006 09:08:32 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1FCY00-0005z4-00; Fri, 24 Feb 2006 02:08:24 -0600 Original-Received: from nas02.math.uh.edu ([129.7.128.40]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1FCXvi-0005yz-00 for ding@lists.math.uh.edu; Fri, 24 Feb 2006 02:03:58 -0600 Original-Received: from quimby.gnus.org ([80.91.224.244]) by nas02.math.uh.edu with esmtp (Exim 4.52) id 1FCXve-0003QI-Vj for ding@lists.math.uh.edu; Fri, 24 Feb 2006 02:03:58 -0600 Original-Received: from washington.hostforweb.net ([66.225.201.13]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1FCXvd-0005U8-00 for ; Fri, 24 Feb 2006 09:03:53 +0100 Original-Received: from [205.234.185.198] (port=48844 helo=mail.jpl.org) by washington.hostforweb.net with esmtpa (Exim 4.52) id 1FCXw9-00006V-94; Fri, 24 Feb 2006 02:04:25 -0600 Original-To: ding@gnus.org X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:cKwy62axzKl19/SGNsNcoJc/fTg= X-Hashcash: 1:20:060224:ding@gnus.org::bRd8C0kt2wAIWZUp:00006VeM X-Hashcash: 1:20:060224:mh-e-devel@lists.sourceforge.net::rcoBtAg4udSQz7t9:000000000000000000000000000000drD X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - washington.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -2.5 (--) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:62079 gmane.mail.mh-e.devel:11742 Archived-At: --=-=-= >>>>> In Reiner Steib wrote: > On Thu, Feb 23 2006, Katsumi Yamaoka wrote: >> Though it might be my needless anxiety. If Gnus could start >> without icons formerly (I'll verify it tomorrow), it might >> confuse some users. > Gnus could start without any icons before. The corresponding tool bar > icons were missing (try adding a bogus filename e.g. to > message-tool-bar-gnome). I also confirmed it. > So I think it there should not be an error. I think so. Though it is not good that `tool-bar-mode' is not turned off despite no images, it is not as serious as we should stop Gnus starting. Users need to read new mails at once anyway. How about this way? --- add the optional NOERROR argument to `gmm-image-load-path'; make Gnus always specify that argument. Here's a modified part of gmm-utils.el and a diff to the other files (they include some irrelevant and not significant changes): 2006-02-24 Katsumi Yamaoka * gmm-utils.el (gmm-image-load-path): Add optional NOERROR argument; don't cause error if it is specified; set the variable gmm-image-load-path to not-found in order not to issue warning two or more times if directory containing images is not found; make sure gmm-image-load-path doesn't appear in result twice. * gnus-group.el (gnus-group-make-tool-bar): Specify optional NOERROR argument to gmm-image-load-path. * gnus-sum.el (gnus-summary-make-tool-bar): Ditto. * message.el (message-make-tool-bar): Ditto. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable (defvar gmm-image-load-path nil "Directory where images are found. The function `gmm-image-load-path' (which see) will set the value according to `image-load-path' or `load-path'. If the directory containing images is not found, it will be set to `not-found'.") (defun gmm-image-load-path (library image &optional path noerror) "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'. If the optional NOERROR is set, this function won't throw an error even if the directory containing images is not found." (unless library (error "No library specified.")) (unless image (error "No image specified.")) (cond (gmm-image-load-path) ;; Already set. ((let (gmm-library-name d1ei d2ei) ;; 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 ;; Go down 2 levels... d2ei (expand-file-name (concat (file-name-directory gmm-library-name) "../../etc/images")) ;; Go down 1 level... d1ei (expand-file-name (concat (file-name-directory gmm-library-name) "../etc/images"))) (setq gmm-image-load-path ;; Set it to nil if image is not found... (cond ((file-exists-p (expand-file-name image d2ei)) d2ei) ((file-exists-p (expand-file-name image d1ei)) d1ei))))) ((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)))))) ;; (let ((issuer (if noerror 'message 'error))) (cond ((eq gmm-image-load-path 'not-found)) ((not gmm-image-load-path) (setq gmm-image-load-path 'not-found) (funcall issuer "Directory containing images for this version of %s is not found" (capitalize library)) (sit-for 2)) ((not (file-exists-p gmm-image-load-path)) (funcall issuer "Directory `%s' in gmm-image-load-path does not exist" gmm-image-load-path)) ((not (file-exists-p (expand-file-name image gmm-image-load-path))) (funcall issuer "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)) (if (eq gmm-image-load-path 'not-found) (copy-sequence (symbol-value path)) (setq gmm-image-load-path (file-name-directory gmm-image-load-path)) (nconc (list gmm-image-load-path) (delete (directory-file-name gmm-image-load-path) (delete gmm-image-load-path (if (boundp path) (copy-sequence (symbol-value path)) nil)))))) ((eq gmm-image-load-path 'not-found) (copy-sequence load-path)) (t (setq gmm-image-load-path (file-name-directory gmm-image-load-path)) (nconc (list gmm-image-load-path) (delete (directory-file-name gmm-image-load-path) (delete gmm-image-load-path (copy-sequence load-path))))))) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment --- gnus-group.el~ 2006-02-23 21:46:07 +0000 +++ gnus-group.el 2006-02-24 08:00:37 +0000 @@ -1117,10 +1117,10 @@ (or (not gnus-group-tool-bar-map) force)) (let* ((load-path (gmm-image-load-path "gnus" "gnus/toggle-subscription.xpm" - 'load-path)) + 'load-path t)) (image-load-path (gmm-image-load-path "gnus" "gnus/toggle-subscription.xpm" - 'image-load-path)) + 'image-load-path t)) (map (gmm-tool-bar-from-list gnus-group-tool-bar gnus-group-tool-bar-zap-list 'gnus-group-mode-map))) --- gnus-sum.el~ 2006-02-23 21:46:07 +0000 +++ gnus-sum.el 2006-02-24 08:00:37 +0000 @@ -2770,9 +2770,9 @@ tool-bar-mode (or (not gnus-summary-tool-bar-map) force)) (let* ((load-path - (gmm-image-load-path "gnus" "mail/save.xpm" 'load-path)) + (gmm-image-load-path "gnus" "mail/save.xpm" 'load-path t)) (image-load-path - (gmm-image-load-path "gnus" "mail/save.xpm" 'image-load-path)) + (gmm-image-load-path "gnus" "mail/save.xpm" 'image-load-path t)) (map (gmm-tool-bar-from-list gnus-summary-tool-bar gnus-summary-tool-bar-zap-list 'gnus-summary-mode-map))) --- message.el~ 2006-02-24 04:59:45 +0000 +++ message.el 2006-02-24 08:00:37 +0000 @@ -6803,10 +6803,10 @@ (setq message-tool-bar-map (let ((load-path (gmm-image-load-path "message" "mail/save-draft.xpm" - 'load-path)) + 'load-path t)) (image-load-path (gmm-image-load-path "message" "mail/save-draft.xpm" - 'image-load-path))) + 'image-load-path t))) (gmm-tool-bar-from-list message-tool-bar message-tool-bar-zap-list 'message-mode-map)))) --=-=-=--