Commit graph

5173 commits

Author SHA1 Message Date
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
Stefan Monnier
1a6597660a * lisp/emacs-lisp/cl-print.el (cl-print-object): Use #f(..) for functions. 2017-03-07 20:35:40 -05:00
Phillip Lord
542a763281 Revert "Replace ldefs-boot with a much smaller file"
This reverts commit c27b645956.

This commit has been reverted because the new mechanism was too
sensitive to changes in the lisp source, generation of new ldefs-boot
files was platform specific and resulted in warnings about undefined
variables.

See also 11436e2890d.
2017-03-07 13:49:48 +00:00
Paul Eggert
788a5b8447 ; Spelling fixes 2017-03-05 08:19:06 -08:00
Tino Calancha
244de7b0ed Use lexical binding in benchmark.el
* lisp/emacs-lisp/benchmark.el: Enable lexical binding.
(benchmark-elapse): Use 'declare'.
* test/lisp/emacs-lisp/benchmark-tests.el: Add test suite.
2017-03-03 18:26:30 +09:00
Noam Postavsky
f5388ba8a7 Switch pp.el to lexical binding
Additionally, do some minor code cleanup.

* lisp/emacs-lisp/pp.el: Set lexical-binding.
(pp-buffer): Use skip-syntax-forward.
(pp-eval-expression): Use push.
(pp-last-sexp): Use with-syntax-table.
* test/lisp/emacs-lisp/pp-tests.el: New tests.
2017-03-02 23:03:20 -05:00
Chunyang Xu
55c0c3e31b Fix completing-read call in reb-change-syntax
* lisp/emacs-lisp/re-builder.el (reb-change-syntax): Use 'default' arg
of completing-read.

Copyright-paperwork-exempt: yes
2017-03-02 19:01:18 -05:00
Glenn Morris
dacafa8c30 Ert commands to error if no test at point (bug#25931)
* lisp/emacs-lisp/ert.el (ert-results-mode-menu):
Deactivate some items if no test at point.
(ert--results-test-at-point-no-redefinition):
Add option to signal an error rather than return nil.
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-results-describe-test-at-point): Error if no test at point.
2017-03-02 15:40:15 -05:00
Tino Calancha
4daca38d5c Prevent for consing in cl-mapc and cl-mapl
* lisp/emacs-lisp/cl-extra.el (cl--mapcar-many): Add optional arg ACC;
If non-nil, accumulate values in the result (Bug#25826).
(cl-mapc): Do computations inside function instead of call cl-map.
(cl-mapl): Do computations inside function instead of call cl-maplist.
* lisp/emacs-lisp/cl-lib.el (mapcar): Add autoload cookie.
Call cl--mapcar-many with non-nil 3rd argument.
* test/lisp/emacs-lisp/cl-extra-tests.el (cl-extra-test-map)
(cl-extra-test-mapc, cl-extra-test-mapcar, cl-extra-test-mapl)
(cl-extra-test-maplist): New tests.
2017-02-27 16:32:10 +09:00
Noam Postavsky
6b6cc56e72 Don't call package--ensure-init-file if initialized during startup
* lisp/emacs-lisp/package.el (package-initialize): Check
`after-init-time' rather than `load-file-name' to decide if
`package--ensure-init-file' should be called.  Depending on
`load-file-name' will fail if the user calls `pacakge-initialize' in
file which is loaded from the init file (Bug#24643, Bug#25819).
2017-02-26 11:11:40 -05:00
Stefan Monnier
91932fff1d Use cl-print for Edebug and EIEIO
* lisp/emacs-lisp/edebug.el (edebug-prin1-to-string): Use cl-print.
(edebug-prin1, edebug-print): Remove.

* lisp/emacs-lisp/eieio.el (object-print): Declare obsolete.
(cl-print-object): Add a method for EIEIO objects.
(eieio-edebug-prin1-to-string): Delete.
(edebug-prin1-to-string): Don't advise any more.

* lisp/emacs-lisp/eieio-datadebug.el (data-debug-insert-object-button):
Replace `object-print' -> `cl-prin1-to-string'.
2017-02-23 22:39:53 -05:00
Stefan Monnier
407e650413 * lisp/emacs-lisp/cl-print.el: New file
* lisp/emacs-lisp/nadvice.el (advice--where): New function.
(advice--make-docstring): Use it.

* src/print.c (print_number_index): Don't declare here any more.
(Fprint_preprocess): New function.

* test/lisp/emacs-lisp/cl-print-tests.el: New file.
2017-02-23 21:06:54 -05:00
Gemini Lasswell
8b912ab47b Support read syntax for circular objects in Edebug (Bug#23660)
* lisp/emacs-lisp/edebug.el (edebug-read-special): New name
for edebug-read-function. Handle the read syntax for circular
objects.
(edebug-read-objects): New variable.
(edebug-read-and-maybe-wrap-form1): Reset edebug-read-objects.

* src/lread.c (Fsubstitute_object_in_subtree): Make
substitute_object_in_subtree into a Lisp primitive.
2017-02-23 20:21:11 -05:00
Stefan Monnier
fb997d30af * lisp/emacs-lisp/cl-generic.el (cl--generic-typeof-types): Add `atom'
remove entries whose car can't be returned by type-of.
(cl--generic-all-builtin-types): New var.
(cl-generic-generalizers): Use it to avoid requiring
extra entries in cl--generic-typeof-types.
2017-02-21 21:47:10 -05:00
Stefan Monnier
3f1cd957ff * lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Fix last change 2017-02-21 21:32:27 -05:00
Stefan Monnier
bac7de05e2 * lisp/emacs-lisp/autoload.el (make-autoload): Support cl-defgeneric
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Tweak for autoloading.
2017-02-21 13:51:12 -05:00
Stefan Monnier
e785c74d3a * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Fix duplication
which resulted in incomplete list of parents in one copy of the
cl-structure-class class.
2017-02-21 13:48:30 -05:00
Noam Postavsky
2f53c0c468 Simplify cl-get using `plist-member'
* lisp/emacs-lisp/cl-extra.el (cl-get, cl-getf, cl--set-getf): Use
`plist-member' instead of explicit loop.
* test/lisp/emacs-lisp/cl-extra-tests.el: New tests.
2017-02-20 16:53:14 -05:00
Mark Oteiza
edadd31bf4 Turn on lexical-binding in elint.el
* lisp/emacs-lisp/elint.el: Quote entry point commands in commentary.
(elint-running, elint-current-pos): Move these dynamic vars to toward
the top of the file.
(elint-check-quote-form): Ignore unused argument.
(elint-check-conditional-form): Remove unused binding.
2017-02-17 18:52:12 -05:00
Gemini Lasswell
5401820672 * lisp/emacs-lisp/subr-x.el (if-let*): Fix Edebug spec (Bug#24748) 2017-02-17 18:47:50 -05:00
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
Mark Oteiza
1b4442bee9 Don't expand body inside a let-binding when there are no bindings
* lisp/emacs-lisp/pcase.el (pcase-codegen): Only let-bind if VARS
is non-nil.
2017-02-15 20:40:46 -05:00
Vibhav Pant
71b90192da byte-opt: Replace merged tags in jump tables too. (bug#25716)
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): While merging
  adjacent tags, make sure that the old tag is replaced in all jump
  tables, if any. This fixes the bytecode VM jumping to the wrong
  address in compiled cond forms where the body of a clause was a loop
  of any sort.
2017-02-14 21:53:26 +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
c1a9b5db0e Merge branch 'master' into feature/byte-switch 2017-02-11 19:54:37 +05:30
Gemini Lasswell
c48f8fa51b Fix instrumenting code with propertized strings in Edebug
* lisp/emacs-lisp/edebug.el (edebug-read-function): Allow
'read' to decide what is and isn't a syntax error.  (Bug#25068)
2017-02-10 11:35:20 +02:00
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
ad70ca1dad Merge remote-tracking branch 'origin/master' into feature/byte-switch 2017-02-05 23:08:53 +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
74a3423b0b * byte-opt.el (byte-decompile-bytecode-1): Use eq instead of =. 2017-02-05 22:10:22 +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
fea1ad36a0 ; * byte-opt.el (byte-decompile-bytecode-1): Add more documentation. 2017-02-05 18:55:45 +05:30
Vibhav Pant
84eef50155 byte-opt.el: Replace jump tables while decompiling correctly.
* lisp/emacs-lisp/byte-opt.el (byte-decompile-bytecode-1):
  Don't make a copy of the constant vector, as it isn't used with
  the decompiled lapcode.
  Make sure that the correct lapcode pair/list is being modified while
  replacing the jump table.
2017-02-05 18:49:24 +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
Gemini Lasswell
ef3d8d6f72 New macro 'ert-with-message-capture'
* lisp/emacs-lisp/ert-x.el (ert-with-message-capture): New macro.
(Bug#25158)

* test/lisp/autorevert-tests.el (auto-revert--wait-for-revert)
(auto-revert-test00-auto-revert-mode)
(auto-revert-test01-auto-revert-several-files)
(auto-revert-test02-auto-revert-deleted-file)
(auto-revert-test03-auto-revert-tail-mode)
(auto-revert-test04-auto-revert-mode-dired):
* test/lisp/filenotify-tests.el (file-notify-test03-autorevert): Use
ert-with-message-capture.
2017-02-04 13:36:43 +02:00
Gemini Lasswell
8ba27b7ce2 Avoid invalid read syntax errors due to 'ert-with-test-buffer'
* lisp/emacs-lisp/ert-x.el (ert-with-test-buffer): Fix the
'declare' form.  (Bug#24722)
2017-02-04 13:18:29 +02:00
Eli Zaretskii
a46a61904d Fix a syntax error when evaluating pcase.el under Edebug
* lisp/emacs-lisp/pcase.el (pcase-MACRO): Replace def-edebug-spec
with an explicit 'put' form.  Suggested by Gemini Lasswell
<gazally@runbox.com>.  (Bug#24717)
2017-02-04 13:12:14 +02:00
Gemini Lasswell
78f841d6db Change edebug-max-depth from defconst to defcustom
* lisp/emacs-lisp/edebug.el (edebug-max-depth): Add defcustom.
(Bug#24713)

* etc/NEWS: Mention edebug-max-depth.

* doc/lispref/edebug.texi (Checking Whether to Stop): Mention
edebug-max-depth and index it.  Add cross-references for
max-lisp-eval-depth and max-specpdl-size.

Co-authored-by: Eli Zaretskii <eliz@gnu.org>
2017-02-04 12:56:19 +02:00
Mark Oteiza
be10c00d3d Rename to if-let* and when-let*
Make the existing if-let and when-let aliases.
* lisp/emacs-lisp/subr-x.el (if-let*, when-let*): New macros.  Rewrite
docstrings, incorporating that from let* and the existing if-let.
(if-let, when-let, and-let*): Alias them.
2017-02-03 21:42:42 -05:00
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
Mark Oteiza
12da2a5bea ; Bump let-alist
* lisp/emacs-lisp/let-alist.el: Bump micro version (bug#24641).
2017-01-31 19:47:53 -05:00