emacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-commit] emacs/lisp/mh-e mh-utils.el mh-letter.el mh-fol...


From: Bill Wohler
Subject: [Emacs-commit] emacs/lisp/mh-e mh-utils.el mh-letter.el mh-fol...
Date: Fri, 03 Mar 2006 20:50:50 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         
Changes by:     Bill Wohler <address@hidden>    06/03/03 20:50:50

Modified files:
        lisp/mh-e      : mh-utils.el mh-letter.el mh-folder.el ChangeLog 

Log message:
        * mh-folder.el (mh-folder-mode): Rename mh-image-load-path to
        mh-image-load-path-for-library.
        
        * mh-letter.el (mh-letter-mode): Rename mh-image-load-path to
        mh-image-load-path-for-library.
        
        * mh-utils.el (mh-image-load-path): Rename to
        mh-image-load-path-for-library. Add example to docstring. Rename local
        variable mh-image-directory to image-directory. Move error checks to
        default case in cond and simplify.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-utils.el.diff?tr1=1.57&tr2=1.58&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-letter.el.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-folder.el.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/ChangeLog.diff?tr1=1.170&tr2=1.171&r1=text&r2=text

Patches:
Index: emacs/lisp/mh-e/ChangeLog
diff -u emacs/lisp/mh-e/ChangeLog:1.170 emacs/lisp/mh-e/ChangeLog:1.171
--- emacs/lisp/mh-e/ChangeLog:1.170     Fri Mar  3 20:02:10 2006
+++ emacs/lisp/mh-e/ChangeLog   Fri Mar  3 20:50:50 2006
@@ -1,5 +1,16 @@
 2006-03-03  Bill Wohler  <address@hidden>
 
+       * mh-folder.el (mh-folder-mode):  Rename mh-image-load-path to
+       mh-image-load-path-for-library.
+
+       * mh-letter.el (mh-letter-mode): Rename mh-image-load-path to
+       mh-image-load-path-for-library.
+
+       * mh-utils.el (mh-image-load-path): Rename to
+       mh-image-load-path-for-library. Add example to docstring. Rename
+       local variable mh-image-directory to image-directory. Move error
+       checks to default case in cond and simplify.
+
        * mh-comp.el (mh-send-letter, mh-insert-auto-fields): Sync
        docstrings with manual.
 
Index: emacs/lisp/mh-e/mh-folder.el
diff -u emacs/lisp/mh-e/mh-folder.el:1.6 emacs/lisp/mh-e/mh-folder.el:1.7
--- emacs/lisp/mh-e/mh-folder.el:1.6    Fri Mar  3 00:27:49 2006
+++ emacs/lisp/mh-e/mh-folder.el        Fri Mar  3 20:50:50 2006
@@ -591,10 +591,10 @@
 \\{mh-folder-mode-map}"
   (mh-do-in-gnu-emacs
     (unless mh-folder-buttons-init-flag
-      (let ((load-path
-             (mh-image-load-path "mh-e" "mh-logo.xpm" 'load-path))
-            (image-load-path
-             (mh-image-load-path "mh-e" "mh-logo.xpm" 'image-load-path)))
+      (let ((load-path (mh-image-load-path-for-library
+                        "mh-e" "mh-logo.xpm" 'load-path))
+            (image-load-path (mh-image-load-path-for-library
+                              "mh-e" "mh-logo.xpm" 'image-load-path)))
         (mh-tool-bar-folder-buttons-init)
         (setq mh-folder-buttons-init-flag t)))
     (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map))
Index: emacs/lisp/mh-e/mh-letter.el
diff -u emacs/lisp/mh-e/mh-letter.el:1.7 emacs/lisp/mh-e/mh-letter.el:1.8
--- emacs/lisp/mh-e/mh-letter.el:1.7    Fri Mar  3 00:27:49 2006
+++ emacs/lisp/mh-e/mh-letter.el        Fri Mar  3 20:50:50 2006
@@ -313,10 +313,10 @@
   (make-local-variable 'mh-sent-from-msg)
   (mh-do-in-gnu-emacs
     (unless mh-letter-buttons-init-flag
-      (let ((load-path
-             (mh-image-load-path "mh-e" "mh-logo.xpm" 'load-path))
-            (image-load-path
-             (mh-image-load-path "mh-e" "mh-logo.xpm" 'image-load-path)))
+      (let ((load-path (mh-image-load-path-for-library
+                        "mh-e" "mh-logo.xpm" 'load-path))
+            (image-load-path (mh-image-load-path-for-library
+                              "mh-e" "mh-logo.xpm" 'image-load-path)))
         (mh-tool-bar-letter-buttons-init)
         (setq mh-letter-buttons-init-flag t)))
     (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map))
Index: emacs/lisp/mh-e/mh-utils.el
diff -u emacs/lisp/mh-e/mh-utils.el:1.57 emacs/lisp/mh-e/mh-utils.el:1.58
--- emacs/lisp/mh-e/mh-utils.el:1.57    Fri Mar  3 00:27:49 2006
+++ emacs/lisp/mh-e/mh-utils.el Fri Mar  3 20:50:50 2006
@@ -82,7 +82,7 @@
   (delete-region (point) (progn (forward-line lines) (point))))
 
 ;;;###mh-autoload
-(defun mh-image-load-path (library image &optional path)
+(defun mh-image-load-path-for-library (library image &optional path)
   "Return a suitable search path for images of LIBRARY.
 
 Images for LIBRARY are searched for in \"../../etc/images\" and
@@ -91,28 +91,36 @@
 
 This function returns value of `load-path' augmented with the
 path to IMAGE.  If PATH is given, it is used instead of
-`load-path'."
+`load-path'.
+
+Here is an example that uses a common idiom to provide
+compatibility with versions of Emacs that lack the variable
+`image-load-path':
+
+  (let ((load-path
+         (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\" 'load-path))
+        (image-load-path
+         (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\" 
'image-load-path)))
+    (mh-tool-bar-folder-buttons-init))"
   (unless library (error "No library specified"))
   (unless image   (error "No image specified"))
-  (let ((mh-image-directory))
+  (let ((image-directory))
     (cond
      ;; Try relative setting.
-     ((let (mh-library-name d1ei d2ei)
+     ((let (library-name d1ei d2ei)
         ;; First, find library in the load-path.
-        (setq mh-library-name (locate-library library))
-        (if (not mh-library-name)
+        (setq library-name (locate-library library))
+        (if (not library-name)
             (error "Cannot find library %s in load-path" library))
-        ;; And then set mh-image-directory relative to that.
+        ;; And then set image-directory relative to that.
         (setq
          ;; Go down 2 levels.
          d2ei (expand-file-name
-               (concat (file-name-directory mh-library-name)
-                       "../../etc/images"))
+               (concat (file-name-directory library-name) "../../etc/images"))
          ;; Go down 1 level.
          d1ei (expand-file-name
-               (concat (file-name-directory mh-library-name)
-                       "../etc/images")))
-        (setq mh-image-directory
+               (concat (file-name-directory library-name) "../etc/images")))
+        (setq image-directory
               ;; 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)))))
@@ -124,8 +132,8 @@
                   ;; Images in load-path.
                   (locate-library image)))
             parent)
-        ;; Since the image might be in a nested directory
-        ;; (for example, mail/attach.pbm), adjust `mh-image-directory'
+        ;; Since the image might be in a nested directory (for
+        ;; example, mail/attach.pbm), adjust `image-directory'
         ;; accordingly.
         (and dir
              (setq dir (file-name-directory dir))
@@ -133,25 +141,20 @@
                (while (setq parent (file-name-directory img))
                  (setq img (directory-file-name parent)
                        dir (expand-file-name "../" dir)))
-               (setq mh-image-directory dir))))))
-    ;;
-    (unless (file-exists-p mh-image-directory)
-      (error "Directory %s in mh-image-directory does not exist"
-            mh-image-directory))
-    (unless (file-exists-p (expand-file-name image mh-image-directory))
-      (error "Directory %s in mh-image-directory does not contain image %s"
-             mh-image-directory image))
+               (setq image-directory dir)))))
+     (t
+      (error "Could not find image %s for library %s" image library)))
+
     ;; Return augmented `image-load-path' or `load-path'.
     (cond ((and path (symbolp path))
-           (nconc (list mh-image-directory)
-                  (delete mh-image-directory
+           (nconc (list image-directory)
+                  (delete image-directory
                           (if (boundp path)
                               (copy-sequence (symbol-value path))
                             nil))))
           (t
-           (nconc (list mh-image-directory)
-                  (delete mh-image-directory
-                          (copy-sequence load-path)))))))
+           (nconc (list image-directory)
+                  (delete image-directory (copy-sequence load-path)))))))
 
 ;;;###mh-autoload
 (defun mh-make-local-vars (&rest pairs)
@@ -203,10 +206,10 @@
 (defun mh-logo-display ()
   "Modify mode line to display MH-E logo."
   (mh-do-in-gnu-emacs
-    (let ((load-path
-           (mh-image-load-path "mh-e" "mh-logo.xpm" 'load-path))
-          (image-load-path
-           (mh-image-load-path "mh-e" "mh-logo.xpm" 'image-load-path)))
+    (let ((load-path (mh-image-load-path-for-library
+                      "mh-e" "mh-logo.xpm" 'load-path))
+          (image-load-path (mh-image-load-path-for-library
+                            "mh-e" "mh-logo.xpm" 'image-load-path)))
       (add-text-properties
        0 2
        `(display ,(or mh-logo-cache




reply via email to

[Prev in Thread] Current Thread [Next in Thread]