diff options
| author | Glenn Morris | 2012-03-15 21:27:23 -0400 |
|---|---|---|
| committer | Glenn Morris | 2012-03-15 21:27:23 -0400 |
| commit | 0835f01e98aa01800565e727ff63a29099b0a0c0 (patch) | |
| tree | 7c2bbac0f369eab4e430bbea8ced5689f9f24b1b | |
| parent | c7e73d5177c6b51d8453830b6400090cc1a052df (diff) | |
| download | emacs-0835f01e98aa01800565e727ff63a29099b0a0c0.tar.gz emacs-0835f01e98aa01800565e727ff63a29099b0a0c0.zip | |
eval-after-load fix for bug#10946
* lisp/subr.el (eval-after-load): If named feature is provided not
from a file, run after-load forms.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/subr.el | 20 |
2 files changed, 15 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1e1f02f2cd7..7d9ccc95758 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2012-03-16 Glenn Morris <rgm@gnu.org> | 1 | 2012-03-16 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * subr.el (eval-after-load): If named feature is provided not from | ||
| 4 | a file, run after-load forms. (Bug#10946) | ||
| 5 | |||
| 3 | * calendar/calendar.el (calendar-insert-at-column): | 6 | * calendar/calendar.el (calendar-insert-at-column): |
| 4 | Handle non-unit-width characters a bit better. (Bug#10978) | 7 | Handle non-unit-width characters a bit better. (Bug#10978) |
| 5 | 8 | ||
diff --git a/lisp/subr.el b/lisp/subr.el index e0b099dd16b..514827f9615 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -1785,6 +1785,8 @@ this name matching. | |||
| 1785 | 1785 | ||
| 1786 | Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM | 1786 | Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM |
| 1787 | is evaluated at the end of any file that `provide's this feature. | 1787 | is evaluated at the end of any file that `provide's this feature. |
| 1788 | If the feature is provided when evaluating code not associated with a | ||
| 1789 | file, FORM is evaluated immediately after the provide statement. | ||
| 1788 | 1790 | ||
| 1789 | Usually FILE is just a library name like \"font-lock\" or a feature name | 1791 | Usually FILE is just a library name like \"font-lock\" or a feature name |
| 1790 | like 'font-lock. | 1792 | like 'font-lock. |
| @@ -1814,14 +1816,16 @@ This function makes or adds to an entry on `after-load-alist'." | |||
| 1814 | ;; make sure that `form' is really run "after-load" in case the provide | 1816 | ;; make sure that `form' is really run "after-load" in case the provide |
| 1815 | ;; call happens early. | 1817 | ;; call happens early. |
| 1816 | (setq form | 1818 | (setq form |
| 1817 | `(when load-file-name | 1819 | `(if load-file-name |
| 1818 | (let ((fun (make-symbol "eval-after-load-helper"))) | 1820 | (let ((fun (make-symbol "eval-after-load-helper"))) |
| 1819 | (fset fun `(lambda (file) | 1821 | (fset fun `(lambda (file) |
| 1820 | (if (not (equal file ',load-file-name)) | 1822 | (if (not (equal file ',load-file-name)) |
| 1821 | nil | 1823 | nil |
| 1822 | (remove-hook 'after-load-functions ',fun) | 1824 | (remove-hook 'after-load-functions ',fun) |
| 1823 | ,',form))) | 1825 | ,',form))) |
| 1824 | (add-hook 'after-load-functions fun))))) | 1826 | (add-hook 'after-load-functions fun)) |
| 1827 | ;; Not being provided from a file, run form right now. | ||
| 1828 | ,form))) | ||
| 1825 | ;; Add FORM to the element unless it's already there. | 1829 | ;; Add FORM to the element unless it's already there. |
| 1826 | (unless (member form (cdr elt)) | 1830 | (unless (member form (cdr elt)) |
| 1827 | (nconc elt (purecopy (list form))))))) | 1831 | (nconc elt (purecopy (list form))))))) |