Show
Ignore:
Timestamp:
05/27/06 10:35:24 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/subr.el

    r4085 r4091  
    13941394     nil)) 
    13951395 
     1396(defun load-history-regexp (file) 
     1397  "Form a regexp to find FILE in load-history. 
     1398FILE, a string, is described in eval-after-load's doc-string." 
     1399  (if (file-name-absolute-p file) 
     1400      (setq file (file-truename file))) 
     1401  (concat (if (file-name-absolute-p file) "\\`" "\\<") 
     1402          (regexp-quote file) 
     1403          (if (file-name-extension file) 
     1404              "" 
     1405            ;; Note: regexp-opt can't be used here, since we need to call 
     1406            ;; this before Emacs has been fully started.  2006-05-21 
     1407            (concat "\\(" (mapconcat 'regexp-quote load-suffixes "\\|") "\\)?")) 
     1408          "\\(" (mapconcat 'regexp-quote jka-compr-load-suffixes "\\|") 
     1409          "\\)?\\'")) 
     1410 
     1411(defun load-history-filename-element (file-regexp) 
     1412  "Get the first elt of load-history whose car matches FILE-REGEXP. 
     1413Return nil if there isn't one." 
     1414  (let* ((loads load-history) 
     1415         (load-elt (and loads (car loads)))) 
     1416    (save-match-data 
     1417      (while (and loads 
     1418                  (or (null (car load-elt)) 
     1419                      (not (string-match file-regexp (car load-elt))))) 
     1420        (setq loads (cdr loads) 
     1421              load-elt (and loads (car loads))))) 
     1422    load-elt)) 
     1423 
    13961424(defun eval-after-load (file form) 
    13971425  "Arrange that, if FILE is ever loaded, FORM will be run at that time. 
    1398 This makes or adds to an entry on `after-load-alist'. 
    13991426If FILE is already loaded, evaluate FORM right now. 
    1400 It does nothing if FORM is already on the list for FILE. 
    1401 FILE must match exactly.  Normally FILE is the name of a library, 
    1402 with no directory or extension specified, since that is how `load' 
    1403 is normally called. 
    1404 FILE can also be a feature (i.e. a symbol), in which case FORM is 
    1405 evaluated whenever that feature is `provide'd." 
    1406   (let ((elt (assoc file after-load-alist))) 
    1407     ;; Make sure there is an element for FILE. 
    1408     (unless elt (setq elt (list file)) (push elt after-load-alist)) 
    1409     ;; Add FORM to the element if it isn't there. 
     1427 
     1428If a matching file is loaded again, FORM will be evaluated again. 
     1429 
     1430If FILE is a string, it may be either an absolute or a relative file 
     1431name, and may have an extension \(e.g. \".el\") or may lack one, and 
     1432additionally may or may not have an extension denoting a compressed 
     1433format \(e.g. \".gz\"). 
     1434 
     1435When FILE is absolute, it is first converted to a true name by chasing 
     1436out symbolic links.  Only a file of this name \(see next paragraph for 
     1437extensions) will trigger the evaluation of FORM.  When FILE is relative, 
     1438a file whose absolute true name ends in FILE will trigger evaluation. 
     1439 
     1440When FILE lacks an extension, a file name with any extension will trigger 
     1441evaluation.  Otherwise, its extension must match FILE's.  A further 
     1442extension for a compressed format \(e.g. \".gz\") on FILE will not affect 
     1443this name matching. 
     1444 
     1445Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM 
     1446is evaluated whenever that feature is `provide'd. 
     1447 
     1448Usually FILE is just a library name like \"font-lock\" or a feature name 
     1449like 'font-lock. 
     1450 
     1451This function makes or adds to an entry on `after-load-alist'." 
     1452  ;; Add this FORM into after-load-alist (regardless of whether we'll be 
     1453  ;; evaluating it now). 
     1454  (let* ((regexp-or-feature 
     1455          (if (stringp file) (load-history-regexp file) file)) 
     1456         (elt (assoc regexp-or-feature after-load-alist))) 
     1457    (unless elt 
     1458      (setq elt (list regexp-or-feature)) 
     1459      (push elt after-load-alist)) 
     1460    ;; Add FORM to the element unless it's already there. 
    14101461    (unless (member form (cdr elt)) 
    1411       (nconc elt (list form)) 
    1412       ;; If the file has been loaded already, run FORM right away. 
    1413       (if (if (symbolp file) 
    1414               (featurep file) 
    1415             ;; Make sure `load-history' contains the files dumped with 
    1416             ;; Emacs for the case that FILE is one of them. 
    1417             ;; (load-symbol-file-load-history) 
    1418             (when (locate-library file) 
    1419               (assoc (locate-library file) load-history))) 
    1420           (eval form)))) 
    1421   form) 
     1462      (nconc elt (list form))) 
     1463 
     1464    ;; Is there an already loaded file whose name (or `provide' name) 
     1465    ;; matches FILE? 
     1466    (if (if (stringp file) 
     1467            (load-history-filename-element regexp-or-feature) 
     1468          (featurep file)) 
     1469        (eval form)))) 
     1470 
     1471(defun do-after-load-evaluation (abs-file) 
     1472  "Evaluate all `eval-after-load' forms, if any, for ABS-FILE. 
     1473ABS-FILE, a string, should be the absolute true name of a file just loaded." 
     1474  (let ((after-load-elts after-load-alist) 
     1475        a-l-element file-elements file-element form) 
     1476    (while after-load-elts 
     1477      (setq a-l-element (car after-load-elts) 
     1478            after-load-elts (cdr after-load-elts)) 
     1479      (when (and (stringp (car a-l-element)) 
     1480                 (string-match (car a-l-element) abs-file)) 
     1481        (while (setq a-l-element (cdr a-l-element)) ; discard the file name 
     1482          (setq form (car a-l-element)) 
     1483          (eval form)))))) 
    14221484 
    14231485(defun eval-next-after-load (file) 
     
    15561618The user ends with RET, LFD, or ESC.  DEL or C-h rubs out.  C-u kills line. 
    15571619C-g quits; if `inhibit-quit' was non-nil around this function, 
    1558 then it returns nil if the user types C-g
     1620then it returns nil if the user types C-g, but quit-flag remains set
    15591621 
    15601622Once the caller uses the password, it can erase the password 
     
    15761638          success) 
    15771639      (let ((pass nil) 
     1640            ;; Copy it so that add-text-properties won't modify 
     1641            ;; the object that was passed in by the caller. 
     1642            (prompt (copy-sequence prompt)) 
    15781643            (c 0) 
    15791644            (echo-keystrokes 0) 
     
    22512316  "Execute BODY, allowing quits to terminate BODY but not escape further. 
    22522317When a quit terminates BODY, `with-local-quit' returns nil but 
    2253 requests another quit.  That quit will be processed, the next time quitting 
    2254 is allowed once again.
     2318requests another quit.  That quit will be processed as soon as quitting 
     2319is allowed once again.  (Immediately, if `inhibit-quit' is nil.)
    22552320  (declare (debug t) (indent 0)) 
    22562321  `(condition-case nil 
    22572322       (let ((inhibit-quit nil)) 
    22582323         ,@body) 
    2259      (quit (setq quit-flag t) nil))) 
     2324     (quit (setq quit-flag t) 
     2325           ;; This call is to give a chance to handle quit-flag 
     2326           ;; in case inhibit-quit is nil. 
     2327           ;; Without this, it will not be handled until the next function 
     2328           ;; call, and that might allow it to exit thru a condition-case 
     2329           ;; that intends to handle the quit signal next time. 
     2330           (eval '(ignore nil))))) 
    22602331 
    22612332(defmacro while-no-input (&rest body)