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-identity.el mh-alias.el mh-a...


From: Bill Wohler
Subject: [Emacs-commit] emacs/lisp/mh-e mh-identity.el mh-alias.el mh-a...
Date: Mon, 16 Jan 2006 21:34:50 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         
Changes by:     Bill Wohler <address@hidden>    06/01/16 21:34:50

Modified files:
        lisp/mh-e      : mh-identity.el mh-alias.el mh-acros.el 
                         ChangeLog 

Log message:
        * 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.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-identity.el.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-alias.el.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-acros.el.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/ChangeLog.diff?tr1=1.121&tr2=1.122&r1=text&r2=text

Patches:
Index: emacs/lisp/mh-e/ChangeLog
diff -u emacs/lisp/mh-e/ChangeLog:1.121 emacs/lisp/mh-e/ChangeLog:1.122
--- emacs/lisp/mh-e/ChangeLog:1.121     Mon Jan 16 20:05:14 2006
+++ emacs/lisp/mh-e/ChangeLog   Mon Jan 16 21:34:50 2006
@@ -1,5 +1,16 @@
 2006-01-16  Bill Wohler  <address@hidden>
 
+       * 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.
+
        * mh-comp.el (mh-show-buffer-message-number): Replace (car
        (read-from-string string) with (string-to-number string).
 
Index: emacs/lisp/mh-e/mh-acros.el
diff -u emacs/lisp/mh-e/mh-acros.el:1.14 emacs/lisp/mh-e/mh-acros.el:1.15
--- emacs/lisp/mh-e/mh-acros.el:1.14    Sat Jan 14 02:10:11 2006
+++ emacs/lisp/mh-e/mh-acros.el Mon Jan 16 21:34:50 2006
@@ -26,14 +26,14 @@
 
 ;;; Commentary:
 
-;; This file contains macros that would normally be in mh-utils.el except that
-;; their presence there would cause a dependency loop with mh-customize.el.
+;; This file contains most, if not all, macros. It is so named with a
+;; silent "m" so that it is compiled first. Otherwise, "make
+;; recompile" in CVS Emacs may use compiled files with stale macro
+;; definitions.
+
 ;; This file must always be included like this:
 ;;
 ;;   (eval-when-compile (require 'mh-acros))
-;;
-;; It is so named with a silent "m" so that it is compiled first. Otherwise,
-;; "make recompile" in Emacs 21.4 fails.
 
 ;;; Change Log:
 
@@ -150,23 +150,15 @@
                           (list 'nth ,x z)))
        (quote ,struct-name))))
 
-;; A better solution would be to use Stefan's change in bytecomp.el.
-;; If it were checked in, we can drop the advice to require and it
-;; will make things nicer elsewhere too.
-(defadvice require (around mh-prefer-el activate)
-  "Modify `require' to load uncompiled MH-E files."
-  (or (featurep (ad-get-arg 0))
-      (and (string-match "^mh-" (symbol-name (ad-get-arg 0)))
-           (load (format "%s.el" (ad-get-arg 0)) t t))
-      ad-do-it))
-
-(defmacro mh-assoc-ignore-case (key alist)
-  "Check if KEY is present in ALIST while ignoring case to do the comparison.
-Compatibility macro for Emacs versions that lack `assoc-string',
-introduced in Emacs 22."
-  (if (fboundp 'assoc-string)
-      `(assoc-string ,key ,alist t)
-    `(assoc-ignore-case ,key ,alist)))
+(unless (fboundp 'assoc-string)
+  (defsubst assoc-string (key list case-fold)
+    "Like `assoc' but specifically for strings.
+Case is ignored if CASE-FOLD is non-nil.
+This function added by MH-E for Emacs versions that lack
+`assoc-string', introduced in Emacs 22."
+    (if case-fold
+        (assoc-ignore-case key alist)
+      (assoc key alist))))
 
 (provide 'mh-acros)
 
Index: emacs/lisp/mh-e/mh-alias.el
diff -u emacs/lisp/mh-e/mh-alias.el:1.24 emacs/lisp/mh-e/mh-alias.el:1.25
--- emacs/lisp/mh-e/mh-alias.el:1.24    Sun Jan 15 08:17:56 2006
+++ emacs/lisp/mh-e/mh-alias.el Mon Jan 16 21:34:50 2006
@@ -179,7 +179,7 @@
                     (if (string-equal username realname)
                         (concat "<" username ">")
                       (concat realname " <" username ">"))))
-              (when (not (mh-assoc-ignore-case alias-name mh-alias-alist))
+              (when (not (assoc-string alias-name mh-alias-alist t))
                 (setq passwd-alist (cons (list alias-name alias-translation)
                                          passwd-alist)))))))
         (forward-line 1)))
@@ -209,12 +209,12 @@
       (cond
        ((looking-at "^[ \t]"))          ;Continuation line
        ((looking-at "\\(.+\\): .+: .*$") ; A new -blind- MH alias
-        (when (not (mh-assoc-ignore-case (match-string 1) 
mh-alias-blind-alist))
+        (when (not (assoc-string (match-string 1) mh-alias-blind-alist t))
           (setq mh-alias-blind-alist
                 (cons (list (match-string 1)) mh-alias-blind-alist))
           (setq mh-alias-alist (cons (list (match-string 1)) mh-alias-alist))))
        ((looking-at "\\(.+\\): .*$")    ; A new MH alias
-        (when (not (mh-assoc-ignore-case (match-string 1) mh-alias-alist))
+        (when (not (assoc-string (match-string 1) mh-alias-alist t))
           (setq mh-alias-alist
                 (cons (list (match-string 1)) mh-alias-alist)))))
       (forward-line 1)))
@@ -225,7 +225,7 @@
           user)
       (while local-users
         (setq user (car local-users))
-        (if (not (mh-assoc-ignore-case (car user) mh-alias-alist))
+        (if (not (assoc-string (car user) mh-alias-alist t))
             (setq mh-alias-alist (append mh-alias-alist (list user))))
         (setq local-users (cdr local-users)))))
   (run-hooks 'mh-alias-reloaded-hook)
@@ -262,10 +262,10 @@
   "Return expansion for ALIAS.
 Blind aliases or users from /etc/passwd are not expanded."
   (cond
-   ((mh-assoc-ignore-case alias mh-alias-blind-alist)
+   ((assoc-string alias mh-alias-blind-alist t)
     alias)                              ; Don't expand a blind alias
-   ((mh-assoc-ignore-case alias mh-alias-passwd-alist)
-    (cadr (mh-assoc-ignore-case alias mh-alias-passwd-alist)))
+   ((assoc-string alias mh-alias-passwd-alist t)
+    (cadr (assoc-string alias mh-alias-passwd-alist t)))
    (t
     (mh-alias-ali alias))))
 
@@ -300,7 +300,7 @@
       (let* ((case-fold-search t)
              (beg (mh-beginning-of-word))
              (the-name (buffer-substring-no-properties beg (point))))
-        (if (mh-assoc-ignore-case the-name mh-alias-alist)
+        (if (assoc-string the-name mh-alias-alist t)
             (message "%s -> %s" the-name (mh-alias-expand the-name))
           ;; Check if if was a single word likely to be an alias
           (if (and (equal mh-alias-flash-on-comma 1)
Index: emacs/lisp/mh-e/mh-identity.el
diff -u emacs/lisp/mh-e/mh-identity.el:1.24 emacs/lisp/mh-e/mh-identity.el:1.25
--- emacs/lisp/mh-e/mh-identity.el:1.24 Sun Jan 15 08:17:55 2006
+++ emacs/lisp/mh-e/mh-identity.el      Mon Jan 16 21:34:50 2006
@@ -127,7 +127,7 @@
 character \":\", then it must have a special handler defined in
 `mh-identity-handlers', else return an error since it is not a
 valid header field."
-  (or (cdr (mh-assoc-ignore-case field mh-identity-handlers))
+  (or (cdr (assoc-string field mh-identity-handlers t))
       (and (eq (aref field 0) ?:)
            (error "Field %s not found in `mh-identity-handlers'" field))
       (cdr (assoc ":default" mh-identity-handlers))




reply via email to

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