Eric Ludlam [Wed, 26 Nov 2014 16:45:15 +0000 (11:45 -0500)]
semantic: Add 'fromfile' option to grammar package
* lisp/cedet/semantic/grammar.el (semantic-grammar-package): Add
optional 'fromfile' option. This indicates we want to make a
filename from the originating file name.
Eric Ludlam [Wed, 26 Nov 2014 15:41:48 +0000 (10:41 -0500)]
semantic: Improve grammar-mode
* lisp/cedet/semantic/grammar.el (semantic-grammar-create-package):
Get the setupfcn and mode before switching to other buffers. Don't
special eval defvar, we generate defconst now. Be more aggressive
reparsing open buffers of the mode being updated.
(semantic-grammar-mode-map): Don't bind M-TAB.
(semantic-grammar-menu): Use `completion-at-point' instead of grammar
version.
(semantic-grammar-mode): Remove type relation character.
(semantic-grammar-complete): Delete.
(semantic-ctxt-current-class-list): Also support 'token' class.
(semantic-analyze-possible-completions): Support the optional FLAGS
that are passed in for other languages. Reverse the found prefix.
Eric Ludlam [Wed, 26 Nov 2014 15:38:37 +0000 (10:38 -0500)]
semantic: Allow empty type relation separation character
* lisp/cedet/semantic/ctxt.el (semantic-ctxt-current-symbol-default):
Allow the type relation separator to be empty for languages that
don't have symbol sequences, such as grammars and Lisp.
Eric Ludlam [Mon, 24 Nov 2014 17:36:29 +0000 (12:36 -0500)]
semantic: Properly create canonical name for C++ type tag
* lisp/cedet/semantic/bovine/c.el
(semantic-format-tag-canonical-name): Add part for a type with
:parent. Merge parent names together.
(semantic-c-dereference-typedef): If type is tag, use canonical name.
Eric Ludlam [Sun, 14 Feb 2016 15:26:36 +0000 (10:26 -0500)]
semantic: C grammar fixes
* admin/grammars/c.by (constexpr, noexcept): New.
(cvdeclmod, metadeclmod,post-fcn-modifiers): Add ocurences of
above.
(expr-start): Allow to be empty.
(expression): Delete - simplify to just find unaryexpression followed
by more.
(opt-more-expression): New - has specifics originally in expression.
(unaryexpression): Simplified a couple bits around lists and unary
expressions.
Eric Ludlam [Sun, 18 Oct 2015 14:17:24 +0000 (10:17 -0400)]
semantic: completion fixes
* lisp/cedet/semantic/complete.el (semantic-complete-read-tag-engine):
Don't allow buffer switching.
(semantic-collector-calculate-completions): Protect against
cases where the context being completed with isn't a smart completion case.
Eric Ludlam [Sun, 18 Oct 2015 14:10:32 +0000 (10:10 -0400)]
semantic: Optimize 'typeformbase' in C grammar
* admin/grammar/c.by (typeformbase): Replace two rules that could
match the same with one. Replace special
'namespace-symbol-for-typeformbase' with just 'namespace-symbol'.
(namespace-symbol): Force that a symbol @ end can
never have a template specifier.
(opt-namespace-symbol-more): This must now always be
'::namespace-symbol'.
(namespace-symbol-for-typeformbase): Deleted.
Eric Ludlam [Fri, 16 Oct 2015 20:05:17 +0000 (16:05 -0400)]
semantic: More C grammar optimizations
* admin/grammars/c.by (declmods): Optimize out 2nd match to DECLMOD.
(varnamelist, opt-varnamelist-more): Optimize out 2nd match for a variable
name into 'opt-varnamelist-more'.
(namespace-symbol, opt-namespace-symbol-more): Optimize out 2nd match
for the template specifier.
Eric Ludlam [Fri, 16 Oct 2015 19:02:55 +0000 (15:02 -0400)]
semantic: Some C grammar optimizations
* admin/grammars/c.y (typesimple): Optimize out one rule by making
optional subparts.
(typdef-symbol-list,typedef-symbol-list-opt-comma): Optimize symbol
list so only parses typedefname once.
(type,type-namespace): Optimize so we parse 'namespace' only once.
Martin Stein [Mon, 16 Feb 2015 14:01:12 +0000 (09:01 -0500)]
semantic: Fix wisent parser recursion
* lisp/cedet/semantic/wisent/wisent.el (wisent-parse): The semantic
action might be an EXPAND, EXPANDFULL or some similar action calling
the parser recursively. If the last token of the recursively called
parsing step failed to match it ends up in wisent-lookahead, and
function wisent-parse-stream pushs it back onto
wisent-lex-istream. From there on it simply ends up occuring twice on
the unmatched-syntax-cache, or worse might even lead to parse errors
in rare cases.
Eric Ludlam [Mon, 16 Feb 2015 13:38:42 +0000 (08:38 -0500)]
semantic: Deal with missing prefix when completing symbol
* lisp/cedet/semantic/ia.el (semantic-ia-complete-symbol): Protect
against a nil prefix.
(semantic-ia-complete-symbol-menu): If bounds are empty (no prefix),
don't delete region.
Philipp Stephani [Wed, 18 Jan 2017 18:49:58 +0000 (19:49 +0100)]
Check that variable lists are actually lists
'let' and 'let*' document that their first argument has to be a list,
but don't check for that; instead, they allow (and silently ignore)
other types. Introduce an explicit type check.
* src/eval.c (Flet, FletX): Check that the variable list is indeed a
list.
* test/src/eval-tests.el: Add unit tests.
Noam Postavsky [Fri, 13 Jan 2017 04:32:44 +0000 (23:32 -0500)]
Avoid inefficient regex in diff-refine-hunk (Bug#25410)
* lisp/vc/diff-mode.el (diff--forward-while-leading-char): New function.
(diff-refine-hunk): Use it instead of trying to match multiple lines
with a single lines.
Eli Zaretskii [Wed, 18 Jan 2017 16:06:42 +0000 (18:06 +0200)]
Fix a bug with signaling a thread that waits for condvar
* src/thread.c (lisp_mutex_lock_for_thread): New function,
with all the guts of lisp_mutex_lock.
(lisp_mutex_lock): Call lisp_mutex_lock_for_thread.
(condition_wait_callback): Don't call post_acquire_global_lock
before locking the mutex, as that could cause a signaled thread to
exit prematurely, because the condvar's mutex is recorded to be
not owned by any thread, and with-mutex wants to unlock it as part
of unwinding the stack in response to the signal.
Tom Tromey [Mon, 16 Jan 2017 21:02:45 +0000 (14:02 -0700)]
Fix JS regexp literal syntax propertization in expressions
Bug#25465:
* lisp/progmodes/js.el (js-syntax-propertize): Recognize a regexp
literal after "!", "&", and "|".
test/lisp/progmodes/js-tests.el (js-mode-regexp-syntax): New test.
Mark Oteiza [Tue, 17 Jan 2017 05:48:00 +0000 (00:48 -0500)]
Nix some uses of eval
* lisp/play/dunnet.el: Fix triple negative.
(dun-doverb): Use funcall instead of eval.
(dun-echo): Just call dun-mprinc.
(dun-save-val): Just bind value without eval.
Noam Postavsky [Sun, 8 Jan 2017 23:19:32 +0000 (18:19 -0500)]
Improve ffap-gopher-at-point handling of long lines
* lisp/ffap.el (ffap-gopher-regexp): Only match the KEY part. Note
setting to nil is now supported.
(ffap--gopher-var-on-line): New function.
(ffap-gopher-at-point): Use it instead of the old ffap-gopher-regexp
which could overflow the regexp stack on long lines (Bug#25391). Use
`let-alist' instead of calling `set' on local variables.
* test/lisp/ffap-tests.el (ffap-gopher-at-point): New test.
Alan Mackenzie [Sat, 14 Jan 2017 12:38:43 +0000 (12:38 +0000)]
Correct c-parse-state-get-strategy for moving HERE backward into a macro.
* list/progmodes/c-engine.el (c-parse-state-get-strategy): When HERE is below
its previous value, we chose strategy 'forward, and the new HERE is in a
(different) macro, ensure the returned START-POINT is not above the start of
the macro.
Eli Zaretskii [Sat, 14 Jan 2017 08:55:16 +0000 (10:55 +0200)]
Include "Date:" in mail messages filed by 'sendmail-send-it'
* lisp/mail/sendmail.el (mail-do-fcc): Insert a 'Date:' header
into the filed message. In the outgoing message, sendmail will
add the date, but the composed message body doesn't have it.
(Bug#25436)
Phillip Lord [Fri, 13 Jan 2017 13:57:51 +0000 (13:57 +0000)]
Record autoloads till emacs dump
* admin/ldefs-clean.el (ldefs-clean-up): Record autoloads till emacs dump
* lisp/ldefs-boot-auto.el (batch-byte-compile): Update
Previously, autoloads were collected till loaddefs.el was generated as
part of the build. However, bootstrap-emacs does not load
loaddefs (rather it is dumped), hence we must record autoloads until the
full emacs binary is dumped.
Tom Tromey [Tue, 10 Jan 2017 05:15:57 +0000 (22:15 -0700)]
Fix js-mode indentation bug
Bug#15582:
* lisp/progmodes/js.el (js--find-newline-backward): New function.
(js--continued-expression-p): Use it.
* test/manual/indent/js.js: Add new test.
Tom Tromey [Tue, 10 Jan 2017 03:42:43 +0000 (20:42 -0700)]
Fix two js-mode filling bugs
Bug#19399 and Bug#22431:
* lisp/progmodes/js.el (js-mode): Set comment-line-break-function and
c-block-comment-start-regexp.
* test/lisp/progmodes/js-tests.el: New file.
Eli Zaretskii [Fri, 13 Jan 2017 16:17:12 +0000 (18:17 +0200)]
Fix last change
* test/src/thread-tests.el (threads-condvar-wait): Revert
previous change. Make sure no other threads from previous
tests are running, to avoid interfering with our thread counts.
Eli Zaretskii [Fri, 13 Jan 2017 14:13:30 +0000 (16:13 +0200)]
Minor improvements in the new condvar test
* test/src/thread-tests.el (threads-test-condvar-wait): Use
with-mutex instead of emulating it inline.
(threads-condvar-wait): Improve comments. Check that the new
thread is alive before waiting for it to become blocked on the
conditional variable.
Eli Zaretskii [Fri, 13 Jan 2017 09:48:51 +0000 (11:48 +0200)]
Fix a bug in waiting for condition variable
* src/thread.c (lisp_mutex_lock, lisp_mutex_unlock)
(lisp_mutex_unlock_for_wait, condition_wait_callback)
(condition_notify_callback): Improve commentary.
(condition_wait_callback): Call post_acquire_global_lock before
attempting to lock the mutex, to make sure the lock's owner is
recorded correctly.
* test/src/thread-tests.el (threads-condvar-wait): New test.
Dmitry Lazurkin [Wed, 4 Jan 2017 18:46:21 +0000 (21:46 +0300)]
Fix extracting async def type and name in python mode imenu
* lisp/progmodes/python.el (python-imenu--get-defun-type-name):
New function.
(python-imenu--build-tree): Use python-imenu--get-defun-type-name for
extract async or simple def type and name at current
position (Bug#24820).
* test/lisp/progmodes/python-tests.el (python-imenu-create-index-1):
(python-imenu-create-flat-index-1): Add async def's.
Katsumi Yamaoka [Thu, 12 Jan 2017 23:32:41 +0000 (23:32 +0000)]
Remove garbage from Content-Transfer-Encoding value (bug#25420)
* lisp/mail/ietf-drums.el (ietf-drums-strip-cte): New function.
(ietf-drums-remove-garbage): New function.
(ietf-drums-remove-whitespace): Remove CR as well.
* lisp/mail/mail-parse.el (mail-header-strip-cte):
Alias to ietf-drums-strip-cte.
Paul Eggert [Thu, 12 Jan 2017 23:04:38 +0000 (15:04 -0800)]
Restore behavior of ‘./autogen.sh autoconf git’
* autogen.sh: Do both autoconf and git setup when invoked
as ‘./autogen.sh autoconf git’. Avoid unnecessary newline in chatter.
Mention new --no-check option in usage message. (Bug#25359)
Glenn Morris [Wed, 11 Jan 2017 19:35:51 +0000 (14:35 -0500)]
Convert some network test failures to skipping
These tests intermittently fail on hydra.nixos.org for unclear
reasons related to starting the external process.
This isn't an Emacs issue, and the failures cause noise on
the emacs-buildstatus list. (Bug#24503)
* test/lisp/net/network-stream-tests.el (echo-server-nowait)
(connect-to-tls-ipv4-nowait): Skip rather than fail if the
external process fails to start properly.
Alan Mackenzie [Wed, 11 Jan 2017 18:25:39 +0000 (18:25 +0000)]
Handle syntactic WS cache properties more accurately at buffer changes.
This fixes bug #25362.
* lisp/progmodes/cc-engine.el (c-sws-lit-type, c-sws-lit-limits)
(c-invalidate-sws-region-before, c-invalidate-sws-region-after-del)
(c-invalidate-sws-region-after-ins): New variables and functions.
(c-invalidate-sws-region-after): Change from a defsubst to a defun.
Also pass
it the standard OLD-LEN argument. Call both
c-invalidate-sws-region-after-{ins,del} to check for "dangerous" WS
cache
properties.
* lisp/progmodes/cc-langs.el (c-block-comment-ender-regexp): New language
variable.
* lisp/progmodes/cc-mode.el (c-before-change): Call
c-invalidate-sws-region-before.
(c-after-change): Pass old-len to c-invalidate-sws-region-after.
Eli Zaretskii [Tue, 10 Jan 2017 15:47:10 +0000 (17:47 +0200)]
Don't use unsafe encoding for the bookmark file
* lisp/bookmark.el (bookmark-write-file): Handle the case when the
explicitly specified encoding of the bookmark file cannot encode the
additional bookmarks just added. (Bug#25365)
Noam Postavsky [Sun, 1 Jan 2017 19:09:13 +0000 (14:09 -0500)]
Use expanded stack during regex matches
While the stack is increased in main(), to allow the regex stack
allocation to use alloca we also need to modify regex.c to actually take
advantage of the increased stack, and not limit stack allocations to
SAFE_ALLOCA bytes.
* src/regex.c (MATCH_MAY_ALLOCATE): Remove obsolete comment about
allocations in signal handlers which no longer happens and correct
description about when and why MATCH_MAY_ALLOCATE should be defined.
(emacs_re_safe_alloca): New variable.
(REGEX_USE_SAFE_ALLOCA): Use it as the limit of stack allocation instead
of MAX_ALLOCA.
(emacs_re_max_failures): Rename from `re_max_failures' to avoid
confusion with glibc's `re_max_failures'.
* src/emacs.c (main): Increase the amount of fixed 'extra' bytes we add
to the stack. Instead of changing emacs_re_max_failures based on the
new stack size, just change emacs_re_safe_alloca; emacs_re_max_failures
remains constant regardless, since if we run out stack space SAFE_ALLOCA
will fall back to heap allocation.
Noam Postavsky [Sat, 5 Nov 2016 20:51:53 +0000 (16:51 -0400)]
Fix computation of regex stack limit
The regex stack limit was being computed as the number of stack entries,
whereas it was being compared with the current size as measured in
bytes. This could cause indefinite looping when nearing the stack limit
if re_max_failures happened not to be a multiple of sizeof
fail_stack_elt_t (Bug #24751).
* src/regex.c (GROW_FAIL_STACK): Compute both current stack size and
limit as numbers of stack entries.