• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/emacs-lisp/

Lines Matching +defs:file +defs:word

11 ;; This file is part of GNU Emacs.
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
33 ;; The user entry points are byte-compile-file and byte-recompile-directory.
39 ;; byte-recompile-directory, byte-compile-file,
43 ;; (byte-compile-buffer and byte-compile-and-load-file were turned off
61 ;; - functions or macros defined multiple times in the same file;
64 ;; file, or as autoloads;
107 ;; emacs-lisp-file-regexp Regexp for the extension of source-files;
108 ;; see also the function byte-compile-dest-file.
131 ;; o It is possible to open-code a function in the same file it is defined
132 ;; in without having to load that file before compiling it. The
150 ;; o If you run byte-compile-file on a filename which is visited in a
155 ;; Some versions of `file' can be customized to recognize that.
168 ;; The crud you see scattered through this file of the form
199 (defcustom emacs-lisp-file-regexp (if (eq system-type 'vax-vms)
203 You may want to redefine the function `byte-compile-dest-file'
208 ;; This enables file name handlers such as jka-compr
209 ;; to remove parts of the file name that should not be copied
210 ;; through to the output file name.
211 (defun byte-compiler-base-file-name (filename)
212 (let ((handler (find-file-name-handler filename
213 'byte-compiler-base-file-name)))
215 (funcall handler 'byte-compiler-base-file-name filename)
218 (or (fboundp 'byte-compile-dest-file)
219 ;; The user may want to redefine this along with emacs-lisp-file-regexp,
221 (defun byte-compile-dest-file (filename)
222 "Convert an Emacs Lisp source file name to a compiled file name.
223 If FILENAME matches `emacs-lisp-file-regexp' (by default, files
225 (setq filename (byte-compiler-base-file-name filename))
226 (setq filename (file-name-sans-versions filename))
229 ((string-match emacs-lisp-file-regexp filename)
289 They are hidden in comments in the compiled file,
293 To enable this option, make it a file-local variable
294 in the source file you want it to apply to.
297 When this option is true, if you load the compiled file and then move it,
308 inside comments in the file, and bring them into core only when they
311 When this option is true, if you load the compiled file and then move it,
312 you won't be able to find the documentation of anything in that file.
314 To disable this option for a certain file, make it a file-local variable
315 in the source file. For example, add this to the first line:
384 insert-file insert-buffer insert-file-literally)
427 ;; (defvar byte-compile-overwrite-file t
429 ;; files will have the same modes as the corresponding .el file. Otherwise,
431 ;; will not be changed. If this variable is nil, then an .elc file which
432 ;; is a symbolic link will be turned into a normal file, instead of the file
443 "List of variables declared as constants during compilation of this file.")
465 "Alist of macros defined in the file being compiled.
470 "Alist of functions defined in the file being compiled.
485 but won't necessarily be defined when the compiled file is loaded.")
536 ;; opcode word.
611 (byte-defop 118 0 byte-forward-word)
834 ;; Make sure the file was not already loaded before.
862 ;; Make sure the file was not already loaded before.
882 (defvar byte-compile-dest-file nil)
883 (defvar byte-compile-current-file nil)
963 (defvar byte-compile-last-logged-file nil)
970 (file (cond ((stringp byte-compile-current-file)
971 (format "%s:" (file-relative-name byte-compile-current-file dir)))
972 ((bufferp byte-compile-current-file)
974 (buffer-name byte-compile-current-file)))
976 (pos (if (and byte-compile-current-file
989 (when (or (and byte-compile-current-file
990 (not (equal byte-compile-current-file
991 byte-compile-last-logged-file)))
997 (insert (format "%s%s" file pos))))
998 (setq byte-compile-last-logged-file byte-compile-current-file
1008 ;; Log the start of a file in *Compile-Log*, and mark it as done.
1011 (defun byte-compile-log-file ()
1012 (and (not (equal byte-compile-current-file byte-compile-last-logged-file))
1018 (dir (and byte-compile-current-file
1019 (file-name-directory byte-compile-current-file)))
1028 (if byte-compile-current-file
1030 (if (stringp byte-compile-current-file)
1031 (concat "file " byte-compile-current-file)
1032 (concat "buffer " (buffer-name byte-compile-current-file)))
1034 (insert "\f\nCompiling no file at " (current-time-string) "\n"))
1039 (setq byte-compile-last-logged-file byte-compile-current-file
1048 ;; Also log the current function and file if not already done.
1060 (error "%s" format) ; byte-compile-file catches and logs it
1089 ;; (file-format byte-compile-compatibility (emacs18 emacs19)
1105 ;; (setcar (cdr (cdr (assq 'file-format byte-compiler-valid-options)))
1384 cl-compiling-file)))
1477 ;; can change them on a per-file basis.
1505 ;; Log the file name. Record position of that text.
1506 (setq tem (byte-compile-log-file))
1516 ;; Log the file name. Record position of that text.
1517 (or (byte-compile-log-file) 'byte-compile-warning-series)))
1527 "Recompile every `.el' file in DIRECTORY that already has a `.elc' file.
1534 "Recompile every `.el' file in DIRECTORY that needs recompilation.
1535 This is if a `.elc' file exists but is older than the `.el' file.
1538 If the `.elc' file does not exist, normally this function *does not*
1539 compile the corresponding `.el' file. However,
1541 A nonzero ARG means ask the user, for each such `.el' file,
1547 recompile every `.el' file that already has a `.elc' file."
1557 (setq default-directory (expand-file-name directory))
1561 (let ((directories (list (expand-file-name directory)))
1565 (file-count 0)
1574 (dolist (file files)
1575 (setq source (expand-file-name file directory))
1576 (if (and (not (member file '("RCS" "CVS")))
1577 (not (eq ?\. (aref file 0)))
1578 (file-directory-p source)
1579 (not (file-symlink-p source)))
1580 ;; This file is a subdirectory. Handle them differently.
1586 ;; It is an ordinary file. Decide whether to compile it.
1587 (if (and (string-match emacs-lisp-file-regexp source)
1588 (file-readable-p source)
1589 (not (auto-save-file-name-p source))
1590 (setq dest (byte-compile-dest-file source))
1591 (if (file-exists-p dest)
1593 (or force (file-newer-than-file-p source dest))
1594 ;; No compiled file exists yet.
1600 (let ((res (byte-compile-file source)))
1604 (setq file-count (1+ file-count)))
1614 (message "Done (Total of %d file%s compiled%s%s%s)"
1615 file-count (if (= file-count 1) "" "s")
1622 This is normally set in local file variables at the end of the elisp file:
1628 (defun byte-compile-file (filename &optional load)
1629 "Compile a file of Lisp code named FILENAME into a file of byte code.
1630 The output file's name is generated by passing FILENAME to the
1631 `byte-compile-dest-file' function (which see).
1632 With prefix arg (noninteractively: 2nd arg), LOAD the file after compiling.
1634 ;; (interactive "fByte compile file: \nP")
1636 (let ((file buffer-file-name)
1637 (file-name nil)
1638 (file-dir nil))
1639 (and file
1642 (setq file-name (file-name-nondirectory file)
1643 file-dir (file-name-directory file)))
1644 (list (read-file-name (if current-prefix-arg
1645 "Byte compile and load file: "
1646 "Byte compile file: ")
1647 file-dir file-name nil)
1650 (setq filename (expand-file-name filename))
1652 ;; If we're compiling a file that's in a buffer and is modified, offer
1655 (let ((b (get-file-buffer (expand-file-name filename))))
1660 ;; Force logging of the file name for each file compiled.
1661 (setq byte-compile-last-logged-file nil)
1662 (let ((byte-compile-current-file filename)
1664 target-file input-buffer output-buffer
1665 byte-compile-dest-file)
1666 (setq target-file (byte-compile-dest-file filename))
1667 (setq byte-compile-dest-file target-file)
1672 (setq buffer-file-coding-system nil)
1673 ;; Always compile an Emacs Lisp file as multibyte
1674 ;; unless the file itself forces unibyte with -*-coding: raw-text;-*-
1676 (insert-file-contents filename)
1677 ;; Mimic the way after-insert-file-set-coding can make the
1678 ;; buffer unibyte when visiting this file.
1685 ;; If they change the file name, then change it for the output also.
1686 (let ((buffer-file-name filename)
1694 (setq filename buffer-file-name))
1696 (setq default-directory (file-name-directory filename)))
1697 ;; Check if the file's local variables explicitly specify not to
1698 ;; compile this file.
1702 ;; (file-relative-name filename)
1704 (when (file-exists-p target-file)
1706 (file-relative-name target-file)
1708 (condition-case nil (delete-file target-file) (error nil)))
1709 ;; We successfully didn't compile this file.
1729 (if (file-writable-p target-file)
1733 (setq buffer-file-type t))
1734 (when (file-exists-p target-file)
1736 ;; hard-links continue to point to the old file (this makes
1740 (delete-file target-file))
1741 (write-region (point-min) (point-max) target-file))
1743 (signal 'file-error
1744 (list "Opening output file"
1745 (if (file-exists-p target-file)
1746 "cannot overwrite file"
1748 target-file))))
1756 (load target-file))
1759 ;;(defun byte-compile-and-load-file (&optional filename)
1760 ;; "Compile a file of Lisp code named FILENAME into a file of byte code,
1761 ;;and then load it. The output file's name is made by appending \"c\" to
1765 ;; (byte-compile-file filename t)
1767 ;; (call-interactively 'byte-compile-file))))
1774 ;; (let* ((filename (or (buffer-file-name buffer)
1776 ;; (byte-compile-current-file buffer))
1791 (let* ((byte-compile-current-file nil)
1820 ;; and put the output into a file.
1869 (byte-compile-file-form form)))
1870 ;; Compile pending forms at end of file.
1873 ;; give the end of the file as their position.
1893 (search-forward "\n;;; This file")
1907 (insert ";;; This file contains multibyte non-ASCII characters\n"
1915 ;; to make sure all positions in the file remain valid.
1928 ;; that is the file-format version number (18, 19 or 20) as a
1931 ;; the file so that `diff' will simply say "Binary files differ"
1935 ;; 0 string ;ELC GNU Emacs Lisp compiled file,
1947 (current-time-string) "\n;;; from file " filename "\n")
1969 ";;; This file uses dynamic docstrings, first added in Emacs 19.29.\n"
1972 ";;; This file uses opcodes which do not exist in Emacs 18.\n"
1989 (substring (prin1-to-string (file-name-nondirectory filename))
2005 (defun byte-compile-output-file-form (form)
2009 ;; defalias calls are output directly by byte-compile-file-form-defmumble;
2144 (let ((form (byte-compile-out-toplevel t 'file)))
2146 (mapc 'byte-compile-output-file-form (cdr form)))
2148 (byte-compile-output-file-form form)))
2155 (defun byte-compile-file-form (form)
2165 (byte-compile-output-file-form form))))
2169 (byte-compile-file-form form)))))
2175 (put 'defsubst 'byte-hunk-handler 'byte-compile-file-form-defsubst)
2176 (defun byte-compile-file-form-defsubst (form)
2181 (byte-compile-file-form
2186 (put 'autoload 'byte-hunk-handler 'byte-compile-file-form-autoload)
2187 (defun byte-compile-file-form-autoload (form)
2206 (put 'defvar 'byte-hunk-handler 'byte-compile-file-form-defvar)
2207 (put 'defconst 'byte-hunk-handler 'byte-compile-file-form-defvar)
2208 (defun byte-compile-file-form-defvar (form)
2211 ;; and not do a file-boundary.
2220 (byte-compile-top-level (nth 2 form) nil 'file))))
2224 'byte-compile-file-form-custom-declare-variable)
2225 (defun byte-compile-file-form-custom-declare-variable (form)
2245 (put 'require 'byte-hunk-handler 'byte-compile-file-form-require)
2246 (defun byte-compile-file-form-require (form)
2256 (put 'progn 'byte-hunk-handler 'byte-compile-file-form-progn)
2257 (put 'prog1 'byte-hunk-handler 'byte-compile-file-form-progn)
2258 (put 'prog2 'byte-hunk-handler 'byte-compile-file-form-progn)
2259 (defun byte-compile-file-form-progn (form)
2260 (mapc 'byte-compile-file-form (cdr form))
2266 (put 'eval 'byte-hunk-handler 'byte-compile-file-form-eval)
2267 (defun byte-compile-file-form-eval (form)
2272 (put 'defun 'byte-hunk-handler 'byte-compile-file-form-defun)
2273 (defun byte-compile-file-form-defun (form)
2274 (byte-compile-file-form-defmumble form nil))
2276 (put 'defmacro 'byte-hunk-handler 'byte-compile-file-form-defmacro)
2277 (defun byte-compile-file-form-defmacro (form)
2278 (byte-compile-file-form-defmumble form t))
2280 (defun byte-compile-file-form-defmumble (form macrop)
2318 (byte-compile-warn "%s `%s' defined multiple times in this file"
2387 ;; b-c-output-file-form analyze the defalias.
2405 ;; Print Lisp object EXP in the output file, inside a comment,
2406 ;; and return the file position it will have.
2436 ;; Save the file position of the object.
2440 ;; to a file position; they cancel.
2667 ;; 'file -> used at file-level.
2717 ;; uses the (file . pos) syntax. Besides, now that we have
2721 ;; file -> as progn, but takes both quotes and atoms, and longer forms.
2728 (nthcdr (if (eq output-type 'file) 50 8) byte-compile-output)
2749 (and (memq output-type '(file progn t))
2760 (or (eq output-type 'file)
3027 (byte-defop-compiler19 forward-word 0-1)
3167 (byte-defop-compiler backward-word)
3198 (defun byte-compile-backward-word (form)
3200 (byte-compile-form (list 'forward-word (if (numberp (nth 1 form))
3204 (byte-compile-form '(forward-word -1)))
3768 ;; This is not used for file-level defuns with doc strings.
3792 ;; This is not used for file-level defmacros with doc strings.
3803 ;; This is not used for file-level defvar/consts with doc strings.
3866 (put 'defalias 'byte-hunk-handler 'byte-compile-file-form-defalias)
3867 (defun byte-compile-file-form-defalias (form)
3885 ;; which is to call back byte-compile-file-form and then return nil.
3886 ;; Except that we can't just call byte-compile-file-form since it would
3991 ;; to avoid interfering with completion of byte-compile-file.
3994 "Display a call graph of a specified file.
4015 (cond ((null byte-compile-current-file) (or filename "???"))
4016 ((stringp byte-compile-current-file)
4017 byte-compile-current-file)
4018 (t (buffer-name byte-compile-current-file)))
4125 "Like `byte-compile-file' but doesn't recompile if already up to date.
4134 "Run `byte-compile-file' on the files remaining on the command line.
4137 Each file is processed even if an error occurred previously.
4139 If NOFORCE is non-nil, don't recompile a file that seems to be
4147 (if (file-directory-p (expand-file-name (car command-line-args-left)))
4151 (dolist (file files)
4152 (if (and (string-match emacs-lisp-file-regexp file)
4153 (not (auto-save-file-name-p file))
4154 (setq source (expand-file-name file
4156 (setq dest (byte-compile-dest-file source))
4157 (file-exists-p dest)
4158 (file-newer-than-file-p source dest))
4159 (if (null (batch-byte-compile-file source))
4161 ;; Specific file argument
4164 (dest (byte-compile-dest-file source)))
4165 (or (not (file-exists-p dest))
4166 (file-newer-than-file-p source dest))))
4167 (if (null (batch-byte-compile-file (car command-line-args-left)))
4172 (defun batch-byte-compile-file (file)
4174 (byte-compile-file file)
4176 (byte-compile-file file)
4177 (file-error
4181 file
4184 (let ((destfile (byte-compile-dest-file file)))
4185 (if (file-exists-p destfile)
4186 (delete-file destfile)))
4192 file