By default, entering view-mode echoes a usage message. This is
particularly helpful with non-nil view-read-only, to notify the user
that view-mode has been enabled. It is less useful and more spammy,
however, if view-mode is (possibly inadvertently) entered from some
non-interactive code running in the background, such as when a major
mode is enabled in a temporary buffer for text formatting
purposes (bug#44629).
* lisp/jsonrpc.el (jsonrpc-events-buffer, initialize-instance): Use
buffer-read-only in place of read-only-mode for non-interactive use.
* lisp/view.el (view-mode-enter): Inhibit help message if either
view-inhibit-help-message is non-nil, or view-mode-enter was called
from an interactive command. Suggested by João Távora
<joaotavora@gmail.com>.
While playing around with the timing in this function, I left
this change that could freeze the function on some platforms.
* lisp/jsonrpc.el (jsonrpc-request): Use accept-process-output.
(Version): Bump to 1.0.14
* lisp/jsonrpc.el (jsonrpc-default-request-timeout): Rename from
'jrpc-default-request-timeout'.
(jrpc-default-request-timeout): Make into obsolete variable alias
for 'jsonrpc-default-request-timeout'. (Bug#40054)
Report and original implementation by Steve Purcell
<steve@sanityinc.com>. See also See
https://github.com/joaotavora/eglot/pull/493 for details
* lisp/jsonrpc.el (initialize-instance): Make process in original
buffer.
(Version): Bump to 1.0.12
* etc/NEWS: Announce that json-read-number is now stricter.
* json.el: Bump package version.
(json-encoding-lisp-style-closings, json-pre-element-read-function)
(json-post-element-read-function, json-advance, json-peek)
(json--path): Clarify and improve style of doc strings.
(json-join): Define as an obsolete alias of string-join.
(json-alist-p, json-plist-p): Refactor for speed and declare as
pure, side-effect-free, and error-free.
(json--plist-reverse): Rename function...
(json--plist-nreverse): ...to this, making it destructive for speed.
All callers changed.
(json--plist-to-alist): Remove, replacing single use with map-pairs.
(json--with-indentation): Accept multiple forms as arguments, fix
their indentation, and allow them to be instrumented for debugging.
Add docstring.
(json-pop, json-read-keyword, json-add-to-object)
(json-encode-array): Simplify for speed.
(json-skip-whitespace): Put newline before carriage return for
likely frequency of occurrence, and so that the characters appear in
increasing order.
(json--check-position): Use 1+.
(json-path-to-position): Open code apply-partially.
(json-keywords): Turn into a defconst and mark as obsolete now that
it is no longer used.
(json--post-value, json--number, json--escape): New rx definitions.
(json-encode-keyword): Declare as side-effect-free.
(json-read-number): Reject leading zeros and plus signs, and make
integer part mandatory in accordance with JSON standards and for
consistency with native JSON parsing functions. Eagerly signal
json-number-format when garbage follows a valid number, e.g., when
reading "1.1.1", instead of leaving that up to the caller. Remove
optional internal argument from advertised calling convention now
that the function is no longer recursive.
(json-encode-number): Define as an alias of number-to-string.
(json-special-chars): Turn into a defconst.
(json-read-escaped-char, json-new-object, json-read-file)
(json-pretty-print): Simplify.
(json-read-string): For consistency with other json.el error
reporting, remove check for leading '"', and use the integer value
rather than the printed representation of characters in error data.
At EOB signal json-end-of-file instead of json-string-format.
(json--long-string-threshold, json--string-buffer): New variables.
(json-encode-string): Reimplement in terms of buffer manipulation
for speed (bug#20154).
(json-read-object): Escape ?\} properly.
(json--encode-alist): New function extracted from json-encode-alist.
(json-encode-hash-table, json-encode-alist, json-encode-plist): Use
it to avoid destructively modifying the argument when
json-encoding-object-sort-predicate is non-nil without incurring
unnecessary copying (bug#40693). Encode empty object as "{}" even
when pretty-printing. Simplify for speed.
(json-read-array): Avoid recomputing list length on each iteration
when json-pre-element-read-function is non-nil. Make first element
of json-array-format error data a string for consistency with
json-object-format and to make the displayed error message clearer.
(json-readtable-dispatch): Accept any kind of argument, not just
symbols. Generate the table in a simpler manner so the dispatch
order is clearer. Remove dispatch on ?+ and ?. now that
json-read-number is stricter and for consistency with native JSON
parsing functions. Signal json-end-of-file if argument is nil.
(json-read): Simplify accordingly.
(json-encode): Avoid allocating a list on each invocation.
* lisp/jsonrpc.el (jsonrpc--json-read, jsonrpc--json-encode): Check
whether native JSON functions are fboundp only once, at load time.
* lisp/progmodes/python.el (python--parse-json-array): New function.
(python-shell-prompt-detect): Use it to parse JSON directly as a
list rather than converting from a vector.
* test/lisp/json-tests.el (json-tests--with-temp-buffer): Allow
instrumenting for debugging.
(test-json-join, test-json-plist-to-alist): Remove tests.
(test-json-alist-p, test-json-plist-p, test-json-advance)
(test-json-peek, test-json-pop, test-json-skip-whitespace)
(test-json-read-keyword, test-json-encode-keyword)
(test-json-encode-number, test-json-read-escaped-char)
(test-json-read-string, test-json-encode-string)
(test-json-encode-key, test-json-new-object)
(test-json-encode-hash-table, test-json-encode-plist)
(test-json-encode-list, test-json-read-array)
(test-json-encode-array, test-json-read)
(test-json-read-from-string, test-json-encode): Extend tests.
(test-json-plist-reverse): Rename test...
(test-json-plist-nreverse): ...to this and avoid modifying literal
lists.
(test-json-read-number): Rename test...
(test-json-read-integer): ...to this, focusing on integers.
(test-json-add-to-object): Rename test...
(test-json-add-to-alist): ...to this, focusing on alists.
(json-encode-simple-alist): Rename test...
(test-json-encode-alist): ...to this, extending it.
(test-json-encode-alist-with-sort-predicate): Rename test...
(test-json-encode-alist-sort): ...to this, extending it.
(test-json-encode-plist-with-sort-predicate): Rename test...
(test-json-encode-plist-sort): ...to this, extending it.
(test-json-read-keyword-invalid, test-json-read-fraction)
(test-json-read-exponent, test-json-read-fraction-exponent)
(test-json-read-number-invalid)
(test-json-read-escaped-char-invalid, test-json-add-to-plist)
(test-json-add-to-hash-table, test-json-read-object-empty)
(test-json-read-object-invalid, test-json-read-object-function)
(test-json-encode-hash-table-pretty)
(test-json-encode-hash-table-lisp-style)
(test-json-encode-hash-table-sort, test-json-encode-alist-pretty)
(test-json-encode-alist-lisp-style, test-json-encode-plist-pretty)
(test-json-encode-plist-lisp-style, test-json-read-array-function)
(test-json-encode-array-pretty, test-json-encode-array-lisp-style)
(test-json-read-invalid): New tests.
(test-json-path-to-position-no-match): Use should-not.
(test-json-read-object): Move error check to new test
test-json-read-object-invalid.
(test-json-pretty-print-object): Adapt test now that empty objects
are pretty-printed as "{}".
The new packages state they require Emacs 26.3 to function, but a
small part of project.el breaks this "soft" rule: the two functions
requiring fileloop.el are incompatible with Emacs 26.3.
* lisp/jsonrpc.el: Tweak comment near Package-Requires.
* lisp/emacs-lisp/eldoc.el: Add Version and Package-Requires.
* lisp/progmodes/flymake.el: Add comment near Package-Requires.
* lisp/progmodes/project.el: Add Version and Package-Requires.
* lisp/progmodes/xref.el: Add Version and Package-Requires.
Paul Eggert had fixed it in practice, but the missing paren
was meant to close a previous with-current-buffer.
* lisp/jsonrpc.el (initialize-instance): Put parenthesis in right spot.
(Version): Bump to 1.0.11
For inferior processes having useful stderr, it is no longer
cumbersome to switch between different buffers to correlate error
messages with transport-level JSONRPC messages.
The existing stderr and stdout buffers can still be found hidden away
from the normal buffer list.
An original idea of Tobias Rittweiler <trittweiler@gmail.com>.
* lisp/jsonrpc.el (initialize-instance jsonrpc-process-connection):
Setup after-change functions stderr buffer. Hide stderr and stdout
buffers.
(jsonrpc--log-event): Don't output extra newline. Tweak log format.
(Version): Bump to 1.0.10
* lisp/jsonrpc.el (initialize-instance jsonrpc-process-connection):
Use buffer-disable-undo in stdout and stderr buffers.
* lisp/jsonrpc.el (Version): Bump to 1.0.9
Also don't send :error field on non-errors.
* lisp/jsonrpc.el (jsonrpc--reply): Don't send :result and :error
if none supplied.
(Version): Bump to 1.0.8
The convention is that a file with Author: but not Maintainer:
means the author is a maintainer, which makes it confusing
when a file lists the same person as author and maintainer.
Avoid the confusion by removing the duplicate Maintainer: line.
Update some other copyright years automatically, by running:
Run 'UPDATE_COPYRIGHT_YEAR=2019 \
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79 admin/update-copyright'
followed by 'admin/merge-gnulib'.
Previously, if an error handler called jsonrpc-shutdown, and if that
error handler was being called from the process sentinel,
jsonrpc-shutdown would infloop waiting for jsonrpc-sentinel-done to be
set.
Rename the process property jsonrpc-sentinel-done to
jsonrpc-sentinel-cleanup-started, arrange for it to be set earlier
in the sentinel, and also check for it earlier in jsonrpc-shutdown.
* lisp/jsonrpc.el (Version): Bump to 1.0.7.
(jsonrpc--process-sentinel): Set jsonrpc-sentinel-cleanup-started
a bit earlier than previous jsonrpc-sentinel-done.
(jsonrpc-shutdown): Query jsonrpc-sentinel-cleanup-started
This reverts commit c580443325. It
leads to situations where the sentinel hasn't run yet, which brings
problems if the normal process isn't running, but the stderr
pseudo-process still is.
* lisp/jsonrpc.el (jsonrpc-shutdown): Always enter loop.
Pretty printing the event sexp can be very slow when very big messages
are involved.
* lisp/jsonrpc.el (Version): Bump to 1.0.3
(jsonrpc-connection): Tweak docstring for
jsonrpc--event-buffer-scrollback-size.
(jsonrpc--log-event): Only log if max size is positive.
* lisp/jsonrpc.el (Version): Bump to 1.0.2
(jsonrpc--events-buffer-scrollback-size): New
jsonrpc-connection slot.
(jsonrpc--log-event): Use it to trim buffer.
This allows building more responsive interfaces, such as a snappier
completion backend.
* lisp/jsonrpc.el (Version): Bump to 1.0.1
(jsonrpc-connection-receive): Don't warn when continuation isn't
found.
(jsonrpc-request): Add parameters CANCEL-ON-INPUT and
CANCEL-ON-INPUT-RETVAL.
(nth 2) is probably a better alternative to caddr, and in Emacs 26.1
we can pass 0 as :service to automatically find an available port.
* lisp/jsonrpc.el (jsonrpc--call-deferred): Use cl-caddr.
* test/lisp/jsonrpc-tests.el
(jsonrpc--call-with-emacsrpc-fixture): Pass 0 as :service to when
making the listen server.
* jsonrpc.el (Package-Requires): Require Emacs 25.1
(jsonrpc-lambda): Use cl-gensym.
(jsonrpc--call-deferred): Caddr doesn't exist in
emacs 25.1.
* jsonrpc-tests.el
(jsonrpc--call-with-emacsrpc-fixture): New function.
(jsonrpc--with-emacsrpc-fixture): Use it.
(deferred-action-complex-tests): Adjust test for Emacs 25.1
* doc/lispref/text.texi (Text): Add JSONRPC.
(JSONRPC): New node.
* etc/NEWS (New Modes and Packages in Emacs 27.1): Mention jsonrpc.el
* lisp/jsonrpc.el: New file.
* test/lisp/jsonrpc-tests.el: New file.