Philipp Stephani [Wed, 13 Dec 2017 22:35:07 +0000 (23:35 +0100)]
Allow JSON parser functions to return alists
* src/json.c (Fjson_parse_string, Fjson_parse_buffer): Give these
functions a keyword argument to specify the return type for JSON
objects.
(json_to_lisp): Convert objects to alists if requested.
(json_parse_object_type): New helper function to parse keyword
arguments.
* test/src/json-tests.el (json-parse-string/object): Add a unit test.
* doc/lispref/text.texi (Parsing JSON): Document new functionality.
Philipp Stephani [Mon, 18 Dec 2017 23:07:45 +0000 (00:07 +0100)]
JSON: Add tests for Unicode edge cases
* test/src/json-tests.el (json-serialize/string): Add test for
serializing the null character.
(json-parse-string/null): Add test for parsing the null character.
(json-serialize/invalid-unicode): Add tests for invalid Unicode
strings.
(json-serialize/roundtrip): Add Unicode
noncharacter, non-BMP characters, and syntactic characters.
Eric Abrahamsen [Sat, 16 Dec 2017 22:03:18 +0000 (14:03 -0800)]
Fix Gnus registry header extraction
* lisp/gnus/gnus-registry.el (gnus-registry-fetch-recipients-fast,
gnus-registry-fetch-sender-fast): First, delete
`gnus-registry-fetch-header-fast'. It was being called with reversed
arguments, and thus always returned nil, but even if the argument
order was correct it would have raised an error, as it was trying to
`assq' a string in a vector. Instead, just have these two functions
do their own work, as they're doing fairly different things.
Paul Eggert [Mon, 18 Dec 2017 02:43:14 +0000 (18:43 -0800)]
Default CHECK_LISP_OBJECT_TYPE to "no"
* configure.ac: Go back to not defining CHECK_LISP_OBJECT_TYPE by
default for developer builds, since it is no longer that useful.
We can make it a no-op entirely later, if in practice it's not
that helpful to enable it.
Simen Heggestøyl [Sat, 16 Dec 2017 08:49:54 +0000 (09:49 +0100)]
Add command for cycling between CSS color formats
* lisp/textmodes/css-mode.el (css-mode-map): Add keybinding for
'css-cycle-color-format'.
(css--rgb-color): Add support for extracting alpha component.
(css--hex-alpha, css--color-to-4-dpc, css--named-color-to-hex)
(css--format-rgba-alpha, css--hex-to-rgb)
(css--rgb-to-named-color-or-hex): New functions.
(css-cycle-color-format): New command for cycling between color
formats.
* test/lisp/textmodes/css-mode-tests.el (css-test-color-to-4-dpc):
(css-test-named-color-to-hex, css-test-format-rgba-alpha)
(css-test-hex-to-rgb, css-test-rgb-to-named-color-or-hex)
(css-test-cycle-color-format, css-test-hex-alpha): New tests for the
changes mentioned above.
Glenn Morris [Sat, 16 Dec 2017 20:18:45 +0000 (12:18 -0800)]
Merge from origin/emacs-26
28e0261890 * lisp/progmodes/cc-defs.el (c-version): Update to 5.33.1. ac53084f9b Improve fix for Bug#29712 ffd4771560 * doc/lispref/sequences.texi (Sequence Functions): Improve... f274cbd185 Avoid reordering of output in 'shr-insert-document' 7890864413 Improve documentation of 'invisible-p' a1327bbc64 Remove one more check that Vframe_list is non-nil 63b6281fdd Fix off-by-one error in 'css--hex-color' 804b37ca63 Save and restore text-pixel height and width of frames (Bu... 777fe94661 Partially revert "Mention new strictness for &optional, &r... ad17db7964 * lisp/vc/smerge-mode.el (smerge-refine): Respect font-loc... 5a7d0095a4 * lisp/vc/smerge-mode.el (smerge-refine): Replace obsolete... e019c35df6 FOR_EACH_FRAME no longer assumes frame-list d64b88da2f * src/font.c (Ffont_info): Doc fix. (Bug#29682) 92b2604a7f Modernise message.el face spec syntax b1efbe6564 Update message.el obsolete face aliases 2494c14e76 ; * lisp/comint.el (comint-terminfo-terminal): Add a :vers... 12ad276d15 Improve documentation of TERM environment variable 8ed529f0f3 Add option to configure comint TERM 889f07c352 Better support utf-8-with-signature and utf-8-hfs in XML/HTML a2697fac0e * lisp/menu-bar.el (menu-bar-mode): Doc fix. ffb50eace6 ; * etc/NEWS: Fix last change. 95606af8b0 Fix Bug#29712 in tramp-tests.el 9bf66c6bee Don't run FOR_EACH_FRAME when there's no frame left (Bug#2... c2a88ec8e8 * lisp/textmodes/tex-mode.el: Ensure uncompiled file is lo... b178870528 Remember password change for IMAP in Gnus (Bug#29692) a21dac18bb Add %DUMBFW to the default GnuTLS priority strings 780407cff1 Small fixes prompted by make check-declare 541a60108d Fix some custom groups e220d6e112 Fix fontification of first declaration within a C++ lambda... aa66da220c * src/data.c (Fadd_variable_watcher): Doc fix. f838210b01 Fix misfontification of C++ member initialization list aft... 232c6465ce Fix doc-string of Fbuffer_list 3f9aac68d7 Don't raise an extraneous frame (bug#29696) e7b1111155 Mention new strictness for &optional, &rest in arglists (B... 4cb8696e47 Don't misfontify "foo ()" inside C++ initialization parent... ce31e726ad Fixes for defcustoms, prompted by cus-test-opts aacd1e14fc * lisp/net/newst-backend.el (newsticker--raw-url-list-defa... 7e2f4d3d41 * lisp/htmlfontify.el (hfy-which-etags): Fix it. 52d2a690f6 Add missing :version tags revealed by cusver-check f5d0360234 Escape column-zero doc parens
* src/nsfns.m (Fx_display_backing_store):
(Fx_display_save_under): Don't use NSBackingStoreRetained or
NSBackingStoreNonretained on macOS 10.13+.
* src/nsselect.m (symbol_to_nsstring):
(ns_string_to_symbol):
(nxatoms_of_nsselect): Replace NSGeneralPboard with
NSPasteboardNameGeneral.
* src/nsterm.h: #define NSPasteboardNameGeneral to NSGeneralPboard on
GNUstep and macOS < 10.13.
* src/nsterm.m (EmacsView::resetCursorRects):
(EmacsScroller::resetCursorRects): Don't use setOnMouseEntered on
macOS 10.13+.
Michael Albinus [Sat, 16 Dec 2017 15:40:03 +0000 (16:40 +0100)]
Improve fix for Bug#29712
* test/lisp/net/tramp-tests.el
(tramp-test32-environment-variables-and-port-numbers):
Adapt check for systems which do not support "echo -n". (Bug#29712)
Aaron Jensen [Sat, 16 Dec 2017 08:36:35 +0000 (09:36 +0100)]
Save and restore text-pixel height and width of frames (Bug#28442)
* lisp/frameset.el (frameset--record-relationships): Record
text-pixel-height and text-pixel-width of frame.
(frameset--restore-frame): Restore text-pixel-height and
text-pixel-width of frame if available. (Bug#28442)
Noam Postavsky [Sat, 16 Dec 2017 04:20:25 +0000 (23:20 -0500)]
Partially revert "Mention new strictness for &optional, &rest..."
The changes to cl argument parsing are not backwards compatible, and
cause inconvenience when writing macros (e.g., instead of doing '&aux
,@auxargs', some more complicated conditionals would be required).
The `cl-defstruct' macro makes use of this convenience when defining
empty structs (Bug#29728).
* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda):
(cl--do-&aux, cl--do-arglist): Undo strict checking of &rest, &key,
and &aux.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-bad-arglist): Remove
test.
Paul Eggert [Fri, 15 Dec 2017 17:07:52 +0000 (09:07 -0800)]
FOR_EACH_FRAME no longer assumes frame-list
This cleans up a recent fix related to Bug#29661.
Suggested by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2017-12/msg00544.html
* src/frame.c (next_frame, prev_frame, delete_frame):
Restore debugging checks that Vframe_list is non-nil,
as FOR_EACH_FRAME no longer has these checks.
(delete_frame): Remove no-longer-needed checks that Vframe_list is
non-nil, as FOR_EACH_FRAME no longer assumes that.
* src/frame.h (FOR_EACH_FRAME): Do not assume Vframe_list is non-nil.
Allen Li [Fri, 15 Dec 2017 09:30:25 +0000 (11:30 +0200)]
Add option to configure comint TERM
* lisp/comint.el (comint-terminfo-terminal): New defcustom.
(comint-term-environment): New function for setting terminal options
(comint-exec-1): Use comint-term-environment. (Bug#29583)
* lisp/progmodes/compile.el (compilation-start): Use comint-term-environment.
* etc/NEWS:
* doc/emacs/misc.texi (Shell Options): Document the new option.
Eli Zaretskii [Fri, 15 Dec 2017 09:06:07 +0000 (11:06 +0200)]
Better support utf-8-with-signature and utf-8-hfs in XML/HTML
* lisp/international/mule.el (sgml-xml-auto-coding-function):
Support UTF-8 with BOM and utf-8-hfs as variants of UTF-8, and
obey the buffer's encoding if it is one of these variants, instead
of re-encoding in UTF-8 proper. (Bug#20623)
Glenn Morris [Fri, 15 Dec 2017 01:22:08 +0000 (20:22 -0500)]
Improve Custom's treatment of obsolete options (bug#5742)
* lisp/cus-edit.el (custom-variable-obsolete): New face.
(custom-variable-documentation): Include obsolescence information.
(custom-variable-value-create): Use different face for obsolete items.
(custom-face-documentation): New function.
(custom-face): Use custom-face-documentation.
* lisp/info-look.el (info-lookup-guess-custom-symbol):
Add custom-variable-obsolete face.
Alan Mackenzie [Thu, 14 Dec 2017 21:04:39 +0000 (21:04 +0000)]
Fix fontification of first declaration within a C++ lambda form.
* lisp/progmodes/cc-engine.el (c-looking-at-or-maybe-in-bracelist): Cease
spuriously recognizing the braces of a lambda form as a brace list when there
is an "=" preceding the introductory brackets.
Alan Mackenzie [Thu, 14 Dec 2017 17:55:59 +0000 (17:55 +0000)]
Fix misfontification of C++ member initialization list after "throw"
* lisp/progmodes/cc-engine.el (c-forward-type): Stop recognizing a "type"
starting with "throw", by using c-opt-type-modifier-prefix-key.
* lisp/progmodes/cc-langs.el (c-type-modifier-prefix-kwds): New lang const
which, in C++, doesn't contain "throw", otherwise like c-type-modifier-kwds.
(c-opt-type-modifier-prefix-key): New lang const and var, a regexp matching
any keyword in the previous lang const.
Noam Postavsky [Mon, 13 Nov 2017 17:46:13 +0000 (12:46 -0500)]
Mention new strictness for &optional, &rest in arglists (Bug#29165)
* etc/NEWS: Explain that '&optional' not followed by a variable is now
an error.
* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda, cl--do-&aux)
(cl--do-arglist): Also reject '&optional', '&rest', or '&aux' not
followed by a variable for consistency.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-bad-arglist): New
test.
Alan Mackenzie [Wed, 13 Dec 2017 20:55:03 +0000 (20:55 +0000)]
Don't misfontify "foo ()" inside C++ initialization parentheses as a type
Also recognize and handle function names introduced by "extern" inside a
function.
* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Add a new element to
the result list which is t when our declaration is, or is to be treated as,
being at top level.
* lisp/progmodes/cc-fonts.el (c-get-fontification-context): Detect being
inside a C++ uniform initialization and return (not-decl nil) for this case.
(c-font-lock-declarations): Use the new element 4 of the result of
c-forward-decl-or-cast-1.
* lisp/progmodes/cc-langs.el (c-make-top-level-kwds, c-make-top-level-key):
New lang consts/vars.
Glenn Morris [Wed, 13 Dec 2017 03:43:33 +0000 (19:43 -0800)]
Merge from origin/emacs-26
b0369d0536 Import the latest IVD_Sequences.txt cd53b6399b Fix dired-do-compress when tar doesn't default to stdin (B... 51911dae14 Suppress warnings during elisp completion macroexpansion a36a090a95 * lisp/progmodes/verilog-mode.el (verilog-mode): Fix typo ... 6a6e8e6e8d Make tramp-interrupt-process more robust 5bcd468a9e Make quail-input-method work when inhibit-read-only is non... 87baf1242e Fix 'fontset-name-p' d23158777d Fix fontset documentation inconsistencies for bug#29630 a829cb8c8b Remove sentence from child frames section in Elisp manual ad491c80e4 Avoid crashes in 'font-at' after 'set-fontset-font' c73d2cdfd7 * lisp/files-x.el (connection-local-set-profile-variables)... cefca2b8ac Add /etc/ssl/cert.pem to gnutls-trustfiles for macOS 122e7264b8 Fix tool-tip display when display margins are non-zero by ... e1cc2037a9 Handle hash tables and vectors when reading/writing EIEIO ... cda219c3df Improve interactive debugging commands in xdisp.c 1056b3cbcd Fix calculation of continuation_pixel_width in display engine 90e20804f5 Improve documentation of 'save-abbrevs'. 14f0230a48 Improve documentation of Dired 161b0e5493 * lisp/bookmark.el (bookmark-alist): Doc fix. (Bug#29551)
Glenn Morris [Wed, 13 Dec 2017 02:58:38 +0000 (21:58 -0500)]
Fix gitmerge handling of automatic conflict reslution
* admin/gitmerge.el (gitmerge-resolve): Reenable NEWS handling.
(gitmerge-resolve-unmerged): Commit after successful resolution.
(gitmerge-commit): New function, extracted from gitmerge-maybe-resume.
(gitmerge-maybe-resume): Use gitmerge-commit.
Paul Eggert [Tue, 12 Dec 2017 23:15:56 +0000 (15:15 -0800)]
Fix recently-introduced cast typo
* src/alloc.c (SDATA_OF_STRING): Put cast in right spot.
This matters only if GC_CHECK_STRING_BYTES, which is sort
of a coals-to-Newcastle situation if pointer bounds checking
is also enabled.
Paul Eggert [Sat, 9 Dec 2017 21:57:38 +0000 (13:57 -0800)]
Narrow pointer bounds when appropriate
This typically occurs in a storage manager, where the caller
is expected to access only the newly-allocated object,
instead of using the returned value to access unrelated
parts of the heap.
* src/alloc.c (allocate_string, allocate_string_data)
(compact_small_strings, find_string_data_in_pure)
(sweep_strings, setup_on_free_list, allocate_vectorlike
(pure_alloc):
* src/bytecode.c (exec_byte_code):
* src/callint.c (Fcall_interactively):
* src/dispnew.c (scrolling):
* src/editfns.c (styled_format):
* src/frame.c (xrdb_get_resource, x_get_resource_string):
* src/fringe.c (Fdefine_fringe_bitmap):
* src/gmalloc.c (malloc, realloc, aligned_alloc):
Narrow pointer bounds when appropriate.
* src/alloc.c (SDATA_OF_STRING):
* src/lisp.h (make_lisp_symbol) [__CHKP__]:
Widen bounds here, though.
* src/bytecode.c, src/callint.c, src/dispnew.c, src/editfns.c:
* src/emacs.c, src/frame.c, src/fringe.c:
Include ptr-bounds.h.
* src/ptr-bounds.h (ptr_bounds_clip): New function.
Paul Eggert [Sat, 9 Dec 2017 21:57:38 +0000 (13:57 -0800)]
Port to gcc -fcheck-pointer-bounds
This is a minimal port, just to get Emacs running;
it does not attempt to make the pointer bounds at all tight.
* src/ptr-bounds.h: New file.
* src/alloc.c, src/gmalloc.c: Include it.
* src/alloc.c (live_string_holding, live_cons_holding)
(live_symbol_holding, live_misc_holding, garbage_collect_1)
(sweep_conses, sweep_floats):
* src/gmalloc.c (malloc_initialize_1, _free_internal_nolock)
(_realloc_internal_nolock):
Widen pointer bounds as necessary.
We're in a memory allocator so this is OK.
* src/lisp.h (lisp_h_XSYMBOL, make_lisp_symbol) [__CHKP__]:
Do not convert from pointer to integer and back again, so
that GCC does not lose track of pointer bounds.
(XSYMBOL) [__CHKP__ && !USE_LSB_TAG]: Now a compile-time error.
Although it's possible to support both -fcheck-pointer-bounds and
--with-wide-int, it's more work; keep things simple for now.
(DEFINE_LISP_SYMBOL) [__CHKP__]: Now a no-op, to avoid
trouble with unbounded pointers.
Paul Eggert [Tue, 12 Dec 2017 20:59:57 +0000 (12:59 -0800)]
Reimplement Lisp_Object as pointer-to-incomplete
This makes Lisp_Object values opaque pointers instead of integers,
which helps avoid the same sort of typos that
CHECK_LISP_OBJECT_TYPE helps to avoid, without having to wrap
pointers inside structures. This also looks forward to supporting
-fcheck-pointer-bounds.
* etc/DEBUG:
* src/.gdbinit (Lisp_Object_Printer.to_string):
Lisp_Object can be a pointer type now.
* src/alloc.c (macro_XPNTR, XPNTR):
* src/emacs-module.c (value_to_lisp_bits, lisp_to_value_bits):
* src/lisp.h (lisp_h_XLI, lisp_h_XIL):
(lisp_h_XUNTAG) [USE_LSB_TAG]:
(XUNTAG) [!USE_LSB_TAG]:
(Lisp_Object, TAG_PTR, make_lisp_symbol):
Support new Lisp_Object implementation as a pointer to an
incomplete type. Keep pointers pointers, as much as possible.
* src/alloc.c (macro_XPNTR_OR_SYMBOL_OFFSET, XPNTR_OR_SYMBOL_OFFSET):
Remove. All uses replaced by plain XPNTR.
* src/emacs-module.c: Work around GCC bug 83162.
* src/lisp.h (LISP_WORDS_ARE_POINTERS, lisp_h_XLP, lisp_h_XPL):
(XLP, XPL) [DEFINE_KEY_OPS_AS_MACROS]:
New macros.
(Lisp_Word, untagged_ptr, Lisp_Word_tag): New types.
(XLP, XPL): New inline functions.
(TAG_PTR): Now expands to an initializer, not an expression.
All uses changed.
(TAG_SYMOFFSET, XLI_BUILTIN_LISPSYM): Remove. All uses removed.
(LISPSYM_INITIALLY): Redo in terms of the new TAG_PTR.
(NIL_IS_ZERO): Redo without XLI_BUILTIN_LISPSYM.
* src/xwidget.c (webkit_javascript_finished_cb): Use XPL
instead of XIL with a non-EMACS_INT arg.
(Fxwidget_webkit_execute_script): Use XLP instead of XLI
followed by two conversions.
Ted Zlatanov [Tue, 12 Dec 2017 19:46:54 +0000 (14:46 -0500)]
Rename gnus-cloud method setter
* lisp/gnus/gnus-srvr.el (gnus-server-set-cloud-method-server)
(gnus-server-make-menu-bar, gnus-server-mode-map): Rename
`gnus-server-toggle-cloud-method-server' to
`gnus-server-set-cloud-method-server' (Bug#28845).
(gnus-server-toggle-cloud-server): Use "toggle" in docstring.
* lisp/net/tramp-cache.el (tramp-flush-file-properties)
(tramp-flush-directory-properties, tramp-flush-connection-properties):
Rename from `tramp-flush-file-property',`tramp-flush-directory-property'
and `tramp-flush-connection-property', respectively.
(tramp-flush-file-property, tramp-flush-connection-property):
New defuns.
Stefan Monnier [Tue, 12 Dec 2017 14:11:17 +0000 (09:11 -0500)]
* lisp/subr.el (run-mode-hooks): Set parse-sexp-lookup-properties
if syntax-propertize-function is set (bug#24749).
* lisp/progmodes/sh-script.el (sh-set-shell):
* lisp/textmodes/texinfo.el (texinfo-mode):
* lisp/textmodes/mhtml-mode.el (mhtml-mode):
* lisp/progmodes/js.el (js-mode): Don't set parse-sexp-lookup-properties.
Max [Tue, 31 Oct 2017 23:33:59 +0000 (02:33 +0300)]
Fix dired-do-compress when tar doesn't default to stdin (Bug#29094)
* lisp/dired-aux.el (dired-compress-file-suffixes): Use argument '-f-'
to write to stdout rather than relying on the default (the choice of
default is decided when compiling tar, BSD systems usually set it to a
tape drive). Drop '-v', since the output is not used anywhere.
Noam Postavsky [Tue, 5 Dec 2017 01:01:40 +0000 (20:01 -0500)]
Suppress warnings during elisp completion macroexpansion
Errors are already suppressed, therefore it is logical to suppress
warnings as well. Some macros (e.g., use-package) may produce
warnings when given the `elisp--witness--lisp' symbol.
* lisp/progmodes/elisp-mode.el (elisp--local-variables): Let-bind
warning-minimum-log-level to :emergency.