João Távora [Wed, 8 Jul 2020 21:47:00 +0000 (22:47 +0100)]
Have Python mode cooperate asynchronously with Eldoc
When combined with Flymake mode, which also adds a value to
eldoc-documentation-functions, Python-mode users can now experiment
with different eldoc-documentation-strategy values.
Also, this shoulda allow us to write automatic tests for this
particular Eldoc functionality.
* lisp/progmodes/python.el (inferior-python-mode): Set
coming-preoutput-filter-functions.
(python--shell-output-filter-in-progress)
(python--shell-output-filter-buffer): Rename from python- variant.
(python-shell-output-filter): Rework to support async operation.
(python-eldoc--get-doc-at-point): Rework to support async.
(python-eldoc-function): Use callback.
Special-case symbol and fixnum keys in member, assoc and rassoc
* src/fns.c (Fmember, Fassoc, Frassoc): Delegate to the cheaper Fmemq,
Fassq and Frassq for arguments of the appropriate types.
(eq_comparable_value): New function.
João Távora [Sat, 6 Jun 2020 13:04:48 +0000 (14:04 +0100)]
Make more parts of Emacs use new Eldoc capabilities
Elisp-mode was doing a lot of work that can now be delegated to Eldoc.
Flymake uses the new Eldoc functionality, too, installing a global
documentation function that may report on diagnostics under point.
CEDET's grammar.el was left as the only user of an Eldoc-internal
function. That function was moved to grammar.el. That file is still,
somewhat reprehensibly, using an internal function of elisp-mode.el,
but this was left unchanged.
In other situations, eldoc-documentation-functions is used or
recommended.
The only other places where the obsolete eldoc-documentation-function
is still used is in libraries which are presumably meant to remain
compatible with previous Emacs versions.
* lisp/progmodes/elisp-mode.el (elisp-eldoc-funcall)
(elisp-eldoc-var-docstring): New functions.
(emacs-lisp-mode): Put two elements in
eldoc-documentation-functions.
* lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): Setup
new Elisp eldoc-documentation-functions.
* lisp/progmodes/flymake.el (flymake-mode): Use
flymake-eldoc-function.
(flymake-eldoc-function): New function.
(Package-Requires): Require eldoc 1.1.0
João Távora [Mon, 25 May 2020 15:39:40 +0000 (16:39 +0100)]
Better handle asynchronous Eldoc sources
This is a backward compatible redesign of significant parts of the
eldoc.el library.
Previously, Eldoc clients (major/minor modes setting its documentation
gathering variables) needed to directly call eldoc-message, an
internal function, to display the docstring to the user. When more
asynchronous sources are involved, this is hard to do or even breaks
down.
Now, an Eldoc backend may return any non-nil, non-string value and
call a callback afterwards. This restores power to Eldoc over how
(and crucially also when) to display the docstrings to the user.
Among other things, this fixes so called "doc blinking", or the very
short-lived display of a lower priority Eldoc message. This would
happen if a particular producer of documentation finishes shortly
before a higher priority one, like in the LSP engine Eglot as reported
by Andrii Kolomoiets <andreyk.mad@gmail.com> and Dmitry Gutov
<dgutov@yandex.ru>.
Gathering docstrings is now delegated to the variable
eldoc-documentation-strategy, which is the new name for the
now-obsolete eldoc-documentation-function, and still accepts the
so-called "old protocol". Examples of the new strategies enabled are
codified in functions such as eldoc-documentation-enthusiast,
eldoc-documentation-compose-eagerly, along with the existing
eldoc-documentation-compose and eldoc-documentation-default.
The work of displaying and formatting docstrings is shifted almost
fully to Eldoc itself and is delegated to the internal function
eldoc--handle-docs. Among other improvements, it handles most of
eldoc-echo-area-use-multiline-p and outputs documentation to a
temporary *eldoc* buffer.
The manual and NEWS are updated to mention the new Eldoc features.
* lisp/emacs-lisp/eldoc.el (eldoc-documentation-functions):
Overhaul docstring.
(eldoc-documentation-compose, eldoc-documentation-default): Handle
non-nil, non-string values of elements of
eldoc-documentation-functions. Use eldoc--handle-multiline.
(eldoc-print-current-symbol-info): Honour non-nil, non-string
values returned by eldoc-documentation-callback.
(eldoc--make-callback): Now also a function.
(eldoc-documentation-default, eldoc-documentation-compose): Tweak docstring.
(eldoc-documentation-enthusiast, eldoc-documentation-compose-eagerly):
New functions.
(eldoc-echo-area-use-multiline-p): Add new semantics.
(eldoc--handle-docs): Handle some of eldoc-echo-area-use-multiline-p.
(eldoc-doc-buffer): New command.
(eldoc-prefer-doc-buffer): New defcustom.
(eldoc--enthusiasm-curbing-timer): New variable.
(eldoc-documentation-strategy): Rename from eldoc-documentation-function.
(eldoc--supported-p): Use eldoc-documentation-strategy
(eldoc-highlight-function-argument)
(eldoc-argument-case, global-eldoc-mode)
(turn-on-eldoc-mode): Mention eldoc-documentation-strategy.
(eldoc-message-function): Mention eldoc--message.
(eldoc-message): Made obsolete.
(eldoc--message): New helper.
* lisp/hexl.el (hexl-print-current-point-info): Adjust to new
eldoc-documentation-functions protocol.
* lisp/progmodes/cfengine.el (cfengine3-documentation-function):
Adjust to new eldoc-documentation-functions protocol.
* lisp/progmodes/elisp-mode.el
(elisp-eldoc-documentation-function): Adjust to new
eldoc-documentation-functions protocol.
* lisp/progmodes/octave.el (octave-eldoc-function): Adjust to new
eldoc-documentation-functions protocol.
* lisp/progmodes/python.el (python-eldoc-function): Adjust to new
eldoc-documentation-functions protocol.
(eldoc-print-current-symbol-info): Rework with cl-labels.
Most pure functions need no explicit optimisation; we can do away with
almost all uses of byte-optimize-predicate (now renamed to
byte-optimize-constant-args, since it is not just for predicates).
Also remove some superfluous arity warnings.
Extend the list of 'pure' functions to many predicates and numerical
functions that we are reasonably confident will give portable results.
Also include various list and array accessors, because our use of purity
in the byte compiler isn't affected by the mutability of arguments.
* lisp/emacs-lisp/byte-opt.el: Update example in comment.
(pure-fns): Add many functions.
(byte-optimize-form-code-walker) Don't signal errors during evaluation
of calls to pure functions with constant arguments at compile time,
since such calls are not necessarily reachable.
Wilson Snyder [Sun, 5 Jul 2020 17:31:39 +0000 (13:31 -0400)]
Verilog-Mode collected updates.
* lisp/progmodes/verilog-mode.el (verilog-auto-inst): Support regexp of
what AUTOINST I/O to include, issue #1682. Reported by Mrainy.
(verilog-font-lock-keywords-1): Fix highlighting module names with no
following (, issue #1679. Reported by Vinam Arora.
(verilog-font-lock-keywords) Adds syntax highlighting for identifiers in
declaration statements, #1678.
(verilog-calculate-indent, verilog-inject-arg)
(verilog-keywords, verilog-showscopes): Support AMS
connectmodule/endconnectmodule, #1665. Reported by Dan McMahill.
Don't confuse errors with nil in bytecomp-tests.el
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-check-1)
(bytecomp-explain-1, test-byte-opt-arithmetic, bytecomp-lexbind-check-1)
(bytecomp-lexbind-explain-1):
If an expression raises an error when evaluated, don't treat it as if
it had succeeded with the value nil; use 'bytecomp-check-error' as the
result instead.
Eli Zaretskii [Sun, 5 Jul 2020 15:30:21 +0000 (18:30 +0300)]
Clarify the documentation of 'left/right-fringe' display spec
* doc/lispref/display.texi (Other Display Specs, Fringe Bitmaps):
Clarify how the optional FACE parameter of the left-fringe and
right-fringe display spec is used. Reported by Gregory Heytings
<ghe@sdf.org>.
Relax portable number check in byte compiler (bug#42147)
With bignums, the set of representable integers is no longer
platform-dependent, and since we use nothing but IEEE754 64-bit
floats, all numbers are now portable. Take advantage of this fact
to simplify constant-folding in the byte compiler, allowing it to
be applied more widely.
* lisp/emacs-lisp/byte-opt.el (byte-opt--portable-max)
(byte-opt--portable-min, byte-opt--portable-numberp): Remove.
(byte-opt--arith-reduce, byte-optimize-minus, byte-optimize-1+)
(byte-optimize-1-): Simplify: any number will do, and if N is a
number, then so are -N, N+1 and N-1.
Alan Mackenzie [Sat, 4 Jul 2020 12:55:49 +0000 (12:55 +0000)]
Fix filling in js-mode and mhtml-mode (js-mode parts), fixing bug #41897
* lisp/progmodes/js.el (js-mode): Use "\\(?:" in the value of
comment-start-skip rather than "\\(", fixing the second half of bug #41952.
Call c-foreign-init-lit-pos-cache and install c-foreign-truncate-lit-pos-cache
on before-change-functions, to connect up correctly with CC Mode's filling
mechanism.
* lisp/textmodes/mhtml-mode.el (mhtml--crucial-variable-prefix): Add prefixes
"adaptive-fill-", "fill-", "normal-auto-fill-function" and "paragraph-" to
pull in variables crucial to filling.
(mhtml-syntax-propertize): Read the current submode from the piece of text
being propertized rather than one character before it, and do so before
erasing the submode text-property.
(mhtml-mode): Set the js-mode value of auto-fill-function to js-do-auto-fill.
Correctly initialize and use CC Mode's filling facilities, as above.
Alan Mackenzie [Sat, 4 Jul 2020 11:56:18 +0000 (11:56 +0000)]
CC Mode: Fix wrong value of comment-start-skip, fixing half of bug #41952
Also add functions to enable correct use of CC Mode's filling functionality
from major modes which don't initialize CC Mode fully. These modes are
currently js-mode and mhtml-mode.
* lisp/progmodes/cc-langs.el (comment-start-skip): Replace "\\(" by "\\(?:" so
that (match-end 1) isn't falsely taken to be the start of the comment.
* lisp/progmodes/cc-engine.el (c-foreign-truncate-lit-pos-cache)
(c-foreign-init-lit-pos-cache): New functions.
Daniel Koning [Tue, 23 Jun 2020 00:03:20 +0000 (19:03 -0500)]
Use 'emacs-lisp-mode-syntax-table' for reading Lisp expressions
* lisp/simple.el (read--expression): Set syntax table to
'emacs-lisp-mode-syntax-table' when reading a Lisp expression
from the minibuffer. (Bug#41781)
James N. V. Cash [Mon, 29 Jun 2020 23:45:15 +0000 (02:45 +0300)]
Subject: Frame-local tab-bar for numeric value of tab-bar-show (bug#42052)
* lisp/tab-bar.el (tab-bar-new-tab-to): Set frame parameter
tab-bar-lines to 1 when tab-bar-show is the same as number of tabs.
(tab-bar-close-tab, tab-bar-close-other-tabs): Set frame parameter
tab-bar-lines to 0 when tab-bar-show is the same as number of tabs.
Alan Mackenzie [Mon, 29 Jun 2020 19:10:09 +0000 (19:10 +0000)]
CC Mode: optimize for repeated simple operations.
Do this by recognising that unterminated strings in a buffer are typically
going to be few and close together. Also optimize code for C++ attributes.
* lisp/progmodes/cc-defs.el (c-previous-single-property-change): New macro.
(c-put-syn-tab, c-clear-syn-tab): Turned from macros into functions, and moved
to cc-mode.el.
(c-clear-syn-tab-properties): Amended to use c-min/max-syn-tab-mkr.
(c-with-extended-string-fences): Removed.
* lisp/progmodes/cc-engine-el (c-enclosing-c++-attribute): Rewritten for
speed.
(c-slow-enclosing-c++-attribute): Removed.
(c-semi-pp-to-literal): Remove a superfluous call to
c-with-extended-string-fences.
* lisp/progmodes/cc-mode.el (c-min-syn-tab-mkr, c-max-syn-tab-mkr): two new
marker variables which bound the region occupied by positions with
c-fl-syn-tab text properties.
(c-basic-common-init): Initialize these two variables.
(c-fl-syn-tab-region): Removed.
(c-put-syn-tab, c-clear-syn-tab): Functions moved from cc-defs.el.
(c-clear-string-fences): Amended to use the new scheme.
(c-restore-string-fences): Now takes no arguments; amended to use the new
scheme.
(c-font-lock-fontify-region): Amended to use the new scheme.
Paul Eggert [Sun, 28 Jun 2020 20:22:44 +0000 (13:22 -0700)]
Update from Gnulib.
This incorporates:
2020-06-28 getrandom: do not depend on ‘open’ on mingw
2020-06-28 getrandom: fix compilation errors on older versions of mingw
* build-aux/config.sub, lib/getrandom.c, m4/getrandom.m4:
Copy from Gnulib
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
Eli Zaretskii [Sun, 28 Jun 2020 15:26:20 +0000 (18:26 +0300)]
MS-Windows fixes as followup to import of Gnulib 'getrandom'
* nt/mingw-cfg.site (gl_cv_lib_assume_bcrypt): Set to "no" to
disable linking against bcrypt.dll. (Bug#42095)
* src/gnutls.c (gnutls_rnd) [WINDOWSNT]: Don't define a function
pointer, and don't load it from GnuTLS DLL.
(w32_gnutls_rnd) [WINDOWSNT]: Delete unused function.
* src/fns.c (gnutls_rnd) [WINDOWSNT]: Don't redirect to
w32_gnutls_rnd.
Paul Eggert [Sat, 27 Jun 2020 20:02:24 +0000 (13:02 -0700)]
Use getrandom syscall for nonces
* admin/merge-gnulib (GNULIB_MODULES): Add getrandom.
* doc/lispref/text.texi (Format of GnuTLS Cryptography Inputs):
Don’t say that iv-auto uses GNUTLS_RND_NONCE. Also, don’t say
that it returns the IV’s actual value, as it never has done that.
* src/fns.c, src/sysdep.c: Include sys/random.h, for getrandom.
* src/fns.c (Fsecure_hash_algorithms): Use getrandom so that this
function does not depend on HAVE_GNUTLS3.
* src/sysdep.c: Do not include <gnutls/crypto.h>.
(random_seed) [HAVE_LRAND48]: Can be long int now.
(init_random) [!WINDOWSNT]: Use getrandom syscall instead
of opening /dev/urandom, as this works even on GNU/Linux
hosts that lack /dev/urandom. Don’t bother with gnutls_rnd
as it’s not needed now that we have getrandom.
Paul Eggert [Sat, 27 Jun 2020 17:00:17 +0000 (10:00 -0700)]
Update from Gnulib
This incorporates:
2020-06-27 getloadavg: don’t depend on fopen-gnu
2020-06-25 c-dtoastr, c-ldtoastr: new modules
2020-06-01 getloadavg: fix double-increment bug
2020-06-01 tempname: use getrandom, not getentropy
2020-05-31 tempname: merge from glibc and coreutils
2020-05-31 getentropy: work around a macOS and Solaris problem
2020-05-31 fnmatch: merge from glibc
2020-05-30 unistd: remove conflicting declaration of getrandom
2020-05-30 don't assume that UNICODE is not defined
2020-05-29 fix compilation error on native Windows
2020-05-28 avoid dynamic loading of Windows API functions when possible
2020-05-28 at-internal: make more robust in multithreaded applications
2020-05-28 getloadavg: make more robust in multithreaded applications
2020-05-27 getloadavg: make more robust in multithreaded applications
2020-05-26 count-one-bits: fix MSVC specific code
2020-05-25 getentropy, getrandom: new modules
2020-05-24 open, openat: really support O_CLOEXEC
2020-05-23 verify: document ‘assume’ better
2020-05-21 regex: configure better with "clang -fsanitize=leak"
2020-05-21 memmem: configure better with "clang -fsanitize=undefined"
2020-05-19 ftoastr: fix ifndef typo
* build-aux/config.guess, build-aux/config.sub, doc/misc/texinfo.tex:
* lib/count-one-bits.h, lib/ftoastr.c, lib/ftoastr.h:
* lib/getloadavg.c, lib/gettimeofday.c, lib/libc-config.h:
* lib/open.c, lib/openat-proc.c, lib/tempname.c, lib/tempname.h:
* lib/unistd.in.h, lib/verify.h, m4/memmem.m4, m4/regex.m4:
* m4/unistd_h.m4:
Update from Gnulib.
* lib/getrandom.c, lib/sys_random.in.h:
* m4/getrandom.m4, m4/sys_random_h.m4:
New files, copied from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
Glenn Morris [Fri, 26 Jun 2020 14:50:38 +0000 (07:50 -0700)]
Merge from origin/emacs-27
5280e118c0 (origin/emacs-27) ; * src/xdisp.c (pos_visible_p): Fix las... bb1a9481c9 Fix posn-at-point at beginning of a display string 0c4b033670 Improve documentation of Info node movement commands 632b0119e1 Add Jansson dependency to Windows Build dbfcdab837 Unbreak 'reverse-region' c37de84845 Fix typos and markup in fill column indicator docs f61bff3ee9 ; * CONTRIBUTE: Clarify the preferences for patch formatting. 368e140660 Avoid crashes in 'defconst' 11e3413cff Fix text about Lisp archives in the Emacs FQ 4c81724675 Don't use 'cl' functions in ELisp manual's examples
Eli Zaretskii [Fri, 26 Jun 2020 07:41:09 +0000 (10:41 +0300)]
Improve documentation of Info node movement commands
* lisp/info.el (Info-next, Info-prev, Info-forward-node)
(Info-backward-node): More detailed descriptions of what each
commands does with respect to child and parent nodes. (Bug#42050)
Dmitry Gutov [Fri, 26 Jun 2020 00:33:13 +0000 (03:33 +0300)]
project-known-roots: Rename and improve
* lisp/progmodes/project.el (project-known-project-roots):
Rename from 'project-known-roots'. Update the docstring. Make
sure the returned value is a list of strings. Update the caller
(bug#41821).
* lisp/progmodes/project.el (project-kill-buffers-ignores):
Rename from project-kill-buffers-skip-conditions (bug#41868).
Update both references.
Add a :package-version attribute.
Juri Linkov [Thu, 25 Jun 2020 00:48:32 +0000 (03:48 +0300)]
Push action to list of functions in display-buffer-override-next-command
* lisp/window.el (display-buffer-override-next-command):
Push action to 'car' of 'display-buffer-overriding-action'
and in exitfun remove action from 'car'.
https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00803.html
Juri Linkov [Tue, 23 Jun 2020 23:54:30 +0000 (02:54 +0300)]
More not-state-changing vc commands can be used from non-file buffers
* lisp/vc/vc.el (vc-deduce-fileset): Instead of checking for
log-view-mode, check for '(not buffer-file-name)' before trying to
get the backend for default-directory. Remove the branch that
checks for '(not buffer-file-name)' and signals the error because
vc-responsible-backend used in previous condition already signals
its error. (Bug#41974)
Michael Albinus [Tue, 23 Jun 2020 19:18:08 +0000 (21:18 +0200)]
Fix problem in tramp-smb.el
* lisp/net/tramp-smb.el (tramp-smb-handle-directory-files):
Use `directory-file-name'.
* test/lisp/net/tramp-tests.el (trace): Require it.
(tramp--test-instrument-test-case): Print also function traces.
(tramp--test-smb-p): New defun.
(tramp-test03-file-name-method-rules)
(tramp-test05-expand-file-name-relative)
(tramp-test21-file-links, tramp--test-windows-nt-or-smb-p)
(tramp--test-check-files): Use it.
David Edmondson [Tue, 23 Jun 2020 11:52:34 +0000 (12:52 +0100)]
Fix gnus-cloud-download-all-data return value
* lisp/gnus/gnus-cloud.el (gnus-cloud-download-data): Return the
result of calling `gnus-cloud-update-all' when UPDATE is t, as per the
documented behaviour. (Bug#40280)
Eli Zaretskii [Mon, 22 Jun 2020 15:32:01 +0000 (18:32 +0300)]
Minor improvements as followup to recent RGB string-parsing change
* src/xfaces.c (Finternal_color_values_from_color_spec): Rename to...
(Fcolor_values_from_color_spec): ...this. Callers changed.
Rename the argument to SPEC and improve the doc string.
(parse_color_spec, parse_float_color_comp, parse_hex_color_comp):
Improve commentary.
(parse_color_spec): Rename the argument S to SPEC.
This bug was exposed by a previous removal of quoting around lambda
expressions in autoinsert-tests.el (1ecd350f38ee), which caused some
of those tests to fail.
* lisp/autoinsert.el (auto-insert): Cope with lexical closures.
Preserve point in pascal-mode completion (bug#41740)
Failure to do so caused errors in several cases.
Reported by Shinichi Sakata.
* lisp/progmodes/pascal.el (pascal-type-completion)
(pascal-completion): Wrap code that may move point in save-excursion.
* test/lisp/progmodes/pascal-tests.el: New file.
Use a single parser of color strings in the #RGB, rgb:R/G/B and
rgbi:R/G/B formats, replacing four existing ones. Previously,
error-checking was spotty, handling of the rgbi: format not always
present, and normalization of the result was sometimes incorrect.
* src/dispextern.h: New prototype.
* src/xfaces.c (parse_hex_color_comp, parse_float_color_comp)
(parse_color_spec, Finternal-color_values_from_color_spec): New functions.
* test/src/xfaces-tests.el (xfaces-internal-color-values-from-color-spec):
New test.
* lisp/term/tty-colors.el (tty-color-standard-values):
Use internal-color-values-from-color-spec, replacing old parser.
* src/nsterm.m (ns_get_color):
* src/w32fns.c (x_to_w32_color):
* src/xterm.c (x_parse_color): Use parse_color_spec, replacing old
parsers.
(HEX_COLOR_NAME_LENGTH): Remove #define.
* lisp/net/tramp-crypt.el (tramp-crypt-handle-delete-file)
(tramp-crypt-handle-file-attributes, tramp-crypt-handle-file-system-info)
(tramp-crypt-handle-make-directory): Let-bind `tramp-crypt-enabled' to nil.
* lisp/net/tramp.el (tramp-file-name-for-operation): Fix for operations
with two arguments.
(tramp-handle-load): Suppress `signal-hook-function' when NOERROR
is non-nil.
* test/lisp/net/tramp-tests.el (tramp-test41-utf8)
(tramp-test41-utf8-with-stat, tramp-test41-utf8-with-perl)
(tramp-test41-utf8-with-ls): Skip if needed.