Commit graph

6073 commits

Author SHA1 Message Date
Lars Ingebrigtsen
fc8a8bdb7f Move around defgeneric/defmethods in eieio
* lisp/emacs-lisp/eieio.el (object-print):
* lisp/emacs-lisp/eieio-base.el (eieio-object-set-name-string):
Move the defgeneric before the defmethod, because that makes more
sense.
2019-06-19 17:12:29 +02:00
Stefan Monnier
416b83e907 (with-suppressed-warnings): Make it apply to macro-expansion as well
* lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
Change with-suppressed-warnings so it also affects the macro-expansion of
the body.
2019-06-19 10:47:55 -04:00
Lars Ingebrigtsen
eef48e124d Tweak progress reporting in update-directory-autoloads
* lisp/emacs-lisp/autoload.el (update-directory-autoloads): Use
progress reporter so say what percentage the progress is at.
2019-06-19 13:48:48 +02:00
Mattias Engdegård
d3a7f3e6cd Compile any subsequence of `cond' clauses to switch (bug#36139)
A single `cond' form can how be compiled to any number of switch ops,
optionally interspersed with non-switch conditions.
Previously, switch ops would only be used for whole `cond' forms
containing no other tests.

* lisp/emacs-lisp/bytecomp.el (byte-compile--cond-vars):
Rename from `byte-compile-cond-vars'.
(byte-compile--default-val): Remove.
(byte-compile--cond-switch-prefix):
Replace `byte-compile-cond-jump-table-info'; now also returns
trailing non-switch clauses.
(byte-compile-cond-jump-table): New arguments; no longer compiles
the default case.
(byte-compile-cond): Look for and compile switches at any place in the
list of clauses.
* test/lisp/emacs-lisp/bytecomp-tests.el (byte-opt-testsuite-arith-data):
Add test expression.
2019-06-19 11:22:21 +02:00
Mattias Engdegård
14a81524c2 Compile cond with heterogeneous tests into switch (bug#36139)
Allow any mixture of `eq', `eql' and `equal', `memq', `memql' and
`member' in a switch-like `cond' to be compiled into a single switch.

* lisp/emacs-lisp/bytecomp.el (byte-compile--common-test): New.
(byte-compile-cond-jump-table-info): Use most specific common test.
* test/lisp/emacs-lisp/bytecomp-tests.el (byte-opt-testsuite-arith-data):
Add test cases for multi-value clause cond forms.
2019-06-19 11:20:59 +02:00
Mattias Engdegård
b8c74742c0 Tighter pcase or-pattern member function selection (bug#36139)
* lisp/emacs-lisp/pcase.el (pcase--u1):
Use the most specific of `memq', `memql' and `member' in or-patterns
with constant cases.  This improves performance and may help the byte-code
compiler generate a switch.
* test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-member):
Add mixed-type or-pattern test cases.
2019-06-19 11:20:58 +02:00
Mattias Engdegård
36ab408207 Compile list member functions in cond to switch (bug#36139)
* lisp/emacs-lisp/bytecomp.el (byte-compile-cond-jump-table-info):
Expand `memq', `memql' and `member' to their corresponding
equality tests.
(byte-compile-cond-jump-table): Cases now have multiple values.
* lisp/emacs-lisp/byte-opt.el (byte-decompile-bytecode-1)
(byte-optimize-lapcode): Don't assume switch hash tables to be injective.
2019-06-19 11:20:58 +02:00
Lars Ingebrigtsen
6a02ca0b8c Report progress during custom-make-dependencies instead of file count
* lisp/cus-dep.el (custom-make-dependencies): Rewrite to use
reporter to report progress instead of how many files we've
processed.

* lisp/emacs-lisp/byte-run.el (byte-compile-info-string): New function.
(byte-compile-info-message): Use it.
2019-06-18 15:24:10 +02:00
Lars Ingebrigtsen
a5269a7fcf Tweak implementation of byte-compile-info-message
* lisp/emacs-lisp/byte-run.el (byte-compile-info-message): Clean
up implementation.
2019-06-18 10:36:14 +02:00
Lars Ingebrigtsen
56a90c4234 Output progress messages when scraping autoloads during bootstrap
* lisp/emacs-lisp/byte-run.el (byte-compile-info-message): New
function to outout informational messages during byte compilation.

* lisp/emacs-lisp/autoload.el (update-directory-autoloads): Use it
to report progress when scraping autoloads during bootstrap (which
may take half a minute).
2019-06-18 01:05:58 +02:00
Lars Ingebrigtsen
aed6e2f7c6 Compilation work-around for obsolete eieio-object-set-name-string
* lisp/emacs-lisp/eieio-base.el (eieio-object-set-name-string):
Move the generic definition of this method to here from eieio.el
and place it after the cl-method definition.  This avoids a
warning about it being obsolete when doing macro expansion.
2019-06-17 21:53:22 +02:00
Lars Ingebrigtsen
f8efeee0e1 Work around warning from macroexpanding obsolete method
* lisp/emacs-lisp/eieio.el (object-print): Move method definition
to before generic definition because the generic definition
obsoletes the method, which will then output a warning from when
macroexpanding.
2019-06-17 21:40:12 +02:00
Lars Ingebrigtsen
c0b322e33c Change the eieio-declare-slots function into a macro
* lisp/emacs-lisp/eieio-core.el (eieio-declare-slots): Change into
a compile-only macro.
2019-06-17 15:48:39 +02:00
Lars Ingebrigtsen
1250a24f8e New function eieio-declare-slots
* lisp/emacs-lisp/eieio-core.el (eieio-declare-slots): New
function to suppress compiler warnings about unknown slots.
2019-06-17 15:46:09 +02:00
Lars Ingebrigtsen
0161a4ae09 Fix compilation warning by having ede-target inherit from eieio-named
* lisp/cedet/ede/base.el (ede-target): Inherit from eieio-named so
that if you're customizing objects via eieio-object-value-get, you
can set the name.

* lisp/emacs-lisp/eieio-custom.el (eieio-object-value-get): Don't
use obsolete function `eieio-object-set-name-string'.
2019-06-17 13:05:40 +02:00
Lars Ingebrigtsen
a7417ddf5e Suppress warning about object-print in eieio.el
* lisp/emacs-lisp/eieio.el (obsolete): Suppress warning about
object-print being obsolete, because there are no in-tree
definitions any more.
2019-06-17 12:12:48 +02:00
Lars Ingebrigtsen
3ccc0d623a Add check for enabled warning before issuing
* lisp/emacs-lisp/bytecomp.el (byte-compile-function-warn): Check
whether we want the `obsolete' warning before issuing it.
2019-06-17 12:09:18 +02:00
Lars Ingebrigtsen
3820b77c9e Suppress warning about object-print in eieio.el
* lisp/emacs-lisp/eieio.el (cl-print-object): Suppress the warning
about object-print being obsolete, since there are no in-tree
methods like that any more.
2019-06-17 11:42:03 +02:00
Lars Ingebrigtsen
5a35377fed Make with-suppressed-warnings work in cl-defmethod
* lisp/emacs-lisp/cl-generic.el (cl-defmethod): Pass the symbol
name on to `byte-compile-warning-enabled-p' to make
with-suppressed-warnings work in cl-defmethods, too.
2019-06-17 11:39:56 +02:00
Lars Ingebrigtsen
1dfd6b4042 Rewrite object-print methods in cedet to be cl-print-object methods
* lisp/cedet/semantic/db-el.el (object-print): Ditto.
(object-print): Ditto.

* lisp/cedet/semantic/db-global.el (object-print): Ditto.

* lisp/cedet/semantic/db.el (object-print): Remove; unused.
* lisp/cedet/semantic/db.el (semanticdb-debug-info): New method.
(object-print): Rewritten to be cl-print-object.

* lisp/emacs-lisp/eieio.el (eieio-object-name): Allow the EXTRA
argument to be a list of strings.
2019-06-17 11:25:34 +02:00
Glenn Morris
421220e294 Tweak compilation mode used by byte-recompile-directory
* lisp/emacs-lisp/bytecomp.el (emacs-lisp-compilation-mode):
Doc fix.
(byte-recompile-directory): Use emacs-lisp-compilation-mode.
2019-06-16 17:37:21 -07:00
Glenn Morris
a95d614c96 Tweak how byte-compile-print-syms fills
* lisp/emacs-lisp/bytecomp.el (byte-compile-print-syms):
Use fill-column from the compile log buffer.
2019-06-16 17:37:21 -07:00
Glenn Morris
9d702b4cd8 Don't hard-code the fill-column for display-warning
* lisp/emacs-lisp/warnings.el (warning-fill-column): New variable.
(display-warning): Use warning-fill-column.
* doc/lispref/display.texi (Warning Variables):
Mention warning-fill-column.
2019-06-16 17:37:21 -07:00
Stefan Monnier
309743b465 * lisp/emacs-lisp/cl-generic.el (gv-setter): Move declaration.
Move it to those places where we know gv has been loaded.
2019-06-16 18:35:35 -04:00
Lars Ingebrigtsen
2f97200bb9 Add comment to eieio-opt about why we're requiring cl-extra
* lisp/emacs-lisp/eieio-opt.el (cl-extra): Add comment about why
we're not requiring cl-lib.
2019-06-16 22:26:40 +02:00
Lars Ingebrigtsen
a1508e8d2d Fix compilation warning about gv-setter in cl-generic
* lisp/emacs-lisp/cl-generic.el (gv-setter): Declare to avoid a
compilation warning.
2019-06-16 17:58:35 +02:00
Lars Ingebrigtsen
98ba1c6b52 Fix compilation warning i eieio-base
* lisp/emacs-lisp/eieio-base.el (clone): Use eieio-object-class
instead of obsolete function class-of.
2019-06-16 16:48:34 +02:00
Lars Ingebrigtsen
bf8c80be7d Compilation fix for previous change to eieio-opt
* lisp/emacs-lisp/eieio-opt.el (cl-extra): Require for
cl--describe-class.
2019-06-16 16:04:51 +02:00
Lars Ingebrigtsen
303637930c Fix compilation warning in eieio-opt
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): Don't
use obsolete function eieio-help-class.
2019-06-16 16:02:42 +02:00
Lars Ingebrigtsen
0c2b747d26 Avoid "unknown slot" compilation warning in eieio-custom
* lisp/emacs-lisp/eieio-custom.el
(eieio-read-customization-group): Slot `name' may not exist in all
classes, so protect against that (and avoid a compilation warning
about it).
2019-06-16 15:53:03 +02:00
Lars Ingebrigtsen
0c01734a32 Fix byte compilation warning in bindat.el
* lisp/emacs-lisp/bindat.el (bindat--unpack-item): Avoid a byte
compilation warning by using unibyte-string instead of concat +
string-make-unibyte.
2019-06-15 16:33:20 +02:00
Lars Ingebrigtsen
7486b8f4eb Avoid compilation warning in byte-run
* lisp/emacs-lisp/byte-run.el (macro-declaration-function): Avoid
compilation warning by not using `symbol-function'.
2019-06-14 13:24:47 +02:00
Lars Ingebrigtsen
a6191e060b Remove outdated FIXME
* lisp/emacs-lisp/eieio-core.el (eieio--slot-name-index): Remove
comment about issuing a byte compilation warning about accessing
slots via :initarg -- it was implemented a few months later.
2019-06-13 17:19:32 +02:00
Pip Cet
bfec493efe Escape newlines when printing functions in timer list
* timer-list.el (list-timers): Bind `print-escape-newlines' to avoid
newlines in printed representation (bug#36187).
2019-06-13 14:11:39 +02:00
Lars Ingebrigtsen
f660616f82 Compilation fix for previous change 2019-06-13 13:56:16 +02:00
Lars Ingebrigtsen
bb5641d3cc Compilation warning fix for disass.el
* lisp/emacs-lisp/disass.el (disassemble-1): Remove a
string-as-unibyte that probably doesn't do anything, because the
string in question should be unibyte anyway.  If the assert fails,
revert the patch.
2019-06-13 13:54:53 +02:00
Glenn Morris
fb69593f60 Revert "Compilation warning fix for byte-run.el"
* lisp/emacs-lisp/byte-run.el (macro-declaration-function):
Revert change that causes a bootstrap failure.

; Ref eg https://hydra.nixos.org/build/94678649
2019-06-12 17:20:50 -07:00
Lars Ingebrigtsen
e4636297c6 Compilation warning fix for byte-run.el
* lisp/emacs-lisp/byte-run.el (macro-declaration-function):
Suppress warning about obsolete function used by obsolete variable.
2019-06-13 01:14:47 +02:00
Lars Ingebrigtsen
48178edeed (beginning-of-defun-raw): Suppress warning about syntax-begin-function
* lisp/emacs-lisp/lisp.el (beginning-of-defun-raw):
font-lock-compile-keywords also suppresses warnings about the
obsolete syntax-begin-function variable, so suppress the only
other use not in syntax.el.
2019-06-12 17:46:06 +02:00
Lars Ingebrigtsen
e4fd2cfc72 Suppress warning about pi not having a prefix
* lisp/emacs-lisp/float-sup.el (pi): Suppress warning about this
obsolete variable not having a prefix.
2019-06-12 17:46:06 +02:00
Lars Ingebrigtsen
f2071b6de4 Add the new macro with-suppressed-warnings
* lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): New macro.

* doc/lispref/compile.texi (Compiler Errors): Document
with-suppressed-warnings and deemphasise with-no-warnings
slightly.

* lisp/emacs-lisp/bytecomp.el (byte-compile--suppressed-warnings):
New internal variable.
(byte-compile-warning-enabled-p): Heed
byte-compile--suppressed-warnings, bound via with-suppressed-warnings.
(byte-compile-initial-macro-environment): Provide a macro
expansion of with-suppressed-warnings.
(byte-compile-file-form-with-suppressed-warnings): New byte hunk
handler for the suppressed symbol machinery.
(byte-compile-suppressed-warnings): Ditto for the byteop.
(byte-compile-file-form-defmumble): Ditto.
(byte-compile-form, byte-compile-normal-call)
(byte-compile-normal-call, byte-compile-variable-ref)
(byte-compile-set-default, byte-compile-variable-set)
(byte-compile-function-form, byte-compile-set-default)
(byte-compile-warn-obsolete, byte-compile--declare-var): Pass the
symbol being warned in to byte-compile-warning-enabled-p.

* test/lisp/emacs-lisp/bytecomp-tests.el (test-suppression): New
function.
(bytecomp-test--with-suppressed-warnings): Tests.
2019-06-12 15:59:19 +02:00
Noam Postavsky
0026d0bf9f Don't keep warning about unescaped literals (Bug#36068)
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Restore lost
let-binding of lread--unescaped-character-literals, so that unescaped
literals warning will only apply to the form just read.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--unescaped-char-literals): Expand test to check that
we don't keep warning about old unescaped literals.
2019-06-10 18:27:22 -04:00
Stefan Kangas
1af27a1784 Use lexical-binding in password-cache.el and add tests
* lisp/password-cache.el: Use lexical-binding.
* test/lisp/password-cache-tests.el: New file.
2019-06-09 10:08:36 -07:00
Glenn Morris
5e1e1e71cc Merge from origin/emacs-26
2860285 Allow macros autoloaded as functions during bytecomp (Bug#36022)
2019-06-07 07:50:48 -07:00
Dario Gjorgjevski
dec148939a Do not use syntax-ppss-table in syntax-propertize when nil (Bug#36095)
* lisp/emacs-lisp/syntax.el (syntax-propertize): Use (syntax-table)
instead of syntax-ppss-table when the latter is nil.
2019-06-05 07:29:23 -04:00
Stefan Monnier
0b3982b1a3 * lisp/emacs-lisp/syntax.el: Use syntax-ppss-table for syntax-propertize.
`syntax-ppss` uses `syntax-ppss-table` while parsing the buffer as well
as when it calls `syntax-propertize`, but `syntax-propertize` can also
be called directly rather than via `syntax-ppss` so it needs to explicitly
use `syntax-ppss-table` as well in order to avoid using sometimes one
table and sometimes another.

(syntax-ppss-table): Move before new use.
(syntax-propertize): Use it.
2019-06-04 21:48:06 -04:00
Stefan Monnier
f4d3253831 * lisp/emacs-lisp/thunk.el (thunk-delay): Fix memory leak
Get rid of references to the free variables of `body` once the thunk has
been forced (bug#30626).
2019-06-04 12:55:53 -04:00
Paul Eggert
741d04a879 Adjust comments/debug to match C bignum code
* doc/lispintro/emacs-lisp-intro.texi (Digression into C):
Adjust to match current C code.
* lisp/emacs-lisp/ert.el (ert--force-message-log-buffer-truncation):
Simplify.
* src/.gdbinit (Lisp_Object_Printer.to_string): Return
a string that says "make_fixnum", not "make_number".
2019-06-04 08:34:16 -07:00
Paul Eggert
bee3cc604d Tune cl-assoc
* lisp/emacs-lisp/cl-seq.el (cl-assoc):	Use assq for fixnums.
2019-06-01 18:13:00 -07:00
Mattias Engdegård
b5e41e8ba3 Fix cl-member' and cl-assoc' for bignums
* lisp/emacs-lisp/cl-seq.el (cl-member, cl-assoc): Work with bignums.
* test/lisp/emacs-lisp/cl-seq-tests.el (cl-seq-bignum-eql): New.
2019-06-01 18:13:00 -07:00