summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bytecomp.el
Commit message (Collapse)AuthorAgeFilesLines
* Don't save unrelated buffers before recompiling directory (Bug#25964)Andreas Politz2017-05-201-1/+6
| | | | | * lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): Only save buffers visiting lisp files under the directory being compiled.
* Make `old-style-backquotes' variable internalPhilipp2017-05-131-2/+2
| | | | | | | | | | | | | * src/lread.c (load_warn_old_style_backquotes, Fload, read1) (syms_of_lread): Rename `old-style-backquotes' to `lread--old-style-backquotes', and clarify that it's for internal use only. * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Rename variable. * test/src/lread-tests.el (lread-tests--old-style-backquotes): Add unit test. * emacs-lisp/bytecomp-tests.el (bytecomp-tests--old-style-backquotes): Add unit test.
* Improve unescaped character literal warningsPhilipp Stephani2017-05-131-1/+1
| | | | | | | | | | | * src/lread.c (load_warn_unescaped_character_literals) (syms_of_lread): lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Improve formatting of unescaped character literal warnings. * test/src/lread-tests.el (lread-tests--unescaped-char-literals): test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--unescaped-char-literals): Adapt unit tests.
* Remove obsolete method of changing byte-compile-dest-fileGlenn Morris2017-05-061-14/+9
| | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-dest-file): Define unconditionally.
* Warn about missing backslashes during loadPhilipp Stephani2017-05-011-0/+7
| | | | | | | | | | | | | | | | * src/lread.c (load_warn_unescaped_character_literals, Fload, read1) (syms_of_lread): Warn if unescaped character literals are found (Bug#20152). * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Check for unescaped character literals during byte compilation. * test/src/lread-tests.el (lread-tests--unescaped-char-literals): New unit test. (lread-tests--with-temp-file, lread-tests--last-message): Helper functions for unit test. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--unescaped-char-literals): New unit test. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--with-temp-file): Helper macro for unit test.
* b-c--cond-jump-table-info: Use correct body for singleton clausesVibhav Pant2017-04-221-2/+2
| | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-cond-jump-table-info): When a clause's body consists of a single constant expression, use that expression as the body to be compiled. This fixes switch bytecode evaluating to nil to such clauses.
* bytecomp: Don't inline functions that use byte-switch (Bug#26518)Vibhav Pant2017-04-201-40/+46
| | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-unfold-bcf): Don't inline FORM if the bytecode uses the byte-switch instruction. It is impossible to guess the correct stack depth while inlining such bytecode, resulting in faulty code.
* Tweak bytecomp's loading of cl-extraGlenn Morris2017-04-181-2/+4
| | | | | * lisp/emacs-lisp/bytecomp.el: Don't force load of cl-extra in a post-bootstrap emacs where cl-loaddefs does exist.
* Fix obsolete ‘test/automated’ referencesPaul Eggert2017-03-271-1/+1
| | | | | | | | | | | | | | * Makefile.in (mostlyclean, clean, maybeclean_dirs, distclean) (bootstrap-clean, maintainer-clean): Clean ‘test’, not ‘test/automated’. Test for existence of subdirectory only for ‘test’, not for directories that should always exist. * admin/MAINTAINERS, etc/TODO, lisp/emacs-lisp/bytecomp.el: * lisp/emacs-lisp/seq.el, lisp/emacs-lisp/thunk.el: * lisp/man.el (Man-parse-man-k): * lisp/url/url-domsuf.el, make-dist: * test/file-organization.org: Fix obsolete references to test/automated.
* Merge from origin/emacs-25Paul Eggert2017-03-191-1/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ab0a60a ; * CONTRIBUTE (Generating ChangeLog entries): Drop duplicate... 7e02a47 Index byte-compile-debug 7c1e598 Document `byte-compile-debug' in the ELisp manual 4d81eb4 Document variable `byte-compile-debug' 72ef710 Fix call to debugger on assertion failure ae8264c Call modification hooks in org-src fontify buffers b3139da ; Fix last change in doc/lispref/strings.texi c331f39 Improve documentation of 'format' conversions 9f52f67 Remove stale functions from ert manual c416b14 Fix a typo in Eshell manual 06695a0 ; Fix a typo in ediff-merg.el 954e9e9 Improve documentation of hooks related to saving buffers 9fcab85 Improve documentation of auto-save-visited-file-name 2236c53 fix typo in mailcap-mime-extensions 85a3e4e Fix typos in flymake.el a1ef10e More NEWS checking for admin.el's set-version # Conflicts: # lisp/emacs-lisp/bytecomp.el
| * Document variable `byte-compile-debug'Philipp Stephani2017-01-311-1/+2
| | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-debug): Document variable.
* | Byte compile cond clauses without any bodies correctly.Vibhav Pant2017-03-101-1/+3
| | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-cond-jump-table): When a cond clause has no body, push t on to the stack.
* | ; Spelling, punctuation and minor wording fixesPaul Eggert2017-02-161-3/+3
| |
* | bytecomp.el: Avoid unnecessary calculation for jump table addresses.Vibhav Pant2017-02-161-2/+7
| | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Don't do redundant operations while calculating the correct jump addresses from TAGs in jump tables.
* | Merge branch 'master' into feature/byte-switchVibhav Pant2017-02-131-1/+1
|\ \
| * | Nix some useless uses of looking-at, looking-backMark Oteiza2017-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/allout.el (allout-kill-topic): (allout-next-topic-pending-encryption): * lisp/bookmark.el (bookmark-kill-line): * lisp/cus-edit.el (custom-save-variables, custom-save-faces): * lisp/cus-theme.el (custom-theme-write-variables): (custom-theme-write-faces): * lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads): * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): * lisp/emacs-lisp/checkdoc.el (checkdoc-interactive-loop): (checkdoc-interactive-ispell-loop): (checkdoc-message-interactive-ispell-loop, checkdoc-this-string-valid): (checkdoc-this-string-valid-engine): * lisp/emacs-lisp/elint.el (elint-get-top-forms): * lisp/emulation/viper-cmd.el (viper-backward-indent): * lisp/image-dired.el (image-dired-delete-char): * lisp/simple.el (kill-visual-line): Replace instances of looking-at, looking-back with char comparisons using following-char, preceding-char.
* | | ; Add more documentation for byte-switch related code.Vibhav Pant2017-02-131-3/+11
| | |
* | | ; lisp/emacs-lisp/bytecomp.el: Fix indentation.Vibhav Pant2017-02-121-1/+1
| | |
* | | Improve byte-switch execution.Vibhav Pant2017-02-091-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/byte-opt.el, lisp/emacs-lisp/bytecomp.el (byte-decompile-bytecode-1), (byte-compile-lapcode): Calculate the actual jump address while compiling, store it in the jump table. * src/bytecode.c: Jump to the looked up value directly, do a linear search when the number of elements is <= 5.
* | | ; bytecomp.el (byte-compile-cond-jump-table): Add TODO noteVibhav Pant2017-02-061-0/+2
| | |
* | | ; byte(-opt, comp).el: Add more documentation for byte-switch code.Vibhav Pant2017-02-061-0/+19
| | |
* | | bytecomp.el: Use macroexp-const-p instead of bc-cond-valid-obj2-p.Vibhav Pant2017-02-051-11/+5
| | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-cond-vars): Use (macroexp-cons-p) instead of (byte-compile-cond-valid-obj2-p) to make sure that obj1/obj2 can be compared with `eq'.
* | | ; Fix typo.Vibhav Pant2017-02-051-1/+1
| | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-cond-jump-table-info): Fix typo in docstring.
* | | ; bytecomp.el (-inline-lapcode): Fix incorrect parenthesis, refactorVibhav Pant2017-02-051-5/+5
| | |
* | | bytecomp.el: Inline lapcode containing `byte-switch' correctly.Vibhav Pant2017-02-051-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-inline-lapcode): Restore value of byte-compile-depth after emitting a jump to a tag in a jump table, or default/done tags. Set the depth of final tags for byte-switch to nil after emitting any jumps to them.
* | | bytecomp.el: Don't store non-keyword symbols in jump-tables.Vibhav Pant2017-02-051-5/+7
| | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-cond-valid-obj2-p) return nil when OBJ is a non-keyword symbol (i.e a variable), as the jump table can only be used when comparing variables with constant values.
* | | Revert "Use maphash instead of cl-loop."Vibhav Pant2017-02-031-4/+4
| | | | | | | | | | | | This reverts commit bfa88520136dd6b187ba101e6db5a5f8f0d5e874.
* | | Use maphash instead of cl-loop.Vibhav Pant2017-02-011-4/+4
| | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el: (byte-compile-lapcode) Use maphash instead of cl-loop
* | | * lisp/emacs-lisp/bytecomp.el: Create jump tables with :purecopy tVibhav Pant2017-01-301-0/+1
| | |
* | | * lisp/emacs-lisp/bytecomp.el:(bc-cond-jump-table-info)add docstringVibhav Pant2017-01-261-0/+7
| | |
* | | * lisp/emacs-lisp/bytecomp.el: Use correct function to push nilVibhav Pant2017-01-261-1/+1
| | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el: (byte-compile-cond-jump-table) Use byte-compile-constant instead of byte-compile-form to push nil.
* | | * lisp/emacs-lisp/bytecomp.el:Use correct size for switch jump-tableVibhav Pant2017-01-261-1/+4
| | |
* | | * lisp/emacs-lisp/bytecomp.el: Simplify b-c-cond-valid-obj2-pVibhav Pant2017-01-261-5/+5
| | |
* | | * lisp/emacs-lisp/bytecomp.el: Fix byte-switch codegen with symbols.Vibhav Pant2017-01-261-1/+1
| | |
* | | * lisp/emacs-lisp/bytecomp.el: Remove unused debugging statements.Vibhav Pant2017-01-211-2/+0
| | |
* | | * lisp/emacs-lisp/bytecomp.el: Fix errors with matching quoted formsVibhav Pant2017-01-191-1/+1
| | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el: (byte-compile-cond-jump-table-info) eval obj2 to avoid quoted forms being stored as is.
* | | lisp/emacs-lisp/bytecomp.el: Use byte-switch only for quoted symbolsVibhav Pant2017-01-191-1/+3
| | |
* | | * lisp/emacs-lisp/bytecomp.el: Add default-case for last cond clause.Vibhav Pant2017-01-191-16/+19
| | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el: (byte-compile-cond-jump-table) Add default-case for last cond clause.
* | | Use byte-switch for all symbols.Vibhav Pant2017-01-191-1/+0
| | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el: (byte-compile-cond-valid-obj2-p) Return t for all symbols (instead for just keywords)
* | | * lisp/emacs-lisp/bytecomp.el: Add documentation, remove code duplicationVibhav Pant2017-01-151-21/+34
| | |
* | | Add new 'switch' byte-code.Vibhav Pant2017-01-151-35/+139
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'switch' takes two arguments from the stack: the variable to test, and a jump table (implemented as a hash-table with the appropriate :test function). By looking up the value of the variable in the hash table, the interpreter can jump to the label pointed to by the value, if any. This implementation can only be used for `cond' forms of the type `(cond ((test x 'foo) 'bar) ...)`, such that the function `test` and variable `x` is same for all clauses. * lisp/emacs-lisp/bytecomp.el: * Add (byte-compile-cond-valid-obj2-p), (byte-compile-cond-vars), (byte-compile-cond-jump-table-info), (byte-compile-jump-table-add-tag), (byte-compile-cond-jump-table), byte-compile-jump-tables. * Add defcustom `byte-compile-cond-use-jump-table'. * (byte-compile-cond): Use them. * (byte-compile-lapcode): Patch tags present in jump tables, if any. * lisp/emacs-lisp//byte-opt.el: (byte-optimize-lapcode): Add checks to some peephole optimizations to prevent them from messing up any code involving `byte-switch`. * src/bytecode.c: (exec_byte_code): Add bytecode Bswitch.
* | Merge from origin/emacs-25Paul Eggert2017-01-011-1/+1
|\| | | | | | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
| * Update copyright year to 2017Paul Eggert2016-12-311-1/+1
| | | | | | | | Run admin/update-copyright.
* | Prevent dubious argument listsPhilipp Stephani2016-11-181-2/+5
| | | | | | | | | | | | | | | | | | | | See Bug#24912 and Bug#24913. * src/eval.c (funcall_lambda): Detect more dubious argument lists. * lisp/emacs-lisp/bytecomp.el (byte-compile-check-lambda-list): Detect more dubious argument lists. * test/src/eval-tests.el (eval-tests--bugs-24912-and-24913): Add unit test.
* | New error file-missingPaul Eggert2016-10-211-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a recently-introduced bug in delete-directory, where the code assumes the C locale when determining whether a file-error corresponds to a missing file (Bug#24714). * doc/lispref/errors.texi (Standard Errors): * doc/lispref/files.texi (Changing Files): * etc/NEWS: Document this. * doc/lispref/loading.texi (How Programs Do Loading): Say "a file-error" rather than "the error file-error" since it might be a file-missing now. * lisp/emacs-lisp/bytecomp.el (byte-compile-file): * lisp/epa-file.el (epa-file--find-file-not-found-function): (epa-file-insert-file-contents, epa-file-write-region): * lisp/ffap.el (find-file-at-point, dired-at-point): * lisp/jka-compr.el (jka-compr-insert-file-contents) (jka-compr-insert-file-contents): * lisp/net/ange-ftp.el (ange-ftp-barf-if-not-directory) (ange-ftp-insert-file-contents, ange-ftp-copy-file-internal): * lisp/progmodes/etags.el (visit-tags-table): * lisp/url/url-handlers.el (url-copy-file): * src/fileio.c (report_file_errno): Signal file-missing if appropriate. * lisp/epa-file.el (epa-file-insert-file-contents): * lisp/jka-compr.el (jka-compr-insert-file-contents): Don't assume file-error is a leaf in the error hierarchy. * lisp/files.el (files--force): * lisp/gnus/nnmaildir.el (nnmaildir--enoent-p): * lisp/jka-compr.el (jka-compr-insert-file-contents): Use file-missing to detect whether the file is missing. * lisp/url/url-handlers.el (url-copy-file): Signal file-already-exists if appropriate. * src/fileio.c (syms_of_fileio): Define file-missing. 2016-10-18 Paul Eggert <eggert@cs.ucla.edu>
* | Improve accuracy of line/column numbers in byte compiler's warning messages.Alan Mackenzie2016-09-171-22/+26
| | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-set-symbol-position): ensure new value of byte-compile-last-position is not lower than old value. (byte-compile-function-warn): call byte-compile-set-symbol-position.
* | Stop calling ‘byte-compile-log-warning’Philipp Stephani2016-09-111-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For errors, use ‘byte-compile-report-error’ instead so that the error is registered and causes compilation to fail (Bug#24359). For warnings, use ‘byte-compile-warn’ instead so that ‘byte-compile-error-on-warn’ is honored (Bug#24360). * lisp/emacs-lisp/macroexp.el (macroexp--funcall-if-compiled) (macroexp--warn-and-return): Use ‘byte-compile-warn’ instead of ‘byte-compile-log-warning’. * lisp/emacs-lisp/bytecomp.el (byte-compile-form, byte-compile-unfold-bcf) (byte-compile-setq, byte-compile-funcall): Use ‘byte-compile-report-error’ instead of ‘byte-compile-log-warning’. (byte-compile-log-warning): Convert comment to documentation string. Explain that the function shouldn’t be called directly. (byte-compile-report-error): Add optional FILL argument. * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use) (cconv--analyze-function, cconv-analyze-form): Use ‘byte-compile-warn’ instead of ‘byte-compile-log-warning’. * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Use ‘byte-compile-warn’ instead of ‘byte-compile-log-warning’. * lisp/subr.el (add-to-list): Use ‘byte-compile-report-error’ instead of ‘byte-compile-log-warning’. (do-after-load-evaluation): Use ‘byte-compile-warn’ instead of ‘byte-compile-log-warning’.
* | Fix byte-compile of interactive closuresNoam Postavsky2016-08-061-2/+8
| | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile--reify-function): Put bindings after docstring and `interactive' form, if any (Bug #24122).
* | Don’t document declare-function internalsPaul Eggert2016-05-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | Suggested by Stefan Monnier in: http://lists.gnu.org/archive/html/emacs-devel/2016-05/msg00618.html * doc/lispref/functions.texi (Declaring Functions): * lisp/subr.el (declare-function): * lisp/emacs-lisp/bytecomp.el: (byte-compile-macroexpand-declare-function): Document as (fn file &optional arglist fileonly) even though it is really (fn file &rest args).
* | Fix byte-compiler pacification for declare-functionPaul Eggert2016-05-261-6/+5
| | | | | | | | | | | | | | | | | | | | Problem reported by Michael Heerdegen in: http://lists.gnu.org/archive/html/emacs-devel/2016-05/msg00590.html * lisp/emacs-lisp/bytecomp.el: (byte-compile-macroexpand-declare-function): Revert signature to previous value. * lisp/subr.el (declare-function): Change signature to match the reverted signature used in the byte compiler.