diff options
| author | Bill Wohler | 2006-01-16 21:34:50 +0000 |
|---|---|---|
| committer | Bill Wohler | 2006-01-16 21:34:50 +0000 |
| commit | 1e4db53b60d7c9326c98200e80de167527a9fe06 (patch) | |
| tree | 32962cd419323f226567e9fdad15a3d773148529 | |
| parent | 8d2aa2377562f6c8f77e4cfe65a1fb8f1ac78cb6 (diff) | |
| download | emacs-1e4db53b60d7c9326c98200e80de167527a9fe06.tar.gz emacs-1e4db53b60d7c9326c98200e80de167527a9fe06.zip | |
* mh-acros.el (require): Remove defadvice of require as defadvice is
verboten within Emacs and our implementation was returning the wrong
value from require. Upcoming restructuring should make this
unnecessary.
(mh-assoc-ignore-case): Replace with defsubst assoc-string.
* mh-alias.el (mh-alias-local-users, mh-alias-reload, mh-alias-expand,
mh-alias-minibuffer-confirm-address): Use it.
* mh-identity.el (mh-identity-field-handler): Use it.
| -rw-r--r-- | lisp/mh-e/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/mh-e/mh-acros.el | 36 | ||||
| -rw-r--r-- | lisp/mh-e/mh-alias.el | 16 | ||||
| -rw-r--r-- | lisp/mh-e/mh-identity.el | 2 |
4 files changed, 34 insertions, 31 deletions
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog index d31d3eebf99..59c15dadec9 100644 --- a/lisp/mh-e/ChangeLog +++ b/lisp/mh-e/ChangeLog | |||
| @@ -1,5 +1,16 @@ | |||
| 1 | 2006-01-16 Bill Wohler <wohler@newt.com> | 1 | 2006-01-16 Bill Wohler <wohler@newt.com> |
| 2 | 2 | ||
| 3 | * mh-acros.el (require): Remove defadvice of require as defadvice | ||
| 4 | is verboten within Emacs and our implementation was returning the | ||
| 5 | wrong value from require. Upcoming restructuring should make this | ||
| 6 | unnecessary. | ||
| 7 | (mh-assoc-ignore-case): Replace with defsubst assoc-string. | ||
| 8 | |||
| 9 | * mh-alias.el (mh-alias-local-users, mh-alias-reload, | ||
| 10 | mh-alias-expand, mh-alias-minibuffer-confirm-address): Use it. | ||
| 11 | |||
| 12 | * mh-identity.el (mh-identity-field-handler): Use it. | ||
| 13 | |||
| 3 | * mh-comp.el (mh-show-buffer-message-number): Replace (car | 14 | * mh-comp.el (mh-show-buffer-message-number): Replace (car |
| 4 | (read-from-string string) with (string-to-number string). | 15 | (read-from-string string) with (string-to-number string). |
| 5 | 16 | ||
diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el index e37705ea54f..de2a714fc77 100644 --- a/lisp/mh-e/mh-acros.el +++ b/lisp/mh-e/mh-acros.el | |||
| @@ -26,14 +26,14 @@ | |||
| 26 | 26 | ||
| 27 | ;;; Commentary: | 27 | ;;; Commentary: |
| 28 | 28 | ||
| 29 | ;; This file contains macros that would normally be in mh-utils.el except that | 29 | ;; This file contains most, if not all, macros. It is so named with a |
| 30 | ;; their presence there would cause a dependency loop with mh-customize.el. | 30 | ;; silent "m" so that it is compiled first. Otherwise, "make |
| 31 | ;; recompile" in CVS Emacs may use compiled files with stale macro | ||
| 32 | ;; definitions. | ||
| 33 | |||
| 31 | ;; This file must always be included like this: | 34 | ;; This file must always be included like this: |
| 32 | ;; | 35 | ;; |
| 33 | ;; (eval-when-compile (require 'mh-acros)) | 36 | ;; (eval-when-compile (require 'mh-acros)) |
| 34 | ;; | ||
| 35 | ;; It is so named with a silent "m" so that it is compiled first. Otherwise, | ||
| 36 | ;; "make recompile" in Emacs 21.4 fails. | ||
| 37 | 37 | ||
| 38 | ;;; Change Log: | 38 | ;;; Change Log: |
| 39 | 39 | ||
| @@ -150,23 +150,15 @@ more details." | |||
| 150 | (list 'nth ,x z))) | 150 | (list 'nth ,x z))) |
| 151 | (quote ,struct-name)))) | 151 | (quote ,struct-name)))) |
| 152 | 152 | ||
| 153 | ;; A better solution would be to use Stefan's change in bytecomp.el. | 153 | (unless (fboundp 'assoc-string) |
| 154 | ;; If it were checked in, we can drop the advice to require and it | 154 | (defsubst assoc-string (key list case-fold) |
| 155 | ;; will make things nicer elsewhere too. | 155 | "Like `assoc' but specifically for strings. |
| 156 | (defadvice require (around mh-prefer-el activate) | 156 | Case is ignored if CASE-FOLD is non-nil. |
| 157 | "Modify `require' to load uncompiled MH-E files." | 157 | This function added by MH-E for Emacs versions that lack |
| 158 | (or (featurep (ad-get-arg 0)) | 158 | `assoc-string', introduced in Emacs 22." |
| 159 | (and (string-match "^mh-" (symbol-name (ad-get-arg 0))) | 159 | (if case-fold |
| 160 | (load (format "%s.el" (ad-get-arg 0)) t t)) | 160 | (assoc-ignore-case key alist) |
| 161 | ad-do-it)) | 161 | (assoc key alist)))) |
| 162 | |||
| 163 | (defmacro mh-assoc-ignore-case (key alist) | ||
| 164 | "Check if KEY is present in ALIST while ignoring case to do the comparison. | ||
| 165 | Compatibility macro for Emacs versions that lack `assoc-string', | ||
| 166 | introduced in Emacs 22." | ||
| 167 | (if (fboundp 'assoc-string) | ||
| 168 | `(assoc-string ,key ,alist t) | ||
| 169 | `(assoc-ignore-case ,key ,alist))) | ||
| 170 | 162 | ||
| 171 | (provide 'mh-acros) | 163 | (provide 'mh-acros) |
| 172 | 164 | ||
diff --git a/lisp/mh-e/mh-alias.el b/lisp/mh-e/mh-alias.el index 399113e318d..081237b3b39 100644 --- a/lisp/mh-e/mh-alias.el +++ b/lisp/mh-e/mh-alias.el | |||
| @@ -179,7 +179,7 @@ Exclude all aliases already in `mh-alias-alist' from \"ali\"" | |||
| 179 | (if (string-equal username realname) | 179 | (if (string-equal username realname) |
| 180 | (concat "<" username ">") | 180 | (concat "<" username ">") |
| 181 | (concat realname " <" username ">")))) | 181 | (concat realname " <" username ">")))) |
| 182 | (when (not (mh-assoc-ignore-case alias-name mh-alias-alist)) | 182 | (when (not (assoc-string alias-name mh-alias-alist t)) |
| 183 | (setq passwd-alist (cons (list alias-name alias-translation) | 183 | (setq passwd-alist (cons (list alias-name alias-translation) |
| 184 | passwd-alist))))))) | 184 | passwd-alist))))))) |
| 185 | (forward-line 1))) | 185 | (forward-line 1))) |
| @@ -209,12 +209,12 @@ been loaded." | |||
| 209 | (cond | 209 | (cond |
| 210 | ((looking-at "^[ \t]")) ;Continuation line | 210 | ((looking-at "^[ \t]")) ;Continuation line |
| 211 | ((looking-at "\\(.+\\): .+: .*$") ; A new -blind- MH alias | 211 | ((looking-at "\\(.+\\): .+: .*$") ; A new -blind- MH alias |
| 212 | (when (not (mh-assoc-ignore-case (match-string 1) mh-alias-blind-alist)) | 212 | (when (not (assoc-string (match-string 1) mh-alias-blind-alist t)) |
| 213 | (setq mh-alias-blind-alist | 213 | (setq mh-alias-blind-alist |
| 214 | (cons (list (match-string 1)) mh-alias-blind-alist)) | 214 | (cons (list (match-string 1)) mh-alias-blind-alist)) |
| 215 | (setq mh-alias-alist (cons (list (match-string 1)) mh-alias-alist)))) | 215 | (setq mh-alias-alist (cons (list (match-string 1)) mh-alias-alist)))) |
| 216 | ((looking-at "\\(.+\\): .*$") ; A new MH alias | 216 | ((looking-at "\\(.+\\): .*$") ; A new MH alias |
| 217 | (when (not (mh-assoc-ignore-case (match-string 1) mh-alias-alist)) | 217 | (when (not (assoc-string (match-string 1) mh-alias-alist t)) |
| 218 | (setq mh-alias-alist | 218 | (setq mh-alias-alist |
| 219 | (cons (list (match-string 1)) mh-alias-alist))))) | 219 | (cons (list (match-string 1)) mh-alias-alist))))) |
| 220 | (forward-line 1))) | 220 | (forward-line 1))) |
| @@ -225,7 +225,7 @@ been loaded." | |||
| 225 | user) | 225 | user) |
| 226 | (while local-users | 226 | (while local-users |
| 227 | (setq user (car local-users)) | 227 | (setq user (car local-users)) |
| 228 | (if (not (mh-assoc-ignore-case (car user) mh-alias-alist)) | 228 | (if (not (assoc-string (car user) mh-alias-alist t)) |
| 229 | (setq mh-alias-alist (append mh-alias-alist (list user)))) | 229 | (setq mh-alias-alist (append mh-alias-alist (list user)))) |
| 230 | (setq local-users (cdr local-users))))) | 230 | (setq local-users (cdr local-users))))) |
| 231 | (run-hooks 'mh-alias-reloaded-hook) | 231 | (run-hooks 'mh-alias-reloaded-hook) |
| @@ -262,10 +262,10 @@ returns the string unchanged if not defined. The same is done here." | |||
| 262 | "Return expansion for ALIAS. | 262 | "Return expansion for ALIAS. |
| 263 | Blind aliases or users from /etc/passwd are not expanded." | 263 | Blind aliases or users from /etc/passwd are not expanded." |
| 264 | (cond | 264 | (cond |
| 265 | ((mh-assoc-ignore-case alias mh-alias-blind-alist) | 265 | ((assoc-string alias mh-alias-blind-alist t) |
| 266 | alias) ; Don't expand a blind alias | 266 | alias) ; Don't expand a blind alias |
| 267 | ((mh-assoc-ignore-case alias mh-alias-passwd-alist) | 267 | ((assoc-string alias mh-alias-passwd-alist t) |
| 268 | (cadr (mh-assoc-ignore-case alias mh-alias-passwd-alist))) | 268 | (cadr (assoc-string alias mh-alias-passwd-alist t))) |
| 269 | (t | 269 | (t |
| 270 | (mh-alias-ali alias)))) | 270 | (mh-alias-ali alias)))) |
| 271 | 271 | ||
| @@ -300,7 +300,7 @@ Blind aliases or users from /etc/passwd are not expanded." | |||
| 300 | (let* ((case-fold-search t) | 300 | (let* ((case-fold-search t) |
| 301 | (beg (mh-beginning-of-word)) | 301 | (beg (mh-beginning-of-word)) |
| 302 | (the-name (buffer-substring-no-properties beg (point)))) | 302 | (the-name (buffer-substring-no-properties beg (point)))) |
| 303 | (if (mh-assoc-ignore-case the-name mh-alias-alist) | 303 | (if (assoc-string the-name mh-alias-alist t) |
| 304 | (message "%s -> %s" the-name (mh-alias-expand the-name)) | 304 | (message "%s -> %s" the-name (mh-alias-expand the-name)) |
| 305 | ;; Check if if was a single word likely to be an alias | 305 | ;; Check if if was a single word likely to be an alias |
| 306 | (if (and (equal mh-alias-flash-on-comma 1) | 306 | (if (and (equal mh-alias-flash-on-comma 1) |
diff --git a/lisp/mh-e/mh-identity.el b/lisp/mh-e/mh-identity.el index 92467b783a9..cd6cff1daed 100644 --- a/lisp/mh-e/mh-identity.el +++ b/lisp/mh-e/mh-identity.el | |||
| @@ -127,7 +127,7 @@ The field name is downcased. If the FIELD begins with the | |||
| 127 | character \":\", then it must have a special handler defined in | 127 | character \":\", then it must have a special handler defined in |
| 128 | `mh-identity-handlers', else return an error since it is not a | 128 | `mh-identity-handlers', else return an error since it is not a |
| 129 | valid header field." | 129 | valid header field." |
| 130 | (or (cdr (mh-assoc-ignore-case field mh-identity-handlers)) | 130 | (or (cdr (assoc-string field mh-identity-handlers t)) |
| 131 | (and (eq (aref field 0) ?:) | 131 | (and (eq (aref field 0) ?:) |
| 132 | (error "Field %s not found in `mh-identity-handlers'" field)) | 132 | (error "Field %s not found in `mh-identity-handlers'" field)) |
| 133 | (cdr (assoc ":default" mh-identity-handlers)) | 133 | (cdr (assoc ":default" mh-identity-handlers)) |