João Távora [Tue, 21 Sep 2021 21:20:17 +0000 (22:20 +0100)]
Consider shorthands in Elisp's elisp-completion-at-point
Instead of referencing obarray directly, that function has to consider
a collection of completions which includes the shorthand versions of
some of the symbols. That collection changes from buffer to buffer,
depending on the choice of elisp-shorthands.
To make this process efficient, and avoid needless recalculation of
the above collection, a new obarray-specific cache was invented. The
Elisp variable obarray-cache is immediately nullified if something
touches the obarray.
* lisp/progmodes/elisp-mode.el : New helper.
(elisp-completion-at-point): Use new helpers.
(elisp--completion-local-symbols)
(elisp--fboundp-considering-shorthands)
(elisp--bboundp-considering-shorthands): New helpers
João Távora [Wed, 23 Dec 2020 19:57:27 +0000 (19:57 +0000)]
Rework Elisp shorthands to only allow only prefix substitution
This simplification in requirements makes for more complex C code but
that code is much less wasteful in Lisp strings than the previous
implementation.
João Távora [Sat, 19 Sep 2020 21:16:38 +0000 (22:16 +0100)]
Move most of the shorthand implementation to C code
It passes the tests designed for the previous Elisp implementation.
Likely, this isn't the final form of the implementation. For one, the
reader is much slower and allocates a Lisp string for every atom read,
regardless if its already interned or not. This has the potential to
be catastrophic in terms of GC.
Also rename the main variable to elisp-shorthands, from the
repetitive shorthand-shorthands.
For some reason, I had to put 'hack-elisp-shorthands' and
'load-with-shorthands-and-code-conversion', the new source-file
loading functions, in lisp/international/mule.el.
Otherwise, lisp/loadup.el wouldn't see them, for some reason that I
didn't investigate. This should probably be fixed.
* lisp/shorthand.el: Remove.
* test/lisp/shorthand-tests.el: Remove.
* src/lread.c:
(read1, Fintern, Fintern_soft, Funintern): Use
oblookup_considering_shorthand.
(oblookup_considering_shorthand): New helper.
(syms_of_lread): Declare elisp-shorthands.
* lisp/progmodes/elisp-mode.el (elisp-shorthands):
Put a safe-local-variable spec.
* test/lisp/progmodes/elisp-mode-tests.el (elisp-shorthand-read-buffer)
(elisp-shorthand-read-from-string)
(elisp-shorthand-byte-compile-a-file)
(elisp-shorthand-load-a-file): New tests.
* test/lisp/progmodes/elisp-resources/simple-shorthand-test.el: New file
* lisp/loadup.el (load-source-file-function): Set to
load-with-shorthands-and-code-conversion.
* lisp/international/mule.el (hack-elisp-shorthands): Move here.
(load-with-shorthands-and-code-conversion): And here.
Robert Pluim [Fri, 24 Sep 2021 12:13:24 +0000 (14:13 +0200)]
Add glyphless-char-display-control for Variation Selectors
* lisp/international/characters.el (update-glyphless-char-display):
(glyphless-char-display-control): Add control knob for U+FE00 through
U+FE0F, defaulting to 'thin-space'.
* doc/lispref/display.texi (Glyphless Chars): Document it.
Stefan Kangas [Sun, 26 Sep 2021 16:14:27 +0000 (18:14 +0200)]
Explicitly make the rest of erc-compat.el obsolete
* lisp/obsolete/erc-compat.el (erc-decode-coding-string)
(erc-encode-coding-string, erc-set-write-file-functions)
(erc-emacs-build-time, erc-replace-match-subexpression-in-string)
(erc-member-if, erc-delete-if, erc-remove-if-not, erc-subseq):
Explicitly declare obsolete.
(erc-define-minor-mode): Make into obsolete function alias for
'define-minor-mode'.
(erc-user-emacs-directory): Make into obsolete variable alias for
'user-emacs-directory'.
Eli Zaretskii [Sun, 26 Sep 2021 13:50:11 +0000 (16:50 +0300)]
; Fix some recent fixes to doc strings
* lisp/whitespace.el (whitespace-empty-at-bob-regexp):
* lisp/vc/vc-dir.el (vc-dir-child-files-and-states):
* lisp/vc/vc-annotate.el
(vc-annotate-show-changeset-diff-revision-at-line):
* lisp/vc/ediff.el (ediff-merge-with-ancestor-command):
* lisp/gnus/nnvirtual.el (nnvirtual-update-xref-header)
(nnvirtual-map-article):
* lisp/emulation/viper-init.el (viper-ESC-keyseq-timeout):
* lisp/emulation/viper-cmd.el
(viper-set-parsing-style-toggling-macro):
* lisp/cedet/data-debug.el (data-debug-insert-hash-table-button):
"The first line of a doc string must be a complete sentence."
Also, fix some awkward wording in doc strings while at that.
Stefan Kangas [Sun, 26 Sep 2021 13:29:20 +0000 (15:29 +0200)]
Add fast-path to ert--explain-string-equal
* lisp/emacs-lisp/ert.el (ert--explain-string-equal): Add fast-path to
avoid doing extra work.
Problem reported by Mattias Engdegård <mattiase@acm.org>.
* doc/lispref/searching.texi (Rx Constructs, Rx Functions):
Add clarifications and improve naming of arguments. Add examples
illustrating the differences between `rx` and `rx-to-string`.
Stefan Kangas [Fri, 24 Sep 2021 17:10:46 +0000 (19:10 +0200)]
Warn about overly long docstring in lambda
* lisp/emacs-lisp/bytecomp.el
(byte-compile-docstring-length-warn): Warn about overly long
docstring in lambda. (Bug#44858)
(byte-compile--wide-docstring-p): Improve comment.
* test/lisp/emacs-lisp/bytecomp-tests.el
("warn-wide-docstring-defun.el"): Update to test for the above new
warning.
Stefan Kangas [Fri, 24 Sep 2021 15:44:40 +0000 (17:44 +0200)]
Avoid warning about long docstring lines in defcustom
* lisp/custom.el (defcustom): Avoid warning about long docstring
lines. This was caused by the value of the defcustom being treated as
docstring due to it being wrapped in a lambda.
Stefan Kangas [Fri, 24 Sep 2021 15:45:37 +0000 (17:45 +0200)]
Avoid false positives in bytecomp docstring width warning
* lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p):
Ignore more function argument lists.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests-byte-compile--wide-docstring-p): New test.
Michael Albinus [Sun, 26 Sep 2021 08:32:15 +0000 (10:32 +0200)]
Adapt Tramp's make-process for macOS.
* lisp/net/tramp-sh.el (tramp-check-remote-uname): New defun.
(tramp-sh-handle-file-ownership-preserved-p)
(tramp-sh-handle-make-process, tramp-find-executable)
(tramp-find-shell, tramp-get-remote-stat): Use it. (Bug#50748)
* test/lisp/net/tramp-tests.el (tramp-check-remote-uname): Declare.
(tramp-test29-start-file-process, tramp-test30-make-process):
Instrument for macOS.
(tramp--test-hpux-p): Adapt function.
(tramp--test-macos-p): New defun.
* lisp/gnus/mm-view.el (mm-text-html-renderer-alist): Add a new
form for links.
(mm-links-remove-leading-blank): Make obsolete.
(mm-inline-wash-with-file):
(mm-inline-render-with-file): Make obsolete -- they were awkwardly
defined and only used with links.
(mm-inline-render-with-links): New function.
Previously, variables bound outside `while` loops were not substituted
inside even in the absense of mutation. Add the necessary mutation
checking inside loops to allow propagation of values and aliased
variables.
* lisp/emacs-lisp/byte-opt.el
(byte-optimize--inhibit-outside-loop-constprop): New variable.
(byte-optimize-form-code-walker): First traverse each loop without
substitution to discover mutation, then without restrictions.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test-loop): New.
(bytecomp-tests--test-cases): Add test cases.
Use ambient lexical-binding value in ert-deftest body (bug#50738)
* lisp/emacs-lisp/ert.el (ert-deftest):
Evaluate the body of `ert-deftest` with the `lexical-binding` value of
the source file (or more precisely the value in force when the
definition is evaluated), which is what everyone expected, instead of
always using dynamic binding which is what they got until now.
* test/lisp/emacs-lisp/ert-tests.el
(ert-test-deftest-lexical-binding-t): New test.
Allowing &rest without a variable name following turned out not to be
very useful, and it never worked properly. Disallow it.
* lisp/emacs-lisp/bytecomp.el (byte-compile-check-lambda-list):
* src/eval.c (funcall_lambda):
Signal error for &rest without variable name.
* doc/lispref/functions.texi (Argument List): Adjust manual.
* etc/NEWS (file): Announce.
* test/src/eval-tests.el (eval-tests--bugs-24912-and-24913):
Extend test, also checking with and without lexical binding.
(eval-tests-accept-empty-optional-rest): Reduce to...
(eval-tests-accept-empty-optional): ...this, again checking
with and without lexical binding.
Stefan Kangas [Sat, 25 Sep 2021 16:59:37 +0000 (18:59 +0200)]
Clarify define-derived-mode docstring
* lisp/emacs-lisp/derived.el (define-derived-mode): Doc fixes;
correctly mention that the mode name is used in the mode line, clarify
argument types, and how the mode hook is named. (Bug17567)
(derived-mode-hook-name, derived-mode-map-name)
(derived-mode-syntax-table-name, derived-mode-abbrev-table-name):
Clarify that argument is a symbol.
Stefan Kangas [Sat, 25 Sep 2021 15:54:49 +0000 (17:54 +0200)]
Minor clarification of define-minor-mode :keymap argument
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Minor doc fix;
clarify by saying that ":keymap" should be an "unquoted variable
name". (Bug#25505)
Eli Zaretskii [Sat, 25 Sep 2021 09:18:27 +0000 (12:18 +0300)]
Fix cursor motion around some Emoji sequences
* src/character.h: Add TAG_SPACE and CANCEL_TAG to known Unicode
characters values.
* src/composite.c (char_composable_p): Recognize TAG characters
relevant to Emoji as composable regardless of their General
Category. (Bug#39799)
Eli Zaretskii [Sat, 25 Sep 2021 07:30:27 +0000 (10:30 +0300)]
Use explicit man-page section in references
* lisp/dired-aux.el (dired-do-chmod): Use explicit man-page
section in the doc string. This avoids inadvertently showing
the wrong man page, when several identically-named pages are
possible in different sections. E.g., there's also chmod(2).
Stephen Gildea [Sat, 25 Sep 2021 04:59:17 +0000 (21:59 -0700)]
; tramp-auto-save-directory: set mode atomically when creating
* lisp/net/tramp.el (tramp-handle-make-auto-save-file-name):
Use with-file-modes around make-directory. We can do this because
Tramp now honors default file modes in make-directory.
Stefan Kangas [Sat, 25 Sep 2021 01:03:34 +0000 (03:03 +0200)]
Add support for man page hyperlinks in doc strings
* lisp/help-mode.el (help-man): New button type.
(help-xref-man-regexp): New const.
(help-make-xrefs): Use them to allow making man page buttons.
* doc/lispref/tips.texi (Documentation Tips): Document the new
hyperlink type. (Bug#39215)
Daniel Martín [Fri, 24 Sep 2021 13:32:01 +0000 (15:32 +0200)]
Mention the 'r' key in ask-user-about-supersession-help
* lisp/userlock.el (ask-user-about-supersession-help): Replace "n, and
then M-x revert-buffer" in the help message with "r", which does the
same thing. (Bug#50780)
Indent bodies of local function definitions properly in elisp-mode
* lisp/emacs-lisp/lisp-mode.el (lisp-indent-function): Check for
local defforms (`cl-flet' and `cl-labels').
(lisp--local-defform-body): New auxiliary function (bug#9622).
Stefan Kangas [Fri, 24 Sep 2021 22:33:21 +0000 (00:33 +0200)]
Fix alignment on font size change in tabulated-list-mode
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print-col): Fix
bug where the columns didn't align correctly when using
'text-scale-mode' to decrease the font size. (Bug#48639)
Stefan Kangas [Fri, 24 Sep 2021 20:17:04 +0000 (22:17 +0200)]
Revert change to use seq-random-elt in Tramp test
* test/lisp/net/tramp-tests.el (tramp-test44-asynchronous-requests):
Revert change to use seq-random-elt, as Tramp needs to be compatible
with Emacs 25, and the function was only added in 26.1.
Stefan Kangas [Fri, 24 Sep 2021 20:04:55 +0000 (22:04 +0200)]
checkdoc: Improve wide line warning to decrease false positives
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
Respect 'byte-compile-docstring-max-column' if it is set. Allow the
first line to be three characters longer than the others to account
for indentation and the opening string character.