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-seq.el mh-mime.e...


From: Bill Wohler
Subject: [Emacs-commit] emacs/lisp/mh-e mh-utils.el mh-seq.el mh-mime.e...
Date: Mon, 09 Jan 2006 06:28:49 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         
Changes by:     Bill Wohler <address@hidden>    06/01/09 06:28:49

Modified files:
        lisp/mh-e      : mh-utils.el mh-seq.el mh-mime.el mh-init.el 
                         mh-index.el mh-inc.el mh-identity.el 
                         mh-funcs.el mh-e.el mh-customize.el mh-comp.el 
                         mh-alias.el ChangeLog 

Log message:
        * mh-alias.el (mh-alias-gecos-name): Use replace-regexp-in-string
        instead of mh-replace-in-string as mh-replace-in-string was replaced
        by a more appropriate defsubst in mh-xemacs.el.
        
        * mh-comp.el: Require cleanup, wrap compiler-shushing defvars with
        eval-when-compile.
        (mh-file-is-vcard-p): Removed redundant test.
        
        * mh-customize.el: Require cleanup, wrap compiler-shushing defvars
        with eval-when-compile.
        (mh-adaptive-cmd-note-flag, mh-invisible-header-fields)
        (mh-invisible-header-fields-default): Add forward definitions.
        (mh-invisible-header-fields-default): Alphabetize.
        
        * mh-e.el: Require cleanup, wrap compiler-shushing defvars with
        eval-when-compile.
        (mh-thread-scan-line-map-stack, tool-bar-mode): Delete unused
        variables.
        (mh-colors-available-p): Just call display-color-cells. It's on all
        supported Emacsen (and defaliased on XEmacs).
        
        * mh-funcs.el: mh-inc.el: mh-init.el: Wrap compiler-shushing defvars
        * with eval-when-compile.
        
        * mh-identity.el: Don't need (mh-require-cl).
        
        * mh-index.el: Don't need to load executable any more.
        
        * mh-mime.el: Wrap compiler-shushing defvars with eval-when-compile.
        (mh-have-file-command): Initialize variable to 'undefined. Add
        docstring. Update function of same name accordingly. Also don't need
        to load executable any more.
        (mh-mime-content-types): Delete.
        (mh-minibuffer-read-type): Prompt user for type if mh-file-mime-type
        returns application/octet-stream. Assume we have mailcap-mime-types.
        (mh-mime-display): Update error message.
        
        * mh-seq.el: Require cleanup, and wrap compiler-shushing defvars with
        eval-when-compile.
        
        * mh-utils.el: Require cleanup, and wrap compiler-shushing defvars
        with eval-when-compile.
        (mh-clean-msg-header): Don't set after-change-functions to nil.
        (mh-replace-in-string): Remove. Create defsubst in mh-xemacs.el
        instead.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-utils.el.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-seq.el.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-mime.el.diff?tr1=1.36&tr2=1.37&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-init.el.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-index.el.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-inc.el.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-identity.el.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-funcs.el.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-e.el.diff?tr1=1.48&tr2=1.49&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-customize.el.diff?tr1=1.55&tr2=1.56&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-comp.el.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-alias.el.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/ChangeLog.diff?tr1=1.98&tr2=1.99&r1=text&r2=text

Patches:
Index: emacs/lisp/mh-e/ChangeLog
diff -u emacs/lisp/mh-e/ChangeLog:1.98 emacs/lisp/mh-e/ChangeLog:1.99
--- emacs/lisp/mh-e/ChangeLog:1.98      Sat Jan  7 20:46:49 2006
+++ emacs/lisp/mh-e/ChangeLog   Mon Jan  9 06:28:49 2006
@@ -1,3 +1,62 @@
+2006-01-08  Bill Wohler  <address@hidden>
+
+       Removed code that was marked as Emacs 20 compatible that was
+       easily found showing how important it is to document such
+       things (closes SF #1359240). Feel free to nuke any other Emacs 20
+       peculiarities that you find. Wrapped code for shushing compiler
+       with (eval-when-compile), sometimes moving the defvars closer to
+       where they were used.
+       
+       * mh-alias.el (mh-alias-gecos-name): Use replace-regexp-in-string
+       instead of mh-replace-in-string as mh-replace-in-string was
+       replaced by a more appropriate defsubst in mh-xemacs.el.
+
+       * mh-comp.el: Require cleanup, wrap compiler-shushing defvars with
+       eval-when-compile.
+       (mh-file-is-vcard-p): Removed redundant test.
+
+       * mh-customize.el: Require cleanup, wrap compiler-shushing defvars
+       with eval-when-compile.
+       (mh-adaptive-cmd-note-flag, mh-invisible-header-fields)
+       (mh-invisible-header-fields-default): Add forward definitions.
+       (mh-invisible-header-fields-default): Alphabetize.
+
+       * mh-e.el: Require cleanup, wrap compiler-shushing defvars with
+       eval-when-compile.
+       (mh-thread-scan-line-map-stack, tool-bar-mode): Delete unused
+       variables.
+       (mh-colors-available-p): Just call display-color-cells. It's on
+       all supported Emacsen (and defaliased on XEmacs).
+
+       * mh-funcs.el:
+       * mh-inc.el:
+       * mh-init.el: Wrap compiler-shushing defvars with
+       eval-when-compile.
+
+       * mh-identity.el: Don't need (mh-require-cl).
+
+       * mh-index.el: Don't need to load executable any more.
+
+       * mh-mime.el: Wrap compiler-shushing defvars with
+       eval-when-compile.
+       (mh-have-file-command): Initialize variable to 'undefined. Add
+       docstring. Update function of same name accordingly. Also don't
+       need to load executable any more.
+       (mh-mime-content-types): Delete.
+       (mh-minibuffer-read-type): Prompt user for type if
+       mh-file-mime-type returns application/octet-stream. Assume we have
+       mailcap-mime-types.
+       (mh-mime-display): Update error message.
+
+       * mh-seq.el: Require cleanup, and wrap compiler-shushing defvars
+       with eval-when-compile.
+
+       * mh-utils.el: Require cleanup, and wrap compiler-shushing defvars
+       with eval-when-compile.
+       (mh-clean-msg-header): Don't set after-change-functions to nil.
+       (mh-replace-in-string): Remove. Create defsubst in mh-xemacs.el
+       instead.
+       
 2006-01-07  Bill Wohler  <address@hidden>
 
        * mh-customize.el: Updated Faces documentation in header.
Index: emacs/lisp/mh-e/mh-alias.el
diff -u emacs/lisp/mh-e/mh-alias.el:1.21 emacs/lisp/mh-e/mh-alias.el:1.22
--- emacs/lisp/mh-e/mh-alias.el:1.21    Wed Jan  4 02:08:12 2006
+++ emacs/lisp/mh-e/mh-alias.el Mon Jan  9 06:28:49 2006
@@ -132,10 +132,10 @@
         (setq res (match-string 1 res)))
     ;; Replace "&" with capitalized username
     (if (string-match "&" res)
-        (setq res (mh-replace-in-string "&" (capitalize username) res)))
+        (setq res (replace-regexp-in-string "&" (capitalize username) res)))
     ;; Remove " character
     (if (string-match "\"" res)
-        (setq res (mh-replace-in-string "\"" "" res)))
+        (setq res (replace-regexp-in-string "\"" "" res)))
     ;; If empty string, use username instead
     (if (string-equal "" res)
         (setq res username))
Index: emacs/lisp/mh-e/mh-comp.el
diff -u emacs/lisp/mh-e/mh-comp.el:1.35 emacs/lisp/mh-e/mh-comp.el:1.36
--- emacs/lisp/mh-e/mh-comp.el:1.35     Wed Jan  4 02:08:12 2006
+++ emacs/lisp/mh-e/mh-comp.el  Mon Jan  9 06:28:49 2006
@@ -35,24 +35,17 @@
 
 (eval-when-compile (require 'mh-acros))
 (mh-require-cl)
-(require 'mh-e)
-(require 'gnus-util)
+
 (require 'easymenu)
+(require 'gnus-util)
+(require 'mh-e)
 (require 'mh-gnus)
+
 (eval-when (compile load eval)
   (ignore-errors (require 'mailabbrev)))
 
-;; Shush the byte-compiler
-(defvar adaptive-fill-first-line-regexp)
-(defvar font-lock-defaults)
-(defvar mark-active)
-(defvar sendmail-coding-system)
-(defvar mh-identity-list)
-(defvar mh-identity-default)
-(defvar mh-mml-mode-default)
-(defvar mh-identity-menu)
-
 
+
 ;;; Autoloads
 
 (autoload 'mail-mode-fill-paragraph "sendmail")
@@ -958,10 +951,12 @@
         (mail-mode-fill-paragraph arg)
       (fill-paragraph arg))))
 
-;; Avoid compiler warnings in XEmacs and Emacs 20
+;; Shush compiler.
 (eval-when-compile
-  (defvar tool-bar-mode)
-  (defvar tool-bar-map))
+  (defvar adaptive-fill-first-line-regexp)
+  (defvar tool-bar-map)
+    (defvar font-lock-defaults)
+)
 
 (defvar mh-letter-buttons-init-flag nil)
 
@@ -1177,8 +1172,7 @@
          (file-exists-p file)
          (or (and (not (mh-have-file-command))
                   (not (null (string-match "\.vcf$" file))))
-             (and (mh-have-file-command)
-                  (string-equal "text/x-vcard" (mh-file-mime-type file)))))))
+             (string-equal "text/x-vcard" (mh-file-mime-type file))))))
 
 ;;;###mh-autoload
 (defun mh-insert-signature (&optional file)
@@ -1469,6 +1463,8 @@
         unless (eq charset 'ascii) return nil
         finally return t))
 
+(eval-when-compile (defvar sendmail-coding-system)) ;shush compiler
+
 ;;;###mh-autoload
 (defun mh-send-letter (&optional arg)
   "Save draft and send message.
Index: emacs/lisp/mh-e/mh-customize.el
diff -u emacs/lisp/mh-e/mh-customize.el:1.55 
emacs/lisp/mh-e/mh-customize.el:1.56
--- emacs/lisp/mh-e/mh-customize.el:1.55        Sat Jan  7 20:46:49 2006
+++ emacs/lisp/mh-e/mh-customize.el     Mon Jan  9 06:28:49 2006
@@ -67,21 +67,17 @@
 
 (eval-when-compile (require 'mh-acros))
 (mh-require-cl)
-(require 'mh-loaddefs)
 
 (eval-and-compile
   (defvar mh-xemacs-flag (featurep 'xemacs)
-    "Non-nil means the current Emacs is XEmacs."))
+    "Non-nil means the current Emacs is XEmacs.")
+  (when mh-xemacs-flag
+    (require 'mh-xemacs)))
 
-(when mh-xemacs-flag
-  (require 'mh-xemacs))
-
-;; XXX: Functions autoloaded from the following files are used to initialize
-;;  customizable variables. They are require'd here, since otherwise the
-;;  corresponding .elc would be loaded at compile time.
-(eval-when-compile
+(eval-and-compile
+  (require 'mh-identity)
   (require 'mh-init)
-  (require 'mh-identity))
+  (require 'mh-loaddefs))
 
 ;; For compiler warnings...
 (eval-when-compile
@@ -1031,8 +1027,7 @@
 
 ;;; Scan Line Formats (:group 'mh-scan-line-formats)
 
-;; Forward definition to avoid compiler and runtime error.
-(defvar mh-scan-format-file t)
+(defvar mh-scan-format-file t) ;forward definition
 
 (defun mh-adaptive-cmd-note-flag-check (symbol value)
   "Check if desired setting is legal.
@@ -1045,6 +1040,8 @@
              "is set to \"Use MH-E scan Format\"")
     (set-default symbol value)))
 
+(defvar mh-adaptive-cmd-note-flag) ;forward definition
+
 (defun mh-scan-format-file-check (symbol value)
   "Check if desired setting is legal.
 Throw an error if user tries to set `mh-scan-format-file' to
@@ -1598,6 +1595,10 @@
 hidden that you wish to display, and add extra entries to hide in
 `mh-invisible-header-fields'.")
 
+;; Forward definition.
+(defvar mh-invisible-header-fields)
+(defvar mh-invisible-header-fields-default nil)
+
 (defun mh-invisible-headers ()
   "Make or remake the variable `mh-invisible-header-fields-compiled'.
 Done using `mh-invisible-header-fields-internal' as input, from
@@ -1623,23 +1624,6 @@
                  (regexp-opt fields t))))
       (setq mh-invisible-header-fields-compiled nil))))
 
-(defcustom mh-invisible-header-fields-default nil
-  "*List of hidden header fields.
-
-The header fields listed in this option are hidden, although you
-can check off any field that you would like to see.
-
-Header fields that you would like to hide that aren't listed can
-be added to the option `mh-invisible-header-fields'.
-
-See also `mh-clean-message-header-flag'."
-  :type `(set ,@(mapcar (lambda (x) `(const ,x))
-                        mh-invisible-header-fields-internal))
-  :set (lambda (symbol value)
-         (set-default symbol value)
-         (mh-invisible-headers))
-  :group 'mh-show)
-
 (defcustom mh-invisible-header-fields nil
   "*Additional header fields to hide.
 
@@ -1660,6 +1644,23 @@
          (mh-invisible-headers))
   :group 'mh-show)
 
+(defcustom mh-invisible-header-fields-default nil
+  "*List of hidden header fields.
+
+The header fields listed in this option are hidden, although you
+can check off any field that you would like to see.
+
+Header fields that you would like to hide that aren't listed can
+be added to the option `mh-invisible-header-fields'.
+
+See also `mh-clean-message-header-flag'."
+  :type `(set ,@(mapcar (lambda (x) `(const ,x))
+                        mh-invisible-header-fields-internal))
+  :set (lambda (symbol value)
+         (set-default symbol value)
+         (mh-invisible-headers))
+  :group 'mh-show)
+
 (defcustom mh-lpr-command-format "lpr -J '%s'"
   "*Command used to print\\<mh-folder-mode-map>.
 
Index: emacs/lisp/mh-e/mh-e.el
diff -u emacs/lisp/mh-e/mh-e.el:1.48 emacs/lisp/mh-e/mh-e.el:1.49
--- emacs/lisp/mh-e/mh-e.el:1.48        Wed Jan  4 02:39:30 2006
+++ emacs/lisp/mh-e/mh-e.el     Mon Jan  9 06:28:49 2006
@@ -51,7 +51,9 @@
 
 ;; MH-E is an Emacs interface to the MH mail system.
 
-;; MH-E is supported in GNU Emacs 20 and 21, with MH 6.8.4 and nmh 1.0.4.
+;; MH-E is supported in GNU Emacs 21 and 22 as well as XEmacs 21
+;; (except for versions 21.5.9-21.5.16), with MH 6.8.4 on, nmh 1.0.4
+;; on, and GNU mailutils 0.4 on.
 
 ;; Mailing Lists:
 ;;   address@hidden
@@ -87,17 +89,11 @@
 
 (eval-when-compile (require 'mh-acros))
 (mh-require-cl)
-(require 'mh-utils)
-(require 'mh-init)
-(require 'mh-inc)
-(require 'mh-seq)
-(require 'gnus-util)
-(require 'easymenu)
 
-;; Shush the byte-compiler
-(eval-when-compile
-  (defvar font-lock-auto-fontify)
-  (defvar font-lock-defaults))
+(require 'easymenu)
+(require 'gnus-util)
+(require 'mh-seq)
+(require 'mh-utils)
 
 (defconst mh-version "7.85+cvs" "Version number of MH-E.")
 
@@ -1184,8 +1180,6 @@
   (when (consp part-index) (setq part-index (car part-index)))
   (mh-folder-mime-action part-index #'mh-mime-save-part nil))
 
-(defvar mh-thread-scan-line-map-stack)
-
 (defun mh-reset-threads-and-narrowing ()
   "Reset all variables pertaining to threads and narrowing.
 Also removes all content from the folder buffer."
@@ -1761,18 +1755,19 @@
       ''write-file-functions            ;Emacs 21.4
     ''local-write-file-hooks))          ;<Emacs 21.4, XEmacs
 
-;; Avoid compiler warnings in non-bleeding edge versions of Emacs.
-(eval-when-compile
-  (defvar tool-bar-mode)
-  (defvar tool-bar-map)
-  (defvar desktop-save-buffer))         ;Emacs 21.4
-
 ;; Register mh-folder-mode as supporting which-function-mode...
 (load "which-func" t t)
 (when (and (boundp 'which-func-modes)
            (not (member 'mh-folder-mode which-func-modes)))
   (push 'mh-folder-mode which-func-modes))
 
+;; Shush compiler in non-bleeding edge versions of Emacs.
+(eval-when-compile
+  (defvar desktop-save-buffer)         ;Emacs 21.4
+  (defvar font-lock-auto-fontify)
+  (defvar font-lock-defaults)
+  (defvar tool-bar-map))
+
 (defvar mh-folder-buttons-init-flag nil)
 
 ;; Autoload cookie needed by desktop.el
@@ -1913,10 +1908,7 @@
 (defun mh-colors-available-p ()
   "Check if colors are available in the Emacs being used."
   (or mh-xemacs-flag
-      (let ((color-cells
-             (or (ignore-errors (mh-funcall-if-exists display-color-cells))
-                 (ignore-errors (mh-funcall-if-exists
-                                 x-display-color-cells)))))
+      (let ((color-cells (display-color-cells)))
         (and (numberp color-cells) (>= color-cells 8)))))
 
 (defun mh-colors-in-use-p ()
Index: emacs/lisp/mh-e/mh-funcs.el
diff -u emacs/lisp/mh-e/mh-funcs.el:1.21 emacs/lisp/mh-e/mh-funcs.el:1.22
--- emacs/lisp/mh-e/mh-funcs.el:1.21    Tue Jan  3 06:13:43 2006
+++ emacs/lisp/mh-e/mh-funcs.el Mon Jan  9 06:28:49 2006
@@ -149,8 +149,7 @@
           (re-search-forward "^rmf: " (point-max) t))
     (display-buffer mh-temp-buffer)))
 
-;; Avoid compiler warning...
-(defvar view-exit-action)
+(eval-when-compile (defvar view-exit-action)) ;shush compile
 
 ;;;###mh-autoload
 (defun mh-list-folders ()
Index: emacs/lisp/mh-e/mh-identity.el
diff -u emacs/lisp/mh-e/mh-identity.el:1.22 emacs/lisp/mh-e/mh-identity.el:1.23
--- emacs/lisp/mh-e/mh-identity.el:1.22 Wed Jan  4 02:08:12 2006
+++ emacs/lisp/mh-e/mh-identity.el      Mon Jan  9 06:28:49 2006
@@ -40,7 +40,7 @@
 ;;; Code:
 
 (eval-when-compile (require 'mh-acros))
-(mh-require-cl)
+
 (require 'mh-comp)
 
 (autoload 'mml-insert-tag "mml")
Index: emacs/lisp/mh-e/mh-inc.el
diff -u emacs/lisp/mh-e/mh-inc.el:1.10 emacs/lisp/mh-e/mh-inc.el:1.11
--- emacs/lisp/mh-e/mh-inc.el:1.10      Fri Dec 23 08:40:31 2005
+++ emacs/lisp/mh-e/mh-inc.el   Mon Jan  9 06:28:49 2006
@@ -1,6 +1,6 @@
 ;;; mh-inc.el --- MH-E "inc" and separate mail spool handling
 ;;
-;; Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
 
 ;; Author: Peter S. Galbraith <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
@@ -73,8 +73,7 @@
                                         (char-to-string key)
                                         "] inc " folder " folder\n"))))
 
-;; Avoid compiler warning
-(defvar mh-inc-spool-list)
+(eval-when-compile (defvar mh-inc-spool-list)) ;shush compiler
 
 (defun mh-inc-spool-make ()
   "Make all commands and defines keys for contents of `mh-inc-spool-list'."
Index: emacs/lisp/mh-e/mh-index.el
diff -u emacs/lisp/mh-e/mh-index.el:1.19 emacs/lisp/mh-e/mh-index.el:1.20
--- emacs/lisp/mh-e/mh-index.el:1.19    Wed Jan  4 02:39:30 2006
+++ emacs/lisp/mh-e/mh-index.el Mon Jan  9 06:28:49 2006
@@ -45,6 +45,7 @@
 
 (eval-when-compile (require 'mh-acros))
 (mh-require-cl)
+
 (require 'mh-e)
 (require 'mh-mime)
 (require 'mh-pick)
@@ -52,7 +53,6 @@
 (autoload 'gnus-local-map-property "gnus-util")
 (autoload 'gnus-eval-format "gnus-spec")
 (autoload 'widget-convert-button "wid-edit")
-(autoload 'executable-find "executable")
 
 ;; Support different indexing programs
 (defvar mh-indexer-choices
Index: emacs/lisp/mh-e/mh-init.el
diff -u emacs/lisp/mh-e/mh-init.el:1.22 emacs/lisp/mh-e/mh-init.el:1.23
--- emacs/lisp/mh-e/mh-init.el:1.22     Wed Jan  4 02:08:12 2006
+++ emacs/lisp/mh-e/mh-init.el  Mon Jan  9 06:28:49 2006
@@ -43,9 +43,6 @@
 (mh-require-cl)
 (require 'mh-utils)
 
-;; Avoid compiler warnings.
-(eval-when-compile (defvar image-load-path))
-
 ;; Set for local environment:
 ;; mh-progs and mh-lib used to be set in paths.el, which tried to
 ;; figure out at build time which of several possible directories MH
@@ -300,6 +297,8 @@
 
 
 
+(eval-when-compile (defvar image-load-path)) ;shush compiler
+
 (defvar mh-image-load-path-called-flag nil)
 
 ;;;###mh-autoload
@@ -328,6 +327,8 @@
 
 
 
+;;; Support routines for mh-customize.el
+
 (defvar mh-min-colors-defined-flag (and (not mh-xemacs-flag)
                                         (>= emacs-major-version 22))
   "Non-nil means defface supports min-colors display requirement.")
Index: emacs/lisp/mh-e/mh-mime.el
diff -u emacs/lisp/mh-e/mh-mime.el:1.36 emacs/lisp/mh-e/mh-mime.el:1.37
--- emacs/lisp/mh-e/mh-mime.el:1.36     Sat Jan  7 18:23:44 2006
+++ emacs/lisp/mh-e/mh-mime.el  Mon Jan  9 06:28:49 2006
@@ -38,8 +38,9 @@
 
 (eval-when-compile (require 'mh-acros))
 (mh-require-cl)
-(require 'mh-comp)
+
 (require 'gnus-util)
+(require 'mh-comp)
 (require 'mh-gnus)
 
 (autoload 'article-emphasize "gnus-art")
@@ -132,16 +133,16 @@
           "/[-.+a-zA-Z0-9]+")
   "Regexp matching valid media types used in MIME attachment compositions.")
 
-;; Just defvar the variable to avoid compiler warning... This doesn't bind
-;; the variable, so things should work exactly as before.
-(defvar mh-have-file-command)
+(defvar mh-have-file-command 'undefined
+  "Cached value of `mh-have-file-command'.
+Do not reference this variable directly as it might not have been
+initialized. Always use the command `mh-have-file-command'.")
 
 ;;;###mh-autoload
 (defun mh-have-file-command ()
   "Return t if 'file' command is on the system.
 'file -i' is used to get MIME type of composition insertion."
-  (when (not (boundp 'mh-have-file-command))
-    (load "executable" t t)        ; executable-find not autoloaded in emacs20
+  (when (eq mh-have-file-command 'undefined)
     (setq mh-have-file-command
           (and (fboundp 'executable-find)
                (executable-find "file") ; file command exists
@@ -183,9 +184,10 @@
 Returns nil if file command not on system."
   (cond
    ((not (mh-have-file-command))
-    nil)                                ;No file command, exit now.
-   ((not (and (file-exists-p filename)(file-readable-p filename)))
-    nil)
+    nil)                                ;no file command, exit now
+   ((not (and (file-exists-p filename)  
+              (file-readable-p filename))) 
+    nil)                               ;no file or not readable, ditto
    (t
     (save-excursion
       (let ((tmp-buffer (get-buffer-create mh-temp-buffer)))
@@ -200,36 +202,6 @@
                 (mh-file-mime-type-substitute (match-string 0) filename)))
           (kill-buffer tmp-buffer)))))))
 
-(defvar mh-mime-content-types
-  '(("application/mac-binhex40") ("application/msword")
-    ("application/octet-stream") ("application/pdf") ("application/pgp-keys")
-    ("application/pgp-signature") ("application/pkcs7-signature")
-    ("application/postscript") ("application/rtf")
-    ("application/vnd.ms-excel") ("application/vnd.ms-powerpoint")
-    ("application/vnd.ms-project") ("application/vnd.ms-tnef")
-    ("application/wordperfect5.1") ("application/wordperfect6.0")
-    ("application/zip")
-
-    ("audio/basic") ("audio/mpeg")
-
-    ("image/gif") ("image/jpeg") ("image/png")
-
-    ("message/delivery-status")
-    ("message/external-body") ("message/partial") ("message/rfc822")
-
-    ("text/enriched") ("text/html") ("text/plain") ("text/rfc822-headers")
-    ("text/richtext") ("text/x-vcard") ("text/xml")
-
-    ("video/mpeg") ("video/quicktime"))
-  "Valid MIME content types for Emacs 20.
-Obsolete; use `mailcap-mime-types'.
-
-See also \\[mh-mh-to-mime].")
-
-;; Delete mh-minibuffer-read-type and mh-mime-content-types and use
-;; mml-minibuffer-read-type when Emacs20 is no longer supported unless we
-;; think (mh-file-mime-type) is better than (mm-default-file-encoding).
-
 (defun mh-minibuffer-read-type (filename &optional default)
   "Return the content type associated with the given FILENAME.
 If the \"file\" command exists and recognizes the given file,
@@ -241,12 +213,12 @@
   (let* ((default (or default
                      (mm-default-file-encoding filename)
                      "application/octet-stream"))
-        (type (or (mh-file-mime-type filename)
+         (probed-type (mh-file-mime-type filename))
+        (type (or (and (not (equal probed-type "application/octet-stream"))
+                        probed-type)
                    (completing-read
                     (format "Content type (default %s): " default)
-                    (if (fboundp 'mailcap-mime-types)
-                        (mapcar 'list (mailcap-mime-types))
-                      mh-mime-content-types)))))
+                    (mapcar 'list (mailcap-mime-types))))))
     (if (not (equal type ""))
         type
       default)))
@@ -619,7 +591,7 @@
     (mml-insert-empty-tag 'part 'type type 'filename file
                           'disposition dispos 'description description)))
 
-(defvar mh-identity-pgg-default-user-id)
+(eval-when-compile (defvar mh-identity-pgg-default-user-id)) ;shush compiler
 
 (defun mh-secure-message (method mode &optional identity)
   "Add tag to encrypt or sign message.
@@ -969,8 +941,7 @@
                    (mh-mime-display-part handles))
                   (t (mh-signature-highlight))))
         (error
-         (message "Please report this error:\n %s"
-                  (error-message-string err))
+         (message "Could not display body: %s" (error-message-string err))
          (delete-region (point-min) (point-max))
          (insert raw-message-data))))))
 
@@ -1444,8 +1415,9 @@
 
 ;; These variables should already be initialized in mm-decode.el if we have a
 ;; recent enough Gnus. The defvars are here to avoid compiler warnings.
-(defvar mm-verify-function-alist nil)
-(defvar mm-decrypt-function-alist nil)
+(eval-when-compile
+  (defvar mm-verify-function-alist nil)
+  (defvar mm-decrypt-function-alist nil))
 
 (defvar pressed-details)
 
Index: emacs/lisp/mh-e/mh-seq.el
diff -u emacs/lisp/mh-e/mh-seq.el:1.21 emacs/lisp/mh-e/mh-seq.el:1.22
--- emacs/lisp/mh-e/mh-seq.el:1.21      Wed Jan  4 02:08:12 2006
+++ emacs/lisp/mh-e/mh-seq.el   Mon Jan  9 06:28:49 2006
@@ -73,10 +73,8 @@
 
 (eval-when-compile (require 'mh-acros))
 (mh-require-cl)
-(require 'mh-e)
 
-;; Shush the byte-compiler
-(defvar tool-bar-mode)
+(require 'mh-e)
 
 
 
@@ -171,8 +169,7 @@
     (when (and (eq sequence mh-unseen-seq) (mh-speed-flists-active-p))
       (apply #'mh-speed-flists t folders-changed))))
 
-;; Avoid compiler warnings
-(defvar view-exit-action)
+(eval-when-compile (defvar view-exit-action)) ;shush compiler
 
 ;;;###mh-autoload
 (defun mh-list-sequences ()
@@ -239,8 +236,10 @@
                         (mh-list-to-string (mh-seq-containing-msg message t))
                         " "))))
 
-;; Avoid compiler warning
-(defvar tool-bar-map)
+;; Shush compiler
+(eval-when-compile
+  (defvar tool-bar-map)
+  (defvar tool-bar-mode))
 
 (make-variable-buffer-local 'mh-non-seq-mode-line-annotation)
 
Index: emacs/lisp/mh-e/mh-utils.el
diff -u emacs/lisp/mh-e/mh-utils.el:1.31 emacs/lisp/mh-e/mh-utils.el:1.32
--- emacs/lisp/mh-e/mh-utils.el:1.31    Wed Jan  4 02:08:12 2006
+++ emacs/lisp/mh-e/mh-utils.el Mon Jan  9 06:28:49 2006
@@ -33,34 +33,29 @@
 
 ;;; Code:
 
-(defvar recursive-load-depth-limit)
 (eval-and-compile
+  (defvar recursive-load-depth-limit)
   (if (and (boundp 'recursive-load-depth-limit)
            (integerp recursive-load-depth-limit)
-           (> 50 recursive-load-depth-limit))
+           (< recursive-load-depth-limit 50))
       (setq recursive-load-depth-limit 50)))
 
 (eval-when-compile (require 'mh-acros))
 (mh-require-cl)
-(require 'gnus-util)
+
 (require 'font-lock)
-(require 'mouse)
-(load "tool-bar" t t)
-(require 'mh-loaddefs)
+(require 'gnus-util)
 (require 'mh-customize)
 (require 'mh-inc)
+(require 'mouse)
+(require 'sendmail)
 
-(load "mm-decode" t t)                  ; Non-fatal dependency
-(load "mm-view" t t)                    ; Non-fatal dependency
-(load "vcard" t t)                      ; Non-fatal dependency
-(load "hl-line" t t)                    ; Non-fatal dependency
-(load "executable" t t)                 ; Non-fatal dependency on
-                                        ; executable-find
-
-;; Shush the byte-compiler
-(defvar font-lock-auto-fontify)
-(defvar font-lock-defaults)
-(defvar mark-active)
+;; Non-fatal dependencies
+(load "hl-line" t t)
+(load "mm-decode" t t)
+(load "mm-view" t t)
+(load "tool-bar" t t)
+(load "vcard" t t)
 
 
 
@@ -69,7 +64,6 @@
 (autoload 'gnus-article-highlight-citation "gnus-cite")
 (autoload 'message-fetch-field "message")
 (autoload 'message-tokenize-header "message")
-(require 'sendmail)
 (unless (fboundp 'make-hash-table)
   (autoload 'make-hash-table "cl"))
 
@@ -471,11 +465,10 @@
 
 ;; Needed to help shush the byte-compiler.
 (if mh-xemacs-flag
-    (progn
-      (eval-and-compile
-        (require 'gnus)
-        (require 'gnus-art)
-        (require 'gnus-cite))))
+    (eval-and-compile
+      (require 'gnus)
+      (require 'gnus-art)
+      (require 'gnus-cite)))
 
 (defun mh-gnus-article-highlight-citation ()
   "Highlight cited text in current buffer using Gnus."
@@ -751,7 +744,6 @@
   (unlock-buffer)
   (setq buffer-file-name nil))
 
-
 (defun mh-get-msg-num (error-if-no-message)
   "Return the message number of the displayed message.
 If the argument ERROR-IF-NO-MESSAGE is non-nil, then complain if
@@ -1138,9 +1130,10 @@
 ;; Ensure new buffers won't get this mode if default-major-mode is nil.
 (put 'mh-show-mode 'mode-class 'special)
 
-;; Avoid compiler warnings in XEmacs and Emacs 20
+;; Shush compiler.
 (eval-when-compile
-  (defvar tool-bar-mode)
+  (defvar font-lock-auto-fontify)
+  (defvar font-lock-defaults)
   (defvar tool-bar-map))
 
 (define-derived-mode mh-show-mode text-mode "MH-Show"
@@ -1877,9 +1870,7 @@
   ;; XXX Note that MH-E no longer supports the `mh-visible-headers'
   ;; variable, so this function could be trimmed of this feature too."
   (let ((case-fold-search t)
-        (buffer-read-only nil)
-        (after-change-functions nil))   ;Work around emacs-20 font-lock bug
-                                        ;causing an endless loop.
+        (buffer-read-only nil))
     (save-restriction
       (goto-char start)
       (if (search-forward "\n\n" nil 'move)
@@ -2350,8 +2341,11 @@
       (remhash nil mh-sub-folders-cache))))
 
 (defvar mh-folder-hist nil)
-(defvar mh-speed-folder-map)
-(defvar mh-speed-flists-cache)
+
+;; Shush compiler.
+(eval-when-compile
+  (defvar mh-speed-folder-map)
+  (defvar mh-speed-flists-cache))
 
 (defvar mh-allow-root-folder-flag nil
   "Non-nil means \"+\" is an acceptable folder name.
@@ -2612,6 +2606,8 @@
     (mh-exec-cmd-quiet nil "mhparam" "-components" component)
     (mh-get-profile-field (concat component ":"))))
 
+(eval-when-compile (defvar mark-active)) ;shush compiler
+
 (defun mh-exchange-point-and-mark-preserving-active-mark ()
   "Put the mark where point is now, and point where the mark is now.
 This command works even when the mark is not active, and
@@ -2689,31 +2685,13 @@
     new-list))
 
 (defun mh-replace-string (old new)
-  "Replace all occurrences of OLD with NEW in the current buffer."
+  "Replace all occurrences of OLD with NEW in the current buffer.
+Ignores case when searching for OLD."
   (goto-char (point-min))
   (let ((case-fold-search t))
     (while (search-forward old nil t)
       (replace-match new t t))))
 
-(defun mh-replace-in-string (regexp newtext string)
-  "Replace REGEXP with NEWTEXT everywhere in STRING and return result.
-NEWTEXT is taken literally---no \\DIGIT escapes will be recognized.
-
-The function body was copied from `dired-replace-in-string' in
-dired.el.
-Emacs21 has `replace-regexp-in-string' while XEmacs has
-`replace-in-string'.
-Neither is present in Emacs20. The file gnus-util.el in Gnus 5.10.1
-and above has `gnus-replace-in-string'. We should use that when we
-decide to not support older versions of Gnus."
-  (let ((result "") (start 0) mb me)
-    (while (string-match regexp string start)
-      (setq mb (match-beginning 0)
-            me (match-end 0)
-            result (concat result (substring string start mb) newtext)
-            start me))
-    (concat result (substring string start))))
-
 (provide 'mh-utils)
 
 ;; Local Variables:




reply via email to

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