João Távora [Thu, 9 Aug 2018 12:04:03 +0000 (13:04 +0100)]
Trim JSONRPC events buffer when it's too large
* lisp/jsonrpc.el (Version): Bump to 1.0.2
(jsonrpc--events-buffer-scrollback-size): New
jsonrpc-connection slot.
(jsonrpc--log-event): Use it to trim buffer.
Paul Eggert [Thu, 9 Aug 2018 01:51:35 +0000 (18:51 -0700)]
Minor pseudovector allocation cleanups
* src/alloc.c (VECTOR_BLOCK_SIZE, VECTOR_BLOCK_BYTES)
(VBLOCK_BYTES_MIN, VBLOCK_BYTES_MAX, VECTOR_MAX_FREE_LIST_INDEX):
Prefer enums to macros where either will do.
(allocate_vector_from_block): Arg is ptrdiff_t, not size_t.
Use eassume instead of eassert.
(PSEUDOVEC_STRUCT): New macro, which verifies the already-existing
assumption that the vector-like objects are small.
(cleanup_vector): Use it. Use if-then-else systematically;
this lets GCC do a bit better job.
2018-08-08 Paul Eggert <eggert@cs.ucla.edu>
* src/alloc.c (VBLOCK_BYTES_MAX): Use vroundup_ct, not
vroundup, so that can be used in static assertions.
Michael Albinus [Wed, 8 Aug 2018 12:59:56 +0000 (14:59 +0200)]
Tag expensive tests in tramp-archive.el (Bug#30807)
* test/lisp/net/tramp-archive-tests.el (tramp-archive-test44-auto-load)
(tramp-archive-test44-delay-load): Rename.
(tramp-archive-test07-file-exists-p)
(tramp-archive-test08-file-local-copy)
(tramp-archive-test09-insert-file-contents)
(tramp-archive-test11-copy-file)
(tramp-archive-test15-copy-directory)
(tramp-archive-test16-directory-files)
(tramp-archive-test17-insert-directory)
(tramp-archive-test18-file-attributes)
(tramp-archive-test19-directory-files-and-attributes)
(tramp-archive-test20-file-modes)
(tramp-archive-test21-file-links)
(tramp-archive-test26-file-name-completion)
(tramp-archive-test44-auto-load)
(tramp-archive-test44-delay-load): Tag them as :expensive-test,
because they run longer than 10 seconds. (Bug#30807)
Stephen Berman [Mon, 6 Aug 2018 21:52:47 +0000 (23:52 +0200)]
Fix todo-mode bug involving active region (bug#32379)
* lisp/calendar/todo-mode.el (todo-forward-category)
(todo-jump-to-category, todo-toggle-view-done-items)
(todo-toggle-view-done-only, todo-edit-quit, todo-search)
(todo-go-to-source-item, todo-diary-goto-entry): Deactivate the
mark when the region is active.
Stephen Berman [Mon, 6 Aug 2018 17:59:25 +0000 (19:59 +0200)]
Correct and improve part of previous todo-mode.el fix
* lisp/calendar/todo-mode.el (todo-jump-to-category): Improve code
by using bound-and-true-p. This leaves a byte-compiler warning
unsilenced, but ideally, there shouldn't be a warning here (see
https://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00131.html).
(todo--fifiles-history): New variable.
(todo-find-filtered-items-file): Use it to fix the filtered items
files history list for completing-read.
Paul Eggert [Mon, 6 Aug 2018 01:41:20 +0000 (18:41 -0700)]
Simplify regex-emacs code by assuming Emacs
* src/regex-emacs.c: Omit no-longer-needed AIX code.
Don’t ignore GCC warnings.
Include regex-emacs.h immediately after config.h,
to test that it’s independent.
Omit the "#ifndef emacs" and "#ifdef REGEX_MALLOC" and
"#if WIDE_CHAR_SUPPORT" or "#ifdef _REGEX_RE_COMP",
code, as we are no longer interested in compiling outside
Emacs (with or without debugging or native wide char support)
or in avoiding alloca.
(REGEX_EMACS_DEBUG, regex_emacs_debug): Rename from DEBUG and debug,
to avoid collision with other DEBUGS. All uses changed.
In debugging output, change %ld and %zd to %zu when appropriate.
No need to include stddef.h, stdlib.h, sys/types.h, wchar.h,
wctype.h, locale/localeinfo.h, locale/elem-hash.h, langinfo.h,
libintl.h, unistd.h, stdbool.h, string.h, stdio.h, assert.h.
All uses of assert changed to eassert.
(RE_DUP_MAX, reg_syntax_t, RE_BACKSLASH_ESCAPE_IN_LISTS)
(RE_BK_PLUS_QM, RE_CHAR_CLASSES, RE_CONTEXT_INDEP_ANCHORS)
(RE_CONTEXT_INDEP_OPS, RE_CONTEXT_INVALID_OPS, RE_DOT_NEWLINE)
(RE_DOT_NOT_NULL, RE_HAT_LISTS_NOT_NEWLINE, RE_INTERVALS)
(RE_LIMITED_OPS, RE_NEWLINE_ALT, RE_NO_BK_BRACES)
(RE_NO_BK_PARENS, RE_NO_BK_REFS, RE_NO_BK_VBAR)
(RE_NO_EMPTY_RANGES, RE_UNMATCHED_RIGHT_PAREN_ORD)
(RE_NO_POSIX_BACKTRACKING, RE_NO_GNU_OPS, RE_FRUGAL)
(RE_SHY_GROUPS, RE_NO_NEWLINE_ANCHOR, RE_SYNTAX_EMACS)
(REG_NOERROR, REG_NOMATCH, REG_BADPAT, REG_ECOLLATE)
(REG_ECTYPE, REG_EESCAPE, REG_ESUBREG, REG_EBRACK, REG_EPAREN)
(REG_EBRACE, REG_BADBR, REG_ERANGE, REG_ESPACE, REG_BADRPT)
(REG_EEND, REG_ESIZE, REG_ERPAREN, REG_ERANGEX, REG_ESIZEBR)
(reg_errcode_t, REGS_UNALLOCATED, REGS_REALLOCATE, REGS_FIXED)
(RE_NREGS, RE_TRANSLATE, RE_TRANSLATE_P):
Move here from regex-emacs.h.
(RE_NREGS): Define unconditionally.
(boolean): Remove. All uses replaced by bool.
(WIDE_CHAR_SUPPORT, regfree, regexec, regcomp, regerror):
(re_set_syntax, re_syntax_options, WEAK_ALIAS, gettext, gettext_noop):
Remove. All uses removed.
(malloc, realloc, free): Do not redefine. Adjust all callers
to use xmalloc, xrealloc, xfree instead.
(re_error_msgid): Use C99 to avoid need to keep in same order
as reg_error_t.
(REGEX_USE_SAFE_ALLOCA): Simplify by using USE_SAFE_ALLOCA.
(REGEX_ALLOCATE, REGEX_REALLOCATE, REGEX_FREE, REGEX_ALLOCATE_STACK)
(REGEX_REALLOCATE_STACK, REGEX_FREE_STACK): Remove.
All callers changed to use the non-REGEX_MALLOC version.
(REGEX_TALLOC): Remove. All callers changed to use SAFE_ALLOCA.
(re_set_syntax): Remove; unused.
(MATCH_MAY_ALLOCATE): Remove; now always true. All uses simplified.
(INIT_FAILURE_ALLOC): Define unconditionally.
(re_compile_fastmap): Now static.
(re_compile_pattern): Avoid unnecessary cast.
* src/regex-emacs.h (EMACS_REGEX_H): Renamed from _REGEX_H to
avoid possible collision with glibc.
Don’t include sys/types.h. All uses of ssize_t changed to ptrdiff_t.
Don’t worry about C++ or VMS.
Assume emacs is defined and that _REGEX_RE_COMP and WIDE_CHAR_SUPPORT
are not.
Define struct re_registers before including lisp.h.
(REG_ENOSYS, RE_TRANSLATE_TYPE): Remove; all uses replaced by
Lisp_Object.
(regoff_t): Remove. All uses replaced with ptrdiff_t.
(re_match, regcomp, regexec, regerror, regfree):
Remove decl of nonexistent functions.
(RE_DEBUG, RE_SYNTAX_AWK, RE_SYNTAX_GNU_AWK)
(RE_SYNTAX_POSIX_AWK, RE_SYNTAX_GREP, RE_SYNTAX_EGREP)
(RE_SYNTAX_POSIX_EGREP, RE_SYNTAX_ED, RE_SYNTAX_SED)
(_RE_SYNTAX_POSIX_COMMON, RE_SYNTAX_POSIX_BASIC)
(RE_SYNTAX_POSIX_MINIMAL_BASIC, RE_SYNTAX_POSIX_EXTENDED)
(RE_SYNTAX_POSIX_MINIMAL_EXTENDED, REG_EXTENDED, REG_ICASE)
(REG_NEWLINE, REG_NOSUB, REG_NOTBOL, REG_NOTEOL, regmatch_t):
Remove; unused.
* src/search.c (Fset_match_data): Simplify range test now that
we know it’s ptrdiff_t.
Paul Eggert [Mon, 6 Aug 2018 01:41:20 +0000 (18:41 -0700)]
Use Gnulib regex for lib-src
Emacs regular expressions forked from everyone else long ago.
This makes it official and should allow simplification later.
etags.c now uses the glibc regex API, falling back on a
Gnulib-supplied substitute lib/regex.c if necessary.
Emacs proper now uses its own regular expression module.
Although this patch may look dauntingly large, most of it
was generated automatically by admin/merge-gnulib
and contains an exact copy of the glibc regex source,
and the by-hand changes do not grow the Emacs source code.
* admin/merge-gnulib (GNULIB_MODULES): Add regex.
(AVOIDED_MODULES): Add btowc, langinfo, lock, mbrtowc, mbsinit,
nl_langinfo, wchar, wcrtomb, wctype-h.
* lib-src/Makefile.in (regex-emacs.o): Remove; Gnulib does it now.
(etags_deps, etags_libs): Remove regex-emacs.o.
* lib-src/etags.c: Go back to including regex.h.
(add_regex): Use unsigned char translation array,
since glibc regex requires that.
* lib/Makefile.in (not_emacs_OBJECTS, for_emacs_OBJECTS): New macros.
(libegnu_a_OBJECTS): Use them, to avoid building e-regex.o.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/regcomp.c, lib/regex.c, lib/regex.h, lib/regex_internal.c:
* lib/regex_internal.h, lib/regexec.c, m4/builtin-expect.m4:
* m4/eealloc.m4, m4/glibc21.m4, m4/mbstate_t.m4, m4/regex.m4:
New files, copied from Gnulib.
* src/regex-emacs.h, src/conf_post.h:
(RE_TRANSLATE_TYPE, RE_TRANSLATE, RE_TRANSLATE_P):
Move from src/conf_post.h to src/regex-emacs.h,
so that they don’t interfere with compiling lib/regex.c.
Paul Eggert [Mon, 6 Aug 2018 01:41:20 +0000 (18:41 -0700)]
Rename src/regex.c to src/regex-emacs.c.
This is in preparation for using Gnulib regex for etags,
to avoid collisions in include directives.
* src/regex-emacs.c: Rename from src/regex.c.
* src/regex-emacs.h: Rename from src/regex.h. All uses changed.
* test/src/regex-emacs-tests.el: Rename from test/src/regex-tests.el.
Mike Kupfer [Sun, 5 Aug 2018 01:06:37 +0000 (18:06 -0700)]
Fix mh-redistribute to work with nmh 1.5 and identities (SF#268)
Co-authored-by: Jeffrey C Honig <jch@honig.net>
* lisp/mh-e/mh-comp.el (mh-redistribute): Add a non-optional
identity parameter. Use mh-bare-components to generate a draft,
then apply identity-specific settings. Add more details to the
"Resent" annotation line.
(mh-dist-formfile): New.
(mh-bare-components): Add a formfile argument.
(mh-edit-again, mh-send-sub): Track the change to
mh-bare-components.
* lisp/mh-e/mh-identity.el (mh-select-identity)
(mh-identity-field): New.
Tom Tromey [Sat, 4 Aug 2018 17:08:31 +0000 (11:08 -0600)]
Fix hash functions for bignums
* src/fns.c (cmpfn_eql, hashfn_eql): Handle bignums.
(sxhash_bignum): New function.
(sxhash): Use it.
* test/src/fns-tests.el (test-bignum-hash): New test.
Andy Moreton [Sat, 4 Aug 2018 16:28:13 +0000 (10:28 -0600)]
Make bignums work better when EMACS_INT is larger than long
* lisp/international/ccl.el (ccl-fixnum): New function.
(ccl-embed-data, ccl-embed-current-address, ccl-dump): Use it.
* src/alloc.c (make_number): Handle case where EMACS_INT is
larger than long.
* src/data.c (bignumcompare): Handle case where EMACS_INT is
larger than long.
(arith_driver): Likewise. Coerce markers.
(float_arith_driver): Coerce markers.
(Flogcount): Use mpz_sgn.
(ash_lsh_impl): Fix bugs.
(Fsub1): Fix underflow check.
* src/lisp.h (NUMBERP): Don't check BIGNUMP.
(CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER): Fix indentation.
* test/lisp/international/ccl-tests.el: New file.
Stephen Berman [Sat, 4 Aug 2018 16:06:18 +0000 (18:06 +0200)]
Fix assorted todo-mode bugs (bug#32366)
* lisp/calendar/todo-mode.el (todo-forward-category): Fix
calculation for skipping backward over archived categories.
(todo-jump-to-category): When hl-line-mode is enabled, force
highlighting to compensate for apparent failure of
post-command-hook to run.
(todo-insert-item--basic): Prevent inserting a new todo item in an
archive category.
(todo-delete-item): Ensure done items separator disappears when
the last done item is deleted.
(todo-edit-item--header): Fix calculation for choosing a month
prior to the current one.
(todo-find-filtered-items-file): Fix use of completing-read,
correcting typo in default value passed to it and confining
history to filtered items files.
(todo-go-to-source-item): Make a noop when point is not on an item.
(todo-save-filtered-items-buffer): Make buffer read-only after
saving and improve buffer name.
(todo-key-bindings-t+a+f): Remove three mistakenly included bindings.
(todo-key-bindings-t+a): Add two mistakenly omitted bindings.
Respect non-saved value of `read-short-answer' (Bug#31782)
* lisp/emacs-lisp/map-ynp.el (read-answer-short): Add an `auto'
setting.
(read-answer): Check the function cell of `yes-or-no-p' when
`read-answer-short' is `auto' rather than calling
`custom-reevaluate-setting' which would reset the option to its saved
value.
Michael Albinus [Sat, 4 Aug 2018 10:05:28 +0000 (12:05 +0200)]
Rename Tramp method "owncloud" to "nextcloud"
In the spirit of freedom, "nextcloud" is preferred over "owncloud".
* doc/misc/tramp.texi (Quick Start Guide, GVFS based methods):
* etc/NEWS: Rename "owncloud" method to "nextcloud".
* lisp/net/tramp-gvfs.el (tramp-gvfs-methods, tramp-goa-methods)
(tramp-gvfs-url-file-name, tramp-gvfs-handler-mounted-unmounted)
(tramp-gvfs-connection-mounted-p, tramp-gvfs-mount-spec)
(tramp-get-goa-accounts): Use "nextcloud" instead of "owncloud".
(tramp-gvfs-nextcloud-default-prefix)
(tramp-gvfs-nextcloud-default-prefix-regexp): Rename them. Adapt
all callees.
* test/lisp/net/tramp-tests.el (tramp--test-nextcloud-p):
Rename from `tramp--test-owncloud-p'.
(tramp-test11-copy-file, tramp-test12-rename-file): Use it.
Ken Brown [Fri, 3 Aug 2018 14:37:04 +0000 (10:37 -0400)]
Fix a filenotify test failure on Cygwin
* test/lisp/filenotify-tests.el
(file-notify-test04-autorevert): Increase a sleep-for time
from 2 to 3 on Cygwin. This avoids sporadic failures of the
test. (Bug#32363)
Gemini Lasswell [Wed, 1 Aug 2018 14:47:12 +0000 (07:47 -0700)]
Fix some documentation formatting nits
* doc/misc/ert.texi (Running Tests Interactively): Correct
Elisp manual titile in xref.
* doc/lispref/edebug.texi (Edebug Misc): Use single argument
form of xref.
* doc/lispref/debugging.texi (Backtraces): Add comma and
period after xref braces.
(Backtraces): Correct Emacs manual title.
(Internals of Debugger): Add a space before period.
* lisp/emacs-lisp/backtrace.el (backtrace-mode-map): Update
bindings and menu items with new function names.
(backtrace-collapse, backtrace-pretty-print)
(backtrace--collapse, backtrace--pretty-print): Remove functions.
(backtrace-single-line, backtrace-multi-line)
(backtrace--single-line, backtrace--multi-line): New functions.
(backtrace--reformat-sexp): Remove 'error-message' argument.
* test/lisp/emacs-lisp/backtrace-tests.el
(backtrace-tests--pretty-print-and-collapse): Remove.
(backtrace-tests--single-and-multi-line): New test.
(backtrace-tests--verify-pp-and-collapse): Remove.
(backtrace-tests--verify-single-and-multi-line): New function.
Add commands to go to source if available, and to show and hide
Edebug's instrumentation. Make Edebug pop to backtraces instead of
displaying them, which makes Edebug consistant with the behavior of
ERT and the Lisp Debugger.
* doc/lispref/edebug.texi (Edebug Misc): Document when and how you can
jump to source code from an Edebug backtrace. Document
'edebug-backtrace-show-instrumentation' and
'edebug-backtrace-hide-instrumentation'.
* lisp/emacs-lisp/backtrace.el (backtrace-frame): Add comments to
describe the fields.
(backtrace-goto-source-functions): New
abnormal hook.
(backtrace-mode-map): Add keybinding and menu item for
backtrace-goto-source.
(backtrace--flags-width): New constant.
(backtrace-update-flags): Use it.
(backtrace-goto-source): New command.
(backtrace--print-flags): Print the :source-available flag.
* lisp/emacs-lisp/edebug.el (edebug-backtrace-frames)
(edebug-instrumented-backtrace-frames): New variables.
(edebug-backtrace, edebug--backtrace-frames): Remove functions.
(edebug-pop-to-backtrace, edebug--backtrace-goto-source)
(edebug--add-source-info): New functions.
(edebug-mode-map, edebug-mode-menus): Replace 'edebug-backtrace' with
'edebug-pop-to-backtrace'.
(edebug--strip-instrumentation): New function.
(edebug--unwrap-and-add-info): Remove.
(edebug-unwrap-frame, edebug-add-source-info): New functions.
(edebug-backtrace-show-instrumentation)
(edebug-backtrace-hide-instrumentation): New commands.
* test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-check-keymap):
Verify keybindings in backtrace-mode-map used by new test.
Update with binding for 'edebug-pop-to-backtrace'.
(edebug-tests-backtrace-goto-source): New test.
* test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
(edebug-test-code-range): Add a new stop point.
* lisp/emacs-lisp/backtrace.el (backtrace-mode-map): Add a menu.
* lisp/emacs-lisp/debug.el (debugger-mode-map): Change menu text for
'backtrace-help-follow-symbol' to better describe what it does.
Add new command to expand all "..."s in a backtrace frame
* doc/lispref/debugging.texi (Backtraces): Document new keybinding.
* lisp/emacs-lisp/backtrace.el (backtrace-line-length): Add the
option of unlimited line length.
(backtrace--match-ellipsis-in-string): Add a comment to explain
why this function is necessary.
(backtrace-mode-map): Add keybinding for 'backtrace-expand-ellipses'.
(backtrace-expand-ellipsis): Use 'cl-print-to-string-with-limit'.
(backtrace-expand-ellipses): New command.
(backtrace-print-to-string): Use 'cl-print-to-string-with-limit'.
Tag the printed forms with a gensym instead of the values of
print-length and print-level.
(backtrace--print): Add 'stream' argument.
* test/lisp/emacs-lisp/backtrace-tests.el
(backtrace-tests--expand-ellipsis): Make the test less dependent
on the implementation.
(backtrace-tests--expand-ellipses): New test.
Move the fitting of a printed representation into a limited number of
characters using appropriate values of print-level and print-length
from 'backtrace-print-to-string' to cl-print.el for future use by
other parts of Emacs.
* lisp/emacs-lisp/cl-print.el (cl-print-to-string-with-limit): New
function.
* test/lisp/emacs-lisp/cl-print-tests.el
(cl-print-tests-print-to-string-with-limit): New test.
Change keybinding for backtrace-collapse from '=' to '-'
'+' and '-' make a more intuitive pair of keybindings for
backtrace-pretty-print and backtrace-collapse than '+' and '='.
* lisp/emacs-lisp/backtrace.el (backtrace-mode-map):
* doc/lispref/debugging.texi (Backtraces): Change
keybinding for backtrace-collapse.
Gemini Lasswell [Sat, 30 Jun 2018 15:45:53 +0000 (08:45 -0700)]
Add more tests for backtrace-mode
* test/lisp/emacs-lisp/backtrace-tests.el (backtrace-tests--variables)
(backtrace-tests--backward-frame, backtrace-tests--forward-frame)
(backtrace-tests--pretty-print-and-collapse)
(backtrace-tests--verify-pp-and-collapse)
(backtrace-tests--print-circle, backtrace-tests--make-regexp)
(backtrace-tests--expand-ellipsis): New tests.
(backtrace-tests--to-string): Use backtrace-tests--make-backtrace.
(backtrace-tests--get-substring): New function.
Change the method of generating sample backtraces in backtrace tests
to work whether or not the tests are byte-compiled.
* test/lisp/emacs-lisp/backtrace-tests.el (backtrace-tests--func1)
(backtrace-tests--func2, backtrace-tests--func3)
(backtrace-tests--create-backtrace-frames): Remove.
(backtrace-tests--uncompiled-functions): New constant.
(backtrace-tests--make-backtrace, backtrace-tests--setup-buffer):
New functions.
(backtrace-tests--backtrace-lines)
(backtrace-tests--backtrace-lines-with-locals): New functions.
(backtrace-tests--line-count): New constant.
(backtrace-tests--result, backtrace-tests--result-with-locals):
New functions.
(backtrace-tests--header): New constant.
(backtrace-tests--insert-header): Use backtrace-tests--header.
(backtrace-tests--with-buffer): Remove.
Add link in backtraces to position in buffer being evaluated (bug#14081)
* lisp/emacs-lisp/backtrace.el (backtrace-frame): Add buffer field.
(backtrace-get-frames): Set buffer field of frame.
(backtrace-buffer-pos): New button type.
(backtrace--pop-to-buffer-pos): New function.
(backtrace--print-func-and-args): Create a button for the buffer
position if it is set.
Gemini Lasswell [Sat, 23 Jun 2018 17:25:29 +0000 (10:25 -0700)]
Add prefix argument to backtrace-toggle-print-circle
With prefix argument, toggle print-circle for the whole buffer.
* lisp/emacs-lisp/backtrace.el (backtrace-toggle-print-circle): Add
universal prefix argument.
(backtrace--toggle-feature): Add new argument 'all' to toggle all
frames.
(backtrace--set-feature): New function.
(backtrace-mode): Use indent functions from Lisp modes.
Gemini Lasswell [Fri, 22 Jun 2018 19:53:37 +0000 (12:53 -0700)]
Lazily print backtrace frame local variables
Instead of printing the local variables for all frames when the
backtrace buffer is created, print them when they are first made
visible. Add a prefix argument to backtrace-toggle-locals to toggle
local variables display for the entire buffer.
* lisp/emacs-lisp/backtrace.el (backtrace-view): Mention
:show-locals in docstring.
(backtrace-get-section-end): Remove function.
(backtrace-toggle-locals): Add prefix argument.
(backtrace--with-output-variables): Move before first use.
(backtrace--set-frame-locals-visible): New function.
(backtrace--set-locals-visible-overlay): New function.
(backtrace--set-locals-visible): Remove function.
(backtrace-toggle-feature): Remove TODO comment.
(backtrace--print-locals): Skip printing the locals if they are not
visible.
Gemini Lasswell [Tue, 19 Jun 2018 14:27:41 +0000 (07:27 -0700)]
Add backtrace-mode and use it in the debugger, ERT and Edebug
* doc/lispref/debugging.texi (Using Debugger): Remove explanation of
backtrace buffer. Refer to new node.
(Backtraces): New node.
(Debugger Commands): Refer to new node. Remove 'v'.
* doc/lispref/edebug.texi (Edebug Misc): Refer to new node.
* doc/misc/ert.texi (Running Tests Interactively): Refer to new node.
* lisp/emacs-lisp-backtrace.el: New file.
* test/lisp/emacs-lisp/backtrace-tests.el: New file.
* lisp/emacs-lisp/debug.el: (debugger-buffer-state): New cl-defstruct.
(debugger--restore-buffer-state): New function.
(debug): Use a debugger-buffer-state object to save and restore buffer
state. Fix bug#15749 by leaving an unused buffer in debugger-mode,
empty, instead of in fundamental-mode, and then when reusing a buffer,
not calling debugger-mode if the buffer is already in debugger-mode.
(debugger-insert-backtrace): Remove.
(debugger-setup-buffer): Use backtrace-mode.
(debugger--insert-header): New function.
(debugger-continue, debugger-return-value): Change check for flags to
use backtrace-frames.
(debugger-frame-number): Determine backtrace frame number from
backtrace-frames.
(debugger--locals-visible-p, debugger--insert-locals)
(debugger--show-locals, debugger--hide-locals)
(debugger-toggle-locals): Remove.
(debugger-mode-map): Make a child of backtrace-mode-map. Move
navigation commands to backtrace-mode-map. Bind 'q' to debugger-quit
instead of top-level. Make Help Follow menu item call
backtrace-help-follow-symbol.
(debugger-mode): Derive from backtrace-mode.
(debug-help-follow): Remove. Move body of this function to
'backtrace-help-follow-symbol' in backtrace.el.
(debugger-quit): New function.
* lisp/emacs-lisp/edebug.el (edebug-unwrap-results): Remove warning
in docstring about circular results.
(edebug-unwrap): Use pcase.
(edebug-unwrap1): New function to unwrap circular objects.
(edebug-unwrap*): Use it.
(edebug--frame): New cl-defstruct.
(edebug-backtrace): Call the buffer *Edebug Backtrace* and use
backtrace-mode. Get the frames from edebug--backtrace-frames.
(edebug--backtrace-frames, edebug--unwrap-and-add-info)
(edebug--symbol-not-prefixed-p): New functions.
* lisp/emacs-lisp/lisp-mode.el
(lisp-el-font-lock-keywords-for-backtraces)
(lisp-el-font-lock-keywords-for-backtraces-1)
(lisp-el-font-lock-keywords-for-backtraces-2): New constants.
* lisp/emacs-lisp/ert.el (ert--print-backtrace): Remove.
(ert--run-test-debugger): Use backtrace-get-frames.
(ert-run-tests-batch): Use backtrace-to-string.
(ert-results-pop-to-backtrace-for-test-at-point): Use backtrace-mode.
(ert--insert-backtrace-header): New function.
* tests/lisp/emacs-lisp/ert-tests.el (ert-test--which-file):
Use backtrace-frame slot accessor.
Gemini Lasswell [Fri, 15 Jun 2018 17:26:13 +0000 (10:26 -0700)]
Add methods for strings to cl-print
* lisp/emacs-lisp/cl-print.el (cl-print-object) <string>: New method.
(cl-print-object-contents) <string>: New method.
(cl-print--find-sharing): Look in string property lists.
* test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-3): Test
printing of long strings.
(cl-print-tests-4): Test printing of strings nested in other objects.
(cl-print-tests-strings, cl-print-tests-ellipsis-string): New
tests.
Gemini Lasswell [Fri, 15 Jun 2018 17:23:58 +0000 (10:23 -0700)]
Support ellipsis expansion in cl-print
* lisp/emacs-lisp/cl-print.el (cl-print-object-contents): New
generic method.
(cl-print-object-contents) <cons, vector,cl-structure-object>: New
methods.
(cl-print-object) <cons>: Use cl-print-insert-ellipsis.
(cl-print-object) <vector, cl-structure-object>: Elide whole object if
print-level exceeded. Use cl-print-insert-ellipsis.
(cl-print-insert-ellipsis, cl-print-propertize-ellipsis)
(cl-print-expand-ellipsis): New functions.
* test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-4): Test
printing of objects nested in other objects.
(cl-print-tests-strings, cl-print-tests-ellipsis-cons)
(cl-print-tests-ellipsis-vector, cl-print-tests-ellipsis-struct)
(cl-print-tests-ellipsis-circular): New tests.
(cl-print-tests-check-ellipsis-expansion)
(cl-print-tests-check-ellipsis-expansion-rx): New functions.
Eli Zaretskii [Thu, 2 Aug 2018 13:58:44 +0000 (16:58 +0300)]
Avoid assertion violations in maybe_produce_line_number
* src/xdisp.c (redisplay_window): Make sure desired_matrix is
cleared before calling try_window. This is important when
display-line-numbers is non-nil, because line-number display code
assumes each glyph row is completely cleared when it is called to
produce a line number. (Bug#32358)
Eli Zaretskii [Thu, 2 Aug 2018 13:29:54 +0000 (16:29 +0300)]
Avoid assertion violations in set_text_properties_1
* src/textprop.c (set_text_properties): If the call to
modify_text_properties modifies the interval tree as side effect,
recalculate the correct interval for START and END. (Bug#32265)
Tino Calancha [Thu, 2 Aug 2018 04:20:46 +0000 (13:20 +0900)]
New commands to create an empty file
Similarly as `create-directory', `dired-create-directory',
the new commands create the parent dirs as needed (Bug#24150).
* lisp/files.el (make-empty-file): New command.
* lisp/dired-aux.el (dired-create-empty-file): New command.
(dired--find-topmost-parent-dir): New function extracted
from `dired-create-directory'.
(dired-create-directory, dired-create-empty-file): Use it.
* lisp/dired.el (dired-mode-map):
Add menu entry for `dired-create-empty-file'.
Paul Eggert [Thu, 2 Aug 2018 01:53:31 +0000 (18:53 -0700)]
Substitute a <ieee754.h> on hosts lacking it
* .gitignore: Add lib/ieee754.h.
* admin/merge-gnulib (GNULIB_MODULES): Add ieee754-h.
* configure.ac: Remove ieee754.h check, as Gnulib now does that.
* etc/NEWS: Mention this.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/ieee754.in.h, m4/ieee754-h.m4: New files, from Gnulib.
* src/lisp.h (IEEE_FLOATING_POINT): Now a macro so that it
can be used in #if.
* src/lread.c, src/print.c: Include <ieee754.h> if
IEEE_FLOATING_POINT, not if HAVE_IEEE754_H.
* src/lread.c (string_to_number):
* src/print.c (float_to_string):
Process NaNs only on IEEE hosts, and assume <ieee754.h>
in that case.
Add an Edebug matching function for cl-macrolet which keeps track of
its bindings and treats them as macros without Edebug specs when found
in the body of the expression.
* lisp/emacs-lisp/edebug.el (edebug--cl-macrolet-defs): New variable.
(edebug-list-form-args): Use it.
(edebug--current-cl-macrolet-defs): New variable.
(edebug-match-cl-macrolet-expr, edebug-match-cl-macrolet-name)
(edebug-match-cl-macrolet-body): New functions.
* lisp/emacs-lisp/cl-macs.el (cl-macrolet): Use cl-macrolet-expr
for Edebug spec.
* test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-cl-macrolet):
New test.
* test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
(edebug-test-code-use-cl-macrolet): New function.
Stephen Berman [Wed, 1 Aug 2018 12:42:57 +0000 (14:42 +0200)]
Fix todo-mode commands called on done items separator
The done items separator is not reachable by todo-mode navigation
commands, but it is e.g. by C-n and C-p. Ensure that invoking
todo-mode commands with point on the separator does not result in
unexpected results, errors or file corruption (bug#32343).
* lisp/calendar/todo-mode.el (todo-insert-item--basic): Make
copying item and inserting item "here" noops when invoked on done
items separator. Consolidate error handling of these cases. Also
restrict "here" insertion to valid positions in the current
category, since this is simpler than the previous behavior of
inserting as the first item, which was moreover undocumented,
counterintuitive and superfluous.
(todo-set-item-priority, todo-move-item, todo-item-done)
(todo-item-start, todo-item-end): Make noops when invoked on done
items separator.
* test/lisp/calendar/todo-mode-tests.el: Require ert-x.
(todo-test--insert-item): Add formal parameters of
todo-insert-item--basic.
(todo-test--done-items-separator): New function.
(todo-test-done-items-separator01-bol)
(todo-test-done-items-separator01-eol)
(todo-test-done-items-separator02-bol)
(todo-test-done-items-separator02-eol)
(todo-test-done-items-separator03-bol)
(todo-test-done-items-separator03-eol)
(todo-test-done-items-separator04-bol)
(todo-test-done-items-separator04-eol)
(todo-test-done-items-separator05-bol)
(todo-test-done-items-separator05-eol)
(todo-test-done-items-separator06-bol)
(todo-test-done-items-separator06-eol)
(todo-test-done-items-separator07): New tests.
Paul Eggert [Wed, 1 Aug 2018 06:46:57 +0000 (23:46 -0700)]
Simplify by assuming C99 math.h isnan etc.
These should be portable nowadays.
* src/data.c (isnan): Remove.
* src/floatfns.c (isfinite, isnan): Remove.
* src/print.c: Include math.h, for isinf and isnan.
(float_to_string): Simplify by using them.
Eli Zaretskii [Sun, 29 Jul 2018 17:07:09 +0000 (20:07 +0300)]
Avoid gettimeofday deprecation warnings with MinGW
* nt/inc/ms-w32.h (__POSIX_2008_DEPRECATED)
[__MINGW32_VERSION >= 5001000L]: Define to nothing, to avoid
deprecation warnings about gettimeofday with mingw.org's MinGW
runtime 5.1 and later.
It might be argued that a hidden string is more legible when using
?* as the hidden character instead of ?.
For example, the following strings have the same length:
"......"
"******"
It's slighly easier to visually count the number of characters in the second
string (Bug#32220).
* lisp/subr.el (read-passwd): Prefer ?* as default char instead of ?.
* doc/lispref/minibuf.texi (Reading a Password): Update manual.
; * etc/NEWS (Changes in Emacs 27.1): Announce the change.
Stephen Berman [Sun, 29 Jul 2018 11:16:48 +0000 (13:16 +0200)]
Handle symlinks in wdired.el when restoring filename property
* lisp/wdired.el (wdired--restore-dired-filename-prop): If the
file name is a symbolic link, only propertize the link name. This
prevents wdired-create-parentdirs from turning the link into a
directory.
Stephen Berman [Sat, 28 Jul 2018 23:14:41 +0000 (01:14 +0200)]
Fix bugs in wdired.el involving dired-filename property
After every change in wdired-mode, put the dired-filename text
property on the file name. This ensures that changing some but not
all characters in the name succeeds with non-nil
wdired-use-interactive-rename (bug#32173) and it also ensures that
changed names can be found (e.g. by dired-isearch-filenames) while
still in wdired-mode.
* lisp/wdired.el (wdired--restore-dired-filename-prop): New function.
(wdired-change-to-wdired-mode): Add it to after-change-functions.
(wdired-change-to-dired-mode): Remove it from after-change-functions.
(wdired-finish-edit): Move invocation of
wdired-change-to-dired-mode below invocation of wdired-do-renames,
so that the latter runs wdired--restore-dired-filename-prop, but
above the invocation of revert-buffer to avoid using
wdired-revert, which changes back to wdired-mode.
(wdired-search-and-rename): Wrap renaming in unwind-protect and if
user types C-g when prompted to change the file name, make sure we
return to dired-mode.
Stephen Berman [Sat, 28 Jul 2018 21:58:15 +0000 (23:58 +0200)]
Fix use of non-nil wdired-use-interactive-rename
This is a fairly minimal fix for the release branch; a more
comprehensive fix is on master, so do not merge this to master.
* lisp/wdired.el (wdired-search-and-rename): Remove dired-filename
text property in order to find new filename when it only partially
replaces old filename (bug#32173). If user quits before renaming
succeeds, restore the dired-filename text property.