Glenn Morris [Tue, 13 Dec 2016 01:03:20 +0000 (20:03 -0500)]
Minor fix for define-derived-mode
* lisp/emacs-lisp/derived.el (define-derived-mode):
Do not let eg eval-defun reset the values of syntax or abbrev tables,
since they might have been defined externally. (Bug#16160)
Move backtrace to ELisp using a new mapbacktrace primitive
* src/eval.c (get_backtrace_starting_at, backtrace_frame_apply)
(Fmapbacktrace, Fbacktrace_frame_internal): New functions.
(get_backtrace_frame, Fbacktrace_debug): Use `get_backtrace_starting_at'.
* lisp/subr.el (backtrace--print-frame): New function.
(backtrace): Reimplement using `backtrace--print-frame' and `mapbacktrace'.
(backtrace-frame): Reimplement using `backtrace-frame--internal'.
* lisp/emacs-lisp/debug.el (debugger-setup-buffer): Pass a base to
`mapbacktrace' instead of searching for "(debug" in the output of
`backtrace'.
* test/lisp/subr-tests.el (subr-test-backtrace-simple-tests)
(subr-test-backtrace-integration-test): New tests.
* doc/lispref/debugging.texi (Internals of Debugger): Document
`mapbacktrace' and missing argument BASE of `backtrace-frame'.
Paul Eggert [Mon, 12 Dec 2016 22:27:35 +0000 (14:27 -0800)]
Use C99 syntax for font drivers
Problem reported by Daniel Colascione in:
http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00515.html
* src/ftcrfont.c (ftcrfont_driver):
* src/ftfont.c (ftfont_driver):
* src/ftxfont.c (ftxfont_driver):
* src/macfont.m (macfont_driver):
* src/nsfont.m (nsfont_driver):
* src/xfont.c (xfont_driver):
* src/xftfont.c (xftfont_driver):
Use C99 syntax, not the old GNU C syntax.
Glenn Morris [Mon, 12 Dec 2016 20:20:39 +0000 (15:20 -0500)]
Minor advice.el fix
* lisp/emacs-lisp/advice.el (ad-preactivate-advice):
Avoid setting the function definition of nil.
This was happening during bootstrap of org-compat.el,
apparently due to eager macro expansion of code behind
a (featurep 'xemacs) test.
Eli Zaretskii [Mon, 12 Dec 2016 17:56:03 +0000 (19:56 +0200)]
Make etags-tests work in out-of-tree builds
* test/lisp/progmodes/etags-tests.el (etags-bug-158)
(etags-bug-23164): Make them work in an out-of-tree build.
Reported by Ken Brown <kbrown@cornell.edu>.
Eli Zaretskii [Mon, 12 Dec 2016 17:08:21 +0000 (19:08 +0200)]
Avoid crashing if a new thread is signaled right away
* src/thread.c (post_acquire_global_lock): Don't raise the pending
signal if the thread's handlers were not yet set up, as that will
cause Emacs to exit with a fatal error. This can happen if a
thread is signaled as soon as make-thread returns, before the new
thread had an opportunity to acquire the global lock, set up the
handlers, and call the thread function.
* test/src/thread-tests.el (thread-signal-early): New test.
Eli Zaretskii [Mon, 12 Dec 2016 16:03:40 +0000 (18:03 +0200)]
Fix point motion in cloned buffers
* src/thread.c (post_acquire_global_lock): Call
set_buffer_internal_2 instead of tricking set_buffer_internal_1
into resetting the current buffer even if it didn't change. This
avoids bug#25165, caused by failing to record the modified values
of point and mark, because current_buffer was set to NULL. Also,
don't bother re-setting the buffer if there was no thread switch,
as that just wastes cycles.
* src/buffer.c (set_buffer_internal_2): New function, with most of
the body of set_buffer_internal_1, but without the test for B
being identical to the current buffer.
(set_buffer_internal_1): Call set_buffer_internal_2 if B is not
identical to the current buffer.
* src/buffer.h (set_buffer_internal_2): Add prototype.
* test/src/thread-tests.el (thread-sticky-point): New test.
Michael Albinus [Mon, 12 Dec 2016 10:12:34 +0000 (11:12 +0100)]
Further improvements in Tramp's file name unquoting
* lisp/net/tramp-adb.el (tramp-adb-handle-file-local-copy)
(tramp-adb-handle-write-region): Unquote localname.
(tramp-adb-handle-copy-file): Implement direct copy on remote device.
(tramp-adb-handle-rename-file): Quote arguments, add "-f" to force.
* lisp/net/tramp.el (tramp-file-name-unquote-localname): New defun.
(tramp-handle-file-name-case-insensitive-p):
* lisp/net/tramp-gvfs.el (tramp-gvfs-get-file-attributes)
(tramp-gvfs-connection-mounted-p, tramp-gvfs-mount-spec)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-make-copy-program-file-name):
* lisp/net/tramp-smb.el (tramp-smb-get-share)
(tramp-smb-get-localname): Use it.
* test/lisp/net/tramp-tests.el (tramp--test-docker-p): New defun.
(tramp--test-special-characters, tramp-test34-utf8)
(tramp-test34-utf8-with-stat, tramp-test34-utf8-with-perl)
(tramp-test34-utf8-with-ls): Use it.
Noam Postavsky [Fri, 28 Oct 2016 02:17:11 +0000 (22:17 -0400)]
Quote filenames containing '~' in prompts
When in a directory named '~', the default value given by
`read-file-name' should be quoted by prepending '/:', in order to
prevent it from being interpreted as referring to the $HOME
directory (Bug#16984).
* lisp/minibuffer.el (minibuffer-maybe-quote-filename): New function.
(completion--sifn-requote, read-file-name-default): Use it instead of
`minibuffer--double-dollars'.
* test/lisp/files-tests.el (files-test-read-file-in-~): Test it.
Eli Zaretskii [Sun, 11 Dec 2016 15:59:55 +0000 (17:59 +0200)]
Avoid aborts when a thread signals an error
* src/thread.h (struct thread_state): Add members
m_waiting_for_input and m_input_available_clear_time.
(waiting_for_input, input_available_clear_time): New macros.
* src/keyboard.c (waiting_for_input, input_available_clear_time):
Remove; they are now macros that reference the current thread.
(Bug#25171)
* src/w32select.c: Don't include keyboard.h.
* test/src/thread-tests.el (thread-errors): New test.
Philipp Stephani [Sat, 10 Dec 2016 20:36:15 +0000 (21:36 +0100)]
Clean up compile-tests.el
Switch to lexical binding. Make checkdoc happy.
* test/lisp/progmodes/compile-tests.el (compile--test-error-line)
(compile-test-error-regexps): Instead of checking a single Boolean
value, use `should' for each attribute of the message to be compared.
(compile-tests--test-regexps-data): Document sixth list element
TYPE.
Glenn Morris [Sun, 11 Dec 2016 03:03:28 +0000 (19:03 -0800)]
Tweaks for message bogus address detection
* lisp/gnus/message.el (message-bogus-recipient-p):
Do not require "@", since some mailers deliver to local addresses
without one. (Bug#23054)
Move "@.*@" from here...
(message-bogus-addresses): ...to here, so it can be customized.
Eli Zaretskii [Sat, 10 Dec 2016 09:06:23 +0000 (11:06 +0200)]
Fix building with check-lisp-object-type
* src/thread.c (mark_one_thread): Use NILP to compare with
m_saved_last_thing_searched, which is a Lisp object. Reported by
Andreas Politz <politza@hochschule-trier.de>.
Eli Zaretskii [Fri, 9 Dec 2016 16:23:04 +0000 (18:23 +0200)]
Fix compilation warnings due to prototype of thread_select
* src/thread.h <int select_func>: Make the 5th and 6th arguments
be 'const'.
* src/process.c [WINDOWSNT]:
* src/w32proc.c: Make the 5th and 6th argument to sys_select be
'const'.
Eli Zaretskii [Fri, 9 Dec 2016 14:03:08 +0000 (16:03 +0200)]
Fix subtle errors with let-binding of localized variables
* src/eval.c (do_specbind): Don't require a "symbol" that is
actually a cons cell, in order to call set-default, as there are
no longer such bindings. This makes do_specbind work like the
pre-concurrency implementation in specbind for bindings of
forwarded symbols. Use specpdl_kind to access the type of the
binding.
(specpdl_kind): New function.
Noam Postavsky [Fri, 9 Dec 2016 05:14:48 +0000 (00:14 -0500)]
Fix bad quoting of python-shell-interpreter
`python-shell-calculate-command' was using `shell-quote-argument' as if
it was generating a shell command, but its callers don't pass the result
to a shell, and they expect to parse it with `split-string-and-unquote'.
This caused problems depending on the flavor of shell quoting in
effect (Bug#25025).
* lisp/progmodes/python.el (python-shell-calculate-command): Use
`combine-and-quote-strings' to quote the interpreter, so that it can be
parsed by `python-shell-make-comint' successfully using
`split-string-and-unquote'.
Paul Eggert [Thu, 8 Dec 2016 19:32:48 +0000 (11:32 -0800)]
Make read1 more reentrant
This is needed if ‘read’ is called soon after startup, before the
Unicode tables have been set up, and it reads a \N escape and
needs to look up a value the Unicode tables, a lookup that in turn
calls read1 recursively. Although this change doesn’t make ‘read’
fully reentrant, it’s good enough to handle this case.
* src/lread.c (read_buffer_size, read_buffer): Remove static vars.
(grow_read_buffer): Revamp to use locals, not statics, and to
record memory allocation un the specpdl. All callers changed.
(read1): Start with a stack-based buffer, and use the heap
only if the stack buffer is too small. Use unbind_to to
free any heap buffer allocated. Use bool for boolean.
Redo symbol loop so that only one call to grow_read_buffer
is needed.
(init_obarray): Remove no-longer-needed initialization.
Tino Calancha [Thu, 8 Dec 2016 04:46:25 +0000 (13:46 +0900)]
Fix Bug#24962
* lisp/buff-menu.el (list-buffers--refresh):
List buffers with name starting with " " if they visit a file.
* test/lisp/buff-menu-tests.el (buff-menu-24962):
Update test result as pass.
Paul Eggert [Wed, 7 Dec 2016 20:53:02 +0000 (12:53 -0800)]
Put post-25 ChangeLog entries into ChangeLog.3
* ChangeLog.2: Copy from emacs-25 branch.
* ChangeLog.3: New file, with changes only in master.
* Makefile.in (CHANGELOG_HISTORY_INDEX_MAX): Bump from 2 to 3.
Paul Eggert [Wed, 7 Dec 2016 20:39:07 +0000 (12:39 -0800)]
Merge from origin/emacs-25
93c0f51 Handle TeX comments when making new paragraph e0884f1 Restore keystroke echo in 'C-q' a6213ce Improve documentation of 'current-word' 0828126 Fix a typo in an Eshell defcustom 2e361c7 Minor copyedits of electric-pair-mode 7499ee8 ; Minor copyedit in the Emacs manual 45b652b Fix documentation of 'invocation-directory' 7f43d7c * admin/authors.el (authors-aliases): Add an entry. ba48880 ; Fix pl-refcard.tex
Paul Eggert [Wed, 7 Dec 2016 20:36:38 +0000 (12:36 -0800)]
Merge from origin/emacs-25
3d63b48 Update ChangeLog files and authors.el 9d30264 Fix menu bindings of Dired 'A' and 'Q' commands a725592 Avoid errors in shr-pixel-column due to dedicated windows 3138598 Update format-time-string documentation
Paul Eggert [Wed, 7 Dec 2016 18:29:57 +0000 (10:29 -0800)]
Fix --enable-gcc-warnings --with-ns on Fedora
* src/Makefile.in (NON_OBJC_CFLAGS): New macro.
(ALL_OBJC_CFLAGS): Use it.
(EMACS_CFLAGS): New macro, with most of the old ALL_CFLAGS.
(ALL_CFLAGS, ALL_OBJC_FLAGS): Use it.
Michael Albinus [Wed, 7 Dec 2016 16:16:57 +0000 (17:16 +0100)]
Fix problems in quoting Tramp file names
* lisp/net/tramp.el (tramp-get-remote-tmpdir): Add also hop to result.
(tramp-unquote-shell-quote-argument): New defun.
(tramp-shell-quote-argument):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-make-copy-program-file-name):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-shell-quote-argument): Use it.
Tino Calancha [Wed, 7 Dec 2016 13:02:54 +0000 (22:02 +0900)]
define-ibuffer-filter: Discard wrong filters
* lisp/ibuf-macs.el (define-ibuffer-filter): Do not store
in 'ibuffer-filtering-qualifiers' a wrong filter (Bug#25042).
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25042): Add test.
Tino Calancha [Wed, 7 Dec 2016 12:49:50 +0000 (21:49 +0900)]
ibuffer-decompose-filter-group avoid unwanted side effects
* lisp/ibuf-ext.el (ibuffer-delete-alist): Remove it.
(ibuffer-remove-alist): New defun; it supersedes 'ibuffer-delete-alist'.
All callers changed (Bug#25058).
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25058): Add test.
Tino Calancha [Wed, 7 Dec 2016 12:36:38 +0000 (21:36 +0900)]
ibuffer-unmark-backward: Unmark the region when is active
* lisp/ibuffer.el (ibuffer-unmark-backward):
Use 'ibuffer-get-region-and-prefix'; call 'ibuffer-unmark-forward'
with the region boundary as the first 2 arguments (Bug#24987).
Tino Calancha [Wed, 7 Dec 2016 12:07:45 +0000 (21:07 +0900)]
ediff-context-diff-label-regexp: Detect the end of second file
* lisp/vc/ediff-ptch.el (ediff-context-diff-label-regexp): Skip
'\n' in file names (Bug#25010).
* test/lisp/vc/ediff-ptch-tests.el: New file.
(ibuffer-test-bug25010): Add test for Bug#25010.
Tino Calancha [Wed, 7 Dec 2016 11:47:34 +0000 (20:47 +0900)]
ibuffer-decompose-filter: Avoid side effects on error
* lisp/ibuf-ext.el (ibuffer-decompose-filter):
Update 'ibuffer-filtering-qualifiers' only if there is no error (Bug#24997).
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug24997):
Update test result as pass.
Tino Calancha [Wed, 7 Dec 2016 11:37:01 +0000 (20:37 +0900)]
ibuffer: compare marks with EQ
* lisp/ibuffer (ibuffer-update-title-and-summary, ibuffer-redisplay-current)
(ibuffer-buffer-name-face, ibuffer-unmark-all)
(ibuffer-count-deletion-lines, ibuffer-buffer-names-with-mark):
Use 'eq' instead of 'char-equal' when comparing mark characters (Bug#25000).
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25000):
Update test result as pass.
Fix Bug#25049.
* lisp/ibuf-ext.el (ibuffer-saved-filters): Remove extra
nesting level; add transparent setter to adjust old-format values;
update doc string.
(ibuffer-save-filters): Remove extra level of nesting
in ibuffer-saved-filters values when saving new filters.
(ibuffer-old-saved-filters-warning): New variable with
clickable message with repair options to be displayed
as a warning if 'ibuffer-repair-saved-filters' detects
a format mismatch.
(ibuffer-repair-saved-filters): Add new command to check and
repair saved filters format.
(ibuffer-included-in-filter-p, ibuffer-decompose-filter):
Change access of saved filter data (cadr->cdr) to account
for reduced nesting.
* test/lisp/ibuffer-tests.el (ibuffer-save-filters):
New test; check that filters are saved in the proper format.
Paul Eggert [Wed, 7 Dec 2016 05:38:32 +0000 (21:38 -0800)]
Simplify FUNCTIONP implementation
* src/bytecode.c (exec_byte_code):
* src/image.c (parse_image_spec):
Prefer FUNCTIONP (x) to !NILP (Ffunctionp (x)).
* src/eval.c (FUNCTIONP): Move here ...
* src/lisp.h: ... from here. No longer inline, as that
bloats the text and does not help speed (at least on my platform).
(functionp): Remove this name, since callers use FUNCTIONP.
Noam Postavsky [Sun, 4 Dec 2016 06:06:52 +0000 (01:06 -0500)]
Don't assume window-point and point are the same
The function `cursor-sensor--detect' calls `bobp' to decide whether to
check properties at (1- (window-point)). However, (window-point) may be
at beginning of buffer, even if (point) is not. In this case an
`args-out-of-range' error will be signaled (Bug#25104).
* lisp/emacs-lisp/cursor-sensor.el (cursor-sensor--detect): Check the
value of (window-point) against (point-min), rather than (bobp) to
decide if (1- (window-point)) is accessible.
Noam Postavsky [Sun, 27 Nov 2016 19:41:02 +0000 (14:41 -0500)]
Give test-completion's PREDICATE the hashtable key
For hashtable entries with symbol keys, `test-completion' would convert
the key to a string before calling PREDICATE, unlike `try-completion'
and `all-completions'.
* src/minibuf.c (Ftest_completion): Pass original key from hashtable.
Noam Postavsky [Sun, 27 Nov 2016 15:04:48 +0000 (10:04 -0500)]
Give test-completion's PREDICATE full alist entry
Since 2016-06-26 "Fix test-completion with completion-regexp-list", when
calling test-completion with an alist collection, the predicate was
recieving the string value instead of the alist entry (Bug#24966).
* src/minibuf.c (Ftest_completion): Don't modify the found element, just
test STRING against `completion-regexp-list'.
* test/src/minibuf-tests.el: New tests for `try-completion',
`all-completions', and `test-completion'.
Noam Postavsky [Mon, 22 Aug 2016 02:58:37 +0000 (22:58 -0400)]
Fix ert-tests when running compiled
* test/lisp/emacs-lisp/ert-tests.el (ert-test-deftest): Don't test for
specific macroexpansion, just check result of evaluation.
(ert-test-record-backtrace): Don't hardcode representation of closure in
expected backtrace, this lets the test succeed even when the test code
is compiled.
* lisp/emacs-lisp/ert.el (ert--expand-should-1): Also pass
`byte-compile-macro-environment' to `macroexpand', this allows the
`should' macro to properly handle macroexpansion of macros that were
defined in the same file when it's being compiled (Bug #17851).
Paul Eggert [Tue, 6 Dec 2016 23:25:54 +0000 (15:25 -0800)]
Change two _Noreturn functions to return void
This is a bit clearer than _Noreturn functions that (do not)
return a non-void type.
* src/callproc.c (call_process) [MSDOS]:
Use 'status' local to record status.
(child_setup): Return CHILD_SETUP_TYPE.
* src/data.c, src/lisp.h (wrong_type_argument): Return void.
All callers changed.
* src/lisp.h (CHILD_SETUP_TYPE): New macro.