diff options
| author | Stefan Monnier | 2013-06-05 10:57:45 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-06-05 10:57:45 -0400 |
| commit | 781b4af61d662b0a67989776c9f281d7bd4b26ac (patch) | |
| tree | a3bebdb5907689109237f3ec62751a401069dc66 /lisp | |
| parent | 3ca0d0b437e006f7b83b92b2d4fe99eeafcb9adf (diff) | |
| download | emacs-781b4af61d662b0a67989776c9f281d7bd4b26ac.tar.gz emacs-781b4af61d662b0a67989776c9f281d7bd4b26ac.zip | |
* lisp/emacs-lisp/edebug.el (edebug-result): Move before first use.
* lisp/subr.el (load-history-regexp, load-history-filename-element)
(eval-after-load, after-load-functions, do-after-load-evaluation)
(eval-next-after-load, display-delayed-warnings)
(collapse-delayed-warnings, delayed-warnings-hook): Move after the
definition of save-match-data.
(overriding-local-map): Remove accidental obsolescence declaration.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 42 | ||||
| -rw-r--r-- | lisp/emacs-lisp/edebug.el | 5 | ||||
| -rw-r--r-- | lisp/subr.el | 338 |
3 files changed, 198 insertions, 187 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b82b07fa303..106d73ec206 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2013-06-05 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * subr.el (load-history-regexp, load-history-filename-element) | ||
| 4 | (eval-after-load, after-load-functions, do-after-load-evaluation) | ||
| 5 | (eval-next-after-load, display-delayed-warnings) | ||
| 6 | (collapse-delayed-warnings, delayed-warnings-hook): Move after the | ||
| 7 | definition of save-match-data. | ||
| 8 | (overriding-local-map): Remove accidental obsolescence declaration. | ||
| 9 | |||
| 10 | * emacs-lisp/edebug.el (edebug-result): Move before first use. | ||
| 11 | |||
| 1 | 2013-06-05 Teodor Zlatanov <tzz@lifelogs.com> | 12 | 2013-06-05 Teodor Zlatanov <tzz@lifelogs.com> |
| 2 | 13 | ||
| 3 | Generalize symbol prettify support to prog-mode and implement it | 14 | Generalize symbol prettify support to prog-mode and implement it |
| @@ -11,8 +22,8 @@ | |||
| 11 | (lisp--augmented-font-lock-keywords-2, lisp-mode-variables) | 22 | (lisp--augmented-font-lock-keywords-2, lisp-mode-variables) |
| 12 | (lisp--prettify-symbols-alist): Implement prettify of lambda. | 23 | (lisp--prettify-symbols-alist): Implement prettify of lambda. |
| 13 | * progmodes/cfengine.el (cfengine3--augmented-font-lock-keywords) | 24 | * progmodes/cfengine.el (cfengine3--augmented-font-lock-keywords) |
| 14 | (cfengine3--prettify-symbols-alist, cfengine3-mode): Implement | 25 | (cfengine3--prettify-symbols-alist, cfengine3-mode): |
| 15 | prettify of -> => :: strings. | 26 | Implement prettify of -> => :: strings. |
| 16 | * progmodes/perl-mode.el (perl-prettify-symbols) | 27 | * progmodes/perl-mode.el (perl-prettify-symbols) |
| 17 | (perl--font-lock-compose-symbol) | 28 | (perl--font-lock-compose-symbol) |
| 18 | (perl--font-lock-symbols-keywords): Move to prog-mode. | 29 | (perl--font-lock-symbols-keywords): Move to prog-mode. |
| @@ -21,8 +32,8 @@ | |||
| 21 | (perl-font-lock-keywords-2): Remove explicit prettify support. | 32 | (perl-font-lock-keywords-2): Remove explicit prettify support. |
| 22 | (perl--augmented-font-lock-keywords) | 33 | (perl--augmented-font-lock-keywords) |
| 23 | (perl--augmented-font-lock-keywords-1) | 34 | (perl--augmented-font-lock-keywords-1) |
| 24 | (perl--augmented-font-lock-keywords-2, perl-mode): Implement | 35 | (perl--augmented-font-lock-keywords-2, perl-mode): |
| 25 | prettify support. | 36 | Implement prettify support. |
| 26 | 37 | ||
| 27 | 2013-06-05 Leo Liu <sdl.web@gmail.com> | 38 | 2013-06-05 Leo Liu <sdl.web@gmail.com> |
| 28 | 39 | ||
| @@ -109,7 +120,7 @@ | |||
| 109 | 120 | ||
| 110 | * subr.el: (file-notify-handle-event): New defun. Replacing ... | 121 | * subr.el: (file-notify-handle-event): New defun. Replacing ... |
| 111 | (inotify-event-p, inotify-handle-event, w32notify-handle-event): | 122 | (inotify-event-p, inotify-handle-event, w32notify-handle-event): |
| 112 | Removed. | 123 | Remove. |
| 113 | 124 | ||
| 114 | 2013-06-03 Juri Linkov <juri@jurta.org> | 125 | 2013-06-03 Juri Linkov <juri@jurta.org> |
| 115 | 126 | ||
| @@ -135,8 +146,8 @@ | |||
| 135 | 146 | ||
| 136 | 2013-06-03 Tassilo Horn <tsdh@gnu.org> | 147 | 2013-06-03 Tassilo Horn <tsdh@gnu.org> |
| 137 | 148 | ||
| 138 | * eshell/em-term.el (eshell-term-initialize): Use | 149 | * eshell/em-term.el (eshell-term-initialize): |
| 139 | `cl-intersection' rather than `intersection'. | 150 | Use `cl-intersection' rather than `intersection'. |
| 140 | 151 | ||
| 141 | 2013-06-02 Xue Fuqiao <xfq.free@gmail.com> | 152 | 2013-06-02 Xue Fuqiao <xfq.free@gmail.com> |
| 142 | 153 | ||
| @@ -190,7 +201,7 @@ | |||
| 190 | (eieiomt-optimizing-obarray, eieiomt-install) | 201 | (eieiomt-optimizing-obarray, eieiomt-install) |
| 191 | (eieiomt-add, eieiomt-next, eieiomt-sym-optimize) | 202 | (eieiomt-add, eieiomt-next, eieiomt-sym-optimize) |
| 192 | (eieio-generic-form, eieio-defmethod, make-obsolete) | 203 | (eieio-generic-form, eieio-defmethod, make-obsolete) |
| 193 | (eieio-defgeneric, make-obsolete): Moved to eieio-core.el | 204 | (eieio-defgeneric, make-obsolete): Move to eieio-core.el |
| 194 | (defclass): Remove `eval-and-compile' from macro. | 205 | (defclass): Remove `eval-and-compile' from macro. |
| 195 | (call-next-method, shared-initialize): Instead of using | 206 | (call-next-method, shared-initialize): Instead of using |
| 196 | `scoped-class' variable, use new eieio--scoped-class, and | 207 | `scoped-class' variable, use new eieio--scoped-class, and |
| @@ -282,8 +293,8 @@ | |||
| 282 | 293 | ||
| 283 | 2013-05-31 Dmitry Gutov <dgutov@yandex.ru> | 294 | 2013-05-31 Dmitry Gutov <dgutov@yandex.ru> |
| 284 | 295 | ||
| 285 | * progmodes/ruby-mode.el (ruby-syntax-expansion-allowed-p): New | 296 | * progmodes/ruby-mode.el (ruby-syntax-expansion-allowed-p): |
| 286 | function, checks if point is inside a literal that allows | 297 | New function, checks if point is inside a literal that allows |
| 287 | expression expansion. | 298 | expression expansion. |
| 288 | (ruby-syntax-propertize-expansion): Use it. | 299 | (ruby-syntax-propertize-expansion): Use it. |
| 289 | (ruby-syntax-propertize-function): Bind `case-fold-search' to nil | 300 | (ruby-syntax-propertize-function): Bind `case-fold-search' to nil |
| @@ -394,7 +405,7 @@ | |||
| 394 | * emacs-lisp/trace.el (trace--read-args): Provide a default. | 405 | * emacs-lisp/trace.el (trace--read-args): Provide a default. |
| 395 | 406 | ||
| 396 | * emacs-lisp/lisp-mode.el (lisp-mode-shared-map): Inherit from | 407 | * emacs-lisp/lisp-mode.el (lisp-mode-shared-map): Inherit from |
| 397 | prog-mode-map. | 408 | prog-mode-map (bug#14504). |
| 398 | 409 | ||
| 399 | 2013-05-29 Leo Liu <sdl.web@gmail.com> | 410 | 2013-05-29 Leo Liu <sdl.web@gmail.com> |
| 400 | 411 | ||
| @@ -426,7 +437,7 @@ | |||
| 426 | 437 | ||
| 427 | 2013-05-28 Aidan Gauland <aidalgol@amuri.net> | 438 | 2013-05-28 Aidan Gauland <aidalgol@amuri.net> |
| 428 | 439 | ||
| 429 | * eshell/em-unix.el: Added -r option to cp | 440 | * eshell/em-unix.el: Add -r option to cp. |
| 430 | 441 | ||
| 431 | 2013-05-28 Glenn Morris <rgm@gnu.org> | 442 | 2013-05-28 Glenn Morris <rgm@gnu.org> |
| 432 | 443 | ||
| @@ -2178,9 +2189,9 @@ | |||
| 2178 | 2013-04-19 Masatake YAMATO <yamato@redhat.com> | 2189 | 2013-04-19 Masatake YAMATO <yamato@redhat.com> |
| 2179 | 2190 | ||
| 2180 | * progmodes/sh-script.el (sh-imenu-generic-expression): | 2191 | * progmodes/sh-script.el (sh-imenu-generic-expression): |
| 2181 | Handle function names with a single character. (Bug#14111) | 2192 | Handle function names with a single character. (Bug#14111) |
| 2182 | 2193 | ||
| 2183 | 2013-04-19 Dima Kogan <dima@secretsauce.net> (tiny change) | 2194 | 2013-04-19 Dima Kogan <dima@secretsauce.net> (tiny change) |
| 2184 | 2195 | ||
| 2185 | * progmodes/gud.el (gud-perldb-marker-filter): Understand position info | 2196 | * progmodes/gud.el (gud-perldb-marker-filter): Understand position info |
| 2186 | for subroutines defined in an eval (bug#14182). | 2197 | for subroutines defined in an eval (bug#14182). |
| @@ -2595,6 +2606,7 @@ | |||
| 2595 | * emacs-lisp/package.el (package-pinned-packages): New var. | 2606 | * emacs-lisp/package.el (package-pinned-packages): New var. |
| 2596 | (package--add-to-archive-contents): Obey it (bug#14118). | 2607 | (package--add-to-archive-contents): Obey it (bug#14118). |
| 2597 | 2608 | ||
| 2609 | |||
| 2598 | 2013-04-03 Alan Mackenzie <acm@muc.de> | 2610 | 2013-04-03 Alan Mackenzie <acm@muc.de> |
| 2599 | 2611 | ||
| 2600 | Handle `parse-partial-sexp' landing inside a comment opener (Bug#13244). | 2612 | Handle `parse-partial-sexp' landing inside a comment opener (Bug#13244). |
| @@ -3234,7 +3246,7 @@ | |||
| 3234 | 2013-03-08 Jambunathan K <kjambunathan@gmail.com> | 3246 | 2013-03-08 Jambunathan K <kjambunathan@gmail.com> |
| 3235 | 3247 | ||
| 3236 | * hi-lock.el (hi-lock-read-regexp-defaults-function): New var. | 3248 | * hi-lock.el (hi-lock-read-regexp-defaults-function): New var. |
| 3237 | (hi-lock-read-regexp-defaults): New defun. | 3249 | (hi-lock-read-regexp-defaults): New defun. |
| 3238 | (hi-lock-line-face-buffer, hi-lock-face-buffer) | 3250 | (hi-lock-line-face-buffer, hi-lock-face-buffer) |
| 3239 | (hi-lock-face-phrase-buffer): Propagate above change. | 3251 | (hi-lock-face-phrase-buffer): Propagate above change. |
| 3240 | Update docstring (bug#13892). | 3252 | Update docstring (bug#13892). |
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 867f079ce5f..319af588eac 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el | |||
| @@ -472,6 +472,8 @@ the option `edebug-all-forms'." | |||
| 472 | (or (fboundp 'edebug-original-eval-defun) | 472 | (or (fboundp 'edebug-original-eval-defun) |
| 473 | (defalias 'edebug-original-eval-defun (symbol-function 'eval-defun))) | 473 | (defalias 'edebug-original-eval-defun (symbol-function 'eval-defun))) |
| 474 | 474 | ||
| 475 | (defvar edebug-result) ; The result of the function call returned by body. | ||
| 476 | |||
| 475 | ;; We should somehow arrange to be able to do this | 477 | ;; We should somehow arrange to be able to do this |
| 476 | ;; without actually replacing the eval-defun command. | 478 | ;; without actually replacing the eval-defun command. |
| 477 | (defun edebug-eval-defun (edebug-it) | 479 | (defun edebug-eval-defun (edebug-it) |
| @@ -487,7 +489,7 @@ With a prefix argument, instrument the code for Edebug. | |||
| 487 | 489 | ||
| 488 | Setting option `edebug-all-defs' to a non-nil value reverses the meaning | 490 | Setting option `edebug-all-defs' to a non-nil value reverses the meaning |
| 489 | of the prefix argument. Code is then instrumented when this function is | 491 | of the prefix argument. Code is then instrumented when this function is |
| 490 | invoked without a prefix argument | 492 | invoked without a prefix argument. |
| 491 | 493 | ||
| 492 | If acting on a `defun' for FUNCTION, and the function was instrumented, | 494 | If acting on a `defun' for FUNCTION, and the function was instrumented, |
| 493 | `Edebug: FUNCTION' is printed in the minibuffer. If not instrumented, | 495 | `Edebug: FUNCTION' is printed in the minibuffer. If not instrumented, |
| @@ -2106,7 +2108,6 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 2106 | (defvar edebug-coverage) ; the coverage results of each expression of function. | 2108 | (defvar edebug-coverage) ; the coverage results of each expression of function. |
| 2107 | 2109 | ||
| 2108 | (defvar edebug-buffer) ; which buffer the function is in. | 2110 | (defvar edebug-buffer) ; which buffer the function is in. |
| 2109 | (defvar edebug-result) ; the result of the function call returned by body | ||
| 2110 | (defvar edebug-outside-executing-macro) | 2111 | (defvar edebug-outside-executing-macro) |
| 2111 | (defvar edebug-outside-defining-kbd-macro) | 2112 | (defvar edebug-outside-defining-kbd-macro) |
| 2112 | 2113 | ||
diff --git a/lisp/subr.el b/lisp/subr.el index 6d2f0161b1f..65943aea337 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -1261,8 +1261,6 @@ is converted into a string by expressing it in decimal." | |||
| 1261 | (make-obsolete-variable 'redisplay-end-trigger-functions 'jit-lock-register "23.1") | 1261 | (make-obsolete-variable 'redisplay-end-trigger-functions 'jit-lock-register "23.1") |
| 1262 | (make-obsolete-variable 'deferred-action-list 'post-command-hook "24.1") | 1262 | (make-obsolete-variable 'deferred-action-list 'post-command-hook "24.1") |
| 1263 | (make-obsolete-variable 'deferred-action-function 'post-command-hook "24.1") | 1263 | (make-obsolete-variable 'deferred-action-function 'post-command-hook "24.1") |
| 1264 | (make-obsolete-variable 'overriding-local-map | ||
| 1265 | 'overriding-terminal-local-map "24.4" 'set) | ||
| 1266 | (make-obsolete 'window-redisplay-end-trigger nil "23.1") | 1264 | (make-obsolete 'window-redisplay-end-trigger nil "23.1") |
| 1267 | (make-obsolete 'set-window-redisplay-end-trigger nil "23.1") | 1265 | (make-obsolete 'set-window-redisplay-end-trigger nil "23.1") |
| 1268 | 1266 | ||
| @@ -1749,7 +1747,7 @@ If TOGGLE has a `:menu-tag', that is used for the menu item's label." | |||
| 1749 | (nconc found (list (cons toggle keymap)) rest)) | 1747 | (nconc found (list (cons toggle keymap)) rest)) |
| 1750 | (push (cons toggle keymap) minor-mode-map-alist))))))) | 1748 | (push (cons toggle keymap) minor-mode-map-alist))))))) |
| 1751 | 1749 | ||
| 1752 | ;;; Load history | 1750 | ;;;; Load history |
| 1753 | 1751 | ||
| 1754 | (defsubst autoloadp (object) | 1752 | (defsubst autoloadp (object) |
| 1755 | "Non-nil if OBJECT is an autoload." | 1753 | "Non-nil if OBJECT is an autoload." |
| @@ -1832,173 +1830,6 @@ and the file name is displayed in the echo area." | |||
| 1832 | file)) | 1830 | file)) |
| 1833 | 1831 | ||
| 1834 | 1832 | ||
| 1835 | ;;;; Specifying things to do later. | ||
| 1836 | |||
| 1837 | (defun load-history-regexp (file) | ||
| 1838 | "Form a regexp to find FILE in `load-history'. | ||
| 1839 | FILE, a string, is described in the function `eval-after-load'." | ||
| 1840 | (if (file-name-absolute-p file) | ||
| 1841 | (setq file (file-truename file))) | ||
| 1842 | (concat (if (file-name-absolute-p file) "\\`" "\\(\\`\\|/\\)") | ||
| 1843 | (regexp-quote file) | ||
| 1844 | (if (file-name-extension file) | ||
| 1845 | "" | ||
| 1846 | ;; Note: regexp-opt can't be used here, since we need to call | ||
| 1847 | ;; this before Emacs has been fully started. 2006-05-21 | ||
| 1848 | (concat "\\(" (mapconcat 'regexp-quote load-suffixes "\\|") "\\)?")) | ||
| 1849 | "\\(" (mapconcat 'regexp-quote jka-compr-load-suffixes "\\|") | ||
| 1850 | "\\)?\\'")) | ||
| 1851 | |||
| 1852 | (defun load-history-filename-element (file-regexp) | ||
| 1853 | "Get the first elt of `load-history' whose car matches FILE-REGEXP. | ||
| 1854 | Return nil if there isn't one." | ||
| 1855 | (let* ((loads load-history) | ||
| 1856 | (load-elt (and loads (car loads)))) | ||
| 1857 | (save-match-data | ||
| 1858 | (while (and loads | ||
| 1859 | (or (null (car load-elt)) | ||
| 1860 | (not (string-match file-regexp (car load-elt))))) | ||
| 1861 | (setq loads (cdr loads) | ||
| 1862 | load-elt (and loads (car loads))))) | ||
| 1863 | load-elt)) | ||
| 1864 | |||
| 1865 | (put 'eval-after-load 'lisp-indent-function 1) | ||
| 1866 | (defun eval-after-load (file form) | ||
| 1867 | "Arrange that if FILE is loaded, FORM will be run immediately afterwards. | ||
| 1868 | If FILE is already loaded, evaluate FORM right now. | ||
| 1869 | |||
| 1870 | If a matching file is loaded again, FORM will be evaluated again. | ||
| 1871 | |||
| 1872 | If FILE is a string, it may be either an absolute or a relative file | ||
| 1873 | name, and may have an extension \(e.g. \".el\") or may lack one, and | ||
| 1874 | additionally may or may not have an extension denoting a compressed | ||
| 1875 | format \(e.g. \".gz\"). | ||
| 1876 | |||
| 1877 | When FILE is absolute, this first converts it to a true name by chasing | ||
| 1878 | symbolic links. Only a file of this name \(see next paragraph regarding | ||
| 1879 | extensions) will trigger the evaluation of FORM. When FILE is relative, | ||
| 1880 | a file whose absolute true name ends in FILE will trigger evaluation. | ||
| 1881 | |||
| 1882 | When FILE lacks an extension, a file name with any extension will trigger | ||
| 1883 | evaluation. Otherwise, its extension must match FILE's. A further | ||
| 1884 | extension for a compressed format \(e.g. \".gz\") on FILE will not affect | ||
| 1885 | this name matching. | ||
| 1886 | |||
| 1887 | Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM | ||
| 1888 | is evaluated at the end of any file that `provide's this feature. | ||
| 1889 | If the feature is provided when evaluating code not associated with a | ||
| 1890 | file, FORM is evaluated immediately after the provide statement. | ||
| 1891 | |||
| 1892 | Usually FILE is just a library name like \"font-lock\" or a feature name | ||
| 1893 | like 'font-lock. | ||
| 1894 | |||
| 1895 | This function makes or adds to an entry on `after-load-alist'." | ||
| 1896 | ;; Add this FORM into after-load-alist (regardless of whether we'll be | ||
| 1897 | ;; evaluating it now). | ||
| 1898 | (let* ((regexp-or-feature | ||
| 1899 | (if (stringp file) | ||
| 1900 | (setq file (purecopy (load-history-regexp file))) | ||
| 1901 | file)) | ||
| 1902 | (elt (assoc regexp-or-feature after-load-alist))) | ||
| 1903 | (unless elt | ||
| 1904 | (setq elt (list regexp-or-feature)) | ||
| 1905 | (push elt after-load-alist)) | ||
| 1906 | ;; Make sure `form' is evalled in the current lexical/dynamic code. | ||
| 1907 | (setq form `(funcall ',(eval `(lambda () ,form) lexical-binding))) | ||
| 1908 | ;; Is there an already loaded file whose name (or `provide' name) | ||
| 1909 | ;; matches FILE? | ||
| 1910 | (prog1 (if (if (stringp file) | ||
| 1911 | (load-history-filename-element regexp-or-feature) | ||
| 1912 | (featurep file)) | ||
| 1913 | (eval form)) | ||
| 1914 | (when (symbolp regexp-or-feature) | ||
| 1915 | ;; For features, the after-load-alist elements get run when `provide' is | ||
| 1916 | ;; called rather than at the end of the file. So add an indirection to | ||
| 1917 | ;; make sure that `form' is really run "after-load" in case the provide | ||
| 1918 | ;; call happens early. | ||
| 1919 | (setq form | ||
| 1920 | `(if load-file-name | ||
| 1921 | (let ((fun (make-symbol "eval-after-load-helper"))) | ||
| 1922 | (fset fun `(lambda (file) | ||
| 1923 | (if (not (equal file ',load-file-name)) | ||
| 1924 | nil | ||
| 1925 | (remove-hook 'after-load-functions ',fun) | ||
| 1926 | ,',form))) | ||
| 1927 | (add-hook 'after-load-functions fun)) | ||
| 1928 | ;; Not being provided from a file, run form right now. | ||
| 1929 | ,form))) | ||
| 1930 | ;; Add FORM to the element unless it's already there. | ||
| 1931 | (unless (member form (cdr elt)) | ||
| 1932 | (nconc elt (list form)))))) | ||
| 1933 | |||
| 1934 | (defvar after-load-functions nil | ||
| 1935 | "Special hook run after loading a file. | ||
| 1936 | Each function there is called with a single argument, the absolute | ||
| 1937 | name of the file just loaded.") | ||
| 1938 | |||
| 1939 | (defun do-after-load-evaluation (abs-file) | ||
| 1940 | "Evaluate all `eval-after-load' forms, if any, for ABS-FILE. | ||
| 1941 | ABS-FILE, a string, should be the absolute true name of a file just loaded. | ||
| 1942 | This function is called directly from the C code." | ||
| 1943 | ;; Run the relevant eval-after-load forms. | ||
| 1944 | (mapc #'(lambda (a-l-element) | ||
| 1945 | (when (and (stringp (car a-l-element)) | ||
| 1946 | (string-match-p (car a-l-element) abs-file)) | ||
| 1947 | ;; discard the file name regexp | ||
| 1948 | (mapc #'eval (cdr a-l-element)))) | ||
| 1949 | after-load-alist) | ||
| 1950 | ;; Complain when the user uses obsolete files. | ||
| 1951 | (when (string-match-p "/obsolete/[^/]*\\'" abs-file) | ||
| 1952 | (run-with-timer 0 nil | ||
| 1953 | (lambda (file) | ||
| 1954 | (message "Package %s is obsolete!" | ||
| 1955 | (substring file 0 | ||
| 1956 | (string-match "\\.elc?\\>" file)))) | ||
| 1957 | (file-name-nondirectory abs-file))) | ||
| 1958 | ;; Finally, run any other hook. | ||
| 1959 | (run-hook-with-args 'after-load-functions abs-file)) | ||
| 1960 | |||
| 1961 | (defun eval-next-after-load (file) | ||
| 1962 | "Read the following input sexp, and run it whenever FILE is loaded. | ||
| 1963 | This makes or adds to an entry on `after-load-alist'. | ||
| 1964 | FILE should be the name of a library, with no directory name." | ||
| 1965 | (declare (obsolete eval-after-load "23.2")) | ||
| 1966 | (eval-after-load file (read))) | ||
| 1967 | |||
| 1968 | (defun display-delayed-warnings () | ||
| 1969 | "Display delayed warnings from `delayed-warnings-list'. | ||
| 1970 | Used from `delayed-warnings-hook' (which see)." | ||
| 1971 | (dolist (warning (nreverse delayed-warnings-list)) | ||
| 1972 | (apply 'display-warning warning)) | ||
| 1973 | (setq delayed-warnings-list nil)) | ||
| 1974 | |||
| 1975 | (defun collapse-delayed-warnings () | ||
| 1976 | "Remove duplicates from `delayed-warnings-list'. | ||
| 1977 | Collapse identical adjacent warnings into one (plus count). | ||
| 1978 | Used from `delayed-warnings-hook' (which see)." | ||
| 1979 | (let ((count 1) | ||
| 1980 | collapsed warning) | ||
| 1981 | (while delayed-warnings-list | ||
| 1982 | (setq warning (pop delayed-warnings-list)) | ||
| 1983 | (if (equal warning (car delayed-warnings-list)) | ||
| 1984 | (setq count (1+ count)) | ||
| 1985 | (when (> count 1) | ||
| 1986 | (setcdr warning (cons (format "%s [%d times]" (cadr warning) count) | ||
| 1987 | (cddr warning))) | ||
| 1988 | (setq count 1)) | ||
| 1989 | (push warning collapsed))) | ||
| 1990 | (setq delayed-warnings-list (nreverse collapsed)))) | ||
| 1991 | |||
| 1992 | ;; At present this is only used for Emacs internals. | ||
| 1993 | ;; Ref http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00085.html | ||
| 1994 | (defvar delayed-warnings-hook '(collapse-delayed-warnings | ||
| 1995 | display-delayed-warnings) | ||
| 1996 | "Normal hook run to process and display delayed warnings. | ||
| 1997 | By default, this hook contains functions to consolidate the | ||
| 1998 | warnings listed in `delayed-warnings-list', display them, and set | ||
| 1999 | `delayed-warnings-list' back to nil.") | ||
| 2000 | |||
| 2001 | |||
| 2002 | ;;;; Process stuff. | 1833 | ;;;; Process stuff. |
| 2003 | 1834 | ||
| 2004 | (defun process-lines (program &rest args) | 1835 | (defun process-lines (program &rest args) |
| @@ -3864,6 +3695,173 @@ consisting of STR followed by an invisible left-to-right mark | |||
| 3864 | (concat str (propertize (string ?\x200e) 'invisible t)) | 3695 | (concat str (propertize (string ?\x200e) 'invisible t)) |
| 3865 | str)) | 3696 | str)) |
| 3866 | 3697 | ||
| 3698 | ;;;; Specifying things to do later. | ||
| 3699 | |||
| 3700 | (defun load-history-regexp (file) | ||
| 3701 | "Form a regexp to find FILE in `load-history'. | ||
| 3702 | FILE, a string, is described in the function `eval-after-load'." | ||
| 3703 | (if (file-name-absolute-p file) | ||
| 3704 | (setq file (file-truename file))) | ||
| 3705 | (concat (if (file-name-absolute-p file) "\\`" "\\(\\`\\|/\\)") | ||
| 3706 | (regexp-quote file) | ||
| 3707 | (if (file-name-extension file) | ||
| 3708 | "" | ||
| 3709 | ;; Note: regexp-opt can't be used here, since we need to call | ||
| 3710 | ;; this before Emacs has been fully started. 2006-05-21 | ||
| 3711 | (concat "\\(" (mapconcat 'regexp-quote load-suffixes "\\|") "\\)?")) | ||
| 3712 | "\\(" (mapconcat 'regexp-quote jka-compr-load-suffixes "\\|") | ||
| 3713 | "\\)?\\'")) | ||
| 3714 | |||
| 3715 | (defun load-history-filename-element (file-regexp) | ||
| 3716 | "Get the first elt of `load-history' whose car matches FILE-REGEXP. | ||
| 3717 | Return nil if there isn't one." | ||
| 3718 | (let* ((loads load-history) | ||
| 3719 | (load-elt (and loads (car loads)))) | ||
| 3720 | (save-match-data | ||
| 3721 | (while (and loads | ||
| 3722 | (or (null (car load-elt)) | ||
| 3723 | (not (string-match file-regexp (car load-elt))))) | ||
| 3724 | (setq loads (cdr loads) | ||
| 3725 | load-elt (and loads (car loads))))) | ||
| 3726 | load-elt)) | ||
| 3727 | |||
| 3728 | (put 'eval-after-load 'lisp-indent-function 1) | ||
| 3729 | (defun eval-after-load (file form) | ||
| 3730 | "Arrange that if FILE is loaded, FORM will be run immediately afterwards. | ||
| 3731 | If FILE is already loaded, evaluate FORM right now. | ||
| 3732 | |||
| 3733 | If a matching file is loaded again, FORM will be evaluated again. | ||
| 3734 | |||
| 3735 | If FILE is a string, it may be either an absolute or a relative file | ||
| 3736 | name, and may have an extension \(e.g. \".el\") or may lack one, and | ||
| 3737 | additionally may or may not have an extension denoting a compressed | ||
| 3738 | format \(e.g. \".gz\"). | ||
| 3739 | |||
| 3740 | When FILE is absolute, this first converts it to a true name by chasing | ||
| 3741 | symbolic links. Only a file of this name \(see next paragraph regarding | ||
| 3742 | extensions) will trigger the evaluation of FORM. When FILE is relative, | ||
| 3743 | a file whose absolute true name ends in FILE will trigger evaluation. | ||
| 3744 | |||
| 3745 | When FILE lacks an extension, a file name with any extension will trigger | ||
| 3746 | evaluation. Otherwise, its extension must match FILE's. A further | ||
| 3747 | extension for a compressed format \(e.g. \".gz\") on FILE will not affect | ||
| 3748 | this name matching. | ||
| 3749 | |||
| 3750 | Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM | ||
| 3751 | is evaluated at the end of any file that `provide's this feature. | ||
| 3752 | If the feature is provided when evaluating code not associated with a | ||
| 3753 | file, FORM is evaluated immediately after the provide statement. | ||
| 3754 | |||
| 3755 | Usually FILE is just a library name like \"font-lock\" or a feature name | ||
| 3756 | like 'font-lock. | ||
| 3757 | |||
| 3758 | This function makes or adds to an entry on `after-load-alist'." | ||
| 3759 | ;; Add this FORM into after-load-alist (regardless of whether we'll be | ||
| 3760 | ;; evaluating it now). | ||
| 3761 | (let* ((regexp-or-feature | ||
| 3762 | (if (stringp file) | ||
| 3763 | (setq file (purecopy (load-history-regexp file))) | ||
| 3764 | file)) | ||
| 3765 | (elt (assoc regexp-or-feature after-load-alist))) | ||
| 3766 | (unless elt | ||
| 3767 | (setq elt (list regexp-or-feature)) | ||
| 3768 | (push elt after-load-alist)) | ||
| 3769 | ;; Make sure `form' is evalled in the current lexical/dynamic code. | ||
| 3770 | (setq form `(funcall ',(eval `(lambda () ,form) lexical-binding))) | ||
| 3771 | ;; Is there an already loaded file whose name (or `provide' name) | ||
| 3772 | ;; matches FILE? | ||
| 3773 | (prog1 (if (if (stringp file) | ||
| 3774 | (load-history-filename-element regexp-or-feature) | ||
| 3775 | (featurep file)) | ||
| 3776 | (eval form)) | ||
| 3777 | (when (symbolp regexp-or-feature) | ||
| 3778 | ;; For features, the after-load-alist elements get run when `provide' is | ||
| 3779 | ;; called rather than at the end of the file. So add an indirection to | ||
| 3780 | ;; make sure that `form' is really run "after-load" in case the provide | ||
| 3781 | ;; call happens early. | ||
| 3782 | (setq form | ||
| 3783 | `(if load-file-name | ||
| 3784 | (let ((fun (make-symbol "eval-after-load-helper"))) | ||
| 3785 | (fset fun `(lambda (file) | ||
| 3786 | (if (not (equal file ',load-file-name)) | ||
| 3787 | nil | ||
| 3788 | (remove-hook 'after-load-functions ',fun) | ||
| 3789 | ,',form))) | ||
| 3790 | (add-hook 'after-load-functions fun)) | ||
| 3791 | ;; Not being provided from a file, run form right now. | ||
| 3792 | ,form))) | ||
| 3793 | ;; Add FORM to the element unless it's already there. | ||
| 3794 | (unless (member form (cdr elt)) | ||
| 3795 | (nconc elt (list form)))))) | ||
| 3796 | |||
| 3797 | (defvar after-load-functions nil | ||
| 3798 | "Special hook run after loading a file. | ||
| 3799 | Each function there is called with a single argument, the absolute | ||
| 3800 | name of the file just loaded.") | ||
| 3801 | |||
| 3802 | (defun do-after-load-evaluation (abs-file) | ||
| 3803 | "Evaluate all `eval-after-load' forms, if any, for ABS-FILE. | ||
| 3804 | ABS-FILE, a string, should be the absolute true name of a file just loaded. | ||
| 3805 | This function is called directly from the C code." | ||
| 3806 | ;; Run the relevant eval-after-load forms. | ||
| 3807 | (mapc #'(lambda (a-l-element) | ||
| 3808 | (when (and (stringp (car a-l-element)) | ||
| 3809 | (string-match-p (car a-l-element) abs-file)) | ||
| 3810 | ;; discard the file name regexp | ||
| 3811 | (mapc #'eval (cdr a-l-element)))) | ||
| 3812 | after-load-alist) | ||
| 3813 | ;; Complain when the user uses obsolete files. | ||
| 3814 | (when (string-match-p "/obsolete/[^/]*\\'" abs-file) | ||
| 3815 | (run-with-timer 0 nil | ||
| 3816 | (lambda (file) | ||
| 3817 | (message "Package %s is obsolete!" | ||
| 3818 | (substring file 0 | ||
| 3819 | (string-match "\\.elc?\\>" file)))) | ||
| 3820 | (file-name-nondirectory abs-file))) | ||
| 3821 | ;; Finally, run any other hook. | ||
| 3822 | (run-hook-with-args 'after-load-functions abs-file)) | ||
| 3823 | |||
| 3824 | (defun eval-next-after-load (file) | ||
| 3825 | "Read the following input sexp, and run it whenever FILE is loaded. | ||
| 3826 | This makes or adds to an entry on `after-load-alist'. | ||
| 3827 | FILE should be the name of a library, with no directory name." | ||
| 3828 | (declare (obsolete eval-after-load "23.2")) | ||
| 3829 | (eval-after-load file (read))) | ||
| 3830 | |||
| 3831 | (defun display-delayed-warnings () | ||
| 3832 | "Display delayed warnings from `delayed-warnings-list'. | ||
| 3833 | Used from `delayed-warnings-hook' (which see)." | ||
| 3834 | (dolist (warning (nreverse delayed-warnings-list)) | ||
| 3835 | (apply 'display-warning warning)) | ||
| 3836 | (setq delayed-warnings-list nil)) | ||
| 3837 | |||
| 3838 | (defun collapse-delayed-warnings () | ||
| 3839 | "Remove duplicates from `delayed-warnings-list'. | ||
| 3840 | Collapse identical adjacent warnings into one (plus count). | ||
| 3841 | Used from `delayed-warnings-hook' (which see)." | ||
| 3842 | (let ((count 1) | ||
| 3843 | collapsed warning) | ||
| 3844 | (while delayed-warnings-list | ||
| 3845 | (setq warning (pop delayed-warnings-list)) | ||
| 3846 | (if (equal warning (car delayed-warnings-list)) | ||
| 3847 | (setq count (1+ count)) | ||
| 3848 | (when (> count 1) | ||
| 3849 | (setcdr warning (cons (format "%s [%d times]" (cadr warning) count) | ||
| 3850 | (cddr warning))) | ||
| 3851 | (setq count 1)) | ||
| 3852 | (push warning collapsed))) | ||
| 3853 | (setq delayed-warnings-list (nreverse collapsed)))) | ||
| 3854 | |||
| 3855 | ;; At present this is only used for Emacs internals. | ||
| 3856 | ;; Ref http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00085.html | ||
| 3857 | (defvar delayed-warnings-hook '(collapse-delayed-warnings | ||
| 3858 | display-delayed-warnings) | ||
| 3859 | "Normal hook run to process and display delayed warnings. | ||
| 3860 | By default, this hook contains functions to consolidate the | ||
| 3861 | warnings listed in `delayed-warnings-list', display them, and set | ||
| 3862 | `delayed-warnings-list' back to nil.") | ||
| 3863 | |||
| 3864 | |||
| 3867 | ;;;; invisibility specs | 3865 | ;;;; invisibility specs |
| 3868 | 3866 | ||
| 3869 | (defun add-to-invisibility-spec (element) | 3867 | (defun add-to-invisibility-spec (element) |