Paul Eggert [Tue, 23 Apr 2019 20:51:07 +0000 (13:51 -0700)]
Remove some unnecessary #ifdef directives
These directives are in files that are compiled only if the
symbols are defined.
* src/gfilenotify.c: Remove unnecessary ‘#ifdef HAVE_GFILENOTIFY’.
* src/inotify.c: Remove unnecessary ‘#ifdef HAVE_INOTIFY’.
* src/kqueue.c: Remove unnecessary ‘#ifdef HAVE_KQUEUE’.
Paul Eggert [Tue, 23 Apr 2019 20:29:42 +0000 (13:29 -0700)]
Remove font.c code commented out for a decade
* src/font.c (LSTRING_HEADER_SIZE, LSTRING_GLYPH_SIZE, check_gstring)
(check_otf_features, otf_list, otf_tag_symbol, otf_open)
(font_otf_capability, generate_otf_features)
(font_otf_DeviceTable, font_otf_ValueRecord)
(font_otf_Anchor, Ffont_drive_otf, Ffont_otf_alternates)
(Fdraw_string, syms_of_font): Remove "experimental and not
tested much" code that has been "#if 0"-ed out for more than a
decade and which was getting in the way of maintenance.
* lisp/autorevert.el
(auto-revert-notify-watch-descriptor-hash-list):
Rename to auto-revert--buffers-by-watch-descriptor. Improved doc string.
(auto-revert-notify-rm-watch, auto-revert-notify-add-watch,
auto-revert-notify-handler): Use new name.
Eli Zaretskii [Tue, 23 Apr 2019 10:20:46 +0000 (13:20 +0300)]
Speed up JSON parsing
Thanks to Dmitry Gutov <dgutov@yandex.ru> for running many
benchmarks and for useful discussions.
* src/json.c (json_make_string): Speed up parsing of JSON
strings by optimizing the normal case of a valid UTF-8 string
being returned from libjansson. (Bug#31138)
Philipp Stephani [Tue, 23 Apr 2019 09:59:29 +0000 (11:59 +0200)]
Small fix for a JSON unit test.
* test/src/json-tests.el (json-parse-string/null): Make JSON object
syntactically valid. This test is supposed to check whether an
escaped null character causes an error, but without quoting the string
it would be syntactically invalid in any case.
Alan Mackenzie [Tue, 23 Apr 2019 09:16:05 +0000 (09:16 +0000)]
Optimize for typing characters into long C++ raw strings.
* lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare)
(c-font-lock-objc-methods) (c-font-lock-declarations, c-font-lock-enum-tail)
(c-font-lock-cut-off-declarators, c-font-lock-enclosing-decls): If the chunk
been fontified consists entirely of comments and strings, don't attempt to
perform the function's action.
* lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): Don't
expand (c-new-BEG c-new-END) unnecessarily to the entire raw string being
fontified.
(c-fl-decl-start, c-fl-decl-end): When in a (raw or otherwise) string, don't
return a position outside of the string (which used to cause unneeded
fontification).
Release xft_data in widget destroy callback to avoid visual distraction
* lwlib/lwlib-int.h (struct _widget_instance) [HAVE_XFT]: Remove nr_xft_data.
* lwlib/lwlib-Xaw.c (find_xft_data, xaw_update_one_widget) [HAVE_XFT]: Loop
while widget member is not NULL instead of using nr_xft_data.
(xaw_destroy_instance) [HAVE_XFT]: Move xft_data release code from here ...
(destroy_xft_data) [HAVE_XFT]: ... to here.
(make_dialog) [HAVE_XFT]: Add destroy_xft_data as destroy callback for dialog.
Paul Eggert [Tue, 23 Apr 2019 03:44:11 +0000 (20:44 -0700)]
Let plain ‘make’ work even not GNU Make
* Makefile.in (top_distclean): Clean makefile as well as Makefile.
* configure.ac: If not using plain ‘make’, create a makefile
so that plain ‘make’ simply calls $(MAKE).
Paul Eggert [Tue, 23 Apr 2019 03:02:20 +0000 (20:02 -0700)]
Revert Vinternal_interpreter_environment tweak
Stefan Monnier pointed out examples like (funcall `(closure
,(let ((cycle (list nil))) (setcdr cycle cycle)) () a)),
where the user can set Vinternal_interpreter_environment
indirectly.
* src/eval.c (Fsetq): Revert recent change, going back to Fassq.
Paul Eggert [Mon, 22 Apr 2019 18:40:13 +0000 (11:40 -0700)]
Go back to old way of checking json int range
Although the lisp.h macros really need improvement,
INTEGER_TO_INT is not the right way to go about it, as it
causes conversion from intmax_t to uintmax_t and back again,
which can cause a signal if the value is negative.
* src/lisp.h (INTEGER_TO_INT, ranged_integer_to_int)
(ranged_integer_to_uint): Remove, reverting recent changes to
this file.
* src/json.c (lisp_to_json): Revert to previous code,
as the change messes up with uintmax_t<->intmax_t conversion.
* lisp/autorevert.el (auto-revert-notify-handler):
When getting a `stopped' event, deal with it for the buffers it applies to,
rather than for all buffers in auto-revert mode.
Allow file-notify callbacks to call `file-notify-rm-watch', harmlessly,
after receiving a `stopped' event without triggering recursion.
* lisp/filenotify.el (file-notify--watch): Note that `callback' can be nil.
(file-notify--rm-descriptor): Set the `callback' field to nil before
sending `stopped'.
(file-notify-rm-watch): Don't do anything if the `callback' field is nil.
Philipp Stephani [Sun, 21 Apr 2019 16:09:38 +0000 (18:09 +0200)]
Improve documentation around standard error pipes (Bug#35328).
* doc/lispref/processes.texi (Asynchronous Processes): Document
existence and properties of the standard error process.
(Accepting Output): Document that one has to accept output from the
standard error process separately.
Philipp Stephani [Mon, 22 Apr 2019 13:43:52 +0000 (15:43 +0200)]
Module API: Don’t require null-terminated strings in make_string.
* emacs-module.c (module_make_string): Use make_unibyte_string, which
doesn’t require its argument to be null-terminated. Since it always
returns a heap-allocated string, we don’t have to copy it any more
while decoding.
(module_decode): New helper function.
For discussion, see thread starting at:
https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00316.html
* doc/lispref/customize.texi (Composite Types): Do not overspecify
:match-alternatives predicates.
* doc/lispref/eval.texi (Intro Eval): Anchor definition of "side
effect" for cross-referencing...
* doc/lispref/functions.texi (What Is a Function): ...from here.
Define what a pure function is.
* doc/lispref/internals.texi (Writing Emacs Primitives): Describe
currently preferred approach to marking primitives as pure and
side-effect-free.
* doc/lispref/symbols.texi (Standard Properties): Expand description
of pure and side-effect-free properties.
Michael Albinus [Mon, 22 Apr 2019 07:58:37 +0000 (09:58 +0200)]
Some changes in tramp-tests
* test/lisp/net/tramp-tests.el (tramp-test32-shell-command):
Check for backward compatibility.
(tramp-test33-environment-variables): Apply a better check for
unset variable.
Paul Eggert [Mon, 22 Apr 2019 04:47:10 +0000 (21:47 -0700)]
Remove --enable-checking=xmallocoverrun
It doesn’t work anymore, and these days ‘gcc -fsanitize=address’
does a better job anyway.
* configure.ac: Remove the option.
* configure.ac (ac_xmalloc_overrun, XMALLOC_OVERRUN_CHECK):
* src/alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD)
(XMALLOC_OVERRUN_CHECK_SIZE, XMALLOC_OVERRUN_SIZE_SIZE)
(xmalloc_overrun_check_header, xmalloc_overrun_check_trailer)
(xmalloc_put_size, xmalloc_get_size, overrun_check_malloc)
(overrun_check_realloc, overrun_check_free):
Remove. All uses removed.
* etc/NEWS: Mention this.
Paul Eggert [Mon, 22 Apr 2019 04:45:04 +0000 (21:45 -0700)]
Simplify XPNTR
Because XPNTR now uses ATTRIBUTE_NO_SANITIZE_UNDEFINED,
it can be simplified.
* src/alloc.c (macro_PNTR_ADD, PNTR_ADD, macro_XPNTR): Remove.
(XPNTR): Open-code rather than using the removed macros and
functions. Also, simplify by using LISP_WORD_TAG.
Paul Eggert [Mon, 22 Apr 2019 04:16:03 +0000 (21:16 -0700)]
Fix drain_reloc_list alignment bug
* src/pdumper.c (dump_charset): Use alignof (struct charset),
not alignof (int), since struct charset might be more strictly
aligned than int. I think this is just a minor performance
issue, but we might as well use the correct alignment.
(drain_reloc_list): Use an alignment instead of a size for the
output alignment. This prevents undefined behavior when
alignof (struct emacs_reloc) == 8 and sizeof (dump_off) == 4
when building on x86-64 with gcc -fsanitize=undefined.
Paul Eggert [Mon, 22 Apr 2019 03:36:56 +0000 (20:36 -0700)]
Port dump_bitset_clear to -fsanitize=undefined
* src/pdumper.c (dump_bitset_clear):
Pacify -fsanitize=undefined by avoiding memset (NULL, x, 0),
which strictly speaking has undefined behavior although it
works on all production platforms I know.
Paul Eggert [Mon, 22 Apr 2019 03:34:03 +0000 (20:34 -0700)]
Port to recent gcc -fsanitize=undefined
* src/alloc.c (XPNTR): Add ATTRIBUTE_NO_SANITIZE_UNDEFINED and
remove ATTRIBUTE_UNUSED. Do not define as a macro, so that
ATTRIBUTE_NO_SANITIZE_UNDEFINED works.
* src/lisp.h (lisp_h_XSYMBOL): Remove. All uses removed.
With recent GCC the macro does not work with -fsanitize=undefined,
and the macro can be omitted as its only function is to optimize -O0.
Paul Eggert [Sun, 21 Apr 2019 16:59:13 +0000 (09:59 -0700)]
Fix double-free in pdumper
Revert the double-free bug that I introduced in
2019-03-11T15:20:54Z!eggert@cs.ucla.edu.
* src/pdumper.c (dump_mmap_reset): Do not free the private member;
that’s the release function’s job.
(dump_mm_heap_cb_release): Free cb if its refcount goes to zero.
(dump_mmap_contiguous_heap): Mention memory leak in comment.
9d7e08d (origin/emacs-26) Avoid false positives and false negatives o... 75b589c Fix markup related to quoting in Info fd6ff29 Merge branch 'emacs-26' of git.savannah.gnu.org:/srv/git/emac... cd2204f Add a package: line to c-submit-bug-report. a992dca ; Remove empty NEWS sections ea67270 ; Add NEWS sections for 26.3 45b0946 ; Bump Emacs version to 26.2.50 aae8cc3 * admin/admin.el (set-version): Add NEWS headers for a .50 ve...
Avoid false positives and false negatives of Info-quoted face
* lisp/info.el (Info-mode-font-lock-keywords): Modify the regexp, for
matching single quotes of opening single quote and closing single
quote, and avoid matching text followed by a curly quote when it is
not quoting. (Bug#35202)
Noam Postavsky [Mon, 5 Feb 2018 01:43:26 +0000 (20:43 -0500)]
Use pkg-config to find lcms2 CFLAGS and LIBS (Bug#30346)
* configure.ac: Use EMACS_CHECK_MODULES fors LCMS2 rather than
AC_SEARCH_LIBS.
* src/Makefile.in: Get LCMS2_LIBS and LCMS2_CFLAGS from configure,
instead of just LIBLCMS2.
* lisp/vc/log-edit.el (log-edit--toggle-amend): Extract from
vc-git-log-edit-toggle-amend (bug#34944).
* lisp/vc/vc-hg.el (vc-hg-log-edit-toggle-amend): New function.
Use the aforementioned.
(vc-hg-log-edit-mode-map): New variable.
(vc-hg-log-edit-mode): New major mode.
Paul Eggert [Sat, 20 Apr 2019 16:31:47 +0000 (09:31 -0700)]
Improve XDG_RUNTIME_DIR diagnostic
* lib-src/emacsclient.c (set_local_socket):
If there appears to be an XDG runtime directory for the user
but XDG_RUNTIME_DIR is unset, suggest setting it while warning
about potential security issues (Bug#35300).
Alan Mackenzie [Sat, 20 Apr 2019 11:30:55 +0000 (11:30 +0000)]
Fix Pike Mode's autodoc doc comments style's continued lines.
* lisp/progmodes/cc-engine.el (c-forward-sws, c-backward-sws): Recognize
matches of c-doc-line-join-re as syntactic whitespace.
(c-find-decl-prefix-search): Recognize and move over matches of
c-doc-line-join-re as whitespace.
(c-find-decl-spots): Before moving backward a char, check (bobp). Before
moving forward over a comment, check it isn't possibly a "bright" comment.
* lisp/progmodes/cc-fonts.el (c-get-doc-comment-style): New function,
extracted from c-compose-keywords-list.
(c-compose-keywords-list): Call the above new function.
(pike-font-lock-keywords, pike-font-lock-keywords-2)
(pike-font-lock-keywords-3): Call c-set-doc-comment-res.
(c-doc-line-join-re, c-doc-bright-comment-start-re, c-doc-line-join-end-ch):
New variables.
(c-set-doc-comment-re-element, c-set-doc-comment-char-list): New macros.
(c-set-doc-comment-res): New function.
(c-font-lock-doc-comments): For consistency and repeatability, in a sequence
of C++ style doc comments, don't fontify the region between BOL and the
comment marker.
(autodoc-line-join-re, autodoc-bright-comment-start-re)
(autodoc-line-join-end-ch): New variables.
* lisp/progmodes/cc-mode.el (c-doc-fl-decl-start, c-doc-fl-decl-end): New
functions.
(c-change-expand-fl-region, c-context-expand-fl-region): Call the above two
new functions for extra possibilities for the start and end of a construct.
* doc/misc/cc-mode.texi (Doc Comments): Add a sentence drawing attention to
the possibility of fontifying constructs within a doc comment.
Eli Zaretskii [Sat, 20 Apr 2019 07:21:02 +0000 (10:21 +0300)]
Backport doc improvement in ELisp manual
* doc/lispref/processes.texi (Accepting Output): Backport:
document how do avoid race conditions while waiting for all of
the process's output to arrive.
Philipp Stephani [Fri, 19 Apr 2019 21:07:58 +0000 (23:07 +0200)]
Remove some #ifdefs for user pointers.
Even if Emacs is compiled without module support, we don't have to
comment out every bit of user pointer support. Defining the basic
structures and functions and detecting user pointers in switch
statements is harmless, and we're already doing the same for module
functions. Removing these #ifdefs makes the code a bit easier to
read.
* src/alloc.c (mark_maybe_pointer): Remove special-casing of tagged
pointers. After commit 09d746dad36e4780d379f975a84b1b076da78c50,
modules no longer rely on tagged pointers.
Paul Eggert [Fri, 19 Apr 2019 19:52:57 +0000 (12:52 -0700)]
Fix comment and tweak eval_sub
* src/eval.c (eval_sub): Check whether Fassq returns Qnil,
not whether it returns a cons, as NILP is faster than CONSP
nowadays. Remove incorrect comment “only original_fun and
original_args have values that will be used below”; instead,
move declarations around so that the set of variables with
useful values is obvious.
Braun Gábor [Fri, 22 Mar 2019 15:11:44 +0000 (16:11 +0100)]
Autoload cua-toggle-rectangle-mark (Bug#34947)
* lisp/emulation/cua-base.el (cua-toggle-rectangle-mark): Autoload it.
Library cua-base.el binds cua-toggle-rectangle-mark to a key in the
:set function in (defcustom cua-rectangle-mark-key ...), so it should
ensure that the command is defined.
Tell xclip not to expect job-control under eshell (Bug#35257)
* lisp/eshell/esh-proc.el (eshell-needs-pipe): Add "xclip" and other
programs that xclip.el (in GNU ELPA) calls with
`process-connection-type' bound to nil.
Eric Abrahamsen [Fri, 19 Apr 2019 17:23:19 +0000 (10:23 -0700)]
Clear gnus-group-list when the newsrc-hashtb is recreated
* lisp/gnus/gnus-start.el (gnus-make-hashtable-from-newsrc-alist):
This routine also happens when re-sorting groups; make sure we're
clearing the group list.
Philipp Stephani [Fri, 19 Apr 2019 16:38:19 +0000 (18:38 +0200)]
Refactoring: simplify definition of some internal variables.
In some cases, we never specbind internal objects, so they don't have
to be symbols. Rather than using DEFSYM/DEFVAR and then uninterning
the symbols, use plain static variables. Call staticpro for all of
them, to protect them from the garbage collector.
* src/eval.c (syms_of_eval): Use a static variable for
Qcatch_all_memory_full.
* src/emacs-module.c (syms_of_module): Use static variables for
Vmodule_refs_hash, Vmodule_runtimes, and Vmodule_environments.