Commit graph

7700 commits

Author SHA1 Message Date
Peter Feigl
a6afa221d7 Add commands to move to next/previous column in tabulated-list-mode
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode-map): Add
keybindings M-left and M-right.
(tabulated-list-previous-column tabulated-list-next-column): Implement
commands (bug#44711).
2021-07-25 09:16:08 +02:00
Lars Ingebrigtsen
f04f8126f0 Rename directory-append to file-name-concat
* src/fileio.c (Ffile_name_concat):
* lisp/files.el (move-file-to-trash):
* lisp/emacs-lisp/shortdoc.el (file-name):
* doc/lispref/files.texi (Directory Names): Rename
`directory-append' to `file-name-concat'.
2021-07-25 08:54:20 +02:00
Lars Ingebrigtsen
b4543dfa9e Extend directory-append to take an arbitrary number of components
* doc/lispref/files.texi (Directory Names): Document it.
* lisp/emacs-lisp/shortdoc.el (file-name): Add new example.

* src/fileio.c (Fdirectory_append): Change the function to take an
arbitrary number of components.
2021-07-24 17:22:43 +02:00
Lars Ingebrigtsen
5431a58e86 Add new function `directory-append'
* doc/lispref/files.texi (Directory Names): Document it, and
remove the concat-based file concatenation description.
* lisp/emacs-lisp/shortdoc.el (file-name): Add.  And add more
expand-file-name examples.

* src/fileio.c (Fdirectory_append): New function.
2021-07-24 13:30:58 +02:00
Mattias Engdegård
109ca1bd00 Warn about arity errors in inlining calls (bug#12299)
Wrong number of arguments in inlining function calls (to `defsubst` or
explicitly using `inline`) did not result in warnings, or in very
cryptic ones.

* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Add calls
to `byte-compile--check-arity-bytecode`.
* lisp/emacs-lisp/bytecomp.el (byte-compile-emit-callargs-warn)
(byte-compile--check-arity-bytecode): New functions.
(byte-compile-callargs-warn): Use factored-out function.
* test/lisp/emacs-lisp/bytecomp-resources/warn-callargs-defsubst.el:
* test/lisp/emacs-lisp/bytecomp-tests.el ("warn-callargs-defsubst.el"):
New test case.
2021-07-23 15:19:01 +02:00
Eli Zaretskii
3edc4fb5d8 ; * lisp/emacs-lisp/macroexp.el (macroexp-warn-and-return): Doc fix. 2021-07-22 10:31:14 +03:00
Lars Ingebrigtsen
a828557320 Move generalized variable specs from cl-lib.el to gv.el
* lisp/emacs-lisp/cl-lib.el: Move all the generalized variable
specifications from cl-lib.el...
* lisp/emacs-lisp/gv.el: ... to gv.el.  This will make things like
`(setf (getenv "FOO") "BAR")' work without requiring anything,
since `setf' lives in gv.el (bug#49651).
2021-07-22 00:21:34 +02:00
Stefan Monnier
52187012f1 * lisp/emacs-lisp/macroexp.el (macroexp-warn-and-return): Add arg category
Use it to obey `byte-compile-warnings`.

(macroexp--warn-wrap): Add arg `category`.
(macroexp-macroexpand, macroexp--expand-all): Use it.

* lisp/emacs-lisp/cconv.el (cconv--convert-funcbody, cconv-convert):
Mark the warnings as `lexical`.

* lisp/emacs-lisp/eieio-core.el (eieio-oref, eieio-oref-default)
(eieio-oset-default):
* lisp/emacs-lisp/eieio.el (defclass): Adjust to new calling convention.
2021-07-21 11:11:50 -04:00
Mattias Engdegård
070c80ee06 Fix mistake in quote optimiser
Found by Pip Cet.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-quote): Fix mistake that
made this optimiser ineffective at removing quoting of nil, t, and
keywords.  The only obvious consequence is that we no longer need...
(byte-optimize-form): ...a 'nil => nil normalising step here; remove.
(byte-optimize-form-code-walker): Make the compiler warn about (quote).
2021-07-21 11:17:18 +02:00
Mattias Engdegård
f9d7440814 ; * lisp/emacs-lisp/byte-opt.el (byte-optimize-eq): Fix last change. 2021-07-20 19:32:11 +02:00
Mattias Engdegård
46d7d44894 Strength-reduce (eq X nil) to (not X)
* lisp/emacs-lisp/byte-opt.el (byte-optimize-eq): New optimisation,
which results in better test and branch code generation where it
applies.
2021-07-20 19:21:00 +02:00
Mattias Engdegård
51a86b6a05 Count (not X) as a switch condition
* lisp/emacs-lisp/bytecomp.el (byte-compile--cond-switch-prefix):
Treat (not VAR) and (null VAR) as (eq VAR nil) when computing the
extent of switch ops.
2021-07-20 19:21:00 +02:00
Ioannis Kappas
606b783acb Allow installing packages with DOS line endings
* lisp/emacs-lisp/package.el (package-install-from-buffer): Allow
installing files with different line ending conventions (Unix, DOS
and Macos) (bug#48137).
2021-07-20 15:53:34 +02:00
Lars Ingebrigtsen
6336c18e5c Use make-separator-line in shortdoc
* lisp/simple.el (separator-line): Tweak definition to not be so
overwhelming.

* lisp/emacs-lisp/shortdoc.el (shortdoc-separator): Removed.
(shortdoc-display-group): Use make-separator-line.
2021-07-19 16:13:57 +02:00
Lars Ingebrigtsen
5ade22c2f8 Fix an unlikely `copyright-find-copyright' problem
* lisp/emacs-lisp/copyright.el (copyright-find-copyright): Make
the copyright matcher more robust (bug#7179).
2021-07-18 14:31:09 +02:00
Lars Ingebrigtsen
153c9d5ff4 Make 'n'/'p' work again in shortdoc after previous changes
* lisp/emacs-lisp/shortdoc.el (shortdoc--goto-section): Adjust to
changes in how the text properties are inserted in 22a5482ab6
(bug#49605).  Also make into a regular function.
2021-07-17 15:41:33 +02:00
akater
109c27341e EIEIO: Prevent excessive evaluation of :initform
* lisp/emacs-lisp/eieio.el (initialize-instance):
Do not evaluate initform of a slot when initarg for the slot is provided,
according to the following secitons of CLHS:
- Object Creation and Initialization
- Initialization Arguments
- Defaulting of Initialization Arguments
- Rules for Initialization Arguments

* test/lisp/emacs-lisp/eieio-etests/eieio-tests.el:
Add corresponding tests
Fix a typo
2021-07-16 15:40:08 -04:00
Mattias Engdegård
24a8cc5e70 Define revert-buffer-function for *Memory Report*
* lisp/emacs-lisp/memory-report.el (memory-report):
Allow the memory report buffer to be updated by pressing 'g'.
2021-07-16 20:05:31 +02:00
Lars Ingebrigtsen
8f5738eb8f Add more car/cdr examples to shortdoc
* lisp/emacs-lisp/shortdoc.el (list): Add more car/cdr examples.
2021-07-15 18:32:34 +02:00
Lars Ingebrigtsen
22a5482ab6 Improve the shortdoc link action in *Help* buffers
* lisp/emacs-lisp/shortdoc.el (shortdoc-display-group): Allow
taking an optional parameter to place point on a specific function.
(shortdoc--display-function): Go to the function in question in
the shortdoc buffer.
2021-07-15 18:29:27 +02:00
Lars Ingebrigtsen
fbc9a50993 Allow restoring the original order in 'tabulated-list-mode'
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-sort): Allow
restoring the original order (bug#13411).
(tabulated-list--sort-by-column-name): Store the original order.
(tabulated-list--original-order): New buffer-local variable.
2021-07-15 17:37:58 +02:00
Lars Ingebrigtsen
4aac8f60e6 Mention more split-string-* functions in shortdoc
* lisp/emacs-lisp/shortdoc.el (string): Mention
split-string-and-unquote and split-string-shell-command.
2021-07-15 10:37:11 +02:00
Lars Ingebrigtsen
da7dbfdf68 Make package-menu-filter-by-status work as documented
* lisp/emacs-lisp/package.el (package-menu-filter-by-status): Work
as documented (bug#49474).
2021-07-10 18:53:28 +02:00
pillule
57354bc64b Use display-buffer with re-builder (bug#49069)
* lisp/emacs-lisp/re-builder.el (re-builder): Uses 'display-buffer'
with 'display-buffer-in-direction' to display the reb-buffer.  This
allow user-customizations and using it on not splitables windows.
Add a dedication to its window so killing this buffer quit the window.
2021-07-08 20:39:39 +03:00
Lars Ingebrigtsen
e7cdbc1d1d Make previous empty-body warning disabling more robust
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all):
`byte-compile-warning-enabled-p' may not be defined here.
2021-07-06 22:01:55 +02:00
Basil L. Contovounesios
044742bfe8 Avoid invalid regexp in wide docstring check
* lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p):
Avoid constructing an invalid regexp during byte-compilation by
limiting the number of columns to the current RE_DUP_MAX of 65535.
This protects against pathological values of fill-column, for
example (bug#49426).
2021-07-06 18:56:15 +01:00
Lars Ingebrigtsen
43fba076c9 Allow inhibiting warnings about unused variables and empty bodies
* lisp/emacs-lisp/cconv.el (cconv--warn-unused-msg): Allow
inhibiting warnings about unbound variables (bug#26486).

* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Allow
inhibiting warnings about empty bodies.
2021-07-06 16:43:49 +02:00
Lars Ingebrigtsen
26b9564bd5 Propagate :safe properties when autoloading defcustoms
* lisp/emacs-lisp/autoload.el (make-autoload): Propagate the :safe
property to the loaddefs file (bug#28104).
2021-07-05 15:55:38 +02:00
Lars Ingebrigtsen
ed15f3954c Ignore .dir-locals-2.el files more
* lisp/emacs-lisp/shadow.el (load-path-shadows-find):
* lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): Ignore
.dir-locals-2.el, too (bug#23257).
2021-07-04 16:23:46 +02:00
Michael Albinus
527bab054f Handle test environment variables
* lisp/emacs-lisp/ert.el (ert-summarize-tests-batch-and-exit):
Check also for EMACS_EMBA_CI.

* test/README (SELECTOR): Mention EMACS_TEST_VERBOSE.

* test/infra/gitlab-ci.yml (variables): Set EMACS_TEST_VERBOSE.
2021-07-01 13:43:44 +02:00
Jonas Bernoulli
3cfc553202 Add new function lm-maintainers (bug#48592)
* doc/lispref/tips.texi (Library Headers): Improve wording.
* lisp/emacs-lisp/lisp-mnt.el (lm-maintainers): New function.
(lm-maintainer): Make obsolete in favor of lm-maintainer.
(lm-verify): Use lm-maintainers.
(lm-report-bug): Use lm-maintainers.
2021-06-30 19:53:48 +02:00
Jonas Bernoulli
0e3668b233 * lisp/emacs-lisp/lisp-mnt.el (lm-crack-address): Right-trim name.
The addresses might be aligned in which case we have to trim the
extra whitespace at the end of the names.
2021-06-30 19:50:54 +02:00
João Távora
1439e9bfad Adjust docstring of lisp-mode (bug#49278)
* lisp/emacs-lisp/lisp-mode.el (lisp-mode): Mention that this mode is
primarily for Common Lisp.
2021-06-30 17:00:20 +01:00
Lars Ingebrigtsen
46a66c6248 Make the minor mode doc strings say that they're minor modes
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
Mention that this is a minor mode (bug#20462).
2021-06-30 15:31:26 +02:00
Colin Woodbury
4f2765f6f1 Add new function file-name-with-extension
* doc/lispref/files.texi (File Name Components): Document it.
* lisp/emacs-lisp/shortdoc.el (file-name): Ditto.

* lisp/files.el (file-name-with-extension): New function.
2021-06-30 14:07:29 +02:00
Stefan Monnier
b8f9e58ef7 * lisp/minibuffer.el (completion-in-region--single-word): Simplify
Remove redundant args `collection` and `predicate` which were always
equal to `minibuffer-completion-table` and
`minibuffer-completion-predicate` anyway.

(minibuffer-complete-word):
* lisp/emacs-lisp/crm.el (crm-complete-word): Simplify accordingly.
2021-06-26 12:29:52 -04:00
Stefan Monnier
73663d14cf * lisp/emacs-lisp/cl-macs.el: Fix test regression
(cl--alist-to-plist): New function.
(cl-struct-slot-info): Use it.
2021-06-26 12:20:25 -04:00
Mattias Engdegård
52528d6a16 Print newlines as \n instead of \12 in ERT results
This makes test errors unquestionably more readable.  The change also
makes FF print as \f; other controls still use octal escapes.

* lisp/emacs-lisp/ert.el (ert--pp-with-indentation-and-newline):
Run `pp` with `pp-escape-newlines` set to `t`.
2021-06-25 19:55:27 +02:00
Lars Ingebrigtsen
9e8d8e1a03 Make (find-face-definition 'default) work more reliably
* lisp/emacs-lisp/find-func.el (find-function--defface): New
function (bug#30230).
(find-function-regexp-alist): Use it to skip past definitions
inside comments and strings.
2021-06-25 17:16:28 +02:00
Stefan Monnier
3788d2237d * lisp/emacs-lisp/cl-preloaded.el: Fix the format of props in slot-descs
(cl--plist-remove): Remove.
(cl--plist-to-alist): New function.
(cl-struct-define): Use it to convert slots's properties to the
format expected by `cl-slot-descriptor`.

* lisp/emacs-lisp/cl-extra.el (cl--describe-class-slots): Revert last
changes, not needed any more.
2021-06-24 17:32:20 -04:00
Mattias Engdegård
1283e1db9b Don't call ERT explainer on error
* lisp/emacs-lisp/ert.el (ert--expand-should-1): If the predicate form
signals an error, don't call an explainer because the arguments passed
(the error and error argument, respectively) do not make any sense to
the explainer at all.
2021-06-24 20:48:41 +02:00
Lars Ingebrigtsen
b188861af4 Attempt to make defclass documentation more legible
* lisp/emacs-lisp/cl-extra.el (cl--print-table): Attempt to make
defclass documentation more readable (bug#30998).
(cl--describe-class-slots): Ditto.
2021-06-24 20:24:43 +02:00
Lars Ingebrigtsen
bf21aba533 Fix printing of defclass documentation slots again
* lisp/emacs-lisp/cl-extra.el (cl--describe-class-slots): Fix
printing defclass slots, and retain printing of defstruct slots
(bug#30998 and bug#46662).
2021-06-24 20:13:08 +02:00
Lars Ingebrigtsen
f85ee6d5c7 Clarify the help in the package buffers
* lisp/emacs-lisp/package.el (package--quick-help-keys): Clarify
marking help (bug#40457).
2021-06-24 16:59:42 +02:00
Lars Ingebrigtsen
3c0b50d1fc Make minor mode docstrings say what the mode "variable" is
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Add
the mode variable (bug#36500).
(easy-mmode--mode-docstring):
(define-minor-mode): Pass in the getter.
2021-06-22 16:03:37 +02:00
Basil L. Contovounesios
3b1d69efc3 Fix shortdoc-add-function section creation
* lisp/emacs-lisp/shortdoc.el (shortdoc-add-function): Use nconc to
actually append a new section to the list of groups while avoiding a
previous OBOE.  Push a new group to the front of shortdoc--groups
without copying it, just like define-short-documentation-group does.
(buffer): Fix copypasta in unlock-buffer example.

* test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-examples): Also
check that :no-value forms demonstrate the right function.

* doc/lispref/help.texi (Documentation Groups): Clarify that @dots
in the define-short-documentation-group arglist refer to whole
key-value pairs.  Fix typo in :eg-result-string description.
2021-06-21 16:20:22 +01:00
Andrea Corallo
a4fb5811fa * Do not attempt to write .elc files when not necessary (bug#49118)
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Do not attempt to
write .elc files when not necessary.
2021-06-21 12:20:19 +02:00
Stefan Monnier
ff053c706c * lisp/emacs-lisp/cl-generic.el: Fix bug#49053 and bug#47454
(cl-generic-define-method): Shorten the time window where the symbol is
defined to `dummy`.
2021-06-16 12:53:59 -04:00
Julian Scheid
8be9d4a156 Allow ERT tests to output the failure reasons, too
* lisp/emacs-lisp/ert.el (ert-reason-for-test-result): New function.
(ert-run-tests-batch): Output failure or skip reason  (bug#47071).
2021-06-15 17:01:57 +02:00
Lars Ingebrigtsen
1756e4757c Fix false positives in docstring width warning with (fn...) constructs.
* lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p):
Don't consider the function signature when determining whether the
doc string is too wide (bug#49007).  (The signature is folded
later when displaying help.)
2021-06-15 15:33:19 +02:00