aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2011-01-10 22:23:04 -0500
committerStefan Monnier2011-01-10 22:23:04 -0500
commit3fa173b4d90d8c9d629cb812b8923c4dd97ff9bd (patch)
treef15832158b4a6b632858b5c6db8112bed27cef99
parent7973bcea7f88d683965178b6dc57f53904b97413 (diff)
downloademacs-3fa173b4d90d8c9d629cb812b8923c4dd97ff9bd.tar.gz
emacs-3fa173b4d90d8c9d629cb812b8923c4dd97ff9bd.zip
* lisp/subr.el (eval-after-load): Fix timing for features.
(declare-function, undefined, insert-for-yank) (replace-regexp-in-string): Follow checkdoc's recommendations. * doc/lispref/loading.texi (Hooks for Loading): Adjust doc of eval-after-load. Fixes: debbugs:7769
-rw-r--r--doc/lispref/ChangeLog6
-rw-r--r--doc/lispref/loading.texi3
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/subr.el35
4 files changed, 37 insertions, 13 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 7307d7fab4f..6a51b3f506b 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,7 @@
12011-01-11 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * loading.texi (Hooks for Loading): Adjust doc of eval-after-load.
4
12011-01-02 Eli Zaretskii <eliz@gnu.org> 52011-01-02 Eli Zaretskii <eliz@gnu.org>
2 6
3 * modes.texi (Emulating Mode Line): Fix last change. 7 * modes.texi (Emulating Mode Line): Fix last change.
@@ -8884,7 +8888,7 @@
8884;; End: 8888;; End:
8885 8889
8886 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 8890 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
8887 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 8891 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
8888 8892
8889 This file is part of GNU Emacs. 8893 This file is part of GNU Emacs.
8890 8894
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index 05d836140c7..11bd48f8a01 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -962,7 +962,8 @@ example, @file{my_inst.elc} or @file{my_inst.elc.gz} in some directory
962@end example 962@end example
963 963
964@var{library} can also be a feature (i.e.@: a symbol), in which case 964@var{library} can also be a feature (i.e.@: a symbol), in which case
965@var{form} is evaluated when @code{(provide @var{library})} is called. 965@var{form} is evaluated at the end of any file where
966@code{(provide @var{library})} is called.
966 967
967An error in @var{form} does not undo the load, but does prevent 968An error in @var{form} does not undo the load, but does prevent
968execution of the rest of @var{form}. 969execution of the rest of @var{form}.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2b4079c0eb9..93716defcbc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12011-01-11 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * subr.el (eval-after-load): Fix timing for features (bug#7769).
4 (declare-function, undefined, insert-for-yank)
5 (replace-regexp-in-string): Follow checkdoc's recommendations.
6
12011-01-10 Stefan Monnier <monnier@iro.umontreal.ca> 72011-01-10 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * calendar/diary-lib.el (diary-mode): Refresh *Calendar* after 9 * calendar/diary-lib.el (diary-mode): Refresh *Calendar* after
diff --git a/lisp/subr.el b/lisp/subr.el
index 536e6c262bd..293d71b8915 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1,7 +1,7 @@
1;;; subr.el --- basic lisp subroutines for Emacs 1;;; subr.el --- basic lisp subroutines for Emacs
2 2
3;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1999, 2000, 2001, 2002, 2003, 3;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1999, 2000, 2001, 2002, 2003,
4;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 4;; 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
5;; Free Software Foundation, Inc. 5;; Free Software Foundation, Inc.
6 6
7;; Maintainer: FSF 7;; Maintainer: FSF
@@ -60,7 +60,7 @@ function-definitions that `check-declare' does not recognize, e.g.
60`defstruct'. 60`defstruct'.
61 61
62To specify a value for FILEONLY without passing an argument list, 62To specify a value for FILEONLY without passing an argument list,
63set ARGLIST to `t'. This is necessary because `nil' means an 63set ARGLIST to t. This is necessary because nil means an
64empty argument list, rather than an unspecified one. 64empty argument list, rather than an unspecified one.
65 65
66Note that for the purposes of `check-declare', this statement 66Note that for the purposes of `check-declare', this statement
@@ -483,6 +483,7 @@ saving keyboard macros (see `edmacro-mode')."
483 (read-kbd-macro keys)) 483 (read-kbd-macro keys))
484 484
485(defun undefined () 485(defun undefined ()
486 "Beep to tell the user this binding is undefined."
486 (interactive) 487 (interactive)
487 (ding)) 488 (ding))
488 489
@@ -1599,11 +1600,7 @@ extension for a compressed format \(e.g. \".gz\") on FILE will not affect
1599this name matching. 1600this name matching.
1600 1601
1601Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM 1602Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM
1602is evaluated whenever that feature is `provide'd. Note that although 1603is evaluated at the end of any file that `provide's this feature.
1603provide statements are usually at the end of files, this is not always
1604the case (e.g., sometimes they are at the start to avoid a recursive
1605load error). If your FORM should not be evaluated until the code in
1606FILE has been, do not use the symbol form for FILE in such cases.
1607 1604
1608Usually FILE is just a library name like \"font-lock\" or a feature name 1605Usually FILE is just a library name like \"font-lock\" or a feature name
1609like 'font-lock. 1606like 'font-lock.
@@ -1612,11 +1609,27 @@ This function makes or adds to an entry on `after-load-alist'."
1612 ;; Add this FORM into after-load-alist (regardless of whether we'll be 1609 ;; Add this FORM into after-load-alist (regardless of whether we'll be
1613 ;; evaluating it now). 1610 ;; evaluating it now).
1614 (let* ((regexp-or-feature 1611 (let* ((regexp-or-feature
1615 (if (stringp file) (setq file (purecopy (load-history-regexp file))) file)) 1612 (if (stringp file)
1613 (setq file (purecopy (load-history-regexp file)))
1614 file))
1616 (elt (assoc regexp-or-feature after-load-alist))) 1615 (elt (assoc regexp-or-feature after-load-alist)))
1617 (unless elt 1616 (unless elt
1618 (setq elt (list regexp-or-feature)) 1617 (setq elt (list regexp-or-feature))
1619 (push elt after-load-alist)) 1618 (push elt after-load-alist))
1619 (when (symbolp regexp-or-feature)
1620 ;; For features, the after-load-alist elements get run when `provide' is
1621 ;; called rather than at the end of the file. So add an indirection to
1622 ;; make sure that `form' is really run "after-load" in case the provide
1623 ;; call happens early.
1624 (setq form
1625 `(when load-file-name
1626 (let ((fun (make-symbol "eval-after-load-helper")))
1627 (fset fun `(lambda (file)
1628 (if (not (equal file ',load-file-name))
1629 nil
1630 (remove-hook 'after-load-functions ',fun)
1631 ,',form)))
1632 (add-hook 'after-load-functions fun)))))
1620 ;; Add FORM to the element unless it's already there. 1633 ;; Add FORM to the element unless it's already there.
1621 (unless (member form (cdr elt)) 1634 (unless (member form (cdr elt))
1622 (nconc elt (purecopy (list form)))) 1635 (nconc elt (purecopy (list form))))
@@ -1872,7 +1885,7 @@ This function echoes `.' for each character that the user types.
1872The user ends with RET, LFD, or ESC. DEL or C-h rubs out. 1885The user ends with RET, LFD, or ESC. DEL or C-h rubs out.
1873C-y yanks the current kill. C-u kills line. 1886C-y yanks the current kill. C-u kills line.
1874C-g quits; if `inhibit-quit' was non-nil around this function, 1887C-g quits; if `inhibit-quit' was non-nil around this function,
1875then it returns nil if the user types C-g, but quit-flag remains set. 1888then it returns nil if the user types C-g, but `quit-flag' remains set.
1876 1889
1877Once the caller uses the password, it can erase the password 1890Once the caller uses the password, it can erase the password
1878by doing (clear-string STRING)." 1891by doing (clear-string STRING)."
@@ -2496,7 +2509,7 @@ Replaces `category' properties with their defined properties."
2496(defvar yank-undo-function) 2509(defvar yank-undo-function)
2497 2510
2498(defun insert-for-yank (string) 2511(defun insert-for-yank (string)
2499 "Calls `insert-for-yank-1' repetitively for each `yank-handler' segment. 2512 "Call `insert-for-yank-1' repetitively for each `yank-handler' segment.
2500 2513
2501See `insert-for-yank-1' for more details." 2514See `insert-for-yank-1' for more details."
2502 (let (to) 2515 (let (to)
@@ -3180,7 +3193,7 @@ is non-nil, start replacements at that index in STRING.
3180REP is either a string used as the NEWTEXT arg of `replace-match' or a 3193REP is either a string used as the NEWTEXT arg of `replace-match' or a
3181function. If it is a function, it is called with the actual text of each 3194function. If it is a function, it is called with the actual text of each
3182match, and its value is used as the replacement text. When REP is called, 3195match, and its value is used as the replacement text. When REP is called,
3183the match-data are the result of matching REGEXP against a substring 3196the match data are the result of matching REGEXP against a substring
3184of STRING. 3197of STRING.
3185 3198
3186To replace only the first match (if any), make REGEXP match up to \\' 3199To replace only the first match (if any), make REGEXP match up to \\'