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:].
Noam Postavsky [Sat, 31 Dec 2016 05:31:49 +0000 (00:31 -0500)]
Fix isearch handling of C-u C-u...
* lisp/isearch.el: Add `isearch-scroll' property to
universal-argument-more so that `isearch-allow-scroll' will apply to it
as well.
(isearch-pre-command-hook): Let `isearch-allow-prefix' apply to
`universal-argument-more' as well (Bug#25302).
Johan Claesson [Wed, 28 Dec 2016 17:56:11 +0000 (12:56 -0500)]
Fix term.el handling of ^Z-sequences spanning chunks
Bash will after each command send ?\032 and the current directory "/tmp"
to inform term.el. Bash output is buffered in 4096 bytes chunks. If a
command outputs roughly 4096 bytes then the end of the first chunk will
be "/tm" (Bug#13350).
* lisp/term.el (term-emulate-terminal): Change the regexp to find the
end of the ?\032 sequence to use \n instead of $, the latter can match
end of string as well.
Paul Eggert [Wed, 4 Jan 2017 08:44:45 +0000 (00:44 -0800)]
Port recent autogen.sh changes to Darwin
Problem reported by Sam Steingold (Bug#25347).
* autogen.sh: Don't assume 'sed -f-' reads a script from stdin, as
POSIX does not require it and it does not work on Darwin.
Stefan Monnier [Wed, 4 Jan 2017 05:40:45 +0000 (00:40 -0500)]
Avoid add-to-list on local variables
* lisp/gnus/nnir.el: Use lexical-binding and cl-lib.
(nnir-retrieve-headers): Use pcase.
(nnir-search-thread): Avoid add-to-list on local variables.
* lisp/gnus/smime.el: Use lexical-binding and cl-lib.
(smime-verify-region): Avoid add-to-list on local variables.
* lisp/mail/undigest.el: Use lexical-binding and cl-lib.
(rmail-digest-parse-mime, rmail-digest-rfc1153)
(rmail-digest-parse-rfc934): Avoid add-to-list on local variable.
* lisp/net/ldap.el (ldap-search): Move init into declaration.
* lisp/net/newst-backend.el (newsticker--cache-add):
Avoid add-to-list on local variables; Simplify code with `assq'.
* lisp/net/zeroconf.el: Use lexical-binding and cl-lib.
(dbus-debug): Remove declaration, unused.
(zeroconf-service-add-hook, zeroconf-service-remove-hook)
(zeroconf-service-browser-handler, zeroconf-publish-service):
Avoid add-to-list and *-hook on local variables.
* lisp/org/org-archive.el (org-all-archive-files):
* lisp/org/org-agenda.el (org-agenda-get-restriction-and-command):
Avoid add-to-list on local variables.
* lisp/org/ox-publish.el (org-publish--run-functions): New function.
(org-publish-projects): Use it to avoid run-hooks on a local variable.
(org-publish-cache-file-needs-publishing): Avoid add-to-list on
local variables.
* lisp/progmodes/ada-prj.el: Use setq instead of (set '...).
(ada-prj-load-from-file): Avoid add-to-list on local variables.
* lisp/progmodes/ada-xref.el (ada-initialize-runtime-library): Simplify.
(ada-gnat-parse-gpr, ada-parse-prj-file-1)
(ada-xref-find-in-modified-ali): Avoid add-to-list on local variables.
* lisp/progmodes/idlw-shell.el (idlwave-shell-update-bp-overlays):
Avoid add-to-list on local variables.
Stefan Merten [Tue, 3 Jan 2017 22:15:13 +0000 (23:15 +0100)]
Lots of refactorings and a few minor improvements.
User visible improvements and changes:
* Improve and debug `rst-forward-section` and `rst-backward-section`.
* Auto-enumeration may be used with all styles for list insertion.
* Improve and debug `rst-toc-insert`.
* Adapt change in Emacs to use customization group `text` instead of `wp`.
* Bind `n` and `p` in `rst-toc-mode`.
* `z` in `toc-mode` returns to the previous window configuration.
* Require Emacs version >= 24.1.
Lots of refactorings including:
* Silence byte compiler.
* Use lexical binding.
* Use `cl-lib`.
* Add tests and raise test coverage.
Stefan Monnier [Tue, 3 Jan 2017 21:07:44 +0000 (16:07 -0500)]
(cl-defstruct): Improve error message for slots w/o value (bug#25312)
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Don't signal an error but
emit a warning for those coders who forgot to put a default value in
their slot.
Eli Zaretskii [Tue, 3 Jan 2017 15:46:40 +0000 (17:46 +0200)]
Generate nt/gnulib.mk from lib/gnulib.mk
This was proposed by Paul Eggert <eggert@cs.ucla.edu>,
with the purpose of avoiding manual maintenance of
nt/gnulib.mk.
* nt/gnulib-modules-to-delete.cfg: New file.
* nt/Makefile.in (AM_V_GEN, am__v_GEN_, am__v_GEN_0)
(am__v_GEN_1): New variables.
(${srcdir}/gnulib.mk): Rules to generate gnulib.mk from
lib/gnulib.mk and list of modules in gnulib-modules-to-delete.cfg.
* make-dist (nt): Add gnulib-modules-to-delete.cfg to the list of
files to link.
* configure.ac (GNULIB_MK): Compute the value according to $opsys.
* autogen.sh: Create nt/gnulib.mk if it doesn't exist, before
running autoreconf.
* Makefile.in (gnulib_mk): New variable.
($(srcdir)/nt/gnulib.mk): Rule to produce it.
(AUTOMAKE_INPUTS): Use $(gnulib_mk) instead of a literal file
name.
* .gitignore: Add nt/gnulib.mk.
* src/w32.c (acl_errno_valid): Implement it here, as we no longer
build the acl-permissions module from Gnulib.
Noam Postavsky [Thu, 29 Dec 2016 01:13:20 +0000 (20:13 -0500)]
Handle multibyte chars spanning chunks in term.el
* lisp/term.el (term-terminal-undecoded-bytes): New variable.
(term-mode): Make it buffer local. Don't make `term-terminal-parameter'
buffer-local twice.
(term-emulate-terminal): Check for bytes of incompletely decoded
characters, and save them until the next call when they can be fully
decoded (Bug#25288).
Michael Albinus [Tue, 3 Jan 2017 08:50:41 +0000 (09:50 +0100)]
Finish work on filenotify-tests.el
* test/lisp/filenotify-tests.el (file-notify--test-monitors):
New variable.
(file-notify--test-cleanup, file-notify--test-monitor): Use it.
(file-notify--test-read-event, file-notify-test02-events)
(file-notify-test04-file-validity): Handle "gvfs-monitor-dir.exe".
(file-notify-test03-autorevert)
(file-notify-test08-watched-file-in-watched-dir):
Set `file-notify--test-desc' for proper work of
`file-notify--test-monitor'. (Bug#21804)
Sašo Živanović [Fri, 30 Dec 2016 10:12:42 +0000 (11:12 +0100)]
Fix RefTeX to show table of contents for dtx files (tiny change)
* lisp/textmodes/reftex.el (reftex-compile-variables): Change the
section regexp so that it accepts lines starting with the comment
character. (tiny change)
* lisp/textmodes/reftex-parse.el (reftex-parse-from-file): Filter
gathered toc entries, accepting a commented entry if and only if the
source file is a ".dtx" file. (tiny change)
Noam Postavsky [Sat, 17 Dec 2016 23:01:52 +0000 (18:01 -0500)]
Warn about incomplete untarring of link files
The current tar-mode doesn't really support unpacking symlinks, it
simply creates an empty file of the same name.
* lisp/tar-mode.el (tar--describe-as-link): New function extracted from
`tar--check-descriptor'.
(tar-untar-buffer): Use it to warn about imperfectly untarred link
files.
Noam Postavsky [Tue, 20 Dec 2016 01:16:50 +0000 (20:16 -0500)]
Remove sh-mode's skeleton-end-hook
* lisp/progmodes/sh-script.el (sh-mode): Remove local setting of
`skeleton-end-hook', `skeleton-insert' already does `newline-and-indent'
and also respects `skeleton-end-newline' (Bug#16634).
Mark Oteiza [Sun, 1 Jan 2017 16:50:59 +0000 (11:50 -0500)]
Add term/tmux.el
Since tmux version 2.1, new tmux terminfos are shipped due to oddities
with xterm and screen terminfos. This is simply a duplication of
term/screen.el with screen -> tmux.
* lisp/term/tmux.el: New file.
Paul Eggert [Sun, 1 Jan 2017 10:33:29 +0000 (02:33 -0800)]
Do not use Gnulib’s m4/wint_t.m4.
* admin/merge-gnulib: Remove m4/wint_t.m4 when merging.
Fix typo so that warn-on-use.m4 is removed too.
* configure.ac (gt_TYPE_WINT_T): New macro, replacing Gnulib’s.
* m4/wint_t.m4: Remove.
Paul Eggert [Sun, 1 Jan 2017 09:32:27 +0000 (01:32 -0800)]
Merge from gnulib
This incorporates:
2016-12-19 stdint: Fix WINT_MAX to match wint_t on mingw
2016-12-18 getopt: Fix link error for users of getopt() in <unistd.h>
2016-12-17 getlogin: Port to newer mingw
2016-12-17 stdint: Fix WINT_MAX to match wint_t on MSVC
2016-12-17 Avoid redefinition errors on MSVC
* lib/getopt.in.h, lib/stdint.in.h, lib/stdio.in.h, lib/unistd.in.h:
* m4/stdint.m4, m4/unistd_h.m4:
Copy from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
Plus, this commit updates the indenting on copyright notices to
match that of gnulib.