Commit graph

8251 commits

Author SHA1 Message Date
Stefan Monnier
92e49944a3 nadvice.el: Auto-generate the doc describing the "how" arg
* lisp/emacs-lisp/nadvice.el (advice--make-how-alist): New macro.
(advice--how-alist): Use it.
(nadvice--make-docstring): New function.
(add-function, advice-add): Use it to auto-generate the table
describing the accepted values for `how`.
2022-04-26 17:36:13 -04:00
Stefan Monnier
f30625943e nadvice.el: Use OClosures
* lisp/emacs-lisp/nadvice.el (advice): New OClosure type.
(advice--how-alist): Make it hold prototype OClosures rather
than bytecode strings.
(advice--bytecodes): Delete var.
(advice--where): Make it an obsolete alias of new `advice--how`.
(oclosure-interactive-form, cl-print-object) <advice>: New methods.
(advice--make-1): Delete function.
(advice--make): Use `advice-copy` and `advice-cons`.
(advice--tweak): Use `advice-cons`.
(add-function, advice-add): Rename `where` arg to `how`.

* lisp/emacs-lisp/cl-print.el (cl-print-object) <:extra "nadvice">:
Remove now-redundant ad-hoc method.

* test/lisp/emacs-lisp/nadvice-tests.el (advice-test-print): New test.
2022-04-26 17:36:13 -04:00
Stefan Monnier
bc9be5449e nadvice.el: Rename "where" to "how"
* lisp/emacs-lisp/nadvice.el (advice--how-alist): Rename from
`advice--where-alist`.
(advice--how): Rename from `advice--where` and keep obsolete alias.
(add-function, advice-add): Rename `where` arg to `how`.
* lisp/emacs-lisp/cl-print.el (cl-print-object): Use `advice--how` name.
2022-04-26 17:36:13 -04:00
Stefan Monnier
4dba7c31a2 Use advice--cd*r where applicable
* lisp/emacs-lisp/bytecomp.el (byte-compile--function-signature):
* lisp/emacs-lisp/advice.el (ad-get-orig-definition):
* lisp/help.el (help-function-arglist): Use `advice--cd*r`.
2022-04-26 17:36:13 -04:00
Stefan Monnier
21112e3683 Pretty print OClosure slot accessors
* lisp/emacs-lisp/oclosure.el (oclosure--accessor-cl-print): New function.
* lisp/emacs-lisp/cl-print.el (cl-print-object) <accessor>: New method.
* test/lisp/emacs-lisp/nadvice-tests.el (advice-test-call-interactively):
Avoid `defun` within a function.
2022-04-26 17:36:12 -04:00
Lars Ingebrigtsen
756b7cf5d9 Mention caveats in the map-delete doc string
* lisp/emacs-lisp/map.el (map-delete): Mention how this has to be
used for lists (bug#25929).
2022-04-26 15:34:26 +02:00
Stefan Monnier
0a151b7c29 cl-generic.el: Upcase formal args in C-h o
Try and improve the display of methods in `C-h o` by moving
the qualifiers to a separate line and upcasing the formal args.
It still needs love, tho.

* lisp/emacs-lisp/cl-generic.el: Upcase formal args in `C-h o`
(cl--generic-upcase-formal-args): New function.
(cl--generic-describe): Use it.
2022-04-25 15:41:21 -04:00
Lars Ingebrigtsen
2c0a01ee38 Don't make a header if the user hasn't specified columns in vtable
* lisp/emacs-lisp/vtable.el (vtable):
(make-vtable): Store whether the user has specified the columns.
(vtable-insert): Don't insert a header line or a header if the
user hasn't specified the columns (bug#55075).
2022-04-23 14:47:55 +02:00
Alan Mackenzie
0b9b363dab Byte compiler: Prevent special forms' symbols being replaced by bare symbols
These are symbols with position from source code, which should not be replaced
by bare symbols in, e.g., optimization functions.

* lisp/Makefile.in: (BYTE_COMPILE_FLAGS, compile-first case): Set
max-specpdl-size to 5000 for the benefit of lisp/emacs-lisp/comp.el.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker)
(byte-optimize--rename-var, byte-optimize-if, byte-optimize-letX)
* lisp/emacs-lisp/bytecomp.el (byte-compile-recurse-toplevel)
(byte-compile-lambda)
* lisp/emacs-lisp/cconv.el (cconv-convert)
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Preserve, e.g., (car
form) in the byte compiler, when this form's car is a symbol with position of
a special form, rather than replacing the symbol with a bare symbol, e.g.
'cond.
2022-04-22 19:11:31 +00:00
Alan Mackenzie
5b23c9942a Byte compiler: correct output warning message positions (part 2)
A supplementary commit to that on 2022-04-18:

* lisp/emacs-lisp/bytecomp.el (byte-compile--first-symbol-with-pos): Handle
vectors and records correctly.

* lisp/emacs-lisp/byte-run.el (byte-run--ssp-seen): Correct the doc string.
2022-04-22 17:16:21 +00:00
Lars Ingebrigtsen
2d71fd3b04 Further doc string quoting fixes
* test/lisp/progmodes/cperl-mode-tests.el (cperl--run-test-cases):
* lisp/simple.el (undo-equiv-table):
* lisp/shell.el (shell-mode):
(shell-mode):
* lisp/recentf.el (recentf-mode):
* lisp/org/ob-table.el (org-sbe):
* lisp/net/eudc.el (eudc-rfc5322-cctext-token):
* lisp/mail/ietf-drums-date.el (ietf-drums-date--slot-ranges):
* lisp/faces.el (color-luminance-dark-limit):
* lisp/erc/erc.el (erc-tls):
* lisp/emacs-lisp/pcase.el (pcase-setq): Further quoting fixes in
doc strings.
2022-04-22 17:16:42 +02:00
Lars Ingebrigtsen
bbf389ea6d Audit quoting the quote character in doc strings
* test/src/regex-emacs-tests.el (regex-tests-compare):
(regex-tests-compare):
(regex-tests-match):
* test/lisp/xml-tests.el (xml-parse-tests--qnames):
* test/lisp/mh-e/mh-thread-tests.el (mh-thread-tests-before-from):
* test/lisp/cedet/srecode-utest-template.el (srecode-utest-map-reset):
* test/lisp/calc/calc-tests.el (calc-tests-equal):
* lisp/window.el (get-lru-window):
(get-mru-window):
(get-largest-window):
(quit-restore-window):
(display-buffer):
* lisp/vc/vc-rcs.el (vc-rcs-consult-headers):
* lisp/url/url-auth.el (url-digest-auth-build-response):
* lisp/tutorial.el (tutorial--find-changed-keys):
* lisp/transient.el (transient-suffix-object):
* lisp/textmodes/rst.el (rst-insert-list-new-item):
* lisp/textmodes/bibtex.el (bibtex-clean-entry):
* lisp/tab-bar.el (tab-bar--key-to-number):
(toggle-frame-tab-bar):
* lisp/ses.el (ses-recalculate-cell):
(ses-define-local-printer):
(ses-prin1):
* lisp/progmodes/xref.el (xref--find-ignores-arguments):
* lisp/progmodes/verilog-mode.el (verilog-single-declaration-end):
* lisp/progmodes/tcl.el (tcl-mode-hook):
* lisp/progmodes/gdb-mi.el (gdb-get-buffer-create):
* lisp/progmodes/elisp-mode.el (elisp--xref-make-xref):
* lisp/play/dunnet.el (dun-room-objects):
* lisp/outline.el (outline--cycle-state):
* lisp/org/ox-publish.el (org-publish-find-property):
* lisp/org/ox-html.el (org-html--unlabel-latex-environment):
* lisp/org/org-table.el (org-table-collapse-header):
* lisp/org/org-plot.el (org--plot/prime-factors):
* lisp/org/org-agenda.el (org-agenda--mark-blocked-entry):
(org-agenda-set-restriction-lock):
* lisp/org/ob-lua.el (org-babel-lua-read-string):
* lisp/org/ob-julia.el (org-babel-julia-evaluate-external-process):
(org-babel-julia-evaluate-session):
* lisp/org/ob-core.el (org-babel-default-header-args):
* lisp/obsolete/mouse-sel.el (mouse-select):
(mouse-select-secondary):
* lisp/net/tramp.el (tramp-methods):
* lisp/net/eww.el (eww-accept-content-types):
* lisp/net/dictionary-connection.el (dictionary-connection-status):
* lisp/minibuffer.el (completion-flex--make-flex-pattern):
* lisp/mh-e/mh-mime.el (mh-have-file-command):
* lisp/mh-e/mh-limit.el (mh-subject-to-sequence):
(mh-subject-to-sequence-threaded):
(mh-subject-to-sequence-unthreaded):
* lisp/mail/feedmail.el (feedmail-queue-buffer-file-name):
(feedmail-vm-mail-mode):
* lisp/ls-lisp.el (ls-lisp--sanitize-switches):
* lisp/keymap.el (key-valid-p):
* lisp/international/ccl.el (ccl-compile-branch-blocks):
* lisp/image/image-converter.el (image-convert):
* lisp/gnus/spam.el (spam-backend-check):
* lisp/gnus/nnselect.el (nnselect-generate-artlist):
* lisp/gnus/nnmairix.el (nnmairix-widget-other):
* lisp/gnus/message.el (message-mailto):
* lisp/gnus/gnus-sum.el (gnus-collect-urls-from-article):
* lisp/gnus/gnus-search.el (gnus-search-prepare-query):
* lisp/frame.el (frame-size-history):
* lisp/eshell/esh-var.el (eshell-parse-variable-ref):
* lisp/eshell/em-dirs.el (eshell-expand-multiple-dots):
* lisp/erc/erc-backend.el (erc-bounds-of-word-at-point):
* lisp/emulation/cua-rect.el (cua--rectangle-operation):
* lisp/emacs-lisp/text-property-search.el (text-property-search-forward):
* lisp/emacs-lisp/package.el (package-desc-suffix):
* lisp/emacs-lisp/faceup.el (faceup-test-explain):
* lisp/emacs-lisp/comp.el (comp-curr-allocation-class):
(comp-alloc-class-to-container):
(comp-add-cstrs):
(comp-remove-type-hints-func):
(batch-byte+native-compile):
* lisp/emacs-lisp/cl-macs.el (cl--optimize):
* lisp/elec-pair.el (electric-pair--syntax-ppss):
* lisp/doc-view.el (doc-view-doc-type):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-alist):
(semantic-symref-hit-to-tag-via-db):
(semantic-symref-hit-to-tag-via-buffer):
* lisp/cedet/semantic/lex-spp.el (semantic-lex-spp-get-overlay):
* lisp/cedet/semantic/java.el (semantic-java-doc-keywords-map):
* lisp/cedet/semantic/find.el (semantic-brute-find-tag-by-function):
* lisp/cedet/semantic/db.el (semanticdb-project-predicate-functions):
* lisp/cedet/semantic.el (semantic-working-type):
* lisp/cedet/ede/files.el (ede-flush-directory-hash):
* lisp/calc/calc.el (calc--header-line):
* lisp/auth-source.el (auth-source-pick-first-password):
(auth-source--decode-octal-string):
* etc/themes/modus-themes.el (modus-themes--paren):
(modus-themes--agenda-habit):
* admin/cus-test.el (cus-test-vars-with-changed-state): Fix
quoting in doc strings.  In code examples, the ' character is
quoted with \\=, and regularize 'foo to `foo', and quote strings
like "foo" instead of 'foo'.
2022-04-22 16:17:22 +02:00
Lars Ingebrigtsen
16dfec3c4c Fix map-into doc string example
* lisp/emacs-lisp/map.el (map-into): Fix quote quoting in example.
2022-04-22 15:17:15 +02:00
Lars Ingebrigtsen
935f400a33 Clarify cl-incf/decf doc strings
* lisp/emacs-lisp/cl-lib.el (cl-incf):
(cl-decf): Clarify that nil isn't a valid value for X (bug#31715).
2022-04-21 15:11:33 +02:00
Alan Mackenzie
850074636e Byte compiler: correct output warning message positions
Correct the algorithm for determining the warning position to get the first
symbol-with-position in byte-compile--form-stack.

* lisp/emacs-lisp/bytecomp.el (byte-compile--first-symbol-with-pos): Function
renamed and amended from byte-compile--first-symbol.
(byte-compile--warning-source-offset): Call the new function above rather than
the old one.
2022-04-18 15:16:54 +00:00
Alan Mackenzie
2b6a1c98df Byte compiler: remove symbol positions from byte-switch tables
This fixes bug #54990.

* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Remove positions from
symbols with positions in byte-switch tables, by temporarily removing the
entries from the table, and reinserting them amended.
2022-04-18 10:19:54 +00:00
Eli Zaretskii
6ecb7ff5ec Merge from origin/emacs-28
b201823f63 Describe problems with invoking Python on MS-Windows
880f2734c9 A better fix for bug#54800
5ee959aa87 Add a comment about cl-concatenate
ab2b822b9b Revert "Make cl-concatenate an alias of seq-concatenate"
2022-04-16 13:46:04 -04:00
Lars Ingebrigtsen
2d4c5f0b85 Enable dragging resizing final column in vtable
* lisp/emacs-lisp/vtable.el (vtable--insert-line): Insert the
divider after the final column, too, so that the size can be
dragged.
2022-04-15 14:06:33 +02:00
Lars Ingebrigtsen
68e6430959 Add some mouse-face bits to vtable
* lisp/emacs-lisp/vtable.el (make-vtable)
(vtable--insert-header-line): Put mouse-face on draggable bits.
2022-04-15 13:58:41 +02:00
Lars Ingebrigtsen
4bc36f09b9 Tweak sorting indicator placement in vtable
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Tweak
sorting indicator position.
2022-04-15 13:45:00 +02:00
Lars Ingebrigtsen
c4768cda7f Make the sorting indicator prettier in vtable
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Place
the sorting indicator flush right in the heading.
2022-04-15 13:37:13 +02:00
Lars Ingebrigtsen
f36ff9da17 Allow using faces for colors in vtable
* doc/misc/vtable.texi (Making A Table): Adjust color documentation.
* lisp/emacs-lisp/vtable.el (make-vtable): Mix more.
(vtable--compute-colors): Mix both foreground and background colors.
(vtable--make-color-face, vtable--face-blend): New functions.
(vtable--insert-line): Adjust usage.
2022-04-15 12:09:07 +02:00
Lars Ingebrigtsen
cc2a1b2780 Allow dragging the divider in vtable
* lisp/emacs-lisp/vtable.el (vtable): Add a keymap cache.
(make-vtable): Allow dragging the divider.
(vtable-insert): Don't put the table keymap over the entire line
-- avoid the divider, which has its own keymap.
(vtable--drag-resize-column): Adjust to the in-buffer divider
dragging.
2022-04-15 11:10:05 +02:00
Lars Ingebrigtsen
e95c545180 Fix off-by-one error in text-property-search-backward
* lisp/emacs-lisp/text-property-search.el
(text-property-search-backward): Fix off-by-one error -- this
would result in not finding the previous (non-)match when at the
first character in a field.
2022-04-15 11:06:44 +02:00
Lars Ingebrigtsen
807682de1e Allow dragging dividers in vtable
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Allow
dragging dividers.
(vtable--drag-resize-column): Adjust function.
2022-04-14 19:48:59 +02:00
Lars Ingebrigtsen
be54c25dbb Allow resizing vtable columns by dragging
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Allow
resizing by dragging headers.
(vtable--drag-resize-column): New function.
(vtable-narrow-current-column): Refactor out common bits.
(vtable--alter-column-width): To here.
(vtable-widen-current-column): Rewrite to use
vtable-narrow-current-column.
2022-04-14 19:39:01 +02:00
Lars Ingebrigtsen
f498d055a4 Make vtable remember user-altered column widths
* lisp/emacs-lisp/vtable.el (vtable-narrow-current-column)
(vtable-widen-current-column): Store the size to that it's
respected on `g'.
2022-04-14 18:03:58 +02:00
Lars Ingebrigtsen
e7f7930a61 Ensure that commands like { work on all frames in vtable
* lisp/emacs-lisp/vtable.el (vtable--recompute-cache)
(vtable--ensure-cache): New functions.
(vtable-insert): Use it.
(vtable--widths): Ditto.
2022-04-14 16:25:41 +02:00
Lars Ingebrigtsen
c3b6cfda36 Make vtable narrow/widen functions take a prefix
* lisp/emacs-lisp/vtable.el (vtable-narrow-current-column)
(vtable-widen-current-column): Allow using the prefix to say how
much to narrow/widen the columns.
2022-04-14 02:47:23 +02:00
Lars Ingebrigtsen
ffb7612d2c Copy edit make-vtable code
* lisp/emacs-lisp/vtable.el (make-vtable): Clean up code slightly.
2022-04-14 02:41:27 +02:00
Lars Ingebrigtsen
8969836cb8 Edit some vtable doc strings
* lisp/emacs-lisp/vtable.el (make-vtable, vtable): Improve doc
strings.
2022-04-14 02:37:44 +02:00
Lars Ingebrigtsen
5a9e4f2230 Further divider fixes for vtable
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Don't
insert the divider at the end.
(vtable-narrow-current-column, vtable-widen-current-column): Don't
error out when being called on the divider.
2022-04-14 02:18:01 +02:00
Lars Ingebrigtsen
574ae74caa Fix dividers in vtable header lines
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Put the
divider in the correct place in the header line.
2022-04-14 01:56:15 +02:00
Lars Ingebrigtsen
a96679b742 Allow having dividers between columns in vtable
* doc/misc/vtable.texi (Making A Table): Document it.
* lisp/emacs-lisp/vtable.el (vtable): Add a divider slot.
(make-vtable): Accept :divider and :divider-width arguments.
(vtable--insert-line, vtable--insert-header-line): Display the
divider.
2022-04-14 01:36:36 +02:00
Lars Ingebrigtsen
800998808a Allow putting alternating colors on vtable rows
* doc/misc/vtable.texi (Making A Table): Document it.
* lisp/emacs-lisp/vtable.el (vtable): Add :row-colors.
(make-vtable): Ditto.
(vtable--compute-colors, vtable--color-blend): New functions.
(vtable--insert-line): Take a line number argument and adjust
callers.
2022-04-14 01:00:44 +02:00
Lars Ingebrigtsen
6c3869a104 Add a new `vtable' face
* doc/misc/vtable.texi (Introduction): Document it.

* lisp/emacs-lisp/vtable.el (vtable): Add a new face.
2022-04-13 23:19:10 +02:00
Lars Ingebrigtsen
29fae93d1c Add support for column background colors in vtable
* doc/misc/vtable.texi (Making A Table): Document it.

* lisp/emacs-lisp/vtable.el (vtable): Add a column color element.
(make-vtable): Use it.
(vtable--insert-line): Insert the colors here.
2022-04-13 16:26:01 +02:00
Lars Ingebrigtsen
918669cb3d Make list-times not include zero elements
* doc/lispref/os.texi (Time Parsing): Mention %x.
* lisp/calendar/time-date.el (format-seconds): Accept a new %x
spec that removes trailing zeros (bug#54904).

* lisp/emacs-lisp/timer-list.el (list-timers): Don't display
trailing zero bits.
2022-04-13 15:31:34 +02:00
Po Lu
8259e36800 Fix marking upgrades for packages from ELPA or NonGNU ELPA
* lisp/emacs-lisp/package.el (package-menu--find-upgrades): Look
inside ``external'' packages as well when searching for
upgrades.  (bug#54117)
2022-04-13 07:17:30 +00:00
Lars Ingebrigtsen
5ee959aa87 Add a comment about cl-concatenate
* lisp/emacs-lisp/cl-extra.el (cl-concatenate): Add a comment.
2022-04-13 06:11:51 +02:00
Lars Ingebrigtsen
ab2b822b9b Revert "Make cl-concatenate an alias of seq-concatenate"
This reverts commit 78f76fe16e.

The commit made calls to cl-concatenate bug out, since
autoloading defalises doesn't work very well (bug#54901).
2022-04-13 06:11:51 +02:00
Lars Ingebrigtsen
88a04ea985 Tweak how `M-q' in emacs-lisp-mode works
* lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Only fill as
strings inside strings (bug#31656).
(lisp--fill-line-simple): New function to do simple sexp-based
filling.
2022-04-13 05:07:47 +02:00
Sean Whitton
451eeb512d Fix eager macroexpansion cycle in cl-once-only
* lisp/emacs-lisp/cl-macs.el (cl-once-only): Use different cl-loop
syntax, with no functional change, but such that the loop does not
expand into cl-psetq.
2022-04-12 17:59:22 +02:00
Sean Whitton
2e9111813b Add two classic Common Lisp macro-writing macros
* lisp/emacs-lisp/cl-macs.el (cl-with-gensyms, cl-once-only): New macros.
2022-04-11 23:01:55 -07:00
Stefan Monnier
6a480c830b * lisp/emacs-lisp/macroexp.el (macroexp-let2*): Allow common shorthand 2022-04-11 15:10:51 -04:00
Kaushal Modi
cca47ae555 Update docstrings for shortdoc.el FUNC lisp form API
* lisp/emacs-lisp/shortdoc.el (define-short-documentation-group):
Updated docstrings.
2022-04-10 13:52:49 +02:00
Lars Ingebrigtsen
e2f3b0f16e Improve package.el error messages on too-old Emacsen
* lisp/emacs-lisp/package.el (package-compute-transaction): Give a
better error message on too-old Emacs versions (bug#54747).
2022-04-08 14:46:14 +02:00
Stefan Monnier
39e8fd357d OClosure: New function function-documentation
As mentioned in the original OClosure commit, OClosures (ab)use the
bytecode's docstring slot to hold the OClosure's type.  This currently
prevents OClosures from having their own docstring.

Introduce a new generic function `function-documentation` to fetch the
docstring of a function, which can then be implemented in various
different ways depending on the OClosure's type.

* lisp/simple.el (function-documentation): New generic function.
(bad-package-check): Strength-reduce `eval` to `symbol-value`.
* src/doc.c (Fdocumentation): Use it.

* lisp/emacs-lisp/oclosure.el (oclosure--accessor-docstring): New function.
* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-test):
Add test for accessor's docstrings.
2022-04-07 15:59:09 -04:00
Lars Ingebrigtsen
4c8e23d5d7 Clarify read-answer-short/use-short-answers action
* lisp/emacs-lisp/map-ynp.el (read-answer-short): Clarify what
this variable affects (bug#54754).

* src/fns.c (Fyes_or_no_p): Mention `use-short-answers'.
2022-04-07 13:37:16 +02:00
Stefan Monnier
4161a36849 cl-generic.el: Fix bug#46722
Fix longstanding bug due to unexpected interference via side-effect.

* lisp/emacs-lisp/cl-generic.el (cl--generic-get-dispatcher):
Copy the `dispatch` arg before storing it into the hash-table.

Backport from `master` (cherrypick from commit 61f8f7f68f).
2022-04-06 14:26:40 -04:00