Commit graph

7081 commits

Author SHA1 Message Date
Andrea Corallo
acf101c636 Handle type hierarchy in native compiler forward propagation
2020-11-07  Andrea Corallo  <andrea.corallo@arm.com>

	* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add fixnum
	and bignum.
	* lisp/emacs-lisp/comp.el (comp-ctxt): Add `supertype-memoize'
	slot.
	(comp-supertypes, comp-common-supertype-2)
	(comp-common-supertype): New functions.
	(comp-fwprop-insn): Make use of `comp-common-supertype' to
	identify the common supertype to be propagated.
2020-11-07 11:27:14 +01:00
Andrea Corallo
c6abe97f94 * A native compiler forward propagation fix
* lisp/emacs-lisp/comp.el (comp-fwprop-insn): Fix `comp-mvar'
	`const-vld' slot left unset while propagating in phis.
2020-11-05 22:34:12 +01:00
Stephen Berman
233d350d19 Improve display of tabulated list header line labels (bug#44068)
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-init-header):
Ensure sort indicator appears after the label of any selected
sortable column that is wide enough and enable label truncation
when narrowing a column.

* lisp/emacs-lisp/timer-list.el (timer-list-mode): Improve column
alignment.
(timer-list--function-predicate): Correct typo in doc string.
2020-11-04 23:52:21 +01:00
Stefan Monnier
d6cb106a37 * lisp-mode.el: Fix missing highlight of "hidden" string arg
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2)
(lisp-cl-font-lock-keywords-2): Highlight "hidden arg" even if it
already has another face.
2020-11-04 11:37:00 -05:00
Stefan Kangas
6ad628b865 Improve ert-resource-directory docstring
* lisp/emacs-lisp/ert-x.el (ert-resource-directory): Improve
docstring.
2020-11-03 00:11:02 +01:00
Glenn Morris
018e0c36fb Merge from origin/emacs-27
1fc9de4b81 Improve reproducibility of generated -pkg.el files
da6234e2df Make sure pixel sizes are zero when setting window size fo...
2d15296db1 Fix failure of 'emacs --daemon' on Cygwin
8abce5b0c6 CC Mode: Only recognize foo (*bar) as a function pointer w...
85d1d8d768 Fix NEWS entry for fix of Bug#44080
2443b15a91 * src/buffer.c (syms_of_buffer) <fill-column>: Improve doc...

# Conflicts:
#	etc/NEWS
2020-11-02 09:27:40 -08:00
Lars Ingebrigtsen
5cea77af41 Partially revert previous define-minor-mode change
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
Only document the values we want to support, not the ones we
actually support.
(define-minor-mode): Partially revert to previous behaviour.
2020-11-02 10:17:08 +01:00
Glenn Morris
8761c155e4 * lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Doc typo. 2020-11-01 09:39:44 -08:00
Mattias Engdegård
d85e0df7ad Add missing side-effect-free and error-free properties
Any function that is pure is also side-effect-free and some are also
error-free.  Right now these have to be declared separately.

* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Add
bool-vector-count-consecutive, bool-vector-count-population,
bool-vector-subsetp, copysign, isnan, lax-plist-get, ldexp, memql,
regexp-opt and string-to-syntax.
(side-effect-and-error-free-fns): Add type-of.
* lisp/subr.el (kbd, string-replace): Declare side-effect-free.
2020-11-01 18:22:11 +01:00
Mattias Engdegård
d860168493 * lisp/emacs-lisp/byte-opt.el (pure-fns): Fix typos. 2020-11-01 16:00:49 +01:00
Andrea Corallo
3e3843512b * Fix 'comp-call-optim pass' for anonymous lambdas
* lisp/emacs-lisp/comp.el (comp-call-optim-func): Remove anonymous
	lambdas gate.
	(comp-call-optim-form-call): Add the correct missing condition.
2020-11-01 15:17:00 +01:00
Andrea Corallo
42970cceb9 Add new cond-rw pass to have forward propagation track cond branches
Add a new pass to rewrite conditional branches.  This is introducing
and placing a new LIMPLE operator 'assume' in use by fwprop to
propagate conditional branch test informations on target basic blocks.

	* lisp/emacs-lisp/comp.el (comp-passes): Add `comp-cond-rw'.
	(comp-limple-assignments): Add `assume' operator.
	(comp-emit-assume, comp-cond-rw-target-slot, comp-cond-rw-func)
	(comp-cond-rw): Add new functions.
	(comp-fwprop-insn): Update to pattern match `assume' insns.
	* src/comp.c (emit_limple_insn): Add for `assume'.
	(syms_of_comp): Define 'Qassume' symbol.
2020-11-01 15:17:00 +01:00
Lars Ingebrigtsen
2a4b0da28c Make minor mode ARG work as documented
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
Clarify when minor modes are switched on/off when called from lisp
(bug#44341).
(define-minor-mode): Make calls from Lisp switch the mode on/off
as documented.
2020-11-01 15:00:44 +01:00
Lars Ingebrigtsen
7a3d8559c9 Doc string clarification for cl-some
* lisp/emacs-lisp/cl-extra.el (cl-some): Clarify the return value
(bug#44330).
2020-11-01 13:55:29 +01:00
Andrea Corallo
f7f5d59ab4 Merge remote-tracking branch 'savannah/master' into HEAD 2020-10-31 15:00:00 +00:00
Mattias Engdegård
0cbcc6223a 'assoc' is not side-effect-free; constprop its pure subset
Since a supplied test function can do anything, assoc is not
side-effect-free (bug#44018).  However, with only two arguments it is
pure and should be optimised accordingly.

* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Remove 'assoc'.
(byte-optimize-assoc): Constant-propagate through 2-arg assoc calls.
* test/lisp/emacs-lisp/bytecomp-tests.el
(byte-opt-testsuite-arith-data): Add test cases.
2020-10-31 14:31:43 +01:00
Mattias Engdegård
c3a20804a8 Trim and explain set of safe forms for 'unsafep' (bug#44018)
* lisp/emacs-lisp/unsafep.el:
Add comment explaining the policy for which forms can be considered
'safe' in the sense of unsafep.  Remove ones that didn't make the cut:

 play-sound-file (large attack surface)
 catch, throw (alter program flow, inject data)
 replace-regexp-in-string (execute arbitary code)
 error, signal (deceptive messages)

* test/lisp/emacs-lisp/unsafep-tests.el (unsafep-tests--unsafe):
Add test cases.
* etc/NEWS: Announce the change.
2020-10-31 13:42:07 +01:00
Glenn Morris
1fc9de4b81 Improve reproducibility of generated -pkg.el files
* lisp/emacs-lisp/package.el (package-generate-description-file):
Don't include the full name of the source file in the header,
since that varies non-reproducibly according to the build directory.
https://bugs.debian.org/972861
Note that elpa.gnu.org's admin/archive-contents.el does this by hand
and already only includes the nondirectory part.
2020-10-30 19:21:04 -07:00
João Távora
74c45a62e1 Shoosh byte-compilation warning in lisp/emacs-lisp/eldoc.el
Per bug#43609, elisp-eldoc-documentation-function is again in master,
but since it's now officially obsoleted, this backward compatibility
shim in eldoc--eval-expression-setup shouldn't unnecessarily trigger
warnings in master's code.

* lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): Shoosh
by-compilation warning.
2020-10-30 22:31:20 +00:00
João Távora
3758be484e Don't make ElDoc doc buffer visible in buffer list by default
Fixes: bug#44334

* lisp/emacs-lisp/eldoc.el (eldoc-doc-buffer): No longer take
INTERACTIVE arg.  Show buffer if invisible.
(eldoc--format-doc-buffer): Don't change buffer visibility.
(eldoc-display-in-buffer): Show buffer if invisible if by calling
eldoc-doc-buffer.
2020-10-30 22:31:20 +00:00
Stefan Kangas
b295174210 Clarify point position after text-property-search
* lisp/emacs-lisp/text-property-search.el
(text-property-search-forward, text-property-search-backward): Doc fix
to clarify placement of point after search.
* test/lisp/emacs-lisp/text-property-search-tests.el
(text-property-search--pos-test): New defun.
(text-property-search-forward-point-at-beginning)
(text-property-search-backward-point-at-end): New test.
2020-10-30 13:23:31 +01:00
Lars Ingebrigtsen
02ecbf58e4 Make list-timers do sub-second times
* lisp/emacs-lisp/timer-list.el (list-timers): Do sub-second times
(bug#39956).
2020-10-30 12:10:53 +01:00
Stefan Kangas
ff3838ecc3 ; Remove spurious FIXMEs in my last commit 2020-10-30 11:41:47 +01:00
Stefan Kangas
122ace858b Add shortdoc navigation commands
* lisp/emacs-lisp/shortdoc.el (text-property-search): Require.
(shortdoc-mode): New major mode.
(shortdoc-mode-map): New variable.
(shortdoc--goto-section): New macro.
(shortdoc-next, shortdoc-previous, shortdoc-next-section)
(shortdoc-previous-section): New commands.
(shortdoc-display-group): Use new shortdoc-models.  Propertize
section header.
(shortdoc--display-function): Propertize function header.
2020-10-30 11:40:43 +01:00
Mattias Engdegård
bb3d13ac35 ; * lisp/emacs-lisp/shortdoc.el (regexp): less contrived rx example 2020-10-28 15:05:35 +01:00
Stefan Kangas
bd3ecfef84 Run substitute-command-keys on shortdoc section headings
* lisp/emacs-lisp/shortdoc.el (shortdoc-display-group): Run
substitute-command-keys on section headings before displaying.
2020-10-28 14:46:43 +01:00
Stefan Kangas
6b3ed2375b Extend the regexp shortdoc group
* lisp/emacs-lisp/shortdoc.el (regexp): New section "Match Data"; add
save-match-data.  New section "The `rx' Structured Regexp Notation".
2020-10-28 14:46:28 +01:00
Lars Ingebrigtsen
0cb44eed6c Display times in a more human-readable way in list-timers
* lisp/emacs-lisp/timer-list.el (list-timers): Format the
intervals in a more human-readable way (bug#39956).
2020-10-28 10:08:09 +01:00
Mattias Engdegård
88f5530a9b ERT: escape control characters in pretty-printed error output
* lisp/emacs-lisp/ert.el (ert--pp-with-indentation-and-newline):
Escape control characters which would otherwise be blasted directly to
the terminal (when running noninteractively) with unpleasant results.
2020-10-27 13:20:20 +01:00
Paul Pogonyshev
083707bbab Don't leak result of nested byte-compilation to outer level
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Bind
`byte-compiler-error-flag' instead of setting it (bug#41065).
This fixes a problem of "leaking" the flag when compiling
something that then compiles something that errors out (i.e., an
"inner" compile).
2020-10-27 09:43:55 +01:00
Lars Ingebrigtsen
f314ac2a30 Make the -modes variable autoloaded
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Make the -modes variable be autoloaded.
2020-10-26 20:44:21 +01:00
Lars Ingebrigtsen
b8b18cf34a Implement a :predicate parameter for globalized minor modes
* doc/lispref/modes.texi (Defining Minor Modes): Describe the new
:predicate keyword (bug#44232).

* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Allow a new :predicate keyword.
(easy-mmode--globalized-predicate-p): New function.
2020-10-26 19:15:36 +01:00
Lars Ingebrigtsen
d23e483cfb Tweak how shortdocs are displayed
* lisp/emacs-lisp/shortdoc.el (shortdoc-example): Removed.
(shortdoc-section): Remove colors.
(shortdoc-separator): New face.
(shortdoc-display-group, shortdoc--display-function): Don't use
background colours, because that makes things harder to read.
Separate with a horizontal line instead.
2020-10-26 19:15:36 +01:00
Andrea Corallo
fd9e9308d2 Make native compiler tollerant to redefined primitives (bug#44221).
* lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Rework based
	on the fact that the subr can now be redefined.
	* test/src/comp-tests.el (primitive-redefine-compile-44221):
	New testcase.
2020-10-26 16:34:20 +00:00
Mattias Engdegård
27910f4e96 Revert "Don't consider play-sound-file to be a 'safe' function (bug#44018)"
This reverts commit cdb3c9d662.
2020-10-26 17:10:06 +01:00
Mattias Engdegård
cdb3c9d662 Don't consider play-sound-file to be a 'safe' function (bug#44018)
While there are currently no known security holes in play-sound-file,
the attack surface is considerable and historically audio file
processing has had more than its share of security problems; the
benefit to risk ratio is low.

* lisp/emacs-lisp/unsafep.el: Don't mark play-sound-file as safe.
2020-10-26 12:40:51 +01:00
Andrea Corallo
5edc7aa019 Fix defsubst effectiveness (bug#44209)
* lisp/emacs-lisp/byte-run.el (defsubst): Fix macro definition.
	* test/src/comp-tests.el (comp-test-defsubst): New testcase.
	* test/src/comp-test-funcs.el (comp-test-defsubst-f): New
	function.
2020-10-25 22:56:50 +00:00
Stefan Kangas
a98bb620c4 Add section "Replacing Match" to the regexp shortdoc group
* lisp/emacs-lisp/shortdoc.el (regexp): New section "Replacing Match".
2020-10-25 19:18:27 +01:00
Stefan Kangas
158d2a1f50 Remove some Emacs 19 compat code and references
* lisp/progmodes/sql.el:
* lisp/mh-e/mh-show.el (mh-display-msg): Remove Emacs 19 compat code.
* lisp/emacs-lisp/edebug.el (edebug-mark-marker): Make into
obsolete alias for mark-marker.
(edebug--display-1, edebug-bounce-point)
(edebug-outside-excursion): Adjust callers.
* lisp/net/snmp-mode.el:
* lisp/forms.el: Remove references to Emacs 19.
(forms-use-text-properties): Doc fix.
2020-10-25 18:27:19 +01:00
Andrea Corallo
868d3ff9b8 * Report warnings and errors from native asynchronous compilation (bug#44168)
* lisp/emacs-lisp/comp.el (comp-last-scanned-async-output): New
	buffer local variable.
	(comp-accept-and-process-async-output): New function.
	(comp-run-async-workers): Use
	`comp-accept-and-process-async-output'.
2020-10-25 14:45:53 +00:00
Lars Ingebrigtsen
b0a7a19d5d Fix problem when replacing the final char in checkdoc
* lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-ask-replace):
Ensure that the end-of-doc-string marker is really at the end,
even if we replace the final " char in the string (bug#44201).
2020-10-25 14:34:47 +01:00
Andrea Corallo
ada80d66d6 * Fix `comp-dry-run' effectiveness
* lisp/emacs-lisp/comp.el (comp-compile-ctxt-to-file): Remove
	`comp-dry-run' guard.
	(comp-final): And move it here so is effective for interactive
	sessions and non.
2020-10-25 10:56:18 +00:00
Stefan Kangas
10ea719abc Add shortdoc group for alist
* lisp/emacs-lisp/shortdoc.el (alist): New shortdoc group.
2020-10-25 01:40:52 +02:00
Stefan Kangas
b6a41c76a5 Add shortdoc group for hash-table
* lisp/emacs-lisp/shortdoc.el (hash-table): New shortdoc group.
2020-10-25 00:53:17 +02:00
João Távora
10e7c76ee3 Rework semantics of eldoc-echo-are-use-multiline-p
Per bug#43543.  Now uses logical lines, not visual lines.

* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p): Rework
semantics.
(eldoc--echo-area-substring): New helper.
(eldoc--echo-area-prefer-doc-buffer-p): New helper.
(eldoc-display-in-echo-area): Rework using new helpers.
2020-10-24 18:02:28 +01:00
João Távora
77c3928425 Rename ElDoc user option controlling display of truncation notice
The new name makes it consistent with other variables controlling the
display of ElDoc documentation in the echo area.

Per bug#43543.

* etc/NEWS (Eldoc): Rename eldoc-display-truncation-message to
eldoc-echo-area-display-truncation-message.

* lisp/emacs-lisp/eldoc.el
(eldoc-echo-area-display-truncation-message): Rename from
eldoc-display-truncation-message.
(eldoc-display-in-echo-area): Use new variable name.
2020-10-24 18:02:28 +01:00
João Távora
5daa6a6a03 Rework eldoc-echo-area-prefer-doc-buffer (bug#42532)
* lisp/emacs-lisp/eldoc.el:
(eldoc-echo-area-prefer-doc-buffer): Rename from
eldoc-echo-area-prefer-doc-buffer
(eldoc-display-in-echo-area): Rework to honour
eldoc-echo-area-prefer-doc-buffer.
2020-10-24 18:02:28 +01:00
João Távora
4c543a724f Introduce eldoc-display-functions
See bug#43609.

* lisp/emacs-lisp/eldoc.el (eldoc--request-state): Add comment.
(eldoc--last-request-state): No longer buffer-local.
(eldoc--request-docs-p): Delete.
(eldoc-display-functions): New user variable.
(eldoc--doc-buffer-docs): New variable.
(eldoc-display-message-p): Rework.
(eldoc--format-doc-buffer): Rework from eldoc--handle-docs.
(eldoc-display-in-echo-area, eldoc-display-in-buffer): New
user-visible function.
(eldoc--invoke-strategy): Take INTERACTIVE arg.
Invoke eldoc-display-in-buffer
(eldoc-print-current-symbol-info): Simplify.
(Version): Bump to 1.11.0

* etc/NEWS: Mention eldoc-display-functions.
2020-10-24 18:02:28 +01:00
Stefan Kangas
6dfcb4d4dc Revert "Use lexical-binding in bindat.el"
This reverts commit a497b8e4a4.

This conversion to lexical-binding broke the eval specification,
documented in the ELisp manual.  We will probably want to add tests
for that before we can confidently convert this to lexical-binding.
Problem reported by Mattias Engdegård <mattiase@acm.org>.
2020-10-24 14:26:46 +02:00
Stefan Kangas
9f1dd2a7d5 Use lexical-binding in copyright.el and add tests
* lisp/emacs-lisp/copyright.el: Use lexical-binding.  Remove
redundant :group args.
* test/lisp/emacs-lisp/copyright-tests.el: New file.
2020-10-24 13:35:49 +02:00