Michael Albinus [Sun, 28 May 2017 21:44:10 +0000 (23:44 +0200)]
Some tweaks, almost all for Tramp adb method
* lisp/net/tramp-adb.el (tramp-adb-parse-device-names):
Use `make-tramp-file-name'.
(tramp-adb-get-device): Use `tramp-file-name-port-or-default'.
(tramp-adb-maybe-open-connection): Set "prompt" property.
(tramp-adb-wait-for-output): Use it.
* lisp/net/tramp-cache.el (tramp-cache-print): Use `elt'.
(tramp-dump-connection-properties): Check also that there are
properties to be saved. Don't save "started" property of
"ftp" method.
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name):
Use `make-tramp-file-name'.
* lisp/net/tramp.el (tramp-remote-file-name-spec-regexp):
Host could be empty.
(tramp-file-name-port-or-default): New defun.
(tramp-dissect-file-name): Simplify `make-tramp-file-name' call.
(tramp-handle-file-name-case-insensitive-p): Use a progress reporter.
(tramp-call-process, tramp-call-process-region):
Use `make-tramp-file-name'.
* test/lisp/net/tramp-tests.el (tramp-test03-file-name-defaults):
Revert change from 2017-05-24.
(tramp-test05-expand-file-name-relative): Let it also pass for
"adb" method.
Jürgen Hötzel [Sun, 28 May 2017 11:06:53 +0000 (13:06 +0200)]
Fix Tramp for Android 7
* tramp-adb.el (tramp-adb-ls-toolbox-regexp):
Username part of prompt is empty on Android 7.
(tramp-adb-ls-toolbox-regexp):
Ignore addition links column on Android 7.
(tramp-adb-get-ls-command):
Dont use --color=none when using toybox (Android 7). It's not
possible to disable coloring explicitly for toybox ls.
Paul Eggert [Sat, 27 May 2017 17:54:25 +0000 (10:54 -0700)]
Depromiscuify inotify with IN_MASK_ADD
Use IN_MASK_ADD instead of using a no-longer-promiscuous-enough
mask. This simplifies the code and restores the ability to
use IN_ACCESS, IN_CLOSE_WRITE, IN_CLOSE_NOWRITE, and IN_OPEN
in some cases (Bug#26973).
* src/inotify.c (INOTIFY_DEFAULT_MASK): Remove.
(Finotify_add_watch): Use IN_MASK_ADD instead.
Paul Eggert [Sat, 27 May 2017 17:54:25 +0000 (10:54 -0700)]
Restore inotify onlydir support
There was no need to remove it in the 2017-03-26 inotify change,
as it is like IN_DONT_FOLLOW and does not affect other watchers
for the same file.
* src/inotify.c (symbol_to_inotifymask, Finotify_add_watch)
(syms_of_inotify): Bring back onlydir.
Paul Eggert [Sat, 27 May 2017 17:54:25 +0000 (10:54 -0700)]
Simplify computation of inotify mask
* src/inotify.c (add_watch): Accept uint32_t imask instead
of Lisp_Object aspect. Caller changed.
(Finotify_add_watch): Use aspect_to_inotifymask earlier, to
simplify the code.
Philipp Stephani [Sat, 27 May 2017 12:39:01 +0000 (14:39 +0200)]
Don't attempt to recover from undefined behavior in some cases
These functions can only be run in batch mode and exit Emacs on
return, so nothing can be recovered. Disable unsafe recover
mechanisms so that we get real failures and good stack traces on
fatal signals.
* lisp/emacs-lisp/bytecomp.el (batch-byte-compile)
(batch-byte-recompile-directory):
* lisp/emacs-lisp/ert.el (ert-run-tests-batch-and-exit)
(ert-summarize-tests-batch-and-exit): Don't attempt to recover
from undefined behavior.
Philipp Stephani [Sat, 27 May 2017 13:26:49 +0000 (15:26 +0200)]
Avoid another compiler warning on macOS
When configured with --without-ns, HAVE_NS is not defined on macOS,
thus 'memory-limit' calls the deprecated sbrk(2) function. Avoid that
by using the pre-defined __APPLE__ preprocessor macro.
* src/alloc.c (Fmemory_limit): Never use sbrk(2) on macOS.
Luke Yen-Xun Lee [Sat, 27 May 2017 13:25:02 +0000 (16:25 +0300)]
Fix ruler-mode text-scaling issues
* lisp/ruler-mode.el (ruler-mode-text-scaled-width): New function
for computing scaled text width.
(ruler-mode-text-scaled-window-hscroll)
(ruler-mode-text-scaled-window-width): Compute text scaled
`window-width' value.
(ruler-mode-mouse-grab-any-column, ruler-mode-mouse-add-tab-stop)
(ruler-mode-ruler): Change `window-hscroll' into
`ruler-mode-text-scaled-window-hscroll', and change `window-width'
into `ruler-mode-text-scaled-window-width'.
* doc/lispref/display.texi (Fringe Size/Pos, Scroll Bars)
(Display Margins): Mention that `set-window-buffer' may override
settings made by `set-window-fringes', `set-window-scroll-bars'
and `set-window-margins'.
* doc/lispref/windows.texi (Buffers and Windows): Fix doc of
`set-window-buffer'.
Tak Kunihiro [Sat, 27 May 2017 11:57:11 +0000 (14:57 +0300)]
Support drag and drop of region by mouse (Bug#26725)
* doc/emacs/frames.texi (Drag and Drop): Document support of drag
and drop region by mouse.
* lisp/mouse.el (mouse-drag-region): Call mouse-drag-and-drop-region
when start-event is on region.
(mouse-drag-and-drop-region): New function, moves the region by
(mouse-drag-and-drop-region): New defcustom.
* etc/NEWS: Mention mouse-drag-and-drop-region.
Andreas Politz [Fri, 26 May 2017 14:42:43 +0000 (16:42 +0200)]
Fix Bug#26973
* src/inotify.c (INOTIFY_DEFAULT_MASK): Removing ACCESS, OPEN
and CLOSE events on order do let other processes also reading
from their descriptors. (Bug#26973).
Tino Calancha [Fri, 26 May 2017 01:59:19 +0000 (10:59 +0900)]
test-calc-23889: Skip test on 32-bit platforms
This test fails on some 32-bit platforms as mentioned in
https://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00737.html
* test/lisp/calc/calc-tests.el (test-calc-23889): Skip when
the Lisp integer is not big enough.
Alex Harsanyi [Wed, 24 May 2017 18:18:39 +0000 (14:18 -0400)]
Remove cl dependency in soap-client.el and soap-inspect.el
* lisp/net/soap-inspect.el: Replace cl library with cl-lib, case
with cl-case, destructuring-bind with cl-destructuring-bind and
loop with cl-loop.
* lisp/net/soap-client.el: Replace cl library with cl-lib,
defstruct with cl-defstruct, assert with cl-assert, case with
cl-case, ecase with cl-ecase, loop with cl-loop and
destructuring-bind with cl-destructuring-bind.
Co-authored-by: Stefan Monnier <monnier@iro.umontreal.ca>
Michael Albinus [Thu, 25 May 2017 08:04:12 +0000 (10:04 +0200)]
Switch Tramp to cl-lib
* lisp/net/tramp-compat.el (cl-lib): Require it rather than cl.
* lisp/net/tramp-ftp.el: Don't require cl.
* lisp/net/tramp-gvfs.el: Don't require cl.
(tramp-gvfs-handler-mounted-unmounted)
(tramp-gvfs-connection-mounted-p): Use `cl-*' macros.
* lisp/net/tramp-sh.el: Don't require cl.
(tramp-set-file-uid-gid): Use `shell-quote-argument'.
(tramp-sh-gvfs-monitor-dir-process-filter)
(tramp-sh-inotifywait-process-filter): Use `cl-*' macros.
* lisp/net/tramp-smb.el: Don't require cl.
(tramp-smb-read-file-entry): Use `cl-*' macros.
* lisp/net/tramp.el (cl-lib): Require it rather than cl.
(tramp-parse-file, tramp-parse-shostkeys-sknownhosts)
(tramp-parse-passwd, tramp-parse-etc-group)
(tramp-parse-putty): Use `cl-*' macros.
Michael Albinus [Wed, 24 May 2017 14:17:59 +0000 (16:17 +0200)]
Adapt tramp-tests.el according to new defstruct
* test/lisp/net/tramp-tests.el (tramp-test03-file-name-defaults):
Fix test according to new defstruct.
(tramp-test29-environment-variables-and-port-numbers):
Expect it now as passed. Cleanup at the end.
Stephen Berman [Wed, 24 May 2017 11:33:27 +0000 (13:33 +0200)]
Fix and improve UI of scroll bar menu (bug#27047)
In addition, since the Emacs manual writes "scroll bar", "tool
bar" and "menu bar", use this convention in the Show/Hide menues
and tooltips as well.
* lisp/menu-bar.el (menu-bar-showhide-scroll-bar-menu): Make
pressing a radio button in the menu actually show that it was
pressed. Replace the two radio buttons to turn the horizontal
scroll bar on and off with a single check-box toggle and add a
separator between this and the vertical scroll bar radio
buttons. Use conventional spelling.
(menu-bar-horizontal-scroll-bar)
(menu-bar-no-horizontal-scroll-bar): Remove, since now unused.
(menu-bar-showhide-tool-bar-menu, menu-bar-showhide-menu)
(menu-bar-mode): Use conventional spelling.
Tino Calancha [Wed, 24 May 2017 01:54:48 +0000 (10:54 +0900)]
Fix concatenation of "^" with diff-file-junk-re
This regexp contains "\\|", thus a concatenation
of "^" with it just matches the beginning of line for the
first alternative in diff-file-junk-re.
* lisp/vc/ediff-ptch.el (ediff-map-patch-buffer): Concat "^" with
diff-file-junk-re wrapped in a shy group.
This converts IPv6 addresses to a format suitable for
reverse lookup zone files. (Bug#26820)
* lisp/textmodes/dns-mode.el (dns-mode-map, dns-mode-menu):
Add dns-mode-ipv6-to-nibbles.
(dns-mode-ipv6-to-nibbles, dns-mode-reverse-and-expand-ipv6):
New functions.
* test/lisp/dns-mode-tests.el: New file.
; * etc/NEWS: Mention this.
Wilfred Hughes [Tue, 23 May 2017 17:48:19 +0000 (18:48 +0100)]
Don't treat ' as a string delimiter in RPM spec files
' is commonly used as an apostrophe in the prose sections of spec
files, which was erroneously highlighted as strings. See for example
http://kmymoney2.sourceforge.net/phb/rpm-example.html
* lisp/progmodes/sh-script.el (sh-mode-syntax-table): Treat ' as
punctuation in RPM spec files.
Alan Third [Tue, 23 May 2017 09:42:20 +0000 (02:42 -0700)]
Fix GNUstep build
* src/nsterm.h [NS_IMPL_GNUSTEP]: Add typedefs for Cocoa-only types.
(NSWindowStyleMaskUtilityWindow): #define to NSUtilityWindowMask in
GNUstep and old versions of macOS.
* src/nsfns.m (ns-set-mouse-absolute-pixel-position): Function only
works in cocoa, not GNUstep.
Dima Kogan [Tue, 24 Mar 2015 19:53:08 +0000 (12:53 -0700)]
Make ff-find-other-file symmetric for C++ (Bug#20192)
`cc-other-file-alist' has a mapping of file extensions to switch
between headers and sources, but the mappings weren't completely
symmetric. In particular .cpp would map to .hh, but .hh would NOT map
to .cpp.
* lisp/find-file.el (cc-other-file-alist): Map ".hh" and ".h" to all
C++ extensions to make them symmetric with the C++ extensions that map
to them. This lets repeated invocations of `ff-find-other-file'
toggle between all pairs of sources/headers.
Philipp Stephani [Sun, 21 May 2017 20:33:50 +0000 (22:33 +0200)]
Improve module function terminology
Module functions were previously called "function environments" when
the functions created by module_make_functions were lambdas. Now we
can adapt the terminology and rename "function environments" to
"module functions" everywhere. This also removes the name clash
between "function environments" and "module environments."
* src/emacs-module.c (module_make_function): Adapt comment to reality;
stop using "function environment" terminology.
(funcall_module): Stop using "function environment" terminology.
Philipp Stephani [Sat, 20 May 2017 14:55:00 +0000 (16:55 +0200)]
Clean up code around 'ns-list-services'
* src/nsfns.m (Fns_list_services): Remove unreachable code. In this
branch NS_IMPL_COCOA cannot be defined.
(interpret_services_menu): Define only if called to avoid compiler
warnings about unused static functions.
Philipp Stephani [Sat, 20 May 2017 14:49:16 +0000 (16:49 +0200)]
Nextstep: remove some deprecated method calls
* src/nsterm.m (mouseDown:):
* src/nsmenu.m (runMenuAt:forFrame:keymaps:): Remove call to
deprecated method. The return value is always nil.
* src/macfont.m (mac_font_shape_1): Replace call to deprecated method.
Alan Mackenzie [Sun, 21 May 2017 10:16:09 +0000 (10:16 +0000)]
Enhance mode-line percentage offset facility, with "%o" and "%q"
"%o" will display the percentage "travel" of the window through the buffer.
"%q" will display a combination of the percentage offsets of the top and
bottom of the window. The new user option mode-line-percent-position will
facilitate selecting a setting for this part of the mode line.
* lisp/bindings.el (mode-line-percent-position): New customizable user option.
(mode-line-position): Use mode-line-percent-position in place of "%p", etc.
* src/xdisp.c (decode_mode_spec): Add handlers for "%o" and "%q".
* doc/lispref/modes.texi (Mode Line Variables): Document
mode-line-percent-position.
(%-Constructs): Document %o and %q.
* etc/NEWS: Add an entry for these new facilities.
Paul Eggert [Sun, 21 May 2017 08:45:34 +0000 (01:45 -0700)]
Pacify --enable-gcc-warnings without modules
* src/print.c (print_vectorlike): New function, taken from
part of print_object. This one is indented properly, and
pacifies --enable-gcc-warnings by using a default case
instead of listing all the enum values, sometimes
incompletely.
(print_object): Use it.
Paul Eggert [Sun, 21 May 2017 05:55:17 +0000 (22:55 -0700)]
Remove DARWIN_OS_CASE_SENSITIVE_FIXME code
It does not appear to be needed (Bug#24441).
* etc/PROBLEMS: Remove DARWIN_OS_CASE_SENSITIVE_FIXME stuff.
* src/fileio.c (file_name_case_insensitive_p):
Remove DARWIN_OS_CASE_SENSITIVE_FIXME code.
Paul Eggert [Sun, 21 May 2017 05:51:32 +0000 (22:51 -0700)]
Narrow DARWIN_OS_CASE_SENSITIVE_FIXME to 1 choice
* etc/PROBLEMS: Document this (Bug#24441).
* src/fileio.c (file_name_case_insensitive_p): Prefer pathconf
with _PC_CASE_SENSITIVE, if it works, to
DARWIN_OS_CASE_SENSITIVE_FIXME code.
Support just one method for DARWIN_OS_CASE_SENSITIVE_FIXME,
which matches the Apple documentation more precisely.
Tom Tromey [Sun, 21 May 2017 04:01:15 +0000 (22:01 -0600)]
Fix mhtml-mode fontification bug
Bug#26922
* lisp/textmodes/mhtml-mode.el (mhtml-syntax-propertize): Call
sgml-syntax-propertize-inside if not in a submode.
* test/manual/indent/html-multi-4.html: New file.
* lisp/frame.el (ns-set-mouse-absolute-pixel-position): New
function (Lisp).
(set-mouse-absolute-pixel-position): Change it to call
`ns-set-mouse-absolute-pixel-position' on macOS.
* src/nsfns.m (Fns_set_mouse_absolute_pixel_position): New
function.
* src/nsterm.h (NS_PARENT_WINDOW_TOP_POS): Use the primary
screen's height as a base for calculating global coordinates.
* src/nsterm.m (frame_set_mouse_pixel_position): Fix it in macOS.
* test/lisp/mouse-tests.el (bug26816-mouse-frame-movement): Test
movement of mouse relative to frame.
Noam Postavsky [Sat, 20 May 2017 22:09:24 +0000 (18:09 -0400)]
; Set transient-mark-mode to let mark-defun tests pass
The tests fail when transient-mark-mode is not set since 2017-05-12
"Fix Bug#21072 and rework `mark-defun'".
* test/lisp/progmodes/python-tests.el (python-mark-defun-1)
(python-mark-defun-2): Bind 'transient-mark-mode' to t.
Paul Eggert [Sat, 20 May 2017 20:43:19 +0000 (13:43 -0700)]
Minor fixes for arity ranges in emacs modules
* src/emacs-module.c (module_make_function):
Check that arities fit into fixnums, for func-arity’s benefit.
(funcall_module): Avoid unnecessary conversion to EMACS_INT.
(module_function_arity): Allow arities greater than SHRT_MAX.
Philipp Stephani [Sat, 13 May 2017 14:29:40 +0000 (16:29 +0200)]
Reimplement module functions
Instead of a lambda, create a new type containing all data required to
call the function, and support it in the evaluator. Because this type
now also needs to store the function documentation, it is too big for
Lisp_Misc; use a pseudovector instead. That also has the nice benefit
that we don't have to add special support to the garbage collector.
Since the new type is user-visible, give it a predicate.
Now we can easily support 'help-function-args' and 'func-arity'; add
unit tests for these.
* src/lisp.h (allocate_module_function, MODULE_FUNCTIONP)
(XMODULE_FUNCTION): New pseudovector type 'module function'.
* src/eval.c (FUNCTIONP): Also treat module functions as functions.
(funcall_lambda, Ffuncall, eval_sub): Add support for calling module
functions.
(Ffunc_arity): Add support for detecting the arity of module
functions.
* src/emacs-module.c (module_make_function): Adapt to new structure.
Return module function object directly instead of wrapping it in a
lambda; remove FIXME.
(funcall_module): New function to call module functions. Replaces
`internal--module-call' and is called directly from eval.c.
(syms_of_module): Remove internal helper function, which is no longer
needed.
(module_function_arity): New helper function.
* src/data.c (Ftype_of): Adapt to new implementation.
(Fmodule_function_p, syms_of_data): New user-visible function. Now
that module functions are first-class objects, they deserve a
predicate. Define it even if not compiled with --enable-modules so
that Lisp code doesn't have to check for the function's existence.
* src/doc.c (Fdocumentation): Support module functions.
* src/print.c (print_object): Adapt to new implementation.
* src/alloc.c (mark_object): Specialized garbage collector support is
no longer needed.
* lisp/help.el (help-function-arglist): Support module functions.
While there, simplify the arity calculation by using `func-arity',
which does the right thing for all kinds of functions.
* test/data/emacs-module/mod-test.c: Amend docstring so we can test
the argument list.
* test/src/emacs-module-tests.el (mod-test-sum-docstring): Adapt to
new docstring.
(mod-test-non-local-exit-signal-test): Because `internal--module-call'
is gone, the backtrace has changed and no longer leaks the
implementation.
(module--func-arity): New test for `func-arity'.
(module--help-function-arglist): New test for `help-function-arglist'.