Commit graph

668 commits

Author SHA1 Message Date
Paul Eggert
55086ef651 Fix obsolete ‘test/automated’ references
* 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.
2017-03-27 11:30:08 -07:00
Paul Eggert
e6fd84d2d5 Merge from origin/emacs-25
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
2017-03-19 12:29:06 -07:00
Vibhav Pant
092071345f Byte compile cond clauses without any bodies correctly.
* lisp/emacs-lisp/bytecomp.el (byte-compile-cond-jump-table): When a
cond clause has no body, push t on to the stack.
2017-03-10 00:22:35 +05:30
Paul Eggert
cb70725584 ; Spelling, punctuation and minor wording fixes 2017-02-16 09:18:21 -08:00
Vibhav Pant
501ad54626 bytecomp.el: Avoid unnecessary calculation for jump table addresses.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Don't do
  redundant operations while calculating the correct jump addresses
  from TAGs in jump tables.
2017-02-16 20:30:04 +05:30
Vibhav Pant
cb410433e0 Merge branch 'master' into feature/byte-switch 2017-02-13 17:07:36 +05:30
Vibhav Pant
e742450427 ; Add more documentation for byte-switch related code. 2017-02-13 16:44:06 +05:30
Mark Oteiza
91478f4623 Nix some useless uses of looking-at, looking-back
* 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.
2017-02-12 10:59:33 -05:00
Vibhav Pant
219339e2eb ; lisp/emacs-lisp/bytecomp.el: Fix indentation. 2017-02-12 13:24:55 +05:30
Vibhav Pant
dde800c8c9 Improve byte-switch execution.
* 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.
2017-02-09 12:18:54 +05:30
Vibhav Pant
c4316a2661 ; bytecomp.el (byte-compile-cond-jump-table): Add TODO note 2017-02-06 19:33:01 +05:30
Vibhav Pant
a12b416bca ; byte(-opt, comp).el: Add more documentation for byte-switch code. 2017-02-06 13:26:25 +05:30
Vibhav Pant
2db473bda8 bytecomp.el: Use macroexp-const-p instead of bc-cond-valid-obj2-p.
* 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'.
2017-02-05 22:32:21 +05:30
Vibhav Pant
382f6603ad ; Fix typo.
* lisp/emacs-lisp/bytecomp.el (byte-compile-cond-jump-table-info): Fix
  typo in docstring.
2017-02-05 21:51:05 +05:30
Vibhav Pant
490fc5a502 ; bytecomp.el (-inline-lapcode): Fix incorrect parenthesis, refactor 2017-02-05 21:48:27 +05:30
Vibhav Pant
cadb044fc2 bytecomp.el: Inline lapcode containing `byte-switch' correctly.
* 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.
2017-02-05 19:23:53 +05:30
Vibhav Pant
44c95c58b2 bytecomp.el: Don't store non-keyword symbols in jump-tables.
* 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.
2017-02-05 15:37:43 +05:30
Vibhav Pant
de456d1e4a Revert "Use maphash instead of cl-loop."
This reverts commit bfa8852013.
2017-02-03 23:23:28 +05:30
Vibhav Pant
bfa8852013 Use maphash instead of cl-loop.
* lisp/emacs-lisp/bytecomp.el: (byte-compile-lapcode) Use maphash
  instead of cl-loop
2017-02-01 18:15:59 +05:30
Philipp Stephani
4d81eb450e Document variable `byte-compile-debug'
* lisp/emacs-lisp/bytecomp.el (byte-compile-debug): Document variable.
2017-01-31 19:04:36 +01:00
Vibhav Pant
f441451658 * lisp/emacs-lisp/bytecomp.el: Create jump tables with :purecopy t 2017-01-30 19:22:09 +05:30
Vibhav Pant
25d38a06ec * lisp/emacs-lisp/bytecomp.el:(bc-cond-jump-table-info)add docstring 2017-01-26 23:03:02 +05:30
Vibhav Pant
a7e4870f16 * lisp/emacs-lisp/bytecomp.el: Use correct function to push nil
* lisp/emacs-lisp/bytecomp.el: (byte-compile-cond-jump-table) Use
  byte-compile-constant instead of byte-compile-form to push nil.
2017-01-26 14:31:16 +05:30
Vibhav Pant
19cb3985a3 * lisp/emacs-lisp/bytecomp.el:Use correct size for switch jump-table 2017-01-26 01:00:41 +05:30
Vibhav Pant
c52a9b6ddd * lisp/emacs-lisp/bytecomp.el: Simplify b-c-cond-valid-obj2-p 2017-01-26 00:58:36 +05:30
Vibhav Pant
8189b97e5c * lisp/emacs-lisp/bytecomp.el: Fix byte-switch codegen with symbols. 2017-01-26 00:57:10 +05:30
Vibhav Pant
23a130ee0d * lisp/emacs-lisp/bytecomp.el: Remove unused debugging statements. 2017-01-21 11:37:20 +05:30
Vibhav Pant
fbe6b90b0c * lisp/emacs-lisp/bytecomp.el: Fix errors with matching quoted forms
* lisp/emacs-lisp/bytecomp.el: (byte-compile-cond-jump-table-info)
  eval obj2 to avoid quoted forms being stored as is.
2017-01-19 23:13:53 +05:30
Vibhav Pant
5f3379b338 lisp/emacs-lisp/bytecomp.el: Use byte-switch only for quoted symbols 2017-01-19 23:13:13 +05:30
Vibhav Pant
46193d5209 * lisp/emacs-lisp/bytecomp.el: Add default-case for last cond clause.
* lisp/emacs-lisp/bytecomp.el: (byte-compile-cond-jump-table) Add
default-case for last cond clause.
2017-01-19 23:12:09 +05:30
Vibhav Pant
1fcbd352f8 Use byte-switch for all symbols.
* lisp/emacs-lisp/bytecomp.el: (byte-compile-cond-valid-obj2-p) Return
  t for all symbols (instead for just keywords)
2017-01-19 18:02:40 +05:30
Vibhav Pant
8c0f326ea2 * lisp/emacs-lisp/bytecomp.el: Add documentation, remove code duplication 2017-01-15 19:36:26 +05:30
Vibhav Pant
88549ec38e Add new 'switch' byte-code.
'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.
2017-01-15 01:26:04 +05:30
Paul Eggert
bcf244ef9b Merge from origin/emacs-25
2e2a806 Fix copyright years by hand
5badc81 Update copyright year to 2017
2017-01-01 01:10:47 -08:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Philipp Stephani
0d913da15c Prevent dubious argument lists
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.
2016-11-18 18:02:57 +01:00
Paul Eggert
897998291f New error file-missing
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>
2016-10-21 13:06:03 -07:00
Alan Mackenzie
277e7b011d Improve accuracy of line/column numbers in byte compiler's warning messages.
* 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.
2016-09-17 12:43:54 +00:00
Philipp Stephani
7edaa77c5e Stop calling ‘byte-compile-log-warning’
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’.
2016-09-11 18:12:33 +02:00
Noam Postavsky
031af49e74 Fix byte-compile of interactive closures
* lisp/emacs-lisp/bytecomp.el (byte-compile--reify-function): Put
bindings after docstring and `interactive' form, if any (Bug #24122).
2016-08-06 16:16:02 -04:00
Paul Eggert
66cd9187e3 Don’t document declare-function internals
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).
2016-05-27 18:17:04 -07:00
Paul Eggert
f865e2f1e8 Fix byte-compiler pacification for declare-function
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.
2016-05-26 19:10:47 -07:00
Paul Eggert
b4d1cddc1b Pacify byte-compiler for byte-compile-macroexpand-declare-function
* lisp/emacs-lisp/bytecomp.el: Change signature of
byte-compile-macroexpand-declare-function to match that of
declare-function.
2016-05-18 00:49:30 -07:00
John Wiegley
0608bf1c3d Merge from origin/emacs-25
ee73997 Make erc work better when encountering unknown prefix chars
b99141d Make erc completion case-insensitive again
66c4620 Make complection in erc use consistent casing
8c562b2 Make /QUIT in erc more robust
d93d2c5 Make tracking faces in Emacs work more reliably
af6ab7e Make shr not bug out on images on non-graphical displays
3311f40 Fix bookmark display widths
d90ab1e Fix typo in eww-make-unique-file-name
7f81825 Make it possible to TAB to input fields
a43a1dc Insert complete alt texts when images are disabled
56ed4e1 Allow eww text fields to grow
66b315c Make erc work when subword-mode is switched on
255b68f Fix IMAP doc example
91557f5 Quoting fixes in doc strings and diagnostics
2c0dc9f Fix warning message in hack-local-variables
504696d Etags: yet another improvement in Ruby tags
8784ebf Fix x-popup-menu on TTYs without a mouse
8b87ecb * lisp/emacs-lisp/map.el: Improvements to the docstring of the
        pcase macro
6191003 Use pop-to-buffer-same-window in eww
fe321fd * autogen.sh: Revert all recent changes.
74ebd4a * make-dist: Updates related to nt/.
737193a * make-dist: Add modules/.
3696bf2 * make-dist: Update for super-special file that can't live in etc/.
a4278e2 Fix failure to compile ns-win.el in parallel builds
860da4d Fix names of tags generated for Ruby accessors
f6213ce Fix file-name recognition in 'etags'
e42e662 Change Ruby file names and extensions recognized by 'etags'
58bfb6a More improvements for Ruby support in 'etags'
c04e911 Add --git-config option to autogen.sh
5713466 Fix editing undo changes in eww fields
51362d6 Allow the user more control of popping up the eww window
ee0fbd8 Make eww-browse-url with new-window parameter work again
9c3142d Clean up eww code slightly
cb035f3 Don't insert nil faces in shr
4c3fae3 ; * lisp/progmodes/prolog.el: Remove some obsolete commentary.
93f2153 Improve the custom type of some user options.
9f60d7e Mark some risky calendar variables.
1d07dcd Highlight two additional SCSS keywords
ee8b466 Recommend enabling integrity-checking in git
e639e10 Some corrections in Elisp manual
d766ca8 Chatter when autogen.sh changes Git configuration
3b734e1 * org/org-compat.el (org-font-lock-ensure): Fix bogus test (bug#22399)
43cb9f8 Omit unnecessary history from Lisp intro
2fbd1da * etc/HISTORY: Add some more history, plus git tags.
c90e1b4 Improve elisp “Security Considerations” doc
cedd7ca autogen.sh now arranges for git to check hashes
86ce76b ; Fix ChangeLog.2 commit ID.
7b1d2b1 Fix (c & 040) typo in emergency escapes
a8273da Fix display of overlay strings with 'display' and 'box' property
fc48106 Fix imap-starttls-open
cdecbed Fix return value of imap-starttls-open
20c7e34 ; * etc/NEWS: Fix renamed command name
98bdbdb Correct reference to DARWIN_OS preprocessor symbol
b250d29 Spelling fix
b920a0e Spelling fixes
93b144b Pacify GCC on C library without glibc API
2016-02-03 23:56:08 -08:00
Paul Eggert
91557f5e2d Quoting fixes in doc strings and diagnostics
* lisp/emacs-lisp/bytecomp.el (byte-compile-setq, byte-compile-funcall):
* lisp/gnus/mml-smime.el (mml-smime-get-dns-cert)
(mml-smime-get-ldap-cert):
Follow user style preference when quoting diagnostics.
2016-02-03 17:20:17 -08:00
Glenn Morris
c3a2eded19 * lisp/emacs-lisp/bytecomp.el (byte-compile-nogroup-warn):
Warn if defcustom has no type.  (Bug#16276)
2016-01-28 17:16:51 -05:00
Paul Eggert
0e963201d0 Update copyright year to 2016
Run admin/update-copyright.
2016-01-01 01:34:24 -08:00
Paul Eggert
36649e0150 Spelling and grammar fixes 2015-11-29 21:52:17 -08:00
Alan Mackenzie
5cf012a3a8 Byte compiler: Catch missing argument to `funcall'. Fixes bug#22051.
* lisp/emacs-lisp/bytecomp.el (byte-compile-funcall): When there's no argument
to `funcall', (i) Output an error message; (ii) Generate code to signal a
`wrong-number-of-arguments' error.
2015-11-29 16:17:07 +00:00
Alan Mackenzie
af40b7689a Byte Compiler: generate code to adjust stack count after call to `signal'.
Corrects change from earlier today.

* lisp/emacs-lisp/bytecomp.el (byte-compile-setq): supply the current value of
`byte-compile--for-effect' as argument to `byte-compile-form'.
2015-11-26 20:57:34 +00:00