Commit graph

7959 commits

Author SHA1 Message Date
Stefan Kangas
18eec5720e * lisp/emacs-lisp/checkdoc.el (checkdoc-dired): Autoload. 2021-11-12 11:41:37 +01:00
Stefan Kangas
fc00fe53e1 Merge from origin/emacs-28
a6905e90cc Fix problem with temp buffer killing in package-install-file
144ad77fda Fix Lisp Intro markup error
24b86cb4f7 Fix ACL errors with WebDAV volumes on MS-Windows
2021-11-12 07:17:11 +01:00
Lars Ingebrigtsen
a6905e90cc Fix problem with temp buffer killing in package-install-file
* lisp/emacs-lisp/package.el (package-install-file): Allow killing
the temporary buffer without querying (bug#51769).
2021-11-12 04:44:09 +01:00
Miha Rihtaršič
0a93fb499b Set minibuffer-completion-* variables locally in more places
* lisp/calc/calc-store.el (calc-read-var-name):
* lisp/emacs-lisp/crm.el (completing-read-multiple):
* lisp/progmodes/cc-styles.el (c-read-offset):
* lisp/window.el (read-buffer-to-switch):
Set `minibuffer-completion-*` variables buffer-locally instead of
using a global let-binding (bug#48925).

Follow-up to commit
2021-05-01 "* lisp/minibuffer.el (completing-read-default): Fix bug#45474"
2021-11-11 06:16:52 +01:00
Lars Ingebrigtsen
6c405b7a49 Note that loaddefs.el is copied to ldefs-boot.el
* lisp/emacs-lisp/autoload.el (autoload-rubric): Add a comment to
the file noting what'll happen to it.
2021-11-11 04:08:51 +01:00
Robert Pluim
a491b73c76 Improve 'ensure-empty-lines' docstring
* lisp/emacs-lisp/subr-x.el (ensure-empty-lines): Fix typo and improve
wording.
2021-11-10 17:42:30 +01:00
Stefan Kangas
810fa21d26 Avoid another byte-compiler warning in package-quickstart.el
* lisp/emacs-lisp/package.el (package-quickstart-refresh): Avoid
byte-compiler warning "assignment to free variable" in
package-quickstart.el.
2021-11-10 15:24:29 +01:00
Stefan Kangas
1e7720d39a Avoid spurious byte-compiler warnings in package-quickstart.el
* lisp/emacs-lisp/package.el (package-quickstart-refresh): Disable the
"`make-variable-buffer-local' not called at toplevel" byte-compiler
warnings.  Given that we wrap it all in a let-form, these are mostly
false positives and not helpful.
2021-11-10 14:52:38 +01:00
Tom Levy
a28647a6b6 Remove spurious %S from 'define-error' messages
; The MESSAGE arg of 'define-error' does not support format specifiers
; (unlike the 'error' function). The signal data is automatically
; appended to the error message.

* lisp/emacs/lisp/cl-generic.el (cl--generic-cyclic-definition):
Remove spurious %S from error message.
* lisp/emacs-lisp/gv.el (gv-invalid-place): Remove spurious %S from
error message (and rephrase) (bug#51718).

Copyright-paperwork-exempt: yes
2021-11-10 01:16:16 +01:00
Lars Ingebrigtsen
2e6ed253ce Add new function 'file-name-split'
* doc/lispref/files.texi (File Name Components): Document it.
* lisp/files.el (file-name-split): New function (bug#50572).

* lisp/emacs-lisp/shortdoc.el (file-name): Mention it.
2021-11-10 00:26:32 +01:00
akater
3fd0e7fba6 ; * lisp/emacs-lisp/lisp-mode.el: Restore one check in flet handling
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p):
Do check backward-up-list executing without errors (bug#9622).
2021-11-09 04:26:05 +01:00
Stefan Monnier
4f365eec10 * lisp/emacs-lisp/cl-generic.el: Add reference to inspiration 2021-11-08 08:20:43 -05:00
akater
ca9fb109f7 lisp/emacs-lisp/lisp-mode.el: Fix parser state corruption.
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p): Preserve
the point.
* test/lisp/progmodes/elisp-mode-resources/flet.erts: Add corresponding
test example (bug#9622).
2021-11-08 07:38:41 +01:00
Lars Ingebrigtsen
67276f3403 Make debugging ert--erts-specifications easier
* lisp/emacs-lisp/ert.el (ert--erts-specifications): Strip text
properties from specs to make debugging easier.
2021-11-07 23:45:14 +01:00
Basil L. Contovounesios
e9a5084c45 ; Fix some recent typos/thinkos. 2021-11-07 12:59:18 +02:00
Lars Ingebrigtsen
d69b5a9caa Fix pp-emacs-lisp-code for `when' and related
* lisp/emacs-lisp/pp.el (pp--format-definition): Skip edebug specs
we don't understand at all.
2021-11-07 02:44:42 +01:00
Stefan Kangas
0cac4598a7 Ensure return value of ert-with-temp-directory
* lisp/emacs-lisp/ert-x.el (ert-with-temp-file): Ensure return
value when :directory is t is the directory name.
* test/lisp/emacs-lisp/ert-x-tests.el
(ert-x-tests-with-temp-directory): Extend test for the above.
2021-11-07 01:54:31 +01:00
Stefan Kangas
5dd27fef58 Add generated suffix to test temp file names
* lisp/emacs-lisp/ert-x.el
(ert-with-temp-file): Add temp file name suffix based on file name of
caller.  Reflow docstring.
(ert--with-temp-file-generate-suffix): New defun.
* test/lisp/emacs-lisp/ert-x-tests.el
(ert-x-tests--with-temp-file-generate-suffix): New test.
2021-11-07 01:54:30 +01:00
dickmao
9dfd945a2c Fix byte compilation of package built-ins
* lisp/emacs-lisp/package.el
(package--activate-autoloads-and-load-path):
(package--load-files-for-activation): Remove.
(package--library-stem): New function, because
file-name-sans-extension is insufficient.
(package--reload-previously-loaded): New function.
(package-activate-1): Reload directly.
(package--files-load-history):
(package--list-of-conflicts):
(package--list-loaded-files): Remove
(package-unpack): Adjust call.

* test/lisp/emacs-lisp/package-tests.el (macro-builtin-func): Test.
(macro-builtin-10-and-90): Test.
(package-test-macro-compilation): Test.
(package-test-macro-compilation-gz): Test (bug#49708).
2021-11-07 01:28:47 +01:00
Stefan Kangas
bf2e35c5d2 New convenience macros ert-with-temp-(file|directory)
* lisp/emacs-lisp/ert-x.el
(ert-with-temp-file)
(ert-with-temp-directory): New macros.
* test/lisp/emacs-lisp/ert-x-tests.el
(ert-x-tests-with-temp-directory)
ert-x-tests-with-temp-directory/text-signals-error
(ert-x-tests-with-temp-file)
(ert-x-tests-with-temp-file/handle-error)
(ert-x-tests-with-temp-file/prefix-and-suffix-kwarg)
(ert-x-tests-with-temp-file/text-kwarg)
(ert-x-tests-with-temp-file/unknown-kwargs-signals-error): New tests.
2021-11-06 19:16:05 +01:00
Lars Ingebrigtsen
82d0550648 Remove messaging in pp-display-expression.
* lisp/emacs-lisp/pp.el (pp-display-expression): Remove confusing
message -- we don't usually say that we've popped up a new buffer when
we do so.
2021-11-06 02:20:06 +01:00
Stefan Kangas
1eaee319ea Add "N.B." abbreviation to checkdoc
* lisp/emacs-lisp/checkdoc.el (checkdoc-in-abbreviation-p): Add
abbreviation "N.B.".
2021-11-05 22:31:42 +01:00
Stefan Kangas
49a6b26cf7 Don't hardcode "Commentary" section in checkdoc
* lisp/emacs-lisp/checkdoc.el
(checkdoc-commentary-header-string): New defvar.
(checkdoc-file-comments-engine): Insert value of above new
variable instead of hardcoding what is inserted for the
"Commentary" section.
2021-11-05 22:31:17 +01:00
Lars Ingebrigtsen
c1865384d7 Allow 'pp' to limit the line widths
* lisp/emacs-lisp/pp.el (pp-max-width, pp-use-max-width): New user
options (bug#11934).
(pp-to-string): Use it.
(pp--insert-lisp): Tweak whether to use standard-output or not.
(pp--max-width): New function.
2021-11-05 15:27:08 +01:00
Lars Ingebrigtsen
a78ac0c5df Try harder to keep lines short in pp-emacs-lisp-code
* lisp/emacs-lisp/pp.el (pp--insert): Try harder to keep lines short.
2021-11-04 23:32:51 +01:00
Lars Ingebrigtsen
4cf7af5a2a Tweak multi-line expressions in pp--format-function
* lisp/emacs-lisp/pp.el (pp--format-function): Fix up multi-line
expressions.
2021-11-04 23:16:47 +01:00
Lars Ingebrigtsen
cb9f3e1158 Fix up some list folding in pp-emacs-lisp-code
* lisp/emacs-lisp/pp.el (pp--insert-lisp, pp--format-list)
(pp--insert): Touch up list folding.
2021-11-04 22:31:15 +01:00
Lars Ingebrigtsen
fb1267d90a Indent lambdas/closures better
* lisp/emacs-lisp/pp.el (pp--format-function): Indent lambdas and
closures better.
2021-11-04 22:07:48 +01:00
Lars Ingebrigtsen
292f50d27b Make lambda/closure help buttons format as Emacs Lisp
* lisp/help.el (help--describe-command): Format lambda/closures as
Emacs Lisp.

* lisp/emacs-lisp/pp.el (pp-display-expression): Allow formatting
as Emacs Lisp.
2021-11-04 21:52:56 +01:00
Lars Ingebrigtsen
6cf86ed4c1 Add new basic Emacs Lisp code formatting function
* lisp/emacs-lisp/pp.el (pp-emacs-lisp-code): New interface function.
(pp): Mention it.
(pp--insert-lisp, pp--format-vector, pp--format-list)
(pp--format-function, pp--format-definition, pp--insert-binding)
(pp--insert, pp--indent-buffer): New helper functions.
2021-11-04 21:44:53 +01:00
Lars Ingebrigtsen
1c3e45396e Rename button-buttonize to buttonize
* lisp/help.el (help--describe-command):
* lisp/emacs-lisp/memory-report.el (memory-report--buffers):
* lisp/button.el (button-buttonize):
* doc/lispref/display.texi (Making Buttons): Rename
button-buttonize to just buttonize and adjust callers.
2021-11-04 18:14:29 +01:00
Mattias Engdegård
493fde95be Optimise (cond) => nil at source level
* lisp/emacs-lisp/byte-opt.el (byte-optimize-cond):
Optimise clause-free `cond`, which can arise from earlier
transformations.  This enables further optimisations.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test cases.
2021-11-02 22:46:20 +01:00
Stefan Kangas
2612488c36 Support inserting images in tabulated-list-mode columns
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print-col):
Support using an image descriptor to insert an image in a column.
(tabulated-list-entries):
* doc/lispref/modes.texi (Tabulated List Mode): Update documentation
to reflect above change.
2021-11-02 17:44:57 +01:00
Lars Ingebrigtsen
cd73ec72a6 Make lambdas/closures/byte code in `C-h b' clickable
* lisp/help.el (help--describe-command): Add links for
lambdas/closures/byte code (bug#24235).

* lisp/emacs-lisp/pp.el (pp-display-expression): Autoload.
2021-11-02 16:20:19 +01:00
Gregory Heytings
daea9b3b44 Read mailcaps again only when necessary
* doc/lispref/files.texi (File Attributes): Document it.

* lisp/files.el (file-has-changed-p): New function.
(file-has-changed-p--hash-table): Internal variable used by the
new function (bug#51523).
* lisp/emacs-lisp/shortdoc.el (file): Mention it.

* lisp/net/mailcap.el (mailcap-parse-mailcaps): Read mailcaps again
only when at least one of the mailcap files has changed.  Fixes
bug#51523.
2021-11-01 14:51:57 +01:00
Stefan Monnier
d553e603f4 eieio-core.el: Make slot-value work on defstructs
Adjust the values in EIEIO's index-tables so they are compatible with those
of defstructs.

* lisp/emacs-lisp/eieio-core.el (eieio--slot-name-index): Don't add the
`eieio--object-num-slots` offset.
(eieio-defclass-internal): Add the `eieio--object-num-slots` offset
here instead.
(eieio-oref): Allow its use on `cl-structure-object`.

* lisp/emacs-lisp/eieio.el (eieio-pcase-slot-index-from-index-table):
Don't need to add the `eieio--object-num-slots` offset.

* doc/misc/eieio.texi (Accessing Slots, Accessing Slots):
Mention the use on structs.

* test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
(eieio-test-defstruct-slot-value): New test.
2021-10-31 10:58:43 -04:00
Stefan Kangas
54b8ec4e6f Remove workaround for fixed Bug#6581 from ert
* lisp/emacs-lisp/ert.el (ert-equal-including-properties): Make
into obsolete function alias for 'equal-including-properties'.
* test/src/editfns-tests.el (format-properties):
* test/lisp/emacs-lisp/ert-x-tests.el (ert-propertized-string)
(ert-test-run-tests-interactively-2): Don't use above obsolete
name.

(ert--explain-equal-including-properties-rec): New function.
(ert--explain-equal-including-properties): Use as an explainer for
'equal-including-properties' now that Bug#6581 is fixed.

* test/lisp/emacs-lisp/ert-tests.el
(ert-test-explain-equal-string-properties): Expand test.
(ert-test-equal-including-properties): Merge test into above
expanded test.
2021-10-31 03:02:32 +01:00
Stefan Kangas
8227d1273e Fix bug with string values in equal-including-properties
* src/intervals.c (intervals_equal_1): Factor out from
intervals_equal.  Optionally use Fequal for comparison of string
values in property lists.
(intervals_equal): Update for the above.
(compare_string_intervals): Use the above optional Fequal comparison
to fix a bug where 'equal-including-properties' compared strings with
eq, instead of equal.  (Bug#6581)
* test/src/fns-tests.el (fns-tests-equal-including-properties)
(fns-tests-equal-including-properties/string-prop-vals): New tests.

* test/lisp/emacs-lisp/ert-tests.el
(ert-test-equal-including-properties): Remove parts testing
'equal-including-properties'.
* lisp/emacs-lisp/ert.el (ert-equal-including-properties): Add
FIXME that this should be removed.
2021-10-31 03:02:32 +01:00
Lars Ingebrigtsen
c23cb2861e Add new function string-glyph-split
* doc/lispref/strings.texi (Creating Strings): Document it.
* lisp/emacs-lisp/shortdoc.el (string): Mention it.

* lisp/emacs-lisp/subr-x.el (string-glyph-split): New function.
2021-10-30 15:22:36 +02:00
Eli Zaretskii
c30f95078c Merge from origin/emacs-28
20ebd91a73 Improve documentation of string truncation APIs
3f998a3fc8 * lisp/textmodes/css-mode.el: Fix typo.  (Bug#51488)
2021-10-30 04:07:09 -04:00
Eli Zaretskii
20ebd91a73 Improve documentation of string truncation APIs
* doc/lispref/display.texi (Size of Displayed Text):
* lisp/international/mule-util.el (truncate-string-to-width):
Document caveats of using 'truncate-string-to-width' when
character composition is involved.

* lisp/emacs-lisp/subr-x.el (string-limit):
* doc/lispref/strings.texi (Creating Strings): Improve the
documentation of 'string-limit'.
2021-10-30 10:26:38 +03:00
Glenn Morris
faa2a990c9 Merge from origin/emacs-28
52e7049b58 * lisp/loadup.el: Unbreak build.
91e7df281e Move lisp/shorthands.el to lisp/emacs-lisp/shorthands.el
00103154e0 Some Tramp changes, mainly in tramp-tests.el
2021-10-29 09:20:05 -07:00
Lars Ingebrigtsen
91e7df281e Move lisp/shorthands.el to lisp/emacs-lisp/shorthands.el 2021-10-29 14:37:08 +02:00
akater
0aa9f478e9 Indent cl-flet-like forms correctly in incomplete expressions
* lisp/emacs-lisp/lisp-mode.el
(lisp--local-defform-body-p): Support incomplete sexps

* test/lisp/progmodes/elisp-mode-resources/flet.erts:
Add tests for incomplete sexps (bug#9622).
2021-10-28 23:53:50 +02:00
Stefan Monnier
c22b735f0c (string-pixel-width): Rewrite to avoid side effects
* src/xdisp.c (Fwindow_text_pixel_size): Allow `window` to be a buffer.
* lisp/emacs-lisp/subr-x.el (string-pixel-width): Simplify accordingly.
2021-10-27 14:03:43 -04:00
Lars Ingebrigtsen
7c6f7dc99b Simplify string-pixel-width
* lisp/emacs-lisp/subr-x.el (string-pixel-width): Simplify --
save-window-excursion saves dedication status (and the code was
buggy).
2021-10-27 16:50:40 +02:00
Lars Ingebrigtsen
713e19a60a Fix parsing of erts files
* lisp/emacs-lisp/ert.el (ert-test-erts-file): Fix progress
through a test file (bug#51409).
2021-10-27 16:13:30 +02:00
Lars Ingebrigtsen
5b61f2defe Harden ert-resource-directory against errors
* lisp/emacs-lisp/ert-x.el (ert-resource-directory): Be more
resilient -- don't bug out if called from a file that's not
visiting a directory.
2021-10-27 16:04:31 +02:00
Lars Ingebrigtsen
03366de394 Add new function 'string-pixel-width'
* doc/lispref/display.texi (Size of Displayed Text): Mention it.
* lisp/emacs-lisp/shortdoc.el (string): Mention it.

* lisp/emacs-lisp/subr-x.el (string-pixel-width): New function.
2021-10-27 15:41:32 +02:00
Stefan Kangas
241574375d Add links to commentary reached with finder-list-keywords
* lisp/finder.el (finder-goto-xref): Move from here...
* lisp/emacs-lisp/package.el (package--finder-goto-xref): ...to
here.  Make the old name into an obsolete function alias.
(package--finder-xref): New button type.
(package--describe-add-library-links): Factor out new function...
* lisp/finder.el (finder-commentary): ...from here.
(describe-package-1): Call above new function.  This fixes an
issue where commentaries reached via 'finder-list-keywords' did
not have links.  (Bug#10814)
2021-10-23 05:28:32 +02:00