Ken Raeburn [Sun, 30 Oct 2016 13:05:46 +0000 (09:05 -0400)]
Replace read_objects assoc list with two hash tables.
For larger input files with lots of shared data structures, an
association list is too slow.
* src/lread.c (read_objects_map, read_objects_completed): New
variables, replacing read_objects.
(readevalloop): Initialize them with hash tables before starting a
top-level read, if they're not already empty hash tables, and reset
them to Qnil afterwards if something was added to the hash tables.
(read_internal_start): Likewise.
(read1): Store first the placeholder and later the newly read object
into read_objects_map under the specified object number. If the new
object can contain a reference to itself, store it in
read_objects_completed.
(substitute_objects_recurse): Check read_objects_completed instead of
read_objects for the known possibly-recursive objects.
(syms_of_lread): Update initializations.
Ken Raeburn [Thu, 27 Oct 2016 04:50:07 +0000 (00:50 -0400)]
Use getc_unlocked.
* configure.ac: Check for getc_unlocked.
* src/charset.c (read_hex, load_charset_map_from_file): Use
getc_unlocked instead of getc.
(getc_unlocked) [!HAVE_GETC_UNLOCKED]: Fall back to getc.
* src/lread.c (readbyte_from_file, Fget_file_char, read1,
getc_unlocked): Likewise.
Stefan Monnier [Thu, 27 Oct 2016 05:18:16 +0000 (01:18 -0400)]
Reduce lread substitutions.
* src/lread.c (read1): After reading an object using the "#n=" syntax,
if the read object is a cons cell, instead of recursively substituting
the placeholder with the new object, mutate the placeholder cons cell
itself to have the correct car and cdr values.
Paul Eggert [Thu, 22 Jun 2017 00:18:30 +0000 (17:18 -0700)]
Limit bidi_find_bracket_pairs to MAX_ALLOCA
* src/bidi.c (MAX_BPA_STACK): Now a constant, not a macro.
Shrink it to allow for the two struct bidi_it objects in
the same frame.
(PUSH_BPA_STACK): Avoid integer overflow with enormous bidi cache.
(bidi_find_bracket_pairs): Use compile-time check instead of runtime.
Paul Eggert [Wed, 21 Jun 2017 18:45:05 +0000 (11:45 -0700)]
Fix temacs hybrid_malloc core dump
Without this patch, ./temacs would dump core sometimes on Fedora
25 x86-64. The problem was that the hybrid allocator assumed that
all pointers into bss_sbrk_buffer are allocated via gmalloc. This
assumption is not true on Fedora, because the standard memory
allocator calls gdefault_morecore, which means its blocks are
interleaved with our blocks. Usually the code happened to work,
because our data structures agreed with the glibc data structures,
but this was merely luck due to a shared pedigree, and as glibc
mutates our luck has run out.
* src/gmalloc.c (ALLOCATED_BEFORE_DUMPING) [HYBRID_MALLOC]:
Remove; no longer needed.
(BLOCK): Use unsigned division, as that does the right thing near zero.
(register_heapinfo, __malloc_internal_nolock, __free_internal_nolock)
(_realloc_internal_nolock):
Big blocks now have type -1, not 0, as 0 now means the block is
not ours.
(morecore_nolock): Omit now-unnecessary casts to size_t.
(allocated_via_gmalloc) [HYBRID_MALLOC]: New function.
(hybrid_free, hybrid_realloc) [HYBRID_MALLOC]: Use it, to
avoid calling the wrong free or realloc function in some cases.
Katsumi Yamaoka [Wed, 21 Jun 2017 08:12:10 +0000 (08:12 +0000)]
Make gnus-article-date-user work
* lisp/gnus/gnus-art.el (article-date-ut):
Work for unfolded multi-line Date header.
(article-transform-date):
Refactor; add header name if it is missing in user-defined date line.
(article-date-user): Fix name of date type.
Noam Postavsky [Wed, 21 Jun 2017 02:19:51 +0000 (22:19 -0400)]
Keep order of completion candidates (Bug#25995, Bug#24676)
* lisp/minibuffer.el (completion-pcm--filename-try-filter)
(completion-pcm--all-completions): Use nreverse to undo the reversing
caused by using push in the loop.
Paul Eggert [Tue, 20 Jun 2017 15:48:14 +0000 (08:48 -0700)]
Fix crash when built by GNU Gold linker on x86
Problem reported by Andrés Musetti (Bug#27248).
* src/widget.c (emacsFrameClassRec): Do not initialize superclass here.
(emacsFrameClass): Now a function (which initializes the
superclass) instead of a variable. All uses changed.
Paul Eggert [Tue, 20 Jun 2017 15:18:08 +0000 (08:18 -0700)]
Simplify autogen.sh version checking
* autogen.sh (get_version): Simplify and make more reliable
by using expr rather than echo | sed. Check exit status of program.
Run program in subshell in case it cannot be executed.
(check_version): Check exit status of command rather than its output.
Check return status of get_version.
Katsumi Yamaoka [Tue, 20 Jun 2017 03:46:21 +0000 (03:46 +0000)]
Bind enable-local-variables to nil globally (fix dbe3e41)
* lisp/gnus/mm-view.el (mm-display-inline-fontify):
Bind enable-local-variables to nil globally instead of making it
buffer-local; remove let-bind of local-enable-local-variables.
cf. <b4mtw3bbfp5.fsf@jpl.org> in the emacs-devel list.
Glenn Morris [Tue, 20 Jun 2017 01:13:08 +0000 (21:13 -0400)]
autogen.sh: try to check for tool being present but broken
* autogen.sh (get_version): Check return status of "--version".
(check_version): Try to distinguish between a missing tool
and a broken one. (Bug#27288)
Paul Eggert [Sat, 17 Jun 2017 22:12:50 +0000 (15:12 -0700)]
Merge from gnulib
This (and my previous patch) incorporate:
2017-06-17 diffseq: port to GCC 7 with --enable-gcc-warnings
2017-06-15 gettext-h: Update comment
* lib/diffseq.h: Copy from gnulib.
Philipp Stephani [Sat, 17 Jun 2017 17:12:45 +0000 (19:12 +0200)]
emacs-module.h: Create emacs_env_26
This was part of the original design of the module
API (https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg00960.html),
but I didn't take it into account when adding the should_quit
function.
Instead of duplicating the environment fields or using the C
preprocessor, use configure to build emacs-module.h.
Add a new command 'replace-buffer-contents' that uses the Myers diff
algorithm to non-destructively replace the accessible portion of the
current buffer. The Myers algorithm is implemented in Gnulib.
* src/editfns.c (Freplace_buffer_contents): New command.
(set_bit, bit_is_set, buffer_chars_equal): New helper functions.
(syms_of_editfns): Define new command.
* test/src/editfns-tests.el (replace-buffer-contents-1)
(replace-buffer-contents-2): New unit tests.
* src/buffer.h (BUF_FETCH_CHAR_AS_MULTIBYTE): New helper macro.
* admin/merge-gnulib (GNULIB_MODULES): Add diffseq.h and minmax.h.
Simen Heggestøyl [Sat, 17 Jun 2017 07:28:43 +0000 (09:28 +0200)]
Complete CSS property values less eagerly (Bug#27392)
* lisp/textmodes/css-mode.el (css--complete-property-value): Be less
eager by looking for a colon after the property which values are being
completed for.
* test/lisp/textmodes/css-mode-tests.el (css-test-complete-property):
Add a test case ensuring that properties that are prefixes of other
properties don't hinder further completion.
Alan Mackenzie [Fri, 16 Jun 2017 11:26:59 +0000 (11:26 +0000)]
Ensure C++ initializer lists don't get fontified.
* lisp/progmodes/cc-cmds.el (c-block-comment-flag): Move declaration to solve
compiler warning.
* lisp/progmodes/cc-fonts.el (c-get-fontification-context): Add an extra
clause to handle C++ member initialization lists.
(c-font-lock-single-decl): New function, extracted from
c-font-lock-declarations.
(c-font-lock-declarations): Call c-font-lock-single-decl in place of inline
code.
(c-font-lock-cut-off-declarators): Make more rigorous by calling
c-get-fontification-context, c-forward-decl-or-cast-1, and
c-font-lock-single-decl in place of rather approximate code.
Alan Mackenzie [Thu, 15 Jun 2017 20:47:11 +0000 (20:47 +0000)]
Create a toggle between block and line comments in CC Mode.
Also (unrelated change) initialize the modes' keymaps at each loading.
* lisp/progmodes/cc-cmds.el (c-update-modeline): amend for the new information
on the modeline.
(c-block-comment-flag): New variable.
(c-toggle-comment-style): New function.
* lisp/progmodes/cc-langs.el (c-block-comment-starter)
(c-line-comment-starter): Make them c-lang-defvars.
(c-block-comment-is-default): New c-lang-defvar.
(comment-start, comment-end): Make the default values dependent on
c-block-comment-is-default.
* lisp/progmodes/cc-mode.el (c-mode-base-map): Define C-c C-k in this map.
(c-basic-common-init): Initialize c-block-comment-flag.
(c-mode-map, c++-mode-map, objc-mode-map, java-mode-map, idl-mode-map)
(pike-mode-map, awk-mode-map): Make entries in these key maps each time the
mode is loaded rather than just once per Emacs session.
* doc/misc/cc-mode.texi (Comment Commands): Introduce the notion of comment
style.
(Minor Modes): Define comment style. Describe how comment style influences
the information displayed on the modeline. Document c-toggle-comment-style.
(FAQ): Add a question about toggling the comment style.
Paul Eggert [Thu, 15 Jun 2017 20:29:04 +0000 (13:29 -0700)]
Pacify clang without munging C source
* configure.ac (WARN_CFLAGS): With Clang, use
-Wno-tautological-compare regardless of --enable-gcc-warnings.
(WERROR_CFLAGS): Simplify assignments, and guarantee it’s always set.
* lib/strftime.c: Copy from gnulib, reverting Clang-specific
change which I hope is no longer needed.
* src/emacs.c (main): Revert rlim_t change, as rlim_t is signed on
some older non-POSIX hosts.
Paul Eggert [Thu, 15 Jun 2017 19:34:00 +0000 (12:34 -0700)]
No need to complicate make-docfile.c for Clang
* lib-src/make-docfile.c (put_filename): Undo recent change.
The Clang false alarm occurs only with CFLAGS=-save-temps and
we needn’t worry about pacifying unusual compiler configurations.
Paul Eggert [Thu, 15 Jun 2017 17:33:10 +0000 (10:33 -0700)]
Don’t worry about __STDC_VERSION__ in emacs-module
* src/emacs-module.h: Remove __STDC_VERSION__ check. In the past
we’ve found that some compilers do not define this symbol even
when they work well enough. If necessary features like stdbool.h
are missing the compiler will complain eventually anyway.
Eli Zaretskii [Wed, 14 Jun 2017 16:09:21 +0000 (19:09 +0300)]
Avoid compiler warning in image.c on MS-Windows
* src/image.c (x_create_x_image_and_pixmap) [HAVE_NTGUI]: Avoid
compilation warning under -Warray-bounds by temporarily disabling
the -Warray-bounds option.
Michael Albinus [Wed, 14 Jun 2017 12:17:22 +0000 (14:17 +0200)]
Fix Bug#27315
* lisp/net/tramp-cache.el (tramp-cache-read-persistent-data):
New defvar.
(top): Use it.
* lisp/net/tramp.el (tramp-handle-file-name-case-insensitive-p):
Check for connected, not for connectable. (Bug#27315)
(tramp-process-actions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
Use `tramp-cache-read-persistent-data'.
* test/lisp/net/tramp-tests.el (top): Set also
`tramp-cache-read-persistent-data'.
Philipp Stephani [Wed, 14 Jun 2017 10:35:58 +0000 (12:35 +0200)]
Remove some tautological comparisons involving rlim_t
Clang on macOS warns about these with -Wtautological-compare. POSIX
guarantees that rlim_t is
unsigned (cf.
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/resource.h.html),
so these resource limits can never be negative.
Paul Eggert [Wed, 14 Jun 2017 01:19:30 +0000 (18:19 -0700)]
Port cleanup attribute to Oracle Studio 12.5
* INSTALL (--with-modules): List cleanup attribute as prereq.
* src/conf_post.h (__has_attribute_cleanup): Remove; no longer needed.
* src/emacs-module.c (MODULE_SETJMP_1): Don’t attempt to verify
(__has_attribute (cleanup)), as Oracle Studio 12.5 supports
__has_attribute only inside preprocessor expressions. The C
compiler should check the cleanup attribute in the next line anyway.
(module_reset_handlerlist): Remove an unnecessary ‘const’
that causes Oracle Studio 12.5 to refuse to compile.
Philipp Stephani [Tue, 13 Jun 2017 18:46:03 +0000 (20:46 +0200)]
Inline test module Makefile into main test Makefile
The test/data/emacs-module/Makefile only built a single target, and
inlining it into test/Makefile simplifies dependency tracking and
reduces code duplication.
Noam Postavsky [Sun, 11 Jun 2017 13:49:44 +0000 (09:49 -0400)]
Buttonize #<bytecode> part of printed functions (Bug#25226)
* lisp/emacs-lisp/cl-print.el: Autoload `disassemble-1'.
(cl-print-compiled-button): New variable.
(help-byte-code): New button type, calls `disassemble' in its action.
(cl-print-object): Use it if `cl-print-compiled-button' is
non-nil.
Alan Third [Mon, 12 Jun 2017 17:26:23 +0000 (18:26 +0100)]
Note how fullscreen differs on the NS port
doc/lispref/frames.texi (Size Parameters):
doc/emacs/frames.texi (Tool Bars): Add a description of how macOS
hides the tool-bar and menu-bar in fullscreen.
Alan Third [Sun, 11 Jun 2017 16:07:28 +0000 (17:07 +0100)]
Add no-focus-on-map to NS build (bug#25408)
* src/nsfns.m (ns_frame_parm_handlers): Add x_set_no_focus_on_map.
(x-create-frame): Check for no-focus-on-map.
* src/nsterm.h (x_set_no_focus_on_map): New function.
* src/nsterm.m (x_set_no_focus_on_map): New function.
(ns_raise_frame): Add parameter for specifying whether to focus the
frame.
(ns_frame_raise_lower):
(x_make_frame_visible): Handle new parameter for ns_raise_frame.
Paul Eggert [Mon, 12 Jun 2017 17:38:27 +0000 (10:38 -0700)]
_Noreturn not noreturn
_Noreturn is more portable to non-C11 platforms. See:
https://www.gnu.org/software/gnulib/manual/html_node/stdnoreturn_002eh.html
* src/emacs-module.c: Use _Noreturn, not noreturn. No need to
include <stdnoreturn.h>. Reindent to fit in 80 columns.