Ken Brown [Fri, 12 Jan 2018 13:51:16 +0000 (08:51 -0500)]
Add battery support to all Cygwin builds
It already exists in the Cygwin-w32 build.
* src/w32fns.c (Fw32_battery_status): Move to...
* src/w32cygwinx: New file, to be used for functions common to
the MS Windows and Cygwin builds.
(syms_of_w32cygwinx): New function.
* src/lisp.h: Add prototype of syms_of_w32cygwinx.
* src/emacs.c (main) [HAVE_NTGUI or CYGWIN]: Call syms_of_w32cygwinx.
* src/Makefile.in (SOME_MACHINE_OBJECTS):
* configure.ac (W32_OBJ) [HAVE_W32]: Add w32cygwinx.o.
(W32_LIBS) [CYGWIN]: Set equal to "-lkernel32" in non-w32 build.
(W32_OBJ) [CYGWIN]: Set equal to "w32cygwinx.o" in non-w32 build.
* etc/NEWS: Document the new battery support.
Michael Albinus [Sat, 13 Jan 2018 16:48:10 +0000 (17:48 +0100)]
Fix Bug#29149 in shell.el
* lisp/shell.el (shell): Change order of `file-local-name' and
`expand-file-name' calls. Otherwise, the local file name
would be extended by a drive letter, even when it is a remote
file, seen from w32. (Bug#29149)
Michael Albinus [Sat, 13 Jan 2018 11:07:28 +0000 (12:07 +0100)]
Improve Tramp robustness
* lisp/net/tramp.el (tramp-message, tramp-process-actions)
(tramp-read-passwd, tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-process-sentinel)
(tramp-sh-handle-file-notify-add-watch)
(tramp-barf-if-no-shell-prompt, tramp-maybe-open-connection)
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection): Use process property rather
than connection property "vector".
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
Fix scoping error. Let error traces use process buffer.
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
Move "inotifywait" up. GVFS based monitoring is not stable.
Let error traces use process buffer.
(tramp-sh-gvfs-monitor-dir-process-filter): Check more error
messages.
(tramp-get-remote-gvfs-monitor-dir): Search also for "gio".
* lisp/net/tramp.el (tramp-get-debug-buffer):
Use `special-mode-map' as parent map in debug buffer.
(tramp-message): Ensure, that proper process buffer is dumped
in error case.
Stefan Monnier [Sat, 13 Jan 2018 04:37:06 +0000 (23:37 -0500)]
* src/keyboard.c: Consolidate code into make_lispy_event
(clear_event): Change arg type. Adjust callers.
(kbd_buffer_get_event): Move most special event handling to
make_lispy_event.
(make_lispy_event): Add missing cases, taken from kbd_buffer_get_event.
<SAVE_SESSION_EVENT>: Change return value to match what used to be built
in kbd_buffer_get_event.
Alan Mackenzie [Fri, 12 Jan 2018 16:31:35 +0000 (16:31 +0000)]
Make Fzlib_decompress_region always call the change hooks in a balanced way.
This means there will be exactly one call of each of before- and
after-change-functions, regardless of whether or not the decompression
succeeds, and these calls will refer to corresponding buffer regions.
src/decompress.c (struct decompress_unwind_data): add a new field, orig.
(unwind_decompress): Use del_range_2 and update_compositions in place of
del_range, to avoid unwanted change hook calls. Call signal_after_change for
the failed case.
(Fzlib_decompress_region): Call modify_txt for a before-change-functions. Set
the new field orig of unwind_data to the region's start. Use del_range_2 and
update_compositions in place of del_range to avoid unwanted change hook
calls. Call signal_after_change for the successful case.
Ken Brown [Thu, 11 Jan 2018 16:40:37 +0000 (11:40 -0500)]
Unbreak the Cygwin-w32 build
* src/keyboard.c (input_polling_used) [CYGWIN]: Restore. This was
removed on Cygwin in the commit "On non-MS-Windows, omit unnecessary
polling functions". But it is used in w32fns.c:x_make_frame_visible
in the Cygwin-w32 build.
Stefan Monnier [Thu, 11 Jan 2018 16:56:43 +0000 (11:56 -0500)]
* lisp/mail/smtpmail.el: Use lexical-binding and cl-generic
(smtpmail-auth-supported): Mark it as non-constant.
(smtpmail-try-auth-methods): Remove unused var 'ret'.
Test non-nullness of mech user and password before calling
smtpmail-try-auth-method.
(smtpmail-try-auth-method): Make it into a generic function.
(smtpmail-via-smtp): Remove unused var 'response-code'.
Stefan Monnier [Wed, 10 Jan 2018 16:45:33 +0000 (11:45 -0500)]
* lisp/calendar/appt.el: Use lexical-binding
(appt-display-message): Remove unused variable 'err'.
(appt-check): Fix typo in search for a function on a hook.
(number, original-date): Move declaration into 'appt-make-list'.
Tino Calancha [Mon, 8 Jan 2018 10:11:20 +0000 (19:11 +0900)]
cl-loop: Add missing guard condition
Consider the expansion of `cl-loop' with a `for' clause and more
than one internal variables, X, Y, processed in parallel.
Each step updates X and Y right after update the loop variable, K; if
either X or Y depend on K, then some forms of the body are
evaluated with the wrong K (Bug#29799).
For instance, consider the following code:
(cl-loop for k below 2
for x = (progn (message "k = %d" k) 1)
and y = 1)
This code should show in *Messages*:
k = 0
k = 1
Instead, the code shows:
k = 0
k = 1
k = 2
To prevent this we must ensure that the loop condition is still
satisfied right after update the loop variable.
In the macro expansion of the example above, right after:
(setq k (+ k 1))
evaluate the rest of the body forms iif the condition
(< k 2)
is still valid.
* lisp/emacs-lisp/cl-macs.el (cl--loop-guard-cond): New variable.
(cl--parse-loop-clause): Set it non-nil if the loop contains
a for/as clause.
(cl-loop): After update the loop variable, evaluate the remaining of
the body forms just if the loop condition is still valid (Bug#29799).
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-for-as-equals-and):
New test.
Michael Albinus [Sun, 7 Jan 2018 17:50:06 +0000 (18:50 +0100)]
Make tramp-tests.el more robust on w32
* test/lisp/net/tramp-tests.el (tramp-test21-file-links):
Do not call `make-symbolic-link' on w32.
(tramp-test36-find-backup-file-name): Call also
`convert-standard-filename' due to w32.
(tramp--test-windows-nt): New defun.
(tramp-test42-auto-load, tramp-test42-delay-load)
(tramp-test42-recursive-load, tramp-test42-remote-load-path):
Quote command due to w32.
Philipp Stephani [Sun, 31 Dec 2017 16:43:43 +0000 (17:43 +0100)]
Ignore escape characters for context-sensitive quotes (Bug#29812)
* lisp/electric.el (electric-quote-post-self-insert-function): Skip
over escape characters when determining whether a context-sensitive
quote should be opening or closing.
* test/lisp/electric-tests.el
(electric-quote-replace-double-escaped-open)
(electric-quote-replace-double-escaped-close): New unit tests.
Philipp Stephani [Sun, 31 Dec 2017 17:05:03 +0000 (18:05 +0100)]
Fix a small bug in electric quoting.
Before this commit, if 'electric-quote-replace-double' is non-nil,
typing " '" turned into " ‘" even if
'electric-quote-context-sensitive' was nil.
* lisp/electric.el (electric-quote-post-self-insert-function): Insert
context-sensitive double quote only if the last character is actually
a double quote character.
* test/lisp/electric-tests.el
(electric-quote-replace-double-no-context-single): New unit test.
Philipp Stephani [Thu, 21 Dec 2017 17:25:49 +0000 (18:25 +0100)]
Prevent name clashes between CL structures and builtin types
* lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Don't allow
structures with the same names as builtin types.
(cl--struct-name-p): New helper function.
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Don't allow structures
with the same names as builtin types.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-defstruct/builtin-type):
* test/lisp/emacs-lisp/cl-preloaded-tests.el
(cl-struct-define/builtin-type): New unit tests.
Tak Kunihiro [Sun, 7 Jan 2018 07:17:09 +0000 (09:17 +0200)]
Make pixel-wise scrolling less laggy
* lisp/pixel-scroll.el (pixel-dead-time, pixel-last-scroll-time):
New variables.
(pixel-scroll-up, pixel-scroll-down): Invoke 'scroll-up' or
'scroll-down' when called within 'pixel-dead-time'. (Bug#29737)
Noam Postavsky [Sun, 7 Jan 2018 02:16:33 +0000 (21:16 -0500)]
Revert "Fix command repetition with lexical-binding (Bug#29334)"
It does not work with more complicated interactive forms, because
byte-compile-lambda actually receives an intermediate form of code
rather than valid lisp source (Bug#29988).
* src/callint.c (Fcall_interactively):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lambda): Revert previous
change, and update commentary.
Alan Third [Wed, 3 Jan 2018 13:45:03 +0000 (13:45 +0000)]
Fix child frame placement issues (bug#29953)
* src/nsterm.h (NS_PARENT_WINDOW_LEFT_POS):
(NS_PARENT_WINDOW_TOP_POS): Get the parent frame through the frame
struct as invisible child windows are detached from their parents in
NS.
* src/nsterm.m (x_set_offset): Offscreen frames have `nil' screen
value, so handle that gracefully. Child frames with negative left and
top should be positioned relative to the bottom right of the parent
frame.
Alan Third [Sat, 23 Dec 2017 11:00:35 +0000 (11:00 +0000)]
Allow setting tooltip colors in NS port
* src/nsfns.m (Fx_show_tip): Get face colors and apply them to the
tooltip.
* src/nsmenu.m (EmacsTooltip::setBackgroundColor):
(EmacsTooltip::setForegroundColor): New functions.
* src/nsterm.h (EmacsTooltip::setBackgroundColor):
(EmacsTooltip::setForegroundColor): New function prototypes.
Alan Mackenzie [Sat, 6 Jan 2018 20:15:04 +0000 (20:15 +0000)]
Make transpose-regions invoke before-change-functions only once.
In the case of two non-contiguous regions the same size, transpose-regions has
been calling before-change-functions twice, once for each region. It now
calls it just once, for the minimal region spanning both single regions.
* src/editfns.c (Ftranspose_regions): Combine two calls of modify_text into
one.
Alan Mackenzie [Sat, 6 Jan 2018 18:55:08 +0000 (18:55 +0000)]
Describe the precise interaction of complex primitives with the change hooks
* doc/lispref/text.texi (Change Hooks): Document that most buffer changing
primitives call before- and after-change-functions in balanced pairs, but that
some complex primitives call b-c-f once, and a-c-f zero, one, or several
times.
Alan Mackenzie [Sat, 6 Jan 2018 11:48:32 +0000 (11:48 +0000)]
Fix mark-defun when there's no spaces between successive defuns.
The problem was a parse-partial-sexp call which tried to use the STOPBEFORE
argument to detect non-syntactic WS. This fails on a "}", which does not
begin a sexp.
* lisp/emacs-lisp/lisp.h (beginning-of-defun--in-emptyish-line-p): Enhance to
handle BOL being in a string.
(beginning-of-defun-comments): Call the above function in place of the call
to parse-partial-sexp.
Eli Zaretskii [Sat, 6 Jan 2018 08:56:21 +0000 (10:56 +0200)]
Fix Dired display and operations on file names with raw bytes
* src/coding.c (decode_coding): When flushing remaining raw bytes
from multibyte text, copy 2-byte forms of eight-bit-*
characters as single characters, not as 2 raw bytes. (Bug#29189)
Michael Albinus [Fri, 5 Jan 2018 20:04:39 +0000 (21:04 +0100)]
Add new Tramp connection method "owncloud"
* doc/misc/tramp.texi (all): Use @acronym{GNOME} thoroughly.
(Using GNOME Online Accounts based methods): Rename from
"Using Google Drive". Add `owncloud'.
(GVFS based methods): Add `owncloud'.
* lisp/net/tramp-gvfs.el (tramp-gvfs-methods): Add "owncloud".
Remove goa methods if not supported.
(tramp-goa-methods, tramp-goa-service, tramp-goa-path)
(tramp-goa-path-accounts, tramp-goa-interface-documents)
(tramp-goa-interface-printers, tramp-goa-interface-files)
(tramp-goa-interface-contacts, tramp-goa-interface-calendar)
(tramp-goa-interface-oauth2based)
(tramp-goa-interface-account, tramp-goa-identity-regexp)
(tramp-goa-interface-mail, tramp-goa-interface-chat)
(tramp-goa-interface-photos, tramp-goa-path-manager)
(tramp-goa-interface-documents)
(tramp-gvfs-owncloud-default-prefix)
(tramp-gvfs-owncloud-default-prefix-regexp): New defconst.
(tramp-goa-name): New defstruct.
(tramp-gvfs-stringify-dbus-message): Handle all consp messages.
(tramp-dbus-function, tramp-gvfs-get-remote-prefix)
(tramp-get-goa-accounts): New defun.
(with-tramp-dbus-call-method): Use it.
(with-tramp-dbus-get-all-properties): New defmacro.
(tramp-gvfs-url-file-name)
(tramp-gvfs-handler-mounted-unmounted)
(tramp-gvfs-connection-mounted-p, tramp-gvfs-mount-spec):
Map between "owncloud" and "davs".
(tramp-gvfs-maybe-open-connection): Set "vector" connection property.
* test/lisp/net/tramp-tests.el (tramp-gvfs-handler-askquestion):
Suppress run in tests.
(tramp--test-owncloud-p): New defun.
(tramp-test11-copy-file, tramp-test12-rename-file): Use it.
Jay Kamat [Fri, 22 Dec 2017 23:34:44 +0000 (15:34 -0800)]
Make eshell history expansion more like bash (Bug#29821)
- Prevent expansion of quick substitutions when the initial "^" is not
at start of line (Bug#29157).
- Allow spaces inside substitutions, so "^foo bar^baz" works.
- Allow trailing characters after substitution, so "^foo^bar^trailing"
works.
- Throw an error when substitution does not match.
* lisp/eshell/em-hist.el (eshell-expand-history-references): Expand
history substitution before other types of expansions, and expand them
with the whole line.
(eshell-history-substitution): New function to expand only
substitutions, taking in the entire typed line rather than individual
arguments.
Eli Zaretskii [Fri, 5 Jan 2018 09:22:27 +0000 (11:22 +0200)]
Fix failures in smerge-mode on MS-Windows
* lisp/vc/smerge-mode.el (smerge--refine-chopup-region): Use
utf-8-emacs-unix, not emacs-internal, to make the forced EOL
convention explicit.
(smerge-refine-regions): Use utf-8-emacs instead of
emacs-internal, to allow decoding of non-Unix EOL conventions.
(Bug#29916)
Noam Postavsky [Fri, 24 Nov 2017 02:57:09 +0000 (21:57 -0500)]
Fix command repetition with lexical-binding (Bug#29334)
`call-interactively' relies on analyzing the source of `interactive'
forms in order to preserve arguments like (region-end) in the command
history, rather than just storing the resulting position. However,
the byte-compiler does not preserve the source of the interactive form
when lexical-binding is in effect, because `call-interactively' would
evaluate the form with dynamic binding in that case.
To fix this, change `call-interactively' so that it checks compiled
functions for lexical-binding as well. Then the byte-compiler can
preserve the source of interactive forms regardless of the value of
lexical-binding.
* src/callint.c (Fcall_interactively): Functions compiled with
lexical-binding have their arglist encoded as an integer, use this to
choose the right kind of binding for compiled functions too.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lambda): Preserve the
uncompiled form of the interactive form when lexical-binding is
enabled too.
Paul Eggert [Wed, 3 Jan 2018 06:38:01 +0000 (22:38 -0800)]
Fix .gdbinit to work with Lisp_Word
Problem reported by Stefan Monnier (Bug#29957).
* src/.gdbinit (xgetptr, xgetint, xgettype):
Cast Lisp_Word value to EMACS_INT, since it might be a pointer now.
Noam Postavsky [Tue, 19 Dec 2017 01:30:10 +0000 (20:30 -0500)]
Don't bind dframe events on load (Bug#29599)
* lisp/dframe.el (dframe-setup-hook): New hook.
(dframe-set-special-events): New function, containing previous
top-level key binding code.
(top-level): Add it to dframe-setup-hook.
(dframe-frame-mode): Run the hook.
Ross Donaldson [Mon, 25 Dec 2017 20:51:19 +0000 (12:51 -0800)]
New customization variable for python-mode indentation (Bug#28475)
* lisp/progmodes/python.el (python-indent-def-block-scale): New variable.
(python-indent--calculate-indentation): Let it control how many indent
levels are inserted for multi-line function signatures.
Alan Third [Fri, 22 Dec 2017 12:27:05 +0000 (12:27 +0000)]
Fix menu keyboard shortcuts on macOS (Bug#29595)
* src/nsmenu.m (addItemWithWidgetValue)[NS_IMPL_COCOA]: It looks like
macOS 10.13 no longer ignores long modifier strings, so explicitly use
an empty string.
Paul Eggert [Mon, 1 Jan 2018 09:13:04 +0000 (01:13 -0800)]
Merge from origin/emacs-26
63b04c11d5 Fix copyright years by hand 5c7dd8a783 Update copyright year to 2018 220a9ecba1 Merge from Gnulib 312c565566 Don't add empty keyboard macro to macro ring (Bug#24992) 39ca289a7a Allow customization of decoding of "man" command f8240815ea * etc/NEWS: Add security consideration note on passphrase ... 0c78822c70 Fix subtle problem with scroll-down when scroll-margin is ... acd289c5a4 Fix problems with indexing in User manual b240c7846b * lisp/help.el (describe-key): Only (copy-sequence elt) wh... e879a5444a * src/buffer.c (Frestore_buffer_modified_p): Fix bug#29846 81b1028b63 Improve documentation of 'inhibit-modification-hooks' and ... 7175496d7a Fix doc string of 'enable-recursive-minibuffers' 5b38406491 Fix documentation of delsel and of killing text
Paul Eggert [Mon, 1 Jan 2018 01:19:57 +0000 (01:19 +0000)]
Merge from Gnulib
This incorporates:
2018-01-01 maint: Run 'make update-copyright'
2017-12-29 Add cross-compilation results for GNU/Hurd.
2017-12-12 explicit_bzero: port to macOS + Clang 9.0.0
Eli Zaretskii [Sun, 31 Dec 2017 16:20:12 +0000 (18:20 +0200)]
Allow customization of decoding of "man" command
* lisp/man.el (Man-coding-system): New defcustom.
(Man-start-calling): Use it, and also pay attention to user
overriding coding-system-for-read. (Bug#29872)
Philipp Stephani [Sat, 23 Dec 2017 16:56:36 +0000 (17:56 +0100)]
Improve error reporting when serializing non-Unicode strings to JSON
* src/coding.c (utf8_string_p): New helper function.
(syms_of_coding) <utf-8-unix>: Move from json.c.
* src/json.c (json_check_utf8): New helper function.
(lisp_to_json_toplevel_1, lisp_to_json): Use it. To save a bit of
time, check for invalid UTF-8 strings only after encountering an
error, since Jansson already rejects them.
Eli Zaretskii [Fri, 29 Dec 2017 21:41:20 +0000 (23:41 +0200)]
Fix subtle problem with scroll-down when scroll-margin is nonzero
* src/window.c (window_scroll_pixel_based): Account for
scroll-margin when scrolling down, i.e. moving window-start
towards the beginning of the buffer. Reported by zhang cc
<ccsmile2008@outlook.com> in
http://lists.gnu.org/archive/html/emacs-devel/2017-12/msg00894.html.