Commit graph

8157 commits

Author SHA1 Message Date
Lars Ingebrigtsen
c6465d65fa Don't signal an error on re-builder startup with rx syntax
* lisp/emacs-lisp/re-builder.el (reb-initialize-buffer): Make
startup with rx syntax not signal an error (bug#54107).
2022-02-22 14:43:35 +01:00
Stefan Kangas
bee54495e9 Merge from origin/emacs-28
666e40a109 Fix 'display-line-numbers-mode' in hide-show buffers
68d134cf0f Don't check whether a deleted window is deletable (Bug#54028)
b38223a844 A friendlier error message from image-mode in an empty buffer
b7a651ba37 Update to Org 9.5.2-17-gea6b74
3a8c3f7abd ; Don't reference obsolete variables in edebug.el
2022-02-22 06:30:59 +01:00
Lars Ingebrigtsen
de003cb2b5 Improve vtable :keymap handling
* lisp/emacs-lisp/vtable.el (vtable-map, vtable--make-keymap):
Don't alter keymaps passed in, and respect parent keymaps.
2022-02-21 19:19:55 +01:00
Raffael Stocker
3a8c3f7abd ; Don't reference obsolete variables in edebug.el
* lisp/emacs-lisp/edebug.el (edebug-mode, edebug-eval-mode):
Don't reference obsolete variables in the doc strings.
(Bug#54070)
2022-02-20 17:50:45 +02:00
Lars Ingebrigtsen
d710b84225 Make string-pixel-width about 40% faster
* lisp/emacs-lisp/subr-x.el (string-pixel-width): Speed up.
2022-02-20 16:14:05 +01:00
Stefan Monnier
f262a6af36 (macroexp-warn-and-return): Fix bug#53618
* lisp/emacs-lisp/macroexp.el (macroexp-warn-and-return):
Reorder arguments to preserve compatibility with that of Emacs-28.
(macroexp--unfold-lambda, macroexp--expand-all):
* lisp/emacs-lisp/pcase.el (pcase-compile-patterns, pcase--u1):
* lisp/emacs-lisp/gv.el (gv-ref):
* lisp/emacs-lisp/eieio.el (defclass):
* lisp/emacs-lisp/eieio-core.el (eieio-oref, eieio-oref-default)
(eieio-oset-default):
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet, cl-defstruct):
* lisp/emacs-lisp/cl-generic.el (cl-defmethod):
* lisp/emacs-lisp/byte-run.el (defmacro, defun):
* lisp/emacs-lisp/bindat.el (bindat--type): Adjust accordingly.
2022-02-19 14:20:02 -05:00
Lars Ingebrigtsen
d98b6fbba2 Add column sorting order indicators to vtable
* lisp/emacs-lisp/vtable.el (vtable--indicator): New function.
(vtable--insert-header-line): Use it to display sorting order
indicators.
2022-02-19 14:21:19 +01:00
Lars Ingebrigtsen
babfb064c4 Make string-pixel-width slightly speedier
* lisp/emacs-lisp/subr-x.el (string-pixel-width): Speed up
string-pixel-width in the zero-length string case.
2022-02-19 14:21:19 +01:00
Lars Ingebrigtsen
dfaf150631 Add a new library to format variable-pitch tables
* doc/misc/vtable.texi (Index): New manual.

* lisp/emacs-lisp/vtable.el: New library.
2022-02-19 13:16:28 +01:00
Alan Mackenzie
f687e62ac5 Fix symbols with position appearing in the output of `compile-defun'
This happened with the tags of a condition-case.  Also fix the detection of
circular lists while stripping the positions from symbols with position.

* lisp/emacs-lisp/byte-run.el (byte-run--circular-list-p): Remove.
(byte-run--strip-s-p-1): Write a value of t into a hash table for each cons or
vector/record encountered.  (This is to prevent loops with circular
structures.)  This is now done for all arguments, not just those detected as
circular lists.

* lisp/emacs-lisp/bytecomp.el (byte-compile-file-form-defvar)
(byte-compile-form, byte-compile-dynamic-variable-op)
(byte-compile-constant, byte-compile-push-constant): Remove redundant calls to
`bare-symbol'.
(byte-compile-lambda): call `byte-run-strip-symbol-positions' on the arglist.
(byte-compile-out): call `byte-run-strip-symbol-positions' on the operand.
This is the main call to this function in bytecomp.el.

* src/fns.c (hashfn_eq): Strip the position from an argument which is a symbol
with position.
(hash_lookup): No longer strip a position from a symbol with position.
(sxhash_obj): Add handling for symbols with position, substituting their bare
symbols when symbols with position are enabled.
2022-02-19 10:38:19 +00:00
Eli Zaretskii
927bebcd4b Resurrect innocent joke in byte-opt.el
* lisp/emacs-lisp/byte-opt.el: Resurrect innocent joke in a
comment.
2022-02-17 16:35:03 +02:00
Mattias Engdegård
c1111e9447 Fix or remove outdated comments
* src/eval.c (funcall_lambda): Rewrite obsolete comment.
* src/bytecode.c (exec_byte_code): Remove lying comment and
unneeded #define.
* lisp/emacs-lisp/byte-opt.el: Remove car.  Keep pig.
(byte-compile-log-lap-1): Remove obsolete and irrelevant comment.
2022-02-17 14:52:04 +01:00
Lars Ingebrigtsen
c4da0d3312 Improve interaction between track-mouse and edebug
* lisp/emacs-lisp/edebug.el (edebug--display-1): Work around
`track-mouse' oddity (bug#675).
2022-02-12 08:40:30 +01:00
Corwin Brust
64d211179d Autoload package-installed-p
* lisp/emacs-lisp/package.el (package-installed-p): Add autoload
cookie. (Bug#53885)

Copyright-paperwork-exempt: yes
2022-02-10 19:27:57 +02:00
Stefan Kangas
35bf8d4a02 Merge from origin/emacs-28
69e82968d7 Fix integer arithmetic miss-compilation (bug#53451)
31af9bca99 Mark flymake as compatible with emacs-26.1
2022-02-10 06:56:22 +01:00
Andrea Corallo
69e82968d7 Fix integer arithmetic miss-compilation (bug#53451)
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-set-range-for-arithm):
When one of the two sources is negated revert to set dst as
number.
* test/src/comp-tests.el (comp-tests-type-spec-tests): Add test to
verify this is effective.
2022-02-09 17:58:57 +01:00
Tassilo Horn
2755e6bba0 Allow showing show-paren context in an overlay
* lisp/paren.el (show-paren-context-when-offscreen): Add new
possibility `overlay'.
(show-paren--context-overlay): New defvar.
(show-paren--delete-context-overlay): New function.
(show-paren--show-context-in-overlay): New function.
(show-paren-function): Handle the new `overlay' case.
* lisp/emacs-lisp/eldoc.el (eldoc-display-message-no-interference-p):
There's no interference if `show-paren-context-when-offscreen' is
overlay or child-frame.
2022-02-08 21:54:56 +01:00
Stefan Monnier
9338fbbc28 lisp-mnt, checkdoc: Reduce run-time dependencies
* lisp/emacs-lisp/lisp-mnt.el: Don't require `mail-parse` at top-level.
(lm-crack-address): Require it here instead.

* lisp/emacs-lisp/checkdoc.el (dired): Don't load at run-time.
(checkdoc-dired): Add corresponding `declare-function`.
2022-02-07 12:59:27 -05:00
Stefan Monnier
69efc36c6b Fix eval-tests/backtrace-in-batch-mode test
* lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Fix the
zero-arg case.
2022-02-06 19:20:36 -05:00
Stefan Monnier
bff8354ec4 (debug-early-backtrace): Tweak the non-evald output
* lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Make the
non-evald output more like what is used in `debug.el`.
2022-02-06 13:06:22 -05:00
Stefan Monnier
e95ca5cf07 (debug-early-backtrace): Tweak the non-evald output
* lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Make the
non-evald output more like what is used in `debug.el`.
2022-02-06 13:04:35 -05:00
Lars Ingebrigtsen
ab0554a197 Improve the elp-instrument-package doc string
* lisp/emacs-lisp/elp.el (elp-instrument-package): Note the effect
of loading further files (bug#13252).
2022-02-06 01:00:04 +01:00
Lars Ingebrigtsen
eea93a8aaa Add new user option 'find-library-include-other-files'
* lisp/emacs-lisp/find-func.el (read-library-name--find-files):
New function (bug#15735).
(read-library-name): Use it.
(find-library-include-other-files): New user option.
2022-02-06 00:29:33 +01:00
Alan Mackenzie
9029212c86 * lisp/emacs-lisp/debug-early.el: Improve the documentation 2022-02-05 10:43:27 +00:00
Stefan Monnier
d52c929e31 (with-demoted-errors): Warn on missing format arg
The `format` arg has been mandatory for a while, but the backward
compatibility code that handled the case of a missing `format` arg
made it hard to notice when using the old calling convention.

* lisp/subr.el (with-demoted-errors): Warn on missing `format` arg.

* lisp/emacs-lisp/smie.el (smie-indent--separator-outdent): Don't abuse
`with-demoted-errors`.
(smie-indent-line, smie-auto-fill):
* test/lisp/emacs-lisp/ert-tests.el (ert-test-with-demoted-errors):
* lisp/vc/vc-hooks.el (vc-refresh-state):
* lisp/vc/vc-annotate.el (vc-annotate-background-mode):
* lisp/vc/diff-mode.el (diff-syntax-fontify-hunk):
* lisp/textmodes/reftex-toc.el (reftex-re-enlarge):
* lisp/progmodes/sh-script.el (sh-smie-sh-rules):
* lisp/progmodes/octave.el (inferior-octave-startup):
* lisp/pcmpl-gnu.el (pcmpl-gnu-make-all-targets):
* lisp/org/org-refile.el (org-refile):
* lisp/org/org-capture.el (org-capture-store-last-position):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/notifications.el (notifications-notify):
* lisp/gnus/mm-view.el (mm-display-inline-fontify):
* lisp/finder.el (finder-unload-function):
* lisp/files.el (safe-local-variable-p, backup-buffer-copy
* lisp/autorevert.el (auto-revert-notify-handler):
Pass `format` arg to `with-demoted-errors`.
2022-02-04 19:39:53 -05:00
Andrea Corallo
dcf30f14f9 * Have null' and not' explicit in LIMPLE so we inline them
* lisp/emacs-lisp/comp.el (comp-limplify-lap-inst): Generate explicit
`eq' call in LIMPLE for LAP opcode 'not'.
2022-02-04 15:56:34 +01:00
Alan Mackenzie
aa795a6223 New file lisp/emacs-lisp/debug-early.el for backtraces in early bootstrap
This is also used in batch mode in general.

* lisp/debug-early.el (debug-early-backtrace, debug-early): New functions.

* lisp/loadup.el (top level): Load debug-early.el as first file.

* src/eval.c (signal_or_quit): Remove the condition in the batch mode section
of not being in dumping or bootstrap, since it is no longer needed.  Test that
'debug-early's symbol-function is bound.  Ensure there is enough working space
in specpdl and eval_depth.
(syms_of_eval): New DEFSYM for Qdebug_early.  Initialise Vdebugger to
Qdebug_early rather than Qnil.
2022-02-02 20:35:39 +00:00
Alan Mackenzie
27c93778ef Fix bug with M-x compile-defun in a defconst/defvar
* lisp/emacs-lisp/bytecomp.el (compile-defun): Have symbols-with-pos-enabled
bound to non-nil when the eval takes place.
2022-02-02 18:03:00 +00:00
Andreas Schwab
2c4a24975c Remove extra \= from obsoletion message
* lisp/emacs-lisp/eieio.el (defclass): Remove \= from obsoletion
message.
* lisp/emacs-lisp/eieio-core.el (eieio-defclass-autoload)
(eieio-defclass-internal): Likewise.
2022-02-01 12:02:11 +01:00
Stefan Monnier
cce477cad7 (byte-compile-eval): Adjust to changes in load-history
The `function-history` patch introduced a regression which caused
spurious compiler warnings.  Fix it.
The new code also fixes a bug in the old code, thus causing some
new non-spurious warnings.  Fix them as well.

* lisp/emacs-lisp/bytecomp.el (byte-compile-eval): Adjust to changes in
`load-history`.

* lisp/gnus/gnus-group.el (nnrss-discover-feed)
(nnrss-save-server-data): Use `declare-function`.

* lisp/cedet/semantic/wisent/comp.el (wisent-defcontext)
(wisent-with-context):
* lisp/emacs-lisp/comp.el (comp-op-case): Silence compiler warning.
2022-01-31 16:25:09 -05:00
Stefan Kangas
9a56b4e686 Factor out function to check for clang in tests
This also stops a flymake test from failing on my machine.

* lisp/emacs-lisp/ert-x.el (ert-gcc-is-clang-p): New function
factored out from ...
* test/lisp/progmodes/flymake-tests.el (flymake-tests--gcc-is-clang):
* test/lisp/cedet/semantic/bovine/gcc-tests.el
(semantic-gcc-test-output-parser-this-machine): ... here.

* test/lisp/progmodes/flymake-tests.el (different-diagnostic-types)
(included-c-header-files):
* test/lisp/cedet/semantic/bovine/gcc-tests.el
(semantic-gcc-test-output-parser-this-machine): Use above new function.
2022-01-31 07:42:50 +01:00
Lars Ingebrigtsen
7b13737055 Fix with-suppressed-warnings edebug spec
* lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): Fix
edebug spec.
2022-01-31 03:31:08 +01:00
Stefan Monnier
35cd9197fc package.el: Fix bug#53529
* lisp/emacs-lisp/package.el (package-autoload-ensure-default-file):
Enforce Unix EOLs.
2022-01-29 17:51:06 -05:00
Stefan Monnier
7531bf096e Reduce code duplication in parts of (auto)load&defalias
* src/data.c (defalias): New function, extracted from `Fdefalias`.
(Fdefalias): Use it.
(Ffset): Don't handle `Vautoload_queue` here, handle it in
`defalias` instead.
* src/comp.c (comp--register-subr): Use `defalias` instead of
duplicating its code.

* src/eval.c (load_with_autoload_queue): New function, extracted from
`Fautoload_do_load`.
(Fautoload_do_load): Use it.
(un_autoload): Mark it as static.
* src/fns.c (Frequire): Use it as well.

* src/lisp.h (defalias, load_with_autoload_queue): New declarations.
(un_autoload): Remove declaration.
2022-01-28 13:19:11 -05:00
Lele Gaifax
70c3437ae1 Fix copyright-fix-years, use a dash to separate years in a range
Commit 7a46fa9c75, allowing en-dash as
years separator, changed the way the years range is composed taking the
separator from the `sep' variable instead of always using an hardwired
hyphen. Since the code explicitly avoid to touch (that is, extend)
existing ranges, that `sep' variable is almost always a space, or
whatever character precedes the last parsed year, thus generating a
range like "2020 2022" instead of "2020-2022".

* lisp/emacs-lisp/copyright.el (copyright-fix-years): Always use an dash
to separate years in a range.

* test/lisp/emacs-lisp/copyright-tests.el (with-copyright-fix-years-test):
(copyright-fix-years-tests--data):
(text-copyright-fix-years): New test cases (bug#53597).
2022-01-28 15:23:05 +01:00
Andrea Corallo
60cfb90d01 * Have `benchmark-run-compiled' use the native compiler when available
* lisp/emacs-lisp/benchmark.el (benchmark-run-compiled): Use native
compiler when available.
2022-01-27 11:55:21 +01:00
Lars Ingebrigtsen
c5b0019e10 Fix copyright-find-copyright when searching from the end
* lisp/emacs-lisp/copyright.el (copyright-find-copyright): Make
the double check also work when searching from the end (bug#7179).

Do not merge to master.
2022-01-26 15:03:56 +01:00
Lars Ingebrigtsen
ed18d08f6f Fix copyright.el comment and add a test
* lisp/emacs-lisp/copyright.el (copyright-find-copyright): Fix
comment (bug#7179).

Do not merge to master.
2022-01-26 15:03:33 +01:00
Lars Ingebrigtsen
826959ccb4 Fix copyright-find-copyright when searching from the end
* lisp/emacs-lisp/copyright.el (copyright-find-copyright): Make
the double check also work when searching from the end (bug#7179).
2022-01-26 15:02:00 +01:00
Lars Ingebrigtsen
8a343ecee5 Fix copyright.el comment and add a test
* lisp/emacs-lisp/copyright.el (copyright-find-copyright): Fix
comment (bug#7179).
2022-01-26 14:53:07 +01:00
Andrea Corallo
dfaf8bec4e * `batch-byte+native-compile' produce .eln younger than .elc (bug#52912)
* lisp/emacs-lisp/comp.el (batch-native-compile): Add return
value.
(batch-byte+native-compile): Touch the produced .eln after the
corresponding .elc is produced.
2022-01-25 17:47:34 +01:00
Andrea Corallo
72a4cdaadc * lisp/emacs-lisp/comp.el (batch-byte+native-compile): Fix unwind form 2022-01-25 17:47:34 +01:00
Lars Ingebrigtsen
f16039b161 Don't mutate literals in tabulated-list-widen-current-column
* lisp/emacs-lisp/tabulated-list.el
(tabulated-list-widen-current-column): Avoid mutating constants
(bug#53501).
2022-01-25 14:21:22 +01:00
Lars Ingebrigtsen
c40398e008 Fix widening some columns in tabulated-list-widen-current-column
* lisp/emacs-lisp/tabulated-list.el
(tabulated-list-widen-current-column): Don't bug out on list-based
columns (bug#53498).
2022-01-25 13:58:30 +01:00
Stefan Monnier
96929e5d01 Remove some dubious uses of interactive-form
* lisp/emacs-lisp/cl-generic.el (cl--generic-lambda): `commandp` and
`interactive-form` are for function values, not for source code.
* lisp/cedet/semantic/db-el.el (semanticdb-elisp-sym->tag):
Prefer `commandp` over `interactive-form`.
2022-01-24 21:31:53 -05:00
Lars Ingebrigtsen
ead9547903 Allow jumping to ert failure definitions
* lisp/emacs-lisp/ert.el (ert-test):
(ert-deftest):  Store the file name.
(ert-test-location): New function.
(ert-run-tests-batch): Use it.

* lisp/emacs-lisp/find-func.el (find-ert-deftest-regexp): New
variable.
(find-function-regexp-alist): Add ert-deftest (bug#22471).

Based on code by Phillip Lord <phillip.lord@russet.org.uk>.
2022-01-24 14:01:06 +01:00
Mattias Engdegård
75c6564c92 ; * lisp/emacs-lisp/byte-opt.el: Remove outdated comments
These were optimisation ideas that have been implemented, have become
irrelevant, or were impractical to begin with.
2022-01-24 11:41:47 +01:00
Mattias Engdegård
721357b868 Remove the unused unbind-all bytecode
It was implemented but never generated, originally intended for
TCO in the pre-lexbind era (which was semantically dubious anyway).
Removing it speeds up the interpreter because there is no longer any
need for the outermost `count` variable unless checking is enabled.

* lisp/emacs-lisp/bytecomp.el:
* lisp/emacs-lisp/comp.el (comp-limplify-lap-inst):
* src/bytecode.c (BYTE_CODES, exec_byte_code):
Remove definition and implementation of unbind-all, freeing up the opcode
for other purposes.
2022-01-24 11:41:46 +01:00
Alan Mackenzie
dfae76c991 Expunge read-with-symbol-position and read-symbol-positions-list
These are remnants of the old way of determining byte compiler warning
positions.

* src/lread.c (read_internal_start, read1): Remove initializations amd
manipulations of these variables.
(syms_of_lread): Remove the declarations of the variables.

* lisp/emacs-list/bytecomp.el (compile-defun, byte-compile-from-buffer):
Remove bindings of the variables.
2022-01-24 01:08:03 +00:00
Alan Mackenzie
f4af1137e6 Bind print-symbols-bare to t in byte-compile-from-buffer
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Bind
print-symbols-bare to t here for the benefit of non-defining forms in buffers.
2022-01-23 16:41:23 +00:00