David Engster [Thu, 1 Dec 2011 19:13:55 +0000 (20:13 +0100)]
Fix unit testing for several tests and do better error checking.
* semantic/lex-spp-utests.el (semantic-lex-spp-write-utest):
* tests/cedet-utests.el (cedet-utest-eieio-classloader): Throw
error if we cannot locate test files.
* semantic/utest-c.el (semantic-utest-c-compare)
(semantic-utest-c-conditionals):
* semantic/lex-spp-utest.el (semantic-lex-spp-write-utest): Adapt
to new directory structure and do better error checking to avoid
silent failures in the future.
* src/gnutls.c (emacs_gnutls_handle_error): Demote the normal
peer-closed-connection "The TLS connection was non-properly
terminated" message to a lower level so that it isn't shown to
the user by default.
Avoid having eww unexpectedly open external browsers
* lisp/net/eww.el (eww-render): Instead of opening unsupported
content types like audio/mpeg directly in an external browser
(which can be very confusing especially when something
redirects to a file like that), just display a simple
interstitial that people can choose to click on or not
(bug#22671).
When opening new eww buffers, use buffer names based on the host name
* lisp/net/eww.el (eww-browse-url): When opening in a new
window, use a buffer name based on the host name (bug#23738).
(eww--dwim-expand-url): Refactored out into its own function
for easier reuse.
David Engster [Tue, 24 Jan 2017 21:47:53 +0000 (22:47 +0100)]
xml: Fix parsing of default namespace with quoted names
* lisp/xml.el (xml-parse-attlist): Properly extract namespace when
parsing is done with quoted symbol names (bug#23440).
* test/lisp/xml-tests.el (xml-parse-test--default-namespace-qnames)
(xml-parse-test-default-namespace-qnames): Test for the above.
Noam Postavsky [Sun, 18 Dec 2016 05:00:30 +0000 (00:00 -0500)]
Fix comment detection on open parens
Characters having both open paren syntax and comment start syntax were
being detected as open parens even when they should have been part a
comment starter (Bug#24870).
* src/syntax.c (in_2char_comment_start): New function, extracted from
`scan_sexps_forward'.
(scan_sexps_forward): Add check for a 2-char comment starter before the
loop. Inside the loop, do that check after incrementing the 'from'
character index. Move the single char comment syntax cases into the
switch instead of special casing them before.
* test/src/syntax-tests.el (parse-partial-sexp-paren-comments):
(parse-partial-sexp-continue-over-comment-marker): New tests.
Alan Mackenzie [Mon, 23 Jan 2017 19:00:49 +0000 (19:00 +0000)]
Give , and .@ doc strings. Fixes bug #24561.
Also make *Help* links to ``' possible. Also make usable as such doc strings
on the function-documentation property of a symbol.
* lisp/emacs-lisp/backquote.el (top-level): Give , and '@ doc strings on the
function-documentation property. Also give these symbols a reader-construct
property.
* lisp/help-fns.el (describe-function): Allow the function-documentation
property to work. Use princ rather than prin1 to print the function's name
when it has a reader-construct property.
(help-fns-signature): Don't insert `high-usage' for a reader-construct.
(describe-function-1): Adapt to process documentation on the
function-documentation property. Print "a reader construct" when appropriate.
* lisp/help-mode.el (help-xref-symbol-regexp): Amend this regexp also to match
``'.
Paul Eggert [Sun, 22 Jan 2017 08:18:40 +0000 (00:18 -0800)]
Improve uses of CHECK_LIST etc.
* src/eval.c (FletX): Report an error for invalid constructs like
‘(let* (a . 0))’, so that ‘let*’ is more consistent with ‘let’.
(lambda_arity): Use plain CHECK_CONS.
* src/fns.c (CHECK_LIST_END): Move from here to lisp.h.
(Fcopy_alist): Remove unnecessary CHECK_LIST call, since
concat does that for us.
(Fnthcdr, Fmember, Fmemql, Fdelete, Fnreverse):
Use CHECK_LIST_END, not CHECK_LIST_CONS. This hoists a
runtime check out of the loop.
(Fmemq): Simplify and use CHECK_LIST_END instead of CHECK_LIST.
(Fassq, Fassoc, Frassq, Frassoc):
Simplify and use CHECK_LIST_END instead of CAR.
(assq_no_quit, assoc_no_quit): Simplify and assume proper list.
(Fnconc): Use plain CHECK_CONS, and do-while instead of while loop.
* src/fontset.c (Fnew_fontset):
* src/frame.c (Fmodify_frame_parameters):
Use CHECK_LIST_END at end, rather than CHECK_LIST at start, for a
more-complete check.
* src/gfilenotify.c (Fgfile_add_watch):
Omit unnecessary CHECK_LIST, since Fmember does that for us.
* src/lisp.h (lisp_h_CHECK_LIST_CONS, CHECK_LIST_CONS):
Remove; no longer used.
(CHECK_LIST_END): New inline function.
Alan Mackenzie [Sat, 21 Jan 2017 15:14:15 +0000 (15:14 +0000)]
Fix low-level handling of (big) C macros.
In particular, ensure that a comment detected by its syntax is not a CPP
construct marked with generic comment delimiter syntax-table text
properties.
* lisp/progmodes/cc-engine.el (c-beginning-of-macro, c-end-of-macro): Set
c-macro-cache-syntactic to nil when the cached macro changes.
(c-syntactic-end-of-macro, c-no-comment-end-of-macro)
(c-state-semi-pp-to-literal, c-state-full-pp-to-literal)
(c-state-pp-to-literal, c-parse-ps-state-to-cache)
(c-state-cache-non-literal-place, c-literal-limits, c-literal-start)
(c-determine-limit): When checking a parse syntax for a comment, check that
we're not in a CPP construct marked by syntax-table generic comment delimiter
text property.
(c-state-pp-to-literal): Change from a defsubst to a defun.
* lisp/progmodes/cc-mode.el (c-neutralize-syntax-in-and-mark-CPP): Check a
parse syntax as described above under cc-engine.el.
Noam Postavsky [Sat, 14 Jan 2017 00:47:22 +0000 (19:47 -0500)]
Don't wait for frame to become visible
* src/xterm.c (x_make_frame_visible): Remove code that waits for the
frame to become visible. We have to deal with invisible frames anyway,
the loop could sometimes before the frame turned visible, and for some
window managers (e.g., XMonad, i3wm) it caused Emacs to get stuck in a
busy loop (Bug#24091).
Tino Calancha [Sat, 21 Jan 2017 02:54:55 +0000 (11:54 +0900)]
diff-hunk-kill independent of point inside headers
Make diff-apply-hunk and diff-hunk-kill independent of the point
position in a diff header (Bug#17544).
This change allows to apply hunks in order. It also makes possible to
press M-k repeatedly to kill hunks in the order they appear in the buffer.
See discussion on #Bug25105.
* lisp/vc/diff-mode.el (diff-file-junk-re):
Move definition before it's used.
(diff--at-diff-header-p): New predicate; return non-nil when point
is inside a hunk header, a file header, or within a line
matching diff-file-junk-re.
(diff-beginning-of-hunk): Use it.
Check if the point is inside a diff header, in the middle of a hunk,
or before the first hunk.
(diff-apply-hunk): Call diff-beginning-of-hunk with non-nil arg
before apply the hunk.
(diff-hunk-kill, diff-file-kill):
Call diff-beginning-of-hunk with non-nil arg after kill the hunks.
(diff-post-command-hook): Call diff-beginning-of-hunk with non-nil argument.
Noam Postavsky [Sat, 14 Jan 2017 06:47:52 +0000 (01:47 -0500)]
Fix free var FOO-mode-{syntax,abbrev}-table warnings
* lisp/emacs-lisp/derived.el (define-derived-mode): Unconditionally
defvar the syntax and abbrev tables so that the compiler will know that
they are dynamically bound variables (Bug#25446).
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.
* rst.el (rst-cvs-header, rst-svn-rev, rst-svn-timestamp)
(rst-official-version, rst-official-cvs-rev)
(rst-package-emacs-version-alist): Maintain version numbers.
(rst-forward-indented-block): Fix. Start searching at next
line again. Fixes fontification of comments continuing on the
same line they started.
Paul Eggert [Sun, 8 Jan 2017 02:15:17 +0000 (18:15 -0800)]
Remove @SET_MAKE@ from manually-maintained files
Emacs now assumes GNU Make, so @SET_MAKE@ is no longer needed.
* Makefile.in, lwlib/Makefile.in, nextstep/Makefile.in:
* src/Makefile.in: Remove @SET_MAKE@.
Michael Albinus [Sat, 7 Jan 2017 17:51:30 +0000 (18:51 +0100)]
Fix a problem with `start-file-process' in Tramp
* lisp/net/tramp-sh.el (tramp-maybe-open-connection):
`start-file-process' shall work when `non-essential' is
non-nil, but there is already an established connection.
<https://github.com/company-mode/company-mode/issues/462>
Rolf Ade [Tue, 3 Jan 2017 01:05:37 +0000 (20:05 -0500)]
Fix selecting SQLite database files with sql-mode (Bug#23566)
* lisp/progmodes/sql.el (sql-sqlite-login-params): Allow any name as
SQLite database file name, by default.
(sql-get-login-ext): Fixed read-file-name arguments to provide
path completion even if a database name pattern is customized and to
allow creation of new SQLite database files.
Eli Zaretskii [Sat, 7 Jan 2017 12:33:41 +0000 (14:33 +0200)]
Specify encoding of the bookmark file
* lisp/bookmark.el (bookmark-insert-file-format-version-stamp):
Accept an argument CODING and include a 'coding:' cookie in the
bookmark file preamble.
(bookmark-upgrade-file-format-from-0): Call
'bookmark-insert-file-format-version-stamp' with the file buffer's
encoding, as detected when it was read.
(bookmark-file-coding-system): New variable.
(bookmark-load): Set bookmark-file-coding-system to the encoding
of the loaded file.
(bookmark-write-file): Bind coding-system-for-write to either the
user setting via "C-x RET c" or to the existing file encoding,
defaulting to 'utf-8-emacs'. Update the value of
bookmark-file-coding-system. (Bug#25365)
Eli Zaretskii [Sat, 7 Jan 2017 11:02:50 +0000 (13:02 +0200)]
Avoid infloop in 'ispell-region'
* lisp/textmodes/ispell.el (ispell-begin-skip-region-regexp):
Protect against 'ispell-skip-region-alist' being nil. Reported by
Ernest Adrogué <nfdisco@gmail.com>, see
http://lists.gnu.org/archive/html/help-gnu-emacs/2017-01/msg00007.html.
* src/character.c (blankp): New function for checking Unicode
horizontal whitespace.
* src/regex.c (ISBLANK): Use 'blankp' for non-ASCII horizontal
whitespace.
(BIT_BLANK): New bit for range table.
(re_wctype_to_bit, execute_charset): Use it.
* test/lisp/subr-tests.el (subr-tests--string-match-p--blank): Add
unit test for [:blank:] character class.
* test/src/regex-tests.el (test): Adapt unit test.
* doc/lispref/searching.texi (Char Classes): Document new Unicode
behavior for [:blank:].