Commit graph

8045 commits

Author SHA1 Message Date
Mattias Engdegård
204273c3b9 Fix byte-compilation of (+ -0.0) (bug#42597)
* lisp/emacs-lisp/bytecomp.el (byte-compile-associative):
Translate numerical identity expressions, such as (+ x) and (* x),
into (* x 1) since the previous translation (+ x 0) gets it wrong
for x = -0.0.
* test/lisp/emacs-lisp/bytecomp-tests.el
(byte-opt-testsuite-arith-data): Add test cases.
2020-08-07 09:41:15 +02:00
Lars Ingebrigtsen
47910420c0 Tweak the autoloads scrape output slightly
* lisp/emacs-lisp/autoload.el (batch-update-autoloads--summary):
Output " ..." at the end of the non-concluding lines to signify
that the output continues.
2020-08-06 08:24:56 +02:00
Lars Ingebrigtsen
104dd3b641 Make the loaddefs scraping compilation output look more regular
* lisp/Makefile.in ($(lisp)/loaddefs.el): Don't output the
directories here.

* lisp/emacs-lisp/autoload.el (batch-update-autoloads--summary):
New function.
(batch-update-autoloads): Use it to output the directories we're
scraping.

This changes the compilation output from:

Directories for loaddefs: . ./calc ./calendar ./cedet ./cedet/ede
./cedet/semantic ./cedet/semantic/analyze ./cedet/semantic/bovine
./cedet/semantic/decorate ./cedet/semantic/symref ./cedet/semantic/wisent
./cedet/srecode ./emacs-lisp ./emulation ./erc ./eshell ./gnus ./image
./international ./language ./leim ./leim/ja-dic ./leim/quail ./mail ./mh-e
./net ./nxml ./org ./play ./progmodes ./textmodes ./url ./vc

(but all on one long line)

To:

  SCRAPE   . ./calc ./calendar ./cedet ./cedet/ede ./cedet/semantic
  SCRAPE   ./cedet/semantic/analyze ./cedet/semantic/bovine
  SCRAPE   ./cedet/semantic/decorate ./cedet/semantic/symref
  SCRAPE   ./cedet/semantic/wisent ./cedet/srecode ./emacs-lisp ./emulation
  SCRAPE   ./erc ./eshell ./gnus ./image ./international ./language ./leim
  SCRAPE   ./leim/ja-dic ./leim/quail ./mail ./mh-e ./net ./nxml ./org ./play
  SCRAPE   ./progmodes ./textmodes ./url ./vc

Compilation output with very long lines can be mistaken for errors
when they scroll by fast in the compilation output.  Making it look
more like normal informational output avoids this confusion.
2020-08-06 08:20:09 +02:00
Lars Ingebrigtsen
7384f194be Make 'byte-compile-info*' functions more logical
* lisp/emacs-lisp/byte-run.el (byte-compile-info): New function
that's more flexible that replaces 'byte-compile-info-string' and
'byte-compile-info-message'.
(byte-compile-info-string): Make obsolete.
(byte-compile-info-message): Ditto.

* lisp/international/ja-dic-cnv.el (skkdic-convert-okuri-ari)
(skkdic-convert-postfix, skkdic-convert-prefix)
(skkdic-collect-okuri-nasi, skkdic-set-okuri-nasi):
* lisp/finder.el (finder-compile-keywords):
* lisp/cus-dep.el (custom-make-dependencies): Adjust callers to
use the new function.
2020-08-06 08:12:31 +02:00
Philipp Stephani
ca419812d3 Avoid duplicate Edebug symbols when backtracking (Bug#42701)
When Edebug backtracks, it nevertheless generates definitions for the
non-matching branches, see Bug#41988 and Bug#42701.  This should be
fixed eventually (probably by deferring the definition until a branch
is known to match), but for now add a band-aid to avoid these
duplicate symbols, at least for anonymous forms.

* lisp/emacs-lisp/edebug.el (edebug-make-enter-wrapper): Regenerate
anonymous names.

* test/lisp/emacs-lisp/edebug-tests.el
(edebug-tests-duplicate-symbol-backtrack): New regression test.
2020-08-03 21:07:32 +02:00
Philipp Stephani
a325584281 Improve Edebug symbols for inlined secondary methods (Bug#42671)
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Include qualifiers in
Edebug symbol name.

* test/lisp/emacs-lisp/cl-generic-tests.el
(cl-defgeneric/edebug/method): Adapt unit test.
2020-08-02 22:07:27 +02:00
Philipp Stephani
3e0c3479b2 Add a workaround for Bug#42672
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Work around Bug#42672
by uniquifying inline method names.

* test/lisp/emacs-lisp/cl-generic-tests.el
(cl-defgeneric/edebug/method): New regression test.
2020-08-02 18:05:36 +02:00
Andrea Corallo
80d7f710f2 * Fix defsubst missing inline Bug#42664
* lisp/emacs-lisp/byte-run.el (defsubst): Do not native compile
	defsubsts to have them always effective.
2020-08-02 17:51:44 +02:00
Philipp Stephani
d8ab98843e Avoid duplicate Edebug symbols when using ‘cl-flet’ (Bug#41989)
* lisp/emacs-lisp/edebug.el (edebug-match-:unique): Add a new
‘:unique’ specifier to generate unique names.

* lisp/emacs-lisp/cl-macs.el (cl-flet): Use it.  This requires
inlining the ‘cl-defun’ specification.

* test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-cl-flet): New
unit test.

* doc/lispref/edebug.texi (Specification List): Document new ‘:unique’
construct.
2020-08-02 17:39:24 +02:00
Andrea Corallo
e5095f0fd3 Merge remote-tracking branch 'savannah/master' into HEAD 2020-08-02 17:36:29 +02:00
Philipp Stephani
e6eb554b95 Don’t generate duplicate symbols for secondary CL methods (Bug#42671)
* lisp/emacs-lisp/edebug.el
(edebug-match-cl-generic-method-qualifier): Add matcher for
‘cl-defmethod’ qualifier.

* lisp/emacs-lisp/cl-generic.el (cl-defmethod): Use it.

* test/lisp/emacs-lisp/edebug-tests.el
(edebug-cl-defmethod-qualifier): New unit test.
2020-08-02 16:06:41 +02:00
Glenn Morris
fbe363f5e1 ; Maintainer header updates 2020-07-31 09:09:39 -07:00
Stefan Monnier
450b50df11 * lisp/emacs-lisp/byte-opt.el: Minor simplifications
(byte-optimize-form-code-walker): Use `byte-optimize-form` after
inlining, so optimizations are also applied to the top level call.
Simplify the code for `pure` functions using `byte-optimize-constant-args`.
(byte-optimize-all-constp): Remove, not used any more.
(byte-optimize-1+, byte-optimize-1-): Remove, they are redundant
with the `pure` annotation.
2020-07-31 11:58:13 -04:00
Stefan Kangas
7899fa4309 Declare some ancient compat aliases obsolete (Bug#41328)
* lisp/comint.el (comint-read-noecho):
* lisp/emacs-lisp/edebug.el (edebug-all-defuns):
* lisp/man.el (manual-entry):
* lisp/vc/log-edit.el (vc-log-mode-map, vc-log-entry-mode): Declare
ancient backwards-compatibility aliases and functions obsolete.  The
oldest in this list was added in 1992, and the most recent in 2004.

* lisp/net/telnet.el (telnet-initial-filter): Don't use
`comint-read-noecho'.
2020-07-31 06:02:30 +02:00
Mattias Engdegård
e5889c704f Simplify and streamline optimizer clauses
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Remove clause for 'with-output-to-temp-buffer', since it is a
macro and will have been expanded before reaching this point.
Move clauses for 'lambda' and 'closure' to avoid splitting
a cond jump table.
2020-07-28 15:48:38 +02:00
João Távora
9d751aa822 Make newer ElDoc versions are compatible with Emacs < 28
Fixes: bug#42563

For some time, Eldoc has has some Elisp-specific code that shouldn't
live there, but in elisp-mode.el.  This can be fixed in Emacs master,
but since ElDoc is distributed in GNU Elpa and is meant to work with
Emacs 26 and 27, this means that that elisp-specific code must still
be distributed with eldoc.el and kept up to date.

* lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): Ensure
implementation is compatible with Emacs < 28.
(Version): Bump to 1.8
2020-07-27 22:18:57 +01:00
João Távora
688c03f412 Bring back ElDoc's eldoc-display-message-p, but obsolete it
Like others, this is an implementation detail that third parties could
be relying on.  Better not remove it outright just now, since its
implementation is very simple anyway.

* lisp/emacs-lisp/eldoc.el (Version): Bump to 1.7.0
(eldoc-display-message-p): Bring back, but obsolete.
2020-07-27 16:26:33 +01:00
Andrea Corallo
7a161dc688 Merge remote-tracking branch 'savahnna/master' into HEAD 2020-07-26 09:40:02 +02:00
Andrea Corallo
6c108e44c9 * Add `comp-ensure-native-compiler' guarding entry points
* lisp/emacs-lisp/comp.el (comp-ensure-native-compiler): New function.
	(native-compile, batch-native-compile)
	(batch-byte-native-compile-for-bootstrap, native-compile-async):
	Make use of `comp-ensure-native-compiler'.
2020-07-26 09:36:09 +02:00
Mattias Engdegård
609cbd63c3 Optimise 3-arg +, - and *
Turn (+ a b c) into (+ (+ a b) c), and do the same for - and *.
The 2-arg operations have their own bytecode which results in a 1.5×
speed-up.  Furthermore, the transform enables other optimisations; for
example, (+ a 1 b) -> (+ (1+ a) b).

* lisp/emacs-lisp/byte-opt.el (byte-optimize-plus, byte-optimize-minus)
(byte-optimize-multiply): Transform (OP a b c) into (OP (OP a b) c).
2020-07-25 19:24:56 +02:00
João Távora
fcd43287b3 Don't needlessly request docs from ElDoc functions
Fixes: bug#42421

Do this conservatively for now: if the ElDoc helper buffer (as
returned by eldoc--doc-buffer) is visible and showing documentation
for the very same "situation" (as computed by the the new
eldoc--request-state helper), don't request that documentation from
sources again.

Before this change, not only was that request inefficient but if the
user invoked scroll-other-window to see more of the helper buffer,
that would eventually cause it to be reformatted and unexpectedly
recentered.

Later on, when a customizable list of documentation "sinks" is offered
to the user, say, something like eldoc-display-functions, this process
must be consolidated.  In those circumstances, as soon as one of those
sinks signals that it doesn't have up-to-date documentation for the
state computed by eldoc--request-state, documentation will have to be
requested anew from eldoc-documentation-functions via
eldoc--invoke-strategy.

* lisp/emacs-lisp/eldoc.el (eldoc--request-docs-p): Rework from
eglot-display-message-p.
(eldoc--last-request-state): New variable.
(eldoc--request-state): New helper.
(eldoc--handle-docs): Memorize state of request in doc buffer.
(eldoc-print-current-symbol-info): Pass a token to
eldoc--request-docs-p.
(Version): Bump to 1.6.0
2020-07-23 11:57:27 +01:00
Andrea Corallo
37e0dbc972 Merge remote-tracking branch 'savannah/master' into HEAD 2020-07-19 20:39:27 +01:00
João Távora
c77731e824 Fix ElDoc bugs around eldoc-echo-area-use-multiline-p.
If the value is 'truncate-sym-name-if-fit andthe single docstring
doesn't fit in the echo area even when the symbol name is elided, that
step shouldn't be attempted.  Also if the value is nil, really ensure
that only the first line is shown.

* lisp/emacs-lisp/eldoc.el (eldoc--handle-docs): Rework
'truncate-sym-name-if-fit case of eldoc-echo-area-use-multiline-p.
2020-07-19 00:59:14 +01:00
João Távora
4a7ecaaee0 ; Reword bits of ElDoc internal documentation
* lisp/emacs-lisp/eldoc.el (eldoc--invoke-strategy): Rewrite docstring.
(eldoc--invoke-strategy): Fix formatting and rewrite comments
2020-07-19 00:59:14 +01:00
Lars Ingebrigtsen
ba12555fda Fix NOT-CURRENT behaviour in text-property-search-backward
* lisp/emacs-lisp/text-property-search.el
(text-property-search-backward): Fix inconsistent behaviour of
S-TAB in eww (and other callers that use the NOT-CURRENT
behaviour) when there are adjacent elements
(bug#39239).
2020-07-17 18:44:49 +02:00
Andrea Corallo
907618b3b5 Merge remote-tracking branch 'savahnna/master' into HEAD 2020-07-15 23:13:59 +02:00
Tassilo Horn
85eaa8373b ;Fix eldoc regression bug#42365 2020-07-15 18:58:57 +02:00
Andrea Corallo
4c46f8bac0 * Add a simple major mode for coloring LIMPLE in the log buffer
* lisp/emacs-lisp/comp.el (comp-limple-lock-keywords): New const.
	(comp-limple-mode): New major mode.
	(comp-log-to-buffer): Enable `comp-limple-mode' in the log buffer.
2020-07-15 09:34:16 +02:00
Basil L. Contovounesios
36e6019034 Consistently stylize eldoc as ElDoc in more prose
This fixes new occurrences of "Eldoc" since emacs-27.

* doc/lispref/modes.texi (Major Mode Conventions):
* etc/NEWS:
* lisp/descr-text.el (describe-char-eldoc):
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
(eldoc-prefer-doc-buffer, eldoc--documentation-strategy-defcustom):
Consistently capitalize eldoc as ElDoc rather than Eldoc in
documentation and commentary.
2020-07-14 13:49:34 +01:00
Andrea Corallo
5be335e6b5 Merge remote-tracking branch 'savahnna/master' into HEAD 2020-07-13 15:13:46 +02:00
Andrea Corallo
eb091c8647 * Rename comp-propagate' into fw-prop'
* lisp/emacs-lisp/comp.el (comp-passes): Rename `comp-propagate'
	-> `comp-fwprop'.
	(comp-fwprop-prologue): Rename from `comp-propagate-prologue'.
	(comp-fwprop-insn): Rename from `comp-fwprop-insn'.
	(comp-propagate*): Rename from `comp-propagate*' and update.
	(comp-fwprop): Rename from `comp-propagate' and update.
2020-07-13 14:44:29 +02:00
Andrea Corallo
36c289ec8b * Clean-up now unnecessary backward propagation in comp.el
* lisp/emacs-lisp/comp.el (comp-passes): Invoke 'comp-propagate'
	instead of 'comp-propagate-alloc'.
	(comp-mvar): Remove unnecessary `array-idx' slot.
	(comp-propagate-prologue): Remove.
	(comp-propagate-prologue): Remove `backward' parameter and
	backward propagation logic.
	(comp-propagate1): Remove and move logic into `comp-propagate'.
	(comp-propagate-alloc): Remove pass.
2020-07-13 14:40:07 +02:00
James N. V. Cash
7a712578ed Fix a typo in eldoc.el
* lisp/emacs-lisp/eldoc.el (eldoc-documentation-functions): Fix a
typo.  (Bug#42310)

Copyright-paperwork-exempt: yes
2020-07-12 17:10:32 +03:00
João Távora
45d7db6d22 Sort out ElDoc backward compatibility of eldoc-documentation-function
As explained previously, we can't simply make
eldoc-documentation-function an variable alias for
eldoc-documentation-strategy, because ElDoc is pre-loaded in Emacs <
28, where it holds at least one buffer-local binding.  So if eldoc.el
is loaded in those versions, we do the variable alias binding in
reverse.  We do this using a macro
eldoc--documentation-strategy-defcustom to at load time in which
direction to make the variable alias.

* lisp/emacs-lisp/eldoc.el
(eldoc--documentation-strategy-defcustom): Helper macro.
(eldoc-documentation-strategy, eldoc-documentation-function): Use it.
(Version): Bump to 1.5.0
2020-07-12 14:24:05 +01:00
João Távora
1198b03e55 Fix placement of Eldoc docs during eval-expression (bug#42309)
* lisp/emacs-lisp/eldoc.el (eldoc--handle-docs): Rework.
2020-07-10 21:23:33 +01:00
João Távora
c2599632b0 Revert "Fix Eldoc problem when loading on Emacs 26.3"
This reverts commit 9ade7ea7b7.

* lisp/emacs-lisp/eldoc.el (Version): Bump to 1.4.0
2020-07-10 18:12:10 +01:00
João Távora
62725e87f2 Fix byte compilation warning in Eldoc
* lisp/emacs-lisp/eldoc.el (eldoc-documentation-function): Pass nil as
second argument.
2020-07-10 08:13:15 +01:00
João Távora
9ade7ea7b7 Fix Eldoc problem when loading on Emacs 26.3
When defining the obsolete variable alias for old
eldoc-documentation-function (which now points to the newer
eldoc-documentation-strategy), one gets the error "don't know how to
make a localized vareiable an alias".  I'm not sure, but I suspect
this is because Eldoc is preloaded in Emacs 26.3 and the
eldoc-documentation-function variable is already set locally by some
Elisp buffer.

Uninterning the symbol shortly before defining the alias seems to fix
it.

* lisp/emacs-lisp/eldoc.el (eldoc-documentation-function):
Unintern on load.
(Version): Bump to 1.3.0
2020-07-10 01:47:33 +01:00
João Távora
59f563680d Unbreak M-x eldoc
The command should always invoke Eldoc when called interactively,
instead of going through the usual checks, which are performed to
avoid interference with other commands.

* lisp/emacs-lisp/eldoc.el (eldoc-print-current-symbol-info): Rework.
(Version): Bump to 1.2.0
2020-07-09 18:07:22 +01:00
João Távora
ffb99d8490 Prevent infloop in Eldoc message truncation algorithm
The truncation algorithm still has a long way to go for very narrow
frame sizes.  It should become a generic mechanism that would allows
one to truncate a string so that fits in N possibly truncated screen
lines of a full-width window.

* lisp/emacs-lisp/eldoc.el (eldoc-handle-docs): Tweak
2020-07-09 18:07:22 +01:00
Andrea Corallo
5f13016ced Merge remote-tracking branch 'savannah/master' into wip2 2020-07-09 16:42:16 +01:00
Andrea Corallo
9aaca828fc * Add `comp-disabled-passes'
* lisp/emacs-lisp/comp.el (comp-disabled-passes): New special
	variable.
	(native-compile): Make use of `comp-disabled-passes'.
2020-07-09 16:23:34 +01:00
Andrea Corallo
b4de6baa7b * Optimize pure functions defined by the compilation environment
* lisp/emacs-lisp/comp.el (comp-apply-in-env): New macro.
	(comp-function-call-maybe-remove): Update to make use of
	`comp-apply-in-env'.
2020-07-09 16:22:48 +01:00
Andrea Corallo
7622740e29 * Introduce a new pass ipa-pure
Add a simple pass to infer pure functions not explicitly declared as
such.  Use this information only during compilation (speed 3) to
optimize out function calls whe possible.
2020-07-09 16:22:48 +01:00
Andrea Corallo
5688739c5b * Add `comp-call-op-p'
* lisp/emacs-lisp/comp.el (comp-call-op-p): New predicate.
	(comp-limple-insn-call-p): Make use of.
2020-07-09 16:22:48 +01:00
Andrea Corallo
3db6ace804 * Define `comp-symbol-func-to-fun'
* lisp/emacs-lisp/comp.el (comp-symbol-func-to-fun): New function.
	(comp-func-in-unit): Make use of the `comp-symbol-func-to-fun'.
2020-07-09 16:22:48 +01:00
Andrea Corallo
0b81044e7e * Clean-up some const folding logic and add `comp-function-pure-p'
* lisp/emacs-lisp/comp.el (comp-function-pure-p): New predicate.
	(comp-function-call-maybe-remove): Update to use the
	`comp-function-pure-p'.
2020-07-08 17:26:51 +01:00
João Távora
384fa10958 Improve Eldoc docstrings
* lisp/emacs-lisp/eldoc.el (eldoc-documentation-strategy): Improve
docstring.
(eldoc--make-callback): Improve docstring.
(eldoc--invoke-strategy): New helper function.
(eldoc-print-current-symbol-info): Call eldoc--invoke-strategy.
(eldoc-documentation-functions): Improve docstring.
2020-07-08 11:25:33 +01:00
João Távora
fbc0bc6bef Change version scheme of two Eldoc obsolete specs
* lisp/emacs-lisp/eldoc.el (eldoc-documentation-function)
(eldoc-message): Obsolete spec uses eldoc-1.1.0.
2020-07-08 11:25:33 +01:00
João Távora
bba3bea247 Adjust Eldoc documentation after Eli's review
* etc/NEWS (Eldoc): Adjust paragraphs.

* lisp/emacs-lisp/eldoc.el (eldoc-prefer-doc-buffer): Adjust
docstring.
(eldoc--enthusiasm-curbing-timer, eldoc-documentation-strategy)
(eldoc-documentation-functions): Adjust docstring.
(eldoc--handle-docs): Adjust comments.
(eldoc--documentation-compose-1): New helper.
(eldoc-documentation-compose)
(eldoc-documentation-compose-eagerly): Use it.
(eldoc-print-current-symbol-info): Adjust comments.
2020-07-08 11:25:33 +01:00