Commit graph

7246 commits

Author SHA1 Message Date
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
Andrea Corallo
99e7cc0da6 Merge remote-tracking branch 'savannah/master' into HEAD 2020-10-23 20:08:58 +01:00
Stefan Kangas
dc8bffba5a * lisp/emacs-lisp/pcase.el: Add "extensions" to keyword header. 2020-10-23 05:26:40 +02:00
Stefan Kangas
743bd40126 ; * lisp/emacs-lisp/bindat.el (bindat-unpack): Fix typo. 2020-10-21 17:31:47 +02:00
Stefan Kangas
a497b8e4a4 Use lexical-binding in bindat.el
* lisp/emacs-lisp/bindat.el: Use lexical-binding.
(bindat-raw, bindat-idx, bindat-unpack, bindat-pack): Adjust for
lexical-binding.
(bindat--unpack-group, bindat--length-group): Fix byte-compiler
warning about unused variables last and vlen.
(bindat--unpack-group, bindat--length-group, bindat--pack-group)
(bindat-format-vector): Quote function symbols as such.
2020-10-21 16:14:09 +02:00
Andrea Corallo
3be93390fb Sanitize eln filename when native compiling single functions
* lisp/emacs-lisp/comp.el (comp-spill-lap-function): Fix
	temporary eln name generation.

	* test/src/comp-tests.el (free-fun-silly-name): New testcase.
2020-10-20 21:29:05 +01:00
Andrea Corallo
79ca25c085 * Have native-compile' do not expose with-late-load' parameter
This is really for internal use only by deferred compilation.

	* lisp/emacs-lisp/comp.el (comp-trampoline-compile)
	(comp-run-async-workers): Make use of `comp--native-compile'.
	(comp--native-compile): New function.
	(native-compile, batch-native-compile): Make use of
	`comp--native-compile'.
2020-10-20 21:24:58 +01:00
Stefan Kangas
6c58d90042 Make more load-hooks obsolete (Bug#21563)
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-complete-structtag.el: Recommend
with-eval-after-load instead of load-hooks.
* lisp/calc/calc-ext.el (calc-ext-load-hook):
* lisp/emacs-lisp/bytecomp.el (bytecomp-load-hook):
* lisp/emacs-lisp/cl-extra.el (cl-extra-load-hook):
* lisp/emacs-lisp/cl-macs.el (cl-macs-load-hook):
* lisp/emacs-lisp/cl-seq.el (cl-seq-load-hook):
* lisp/gnus/message.el (message-load-hook):
* lisp/gnus/nnheader.el (nnheader-load-hook):
* lisp/gnus/nnmail.el (nnmail-load-hook):
* lisp/progmodes/dcl-mode.el (dcl-mode-load-hook):
* lisp/textmodes/tex-mode.el (tex-mode-load-hook):
* lisp/whitespace.el (whitespace-load-hook): Obsolete for
with-eval-after-load.  Note that these variables are never declared,
but the byte-compiler will still warn about them if used.
2020-10-20 19:14:04 +02:00
Stefan Kangas
4a575eb18c byte-compile-file: Make optional LOAD argument obsolete
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Declare optional
LOAD argument obsolete.  Adjust callers.  (Bug#38072)
(byte-recompile-file): Declare optional LOAD argument obsolete.
* doc/lispref/compile.texi (Compilation Functions): Update
documentation to reflect above obsoletion.
* etc/NEWS: Announce above obsoletion.
2020-10-20 18:48:27 +02:00
Basil L. Contovounesios
ec4f2723c1 Simplify syntax of shortdoc face specs
* lisp/emacs-lisp/shortdoc.el: Remove unused dependency.
(shortdoc-section, shortdoc-example): Use newer (DISPLAY . PLIST)
face spec syntax.
2020-10-20 17:31:09 +01:00
Lars Ingebrigtsen
4ef8c4a0f4 Tweak the documentation for define-obsolete-variable-alias
* doc/lispref/variables.texi (Variable Aliases): Actually describe
the macro parameters (bug#44088).

* lisp/emacs-lisp/byte-run.el (define-obsolete-variable-alias):
Ditto (bug#44088).
2020-10-20 13:28:29 +02:00
Lars Ingebrigtsen
117d58ace7 Preserve all `eval' elements from both .dir-locals files
* lisp/files.el (dir-locals-read-from-dir): Preserve all `eval'
elements from both .dir-locals files (bug#44066).
2020-10-20 13:07:25 +02:00
Stefan Kangas
8c96c720fa Add command package-menu-filter-upgradable
* lisp/emacs-lisp/package.el (package-menu-filter-upgradable):
New command.  (Bug#41436)
(package-menu-mode-map): Bind the new command.
* doc/emacs/package.texi (Package Menu): Document the new command.
2020-10-19 20:30:52 +02:00
Stefan Kangas
58a9cec525 Add "Old-" prefix to "Version" header in more cases
These version numbers are historical accidents and not relevant today.
Ref: https://lists.gnu.org/r/emacs-devel/2020-03/msg00080.html
2020-10-18 20:35:26 +02:00
Glenn Morris
3ac3a6503e Merge from origin/emacs-27
65078e0a76 * lisp/info.el (Info-hide-note-references): Doc fix.  (Bug...
30305b543d Make lisp/progmodes/js.el dependent on CC Mode in the Make...
c37b2a9b42 Yet another fix for 'set-minibuffer-message'
72dd911981 Fix posn-at-x-y in builds --without-x
ace25f2066 Clarify the seq-reduce documentation
7d598e281d Make tramp-completion-reread-directory-timeout obsolete (B...
2c31ce18ea Fix 'message' when there's active minibuffer on another frame

# Conflicts:
#	doc/misc/tramp.texi
#	etc/NEWS
2020-10-17 09:48:54 -07:00
Mattias Engdegård
3217ae6e05 Add aid for finding missing dynamic variable declarations
Find lexical use of variables that are dynamically declared in other
files by recording 'defvar' declarations in files that can be read
in by the compiler in a second compilation.  This is particularly
useful when converting code to use lexical-binding.

The facility is controlled by setting environment variables:

 EMACS_GENERATE_DYNVARS -- set to non-empty to generate a .dynvars file
                           corresponding to each .elc.
 EMACS_DYNVARS_FILE     -- set to the name of a .dynvars file to use
                           as defvar information during compilation,
                           enabling the new warnings.

* lisp/emacs-lisp/bytecomp.el (byte-compile--known-dynamic-vars)
(byte-compile--seen-defvars): New variables.
(byte-compile-warning-types): Add lexical-dynamic warning.
(byte-compile--load-dynvars, byte-compile--warn-lexical-dynamic):
New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file, byte-compile--declare-var)
(byte-compile-lambda, byte-compile-bind): Add dynamic variable loads,
dumps and checks.
* doc/lispref/variables.texi (Converting to Lexical Binding): Document.
2020-10-17 16:57:38 +02:00
Andrea Corallo
d5791ba5fe Merge remote-tracking branch 'savannah/master' into HEAD 2020-10-17 08:00:34 +02:00
Stefan Kangas
fd5c08892e Remove some references to Emacs 18 and 19
* doc/misc/forms.texi (Modifying Forms Contents, Error Messages):
* lisp/arc-mode.el:
* lisp/emacs-lisp/edebug.el (edebug-temp-display-freq-count):
* lisp/type-break.el: Remove some references to Emacs 18 and 19.
2020-10-16 15:27:25 +02:00
Mattias Engdegård
559c89f49c * lisp/emacs-lisp/backquote.el: Use lexical binding. 2020-10-16 14:03:57 +02:00
Stefan Kangas
f52a775ae2 Add ert macros to get resource file names (Bug#43792)
* lisp/emacs-lisp/ert-x.el (subr-x): Require.
(ert-resource-dir, ert-resource-file): New macros to get the file name
of the resource directory belonging to a test.
(ert-resource-dir-format, ert-resource-dir-trim-left-regexp)
(ert-resource-dir-trim-right-regexp): New variables.
2020-10-16 11:18:38 +02:00
Lars Ingebrigtsen
1e89dfc6c8 Make package-install-from-buffer maybe refresh the quickstart file
* lisp/emacs-lisp/package.el (package-install-from-buffer):
Refresh the quickstart file (bug#43237).  This makes this command
more consistent with package-install.
2020-10-16 09:10:05 +02:00
Stefan Monnier
f5c9d3f54e * lisp/emacs-lisp/warnings.el (display-warning): Don't be so negative 2020-10-15 14:34:12 -04:00
Lars Ingebrigtsen
ce09f19c28 Don't display the warning buttons in bytecomp buffers
* lisp/emacs-lisp/warnings.el (display-warning): Don't do the
buttons in bytecomp buffers.
2020-10-15 18:36:26 +02:00
Lars Ingebrigtsen
c6ecf6428e Make C-x C-e' work more like C-M-x' on defvar etc
* doc/emacs/building.texi (Lisp Eval): Document it.

* lisp/emacs-lisp/pp.el (pp-eval-last-sexp): Ditto.

* lisp/progmodes/elisp-mode.el (elisp--eval-last-sexp): Work more
like `eval-defun': Re-evaluate defvar/defcustom/defface forms.
2020-10-15 16:26:45 +02:00
Lars Ingebrigtsen
ace25f2066 Clarify the seq-reduce documentation
* doc/lispref/sequences.texi (Sequence Functions): Ditto.

* lisp/emacs-lisp/seq.el (seq-reduce): Clarify the order of the
arguments (bug#43995).
2020-10-15 09:37:44 +02:00
Andrea Corallo
f8505fd3d4 Merge remote-tracking branch 'savannah/master' into HEAD 2020-10-14 11:04:55 +02:00
Andrea Corallo
03e98f93f7 Use form native compilation in `comp-trampoline-compile'
* lisp/emacs-lisp/comp.el (comp-trampoline-sym): Remove function.
	(comp-trampoline-filename): As we are introducing an ABI change in
	the eln trampoline format change the trampoline filename to
	disambiguate.
	(comp-trampoline-search): Rename from `comp-search-trampoline'
	and return directly the trampoline.
	(comp-trampoline-compile): Rework to use native form compilation
	in place of un-evaluating a function and return directly the
	trampoline.
	(comp-subr-trampoline-install): Update for
	`comp-trampoline-search' and `comp-trampoline-compile' new
	interfaces.
	* src/comp.c (Fcomp__install_trampoline): Store the trampoline
	itself as value in `comp-installed-trampolines-h'.
	(syms_of_comp): Doc update `comp-installed-trampolines-h'.
2020-10-14 11:04:36 +02:00
Andrea Corallo
4f0e879030 Rework `native-compile' interface so it can return compiled functions
* lisp/emacs-lisp/comp.el (native-compile): Return the compiled
	function when the input is a symbol or a form.
	* test/src/comp-tests.el (free-fun, tco, fw-prop): Update tests
	for new `native-compile' interface.
2020-10-14 11:04:36 +02:00
Andrea Corallo
8861ee8b08 Have `native-elisp-load' return the last registerd function
* lisp/emacs-lisp/comp.el (comp-emit-for-top-level): Synthesize
	'top_level_run' so it returns the last value returned by
	`comp--register-subr'.
	* src/comp.c (load_comp_unit): Return what 'top_level_run'
	returns.
	(Fnative_elisp_load): Return what 'load_comp_unit' returns.
	* src/comp.h (load_comp_unit): Update signature.
2020-10-14 11:04:36 +02:00
Andrea Corallo
4bea0c0b1d * Allow for lambda forms as native compilation input
* lisp/emacs-lisp/comp.el (comp-spill-lap-function): Add new
	specialized method for compiling a lambda form.
2020-10-14 11:04:36 +02:00
Andrea Corallo
fda798808f * Move context output computation in `comp-spill-lap-function'
* lisp/emacs-lisp/comp.el (comp-spill-lap-function): Move
	output filename computation here.
	(native-compile): From here.
2020-10-14 11:04:36 +02:00
Masahiro Nakamura
f256687bd4 Improve package install/delete button action
* lisp/emacs-lisp/package.el (package-install-button-action)
(package-delete-button-action): Run describe-package instead of
revert-buffer in order to use newer package-desc (bug#43983).
2020-10-14 06:14:33 +02:00
Brian Leung
237fd33aef Fix some compilation warnings in non nativecomp build (bug#43892)
* lisp/emacs-lisp/advice.el (comp-subr-trampoline-install):
	Declare function.
	* lisp/emacs-lisp/find-func.el (comp-eln-to-el-h): Declare
	variable.
	* lisp/emacs-lisp/nadvice.el (comp-subr-trampoline-install):
	Declare function.
	* lisp/files.el (comp-eln-to-el-h): Declare variable.
	* lisp/help.el (subr-native-lambda-list): Declare function.
2020-10-12 21:25:50 +02:00
Andrea Corallo
a3304feb9b Revert "Fix some compilation warnings in non nativecomp build (bug#43892)"
This reverts commit 6606ec8e31.
2020-10-12 21:25:00 +02:00
Andrea Corallo
6606ec8e31 Fix some compilation warnings in non nativecomp build (bug#43892)
* lisp/emacs-lisp/advice.el (comp-subr-trampoline-install):
	Declare function.
	* lisp/emacs-lisp/find-func.el (comp-eln-to-el-h): Declare
	variable.
	* lisp/emacs-lisp/nadvice.el (comp-subr-trampoline-install):
	Declare function.
	* lisp/files.el (comp-eln-to-el-h): Declare variable.
	* lisp/help.el (subr-native-lambda-list): Declare function.
2020-10-12 21:19:09 +02:00
Lars Ingebrigtsen
d5c811279b Fix error in file shortdoc group
* lisp/emacs-lisp/shortdoc.el (number): Add some more numeric
stuff (and clean up some arglists).
2020-10-11 23:51:26 +02:00