Commit graph

9739 commits

Author SHA1 Message Date
Mattias Engdegård
61b2f5f96b Single string literal in body is return value only, not doc string
A function or macro body consisting of a single string literal now only
uses it as a return value.  Previously, it had the dual uses as return
value and doc string, which was never what the programmer wanted and
had some inconvenient consequences (bug#69387).

This change applies to `lambda`, `defun`, `defsubst` and `defmacro`
forms; most other defining forms already worked in the sensible way.

* lisp/emacs-lisp/bytecomp.el (byte-compile-lambda):
Don't use a lone string literal as doc string.
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defun.el
(foo): Update docstring warning test.
* doc/lispref/functions.texi (Function Documentation): Update.
* etc/NEWS: Announce.
2024-03-07 13:47:53 +01:00
Stefan Monnier
218748c262 disass.el (disassemble-1): Minor simplification
* lisp/emacs-lisp/disass.el (disassemble-1): Remove code for functions
of the form (lambda ARGS (byte-code ...)) which we don't use any
more nowadays.
2024-03-04 23:42:50 -05:00
Stefan Monnier
418ad866bf cl-preloaded.el: Further fine-tuning
* lisp/emacs-lisp/cl-preloaded.el (cl--direct-supertypes-of-type):
Fix some left over issues:
- Remove redundant `number-or-marker` from `marker`s parents.
- Add `function` to the types, since it was missing.
(cl--typeof-types): Add a warning for missing type info.

* admin/syncdoc-type-hierarchy.el (syncdoc-hierarchy): Fix parent of
`oclosure`.

* doc/lispref/type_hierarchy.txt:
* doc/lispref/type_hierarchy.jpg: Update.
2024-03-04 23:12:29 -05:00
Mattias Engdegård
b9e8474a44 Repair miscompilation of single-arg apply (bug#69533)
* lisp/emacs-lisp/byte-opt.el (byte-optimize-apply):
Don't optimise single-argument `apply`; it's a legacy construct.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.
2024-03-04 14:13:26 +01:00
Stefan Monnier
1d9d07fb00 (cl--typeof-types): Rework to fix some regressions
Initialize the variables directly in their declaration, so
there no time where they exist but aren't yet initialized.
This also allows us to mark `cl--typeof-types` as a `defconst` again.

More importantly, specify the DAG by direct supertypes rather
than direct subtypes.  This is slightly less compact, but it's
necessary to let us specify the *order* of the supertypes,
which is necessary for example to preserve the desired ordering
of methods when several methods can be applied.

Fix a few more regressions, such as removing `atom` from the parents
of `function` since some lists are considered as functions,
adding `number-or-marker` as supertype of `integer-or-marker`,
and re-adding `native-comp-unit`.

I carefully compared all elements of `cl--typeof-types` to make
sure they are the same as before (with one exception for `null`).

* lisp/emacs-lisp/cl-preloaded.el (cl--type-hierarchy): Delete var.
(cl--direct-supertypes-of-type, cl--typeof-types):
Initialize directly in the declaration.
(cl--supertypes-lane, cl--supertypes-lanes-res): Delete vars.
(cl--supertypes-for-typeof-types-rec)
(cl--supertypes-for-typeof-types): Delete functions.
2024-03-03 18:08:50 -05:00
Andrea Corallo
8d11b7e427 * Fix 'cl--typeof-types' computation
* lisp/emacs-lisp/cl-preloaded.el (cl--supertypes-lane)
(cl--supertypes-lanes-res): Define vars.
(cl--supertypes-for-typeof-types-rec): Define function.
(cl--supertypes-for-typeof-types): Reimplement.
2024-03-03 17:49:14 +01:00
Andrea Corallo
8b96503b6e * lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Define as var. 2024-03-01 18:58:44 +01:00
Andrea Corallo
c55694785e Merge branch 'feature/type-hierarchy' into 'master' 2024-03-01 09:30:44 +01:00
Andrea Corallo
0567f3b817 * Fix compilation warning in 'cl--supertypes-for-typeof-types'
* lisp/emacs-lisp/cl-preloaded.el (cl--supertypes-for-typeof-types): Fix
warning.
2024-03-01 09:16:38 +01:00
Juri Linkov
8305d0e0c9 Add tabulated-list-groups and Buffer-menu-group-by (bug#69305)
* doc/lispref/modes.texi (Tabulated List Mode):
Add defvar tabulated-list-groups.

* lisp/buff-menu.el (Buffer-menu-group-by): New defcustom.
(Buffer-menu-unmark-all-buffers): Use tabulated-list-get-entry
to check whether the current line contains an entry.
(list-buffers-noselect): Enable outline-minor-mode
for tabulated-list-groups.
(list-buffers--refresh): When Buffer-menu-group-by is non-nil,
set tabulated-list-groups.
(Buffer-menu-group-by-mode, Buffer-menu-group-by-root):
New functions.

* lisp/emacs-lisp/tabulated-list.el (tabulated-list-groups):
New buffer-local variable.
(tabulated-list-print-fake-header): Add distinct overlay
property 'fake-header'.
(tabulated-list-header-overlay-p): Filter out overlays that
don't have the property 'fake-header'.
(tabulated-list-print): Use the variable 'tabulated-list-groups'
to sort entries in groups separately.
(tabulated-list-print-entries): New function factored out from
'tabulated-list-print'.

* test/lisp/emacs-lisp/tabulated-list-tests.el (tabulated-list-groups):
New test.
2024-02-29 19:50:04 +02:00
Eli Zaretskii
3923998240 Improve documentation of recent changes in comp-run.el
* lisp/emacs-lisp/comp-run.el
(native-comp-async-warnings-errors-kind): Rename from
'native-comp-async-report-warnings-errors-kind', and rename
'importants' to 'important'; all users changed.  Doc fix.

* etc/NEWS: Announce the new option.
2024-02-29 15:37:19 +02:00
Andrea Corallo
8e5baaddec * Add 'native-comp-async-report-warnings-errors-kind'
* lisp/emacs-lisp/comp-run.el (native-comp-async-report-warnings-errors-kind):
Add new customize.
2024-02-29 11:54:24 +01:00
Andrea Corallo
b8ba3cb7f0 * Improve 'native-comp-async-report-warnings-errors' tag
* lisp/emacs-lisp/comp-run.el (native-comp-async-report-warnings-errors):
Improve tag.
2024-02-29 11:26:08 +01:00
Andrea Corallo
1fbe56c327 Merge remote-tracking branch 'origin/master' into 'feature/type-hierarchy' 2024-02-28 20:47:57 +01:00
Andrea Corallo
05195e129f * lisp/emacs-lisp/cl-macs.el (cl-deftype-satisfies): Add 'symbol-with-pos'. 2024-02-28 20:44:32 +01:00
Andrea Corallo
91b90885ac * lisp/emacs-lisp/comp.el (comp-known-predicates): Add 'symbol-with-pos-p'. 2024-02-28 20:44:24 +01:00
Eli Zaretskii
229b3edb07 Merge from origin/emacs-29
01ebc95114 Fix 'help-quick-toggle'
afe49c7e2a ; * admin/authors.el (authors-aliases): Fix last change.
8b1f10f8cf ; Normalize Morgan Smith's attributions.
70cf4b694b ; * etc/PROBLEMS: Describe input lags due to GTK IM (bug#...
f28a557c7d * doc/lispref/modes.texi (Tabulated List Mode): Update.
d6131b5902 * lisp/net/tramp.el (tramp-methods): Fix typo in docstrin...
2eb85a9de1 ; * lisp/emacs-lisp/pcase.el (pcase-let*, pcase-let): Ano...
4c6653f23a ; * lisp/emacs-lisp/pcase.el (pcase-let*, pcase-let): Doc...
5a64d2c759 java-ts-mode: Indentation for opening brace on a separate...
9e56bd5ed8 Removed decommissioned PGP keyservers
e56f0ef51b org: Fix security prompt for downloading remote resource
65ba327465 Revert "Update to Org 9.6.19"
07a392f445 Update to Org 9.6.19
2024-02-24 06:35:16 -05:00
Mattias Engdegård
90d3b3408e Warn about docstrings with control characters
It is easy to include control chars in doc strings by mistake, and the
result is often an unreadable mess.

* lisp/emacs-lisp/bytecomp.el (byte-compile-warning-types)
(byte-compile-warnings, byte-compile--docstring-style-warn):
Add `docstrings-control-chars` warning.
* etc/NEWS: Announce.
2024-02-23 15:16:30 +01:00
Mattias Engdegård
462d8ba813 Add a proper type for obarrays
The new opaque type replaces the previous use of vectors for obarrays.
`obarray-make` now returns objects of this type.  Functions that take
obarrays continue to accept vectors for compatibility, now just using
their first slot to store an actual obarray object.

obarray-size and obarray-default-size now obsolete.

* lisp/obarray.el (obarray-default-size, obarray-size):
Declare obsolete.
(obarray-make, obarrayp, obarray-clear): Remove from here.
* src/fns.c (reduce_emacs_uint_to_hash_hash): Remove from here.
* src/lisp.h (struct Lisp_Obarray, OBARRAYP, XOBARRAY, CHECK_OBARRAY)
(make_lisp_obarray, obarray_size, check_obarray)
(obarray_iter_t, make_obarray_iter, obarray_iter_at_end)
(obarray_iter_step, obarray_iter_symbol, DOOBARRAY, knuth_hash): New.
(reduce_emacs_uint_to_hash_hash): Moved here.
* src/lread.c (check_obarray): Renamed and reworked as...
(checked_obarray_slow): ...this.
(intern_sym, Funintern, oblookup, map_obarray)
(Finternal__obarray_buckets): Adapt to new type.
(obarray_index, allocate_obarray, make_obarray, grow_obarray)
(obarray_default_bits, Fobarray_make, Fobarrayp, Fobarray_clear): New.
* etc/emacs_lldb.py (Lisp_Object):
* lisp/emacs-lisp/cl-macs.el (`(,type . ,pred)):
* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types):
* lisp/emacs-lisp/comp-common.el (comp-known-type-specifiers):
* lisp/emacs-lisp/comp.el (comp-known-predicates):
* src/alloc.c (cleanup_vector, process_mark_stack):
* src/data.c (Ftype_of, syms_of_data):
* src/minibuf.c (Ftry_completion, Fall_completions, Ftest_completion):
* src/pdumper.c (dump_obarray_buckets, dump_obarray, dump_vectorlike):
* src/print.c (print_vectorlike_unreadable):
* test/lisp/abbrev-tests.el (abbrev-make-abbrev-table-test):
* test/lisp/obarray-tests.el (obarrayp-test)
(obarrayp-unchecked-content-test, obarray-make-default-test)
(obarray-make-with-size-test):
Adapt to new type.
2024-02-23 13:02:27 +01:00
Mattias Engdegård
aa82fe9931 Use obarray-make instead of make-vector to create obarrays
This prepares for the introduction of an actual obarray type.

* lisp/cedet/semantic/lex-spp.el (semantic-lex-spp-dynamic-map)
(semantic-lex-spp-dynamic-map-stack, semantic-lex-make-spp-table):
* lisp/cedet/semantic/lex.el (semantic-lex-make-keyword-table)
(semantic-lex-make-type-table):
* lisp/completion.el (cmpl-prefix-obarray, cmpl-obarray)
(clear-all-completions):
* lisp/emacs-lisp/checkdoc.el (checkdoc-defun-info):
* lisp/emacs-lisp/eldoc.el (eldoc-message-commands)
(eldoc-edit-message-commands):
* lisp/mail/mail-extr.el (mail-extr-all-top-level-domains):
* lisp/mail/rmailkwd.el (rmail-label-obarray):
* lisp/net/dns.el (dns-cache):
* lisp/net/eww.el (eww-suggested-uris):
* lisp/net/imap.el (imap-open, imap-mailbox-select-1)
(imap-message-copyuid-1, imap-message-appenduid-1):
* lisp/obsolete/pgg.el (pgg-passphrase-cache, pgg-pending-timers):
* lisp/play/cookie1.el (cookie-cache):
* lisp/progmodes/cc-defs.el (c-lang-constants, c-define-lang-constant):
* lisp/progmodes/cc-langs.el (c-keywords-obarray):
* lisp/vc/vc-hooks.el (vc-file-prop-obarray):
* test/lisp/obarray-tests.el (obarrayp-test):
* test/src/minibuf-tests.el (minibuf-tests--strings-to-obarray):
Use obarray-make instead of obarray-make.
2024-02-23 13:02:27 +01:00
Andrea Corallo
58ca91fe07 * Fix 'parse-colon-path' entry in 'comp-known-type-specifiers'
* lisp/emacs-lisp/comp-common.el (comp-known-type-specifiers): Fix
'parse-colon-path'.
2024-02-22 20:49:55 +01:00
Andrea Corallo
b214cb2843 ; * lisp/emacs-lisp/comp-run.el: Fix typo. 2024-02-21 21:38:11 +01:00
Andrea Corallo
44d5c667d7 * lisp/emacs-lisp/comp.el (comp--compute-function-types): Fix missing doc. 2024-02-21 17:52:52 +01:00
Andrea Corallo
88abbf00af ; Add two comments on comp-known-predicates cl-deftype-satisfies
* lisp/emacs-lisp/comp.el (comp-known-predicates): Add comment.
* lisp/emacs-lisp/cl-macs.el: Likewise.
2024-02-21 17:42:58 +01:00
Andrea Corallo
c65a59a9e9 * Add few missing entries in 'comp-known-predicates'
* lisp/emacs-lisp/comp.el (comp-known-predicates): Add framep, markerp,
number-or-marker-p, overlayp, processp, subrp and windowp and sort it
alphabetically.
2024-02-21 17:42:58 +01:00
Andrea Corallo
5aeea8dc2c * lisp/emacs-lisp/comp-cstr.el (comp-cstr): Rename constructors. 2024-02-21 17:42:58 +01:00
Andrea Corallo
1e1d3f3acd ; * lisp/emacs-lisp/comp.el (native-comp-debug): Fix spacing. 2024-02-21 17:42:58 +01:00
Andrea Corallo
7215c63fc0 * Make 'comp--compute-function-types' a pass
* lisp/emacs-lisp/comp.el (comp-passes): Add comp--compute-function-types.
(comp--compute-function-types): New function.
(comp--compute-function-type): Move it.
(comp--final): Update it.
2024-02-21 17:42:58 +01:00
Stefan Monnier
3b34c5e4a5 * lisp/emacs-lisp/map.el (map--make-pcase-bindings): Fix use in Emacs<30 2024-02-21 08:49:15 -05:00
Jonas Bernoulli
1acc7cb851
Do not attempt to check declarations in lock files
* lisp/emacs-lisp/check-declare.el (check-declare-directory): Do
not attempt to check declarations in lock files.  (Bug#69084)
2024-02-20 22:49:07 +01:00
Jonas Bernoulli
167d9b9040 Allow trivially autoloading uses of transient's define macros
Since 49e41991b2 transient-define-prefix itself was autoloaded, but
that meant that when ever an autoload file was loaded, which contained
an autoload for a command defined using that macro, transient itself
had to be loaded.

That shouldn't be necessary.  For commands using these macros, an
autoload that is identical to what would have been generated if it
had been defined using defun, works just fine.

* lisp/emacs-lisp/loaddefs-gen.el
(loaddefs-generate--make-autoload): Allow uses of
transient-define-prefix, transient-define-suffix,
transient-define-infix and transient-define-argument
to be autoloaded using just ";;;autoload".

* lisp/transient.el (transient-define-prefix): No longer autoload.
2024-02-20 22:04:51 +01:00
Andrea Corallo
bbf0b7d040 * Fix missing entry in 'cl--typeof-types'
* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add
'native-comp-unit'.
2024-02-20 19:52:37 +01:00
Eli Zaretskii
2eb85a9de1 ; * lisp/emacs-lisp/pcase.el (pcase-let*, pcase-let): Another doc fix. 2024-02-20 19:15:38 +02:00
Eli Zaretskii
4c6653f23a ; * lisp/emacs-lisp/pcase.el (pcase-let*, pcase-let): Doc fix. 2024-02-20 15:44:13 +02:00
Jonas Bernoulli
d9afa1f30f
Make find-function-regexp also find transient-define-*
* lisp/emacs-lisp/find-func.el (find-function-regexp): Also find
transient-define-prefix, transient-define-suffix,
transient-define-infix and transient-define-argument.
2024-02-20 13:58:32 +01:00
Mattias Engdegård
ddfba511c1 Check shortdoc keywords and fix one mistake
* lisp/emacs-lisp/shortdoc.el (shortdoc--check)
(define-short-documentation-group): Check that used keywords exist.
* lisp/emacs-lisp/shortdoc.el (list): Fix a typo.
2024-02-19 15:57:05 +01:00
Andrea Corallo
24e8fceb96 Fix typo in 'cl--type-hierarchy'
* lisp/emacs-lisp/cl-preloaded.el (cl--type-hierarchy): Fix typo.
* doc/lispref/type_hierarchy.txt: Regenerate.
* doc/lispref/type_hierarchy.jpg: Likewise.
2024-02-18 20:12:38 +01:00
Eli Zaretskii
e6dae47d71 Merge from origin/emacs-29
45f9af61b8 Remove references to phst@google.com.
7256690a3c * BUGS: Note how to report critical security issues.
1035669b38 Add cross-reference to ELisp manual Caveats
61a1450762 Improve directory prompt used by package-vc-checkout
0c7c8210cb Minor Tramp doc adaption
df243f785d Merge branch 'emacs-29' of git.sv.gnu.org:/srv/git/emacs ...
17a395e04c ;; Fix typo in the Tramp documentation
614b244a7f * Improve reproducibility of inferred values by native comp
9f9da26e0d Handle typescript ts grammar breaking change for function...
717d8c4285 Don't quote 't' in doc strings
2024-02-17 04:54:48 -05:00
Andrea Corallo
4dbc3bbcc5 ; * lisp/emacs-lisp/comp.el (comp--write-bytecode-file): Add comment. 2024-02-15 19:20:03 +01:00
Andrea Corallo
80dce18a39 * lisp/emacs-lisp/cl-preloaded.el (cl--direct-subtypes-of-type): Remove. 2024-02-15 19:10:35 +01:00
Andrea Corallo
aa84998489 * make use of 'cl--direct-supertypes-of-type' in the native-compiler
* lisp/emacs-lisp/comp-cstr.el (comp--direct-supertypes): Use
cl--direct-supertypes-of-type.
2024-02-15 16:48:36 +01:00
Andrea Corallo
8a63e50036 * Define 'cl--type-hierarchy' and compute 'cl--typeof-types' from it
* lisp/emacs-lisp/cl-preloaded.el (cl--type-hierarchy)
(cl--direct-supertypes-of-type, cl--direct-subtypes-of-type): Define.
(cl--typeof-types): Compute automatically.
(cl--supertypes-for-typeof-types): New function.
2024-02-15 16:48:36 +01:00
Joseph Turner
61a1450762 Improve directory prompt used by package-vc-checkout
* lisp/emacs-lisp/package-vc.el (package-vc--read-package-name): Use
read-directory-name instead of read-file-name.  (Bug#66114)
2024-02-14 17:51:59 +01:00
Gerd Möllmann
decfdd4f1a Take file-local variables into account in elint-file (bug#69076)
* lisp/emacs-lisp/elint.el (elint-file): Use hack-local-variables.
2024-02-14 08:54:04 +01:00
Steven Allen
7c23234b4e Respect :lisp-dir whilst scanning for VC package dependencies
* lisp/emacs-lisp/package-vc.el (package-vc--unpack-1):
Scan 'lisp-dir', if set, for lisp files instead of scanning the root
package directory.  (Bug#69019)
2024-02-13 22:06:36 +01:00
Stefan Monnier
40994d2baf (cl--generic-describe): Refactor to ease reuse
* lisp/emacs-lisp/cl-generic.el (cl--map-methods-documentation):
New function, extrated from `cl--generic-describe`.
(cl--generic-describe): Use it.
2024-02-12 17:42:28 -05:00
Stefan Monnier
57544fa2a2 loaddefs-gen.el: Generate an autoload for pcase-defmacro
Autoload cookies on uses of `pcase-defmacro` used to copy
the definition wholesale instead of generating the expected autoload.

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--make-autoload):
Look inside `eval-and-compile` as well.
2024-02-11 22:19:49 -05:00
Stefan Monnier
806759dc0a (pcase): New _ syntax in pred/app functions
The current syntax for functions in `app` and `pred` patterns
allows a shorthand (F ARGS) where the object being matched is
added as an extra last argument.  This is nice for things like
(pred (< 5)) but sometimes the object needs to be at
another position.
Until now you had to use (pred (lambda (x) (memq x my-list)))
or (pred (pcase--flip memq my-list)) in those cases.
So, introduce a new shorthand where `_` can be used to indicate
where the object should be passed: (pred (memq _ my-list))

* lisp/emacs-lisp/pcase.el (pcase--split-pred): Document new syntax
for pred/app functions.
(pcase--funcall): Support new syntax.
(pcase--flip): Declare obsolete.
(pcase--u1, \`): Use `_` instead.
(pcase--split-pred): Adjust accordingly.

* doc/lispref/control.texi (pcase Macro): Document new syntax
for pred/app functions.

* lisp/progmodes/opascal.el (pcase-defmacro):
* lisp/emacs-lisp/seq.el (seq--make-pcase-bindings):
* lisp/emacs-lisp/eieio.el (eieio):
* lisp/emacs-lisp/cl-macs.el (cl-struct, cl-type):
Use _ instead of `pcase--flip`.
(cl--pcase-mutually-exclusive-p): Adjust accordingly.

* lisp/emacs-lisp/map.el (map--pcase-map-elt): Declare obsolete.
(map--make-pcase-bindings): Use `_` instead.
2024-02-11 22:00:44 -05:00
Stefan Monnier
9a1522197f (cl--generic-describe): Fix regression introduced by fix to bug#54628
Since that fix, we made other changes (put arg names in allcaps)
which also happen to fix bug#54628, so we can remove the original fix
which was suboptimal when the type includes quotes.

* lisp/emacs-lisp/cl-generic.el (cl--generic-describe):
Don't rebind `print-quoted` to nil.

* test/lisp/emacs-lisp/cl-generic-tests.el
(cl-generic-tests--print-quoted): New test.
2024-02-11 18:13:27 -05:00
Stefan Monnier
052c2ce028 (pcase): Add buttons to the macros' defs in the docstring of pcase
* lisp/emacs-lisp/pcase.el (pcase--find-macro-def-regexp): New var.
(find-function-regexp-alist): Add entry for `pcase-macro`s.
(help-fns--signature): Move declaration to where we know it is valid.
(pcase--make-docstring): Add buttons to jump to the definition
of Pcase macros.
2024-02-11 17:43:37 -05:00