Commit 7094eefe authored by Bill Wohler's avatar Bill Wohler
Browse files

* 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.
parent e1b3b7a2
2006-01-08 Bill Wohler <wohler@newt.com>
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 <wohler@newt.com>
* mh-customize.el: Updated Faces documentation in header.
......
......@@ -132,10 +132,10 @@ COMMA-SEPARATOR is non-nil."
(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))
......
......@@ -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 @@ Prefix ARG means justify as well. This function enables
(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 @@ a copy of the draft."
(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 @@ doesn't exist there."
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.
......
......@@ -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 @@ message 200, then use the range \"200:200\"."
;;; 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 @@ Otherwise, set SYMBOL to VALUE."
"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 @@ Do not alter this variable directly. Instead, customize
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 @@ removed and entries from `mh-invisible-header-fields' are added."
(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 @@ See also `mh-clean-message-header-flag'."
(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>.
......
......@@ -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:
;; mh-e-users@lists.sourceforge.net
......@@ -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 @@ if it is available."
(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 @@ onward while the latter is used in previous versions and XEmacs."
''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 @@ perform the operation on all messages in that region.
(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 ()
......
......@@ -149,8 +149,7 @@ Display the results only if something went wrong."
(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 ()
......
......@@ -40,7 +40,7 @@
;;; Code:
(eval-when-compile (require 'mh-acros))
(mh-require-cl)
(require 'mh-comp)
(autoload 'mml-insert-tag "mml")
......
;;; 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 <psg@debian.org>
;; Maintainer: Bill Wohler <wohler@newt.com>
......@@ -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'."
......
......@@ -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
......
......@@ -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 @@ This assumes that a temporary buffer is setup."
(eval-when-compile (defvar image-load-path)) ;shush compiler
(defvar mh-image-load-path-called-flag nil)
;;;###mh-autoload
......@@ -328,6 +327,8 @@ there. Otherwise, the images directory is added to the
;;; 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.")
......
......@@ -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 @@ given a prefix argument. Normally default arguments to
"/[-.+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 @@ variable."
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 @@ Returns nil if file command not on system."
(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 @@ Optional argument DEFAULT is returned if a type isn't entered."
(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 @@ automatically."
(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 @@ parsed and then displayed."
(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 @@ Parameter EL is unused."
;; 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)
......
......@@ -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 @@ you want to delete the messages, use \"\\[universal-argument]
(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 @@ MESSAGE appears."
(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)
......
......@@ -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 @@ operation."
;; Needed to help shush the byte-compiler.
(if mh-xemacs-flag
(progn
(eval-and-compile
(require 'gnus)
(require 'gnus-art)