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'.
New commands: find-library-other-window, find-library-other-frame
* lisp/emacs-lisp/find-func.el (find-library-other-window)
(find-library-other-frame): New commands to complement the
existing 'find-library' command. (Bug#26712)
(read-library-name): New function to read a library name.
* etc/NEWS: Mention 'find-library-other-window' and
'find-library-other-frame'.
Eli Zaretskii [Sat, 20 May 2017 07:32:58 +0000 (10:32 +0300)]
Fix automatic hscrolling of only the current line
* src/xdisp.c (display_line): When hscrolling only the current
line, increment iterator's first_visible_x and last_visible_x
values to account for the hscroll. This propagates the hscroll
effect on the iterator geometry all the way down to the
subroutines called by display_line, and avoids scrolling bugs
under large hscroll values. (Bug#26994)
Paul Eggert [Fri, 19 May 2017 23:05:31 +0000 (16:05 -0700)]
Port --enable-gcc-warnings to clang 3.9.1
* configure.ac (WERROR_CFLAGS): Omit -Wmissing-braces for Clang,
to shut off a false alarm. Problem reportd by Philipp Stephani in:
http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00521.html
* lisp/simple.el (eval-expression-print-maximum-character): New
variable.
(eval-expression-print-format): Only display value as character if
it's less than or equal to `eval-expression-print-maximum-character'.
(eval-expression-get-print-arguments): Check
eval-expression-print-maximum-character, allow negative arg to
override it.
(eval-expression):
* lisp/progmodes/elisp-mode.el (elisp--eval-last-sexp):
(elisp--eval-last-sexp-print-value): Handle new variable.
* doc/emacs/building.texi (Lisp Eval): Document new variable and
behavior.
* etc/NEWS: Announce it.
* test/lisp/progmodes/elisp-mode-tests.el
(eval-last-sexp-print-format-small-int)
(eval-last-sexp-print-format-small-int-echo)
(eval-last-sexp-print-format-large-int)
(eval-last-sexp-print-format-large-int-echo):
* test/lisp/simple-tests.el (eval-expression-print-format-small-int)
(eval-expression-print-format-small-int-echo)
(eval-expression-print-format-large-int)
(eval-expression-print-format-large-int-echo): New tests.
* lisp/simple.el (eval-expression-print-format): Don't check
`standard-output' or `current-prefix-arg'.
(eval-expression-get-print-arguments): New function, centralizes
decision about how to print results of `eval-expression' and
`eval-last-sexp'.
(eval-expression):
* lisp/progmodes/elisp-mode.el (elisp--eval-last-sexp-print-value):
Use it.
Paul Eggert [Fri, 19 May 2017 20:43:03 +0000 (13:43 -0700)]
Check that signed right shift is arithmetic
* src/data.c (ash_lsh_impl): Verify that signed right shift is
arithmetic; if we run across a compiler that uses a logical shift
we’ll need to complicate the code before removing this
compile-time check. Help the compiler do common subexpression
elimination better.
Paul Eggert [Fri, 19 May 2017 17:38:22 +0000 (10:38 -0700)]
Minor .gitignore fixes
* .gitignore: modules/mod-test/Makefile was renamed to
test/data/emacs-module/Makefile.
Omit [0-9]*.core, subsumed by *.core.
test/indent/*.new was renamed to test/manual/indent/*.new.
Add *.swp, for Vim.
Nick Helm [Fri, 19 May 2017 12:20:59 +0000 (15:20 +0300)]
Fix turning off whitespace-mode
* lisp/whitespace.el (whitespace-display-char-on): Correct the way
the original buffer-display-table is saved and restored when
global-whitespace-mode is active. (Bug#26892)
* test/lisp/whitespace-tests.el
(whitespace-tests-whitespace-mode-on): New function.
(whitespace-tests-display-tables): New test.
Michael Albinus [Fri, 19 May 2017 11:57:36 +0000 (13:57 +0200)]
Minor tweaks in tramp-tests.el
* test/lisp/net/tramp-tests.el (tramp--test-afp-or-smb-p): New defun.
(tramp-test05-expand-file-name-relative): Use it.
(tramp-test38-unload): Run only in batch mode.
Philipp Stephani [Fri, 19 May 2017 11:26:29 +0000 (13:26 +0200)]
Fix module tests on some systems
If dladdr(3) isn't available or didn't work, the printed
representation of a module function will not include the file name,
but only the address. Make the tests pass in that case.
* test/src/emacs-module-tests.el (module-function-object): Fix match for
module function printed representation
* lisp/emacs-lisp/subr-x.el (string-trim-left, string-trim-right)
(string-trim): Add optional args that serve as defaults per the
original behavior. (Bug#26908)
Eli Zaretskii [Fri, 19 May 2017 08:51:16 +0000 (11:51 +0300)]
Support remote editing in emacsclient via Tramp
* lib-src/emacsclient.c (main, decode_options)
(print_help_and_exit, longopts): New option '--tramp' / '-T' which
specifies how emacs should use tramp to find remote files.
* doc/emacs/misc.texi (TCP Emacs server): New subsection describing
the various knobs to tune server.el for TCP opereation.
(emacsclient Options): Reference "TCP Emacs server" from description of
--server-file. Document the new '--tramp' / '-T' options.
* doc/emacs/emacs.texi (Top): Update the top-level menu.
Paul Eggert [Fri, 19 May 2017 07:11:48 +0000 (00:11 -0700)]
Attempt to work around macOS vfork bug
Problem reported by YAMAMOTO Mitsuharu in:
http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00342.html
This is related to the fix for Bug#26397.
* src/callproc.c (call_process_cleanup, call_process) [!MSDOS]:
Report internal error if wait_for_termination fails.
* src/sysdep.c (get_child_status): Return -1 if waitpid is
buggy, instead of aborting.
(wait_for_termination): Return bool success value.
All callers changed.
Paul Eggert [Fri, 19 May 2017 03:40:42 +0000 (20:40 -0700)]
Fix DARWIN_OS_CASE_SENSITIVE_FIXME==2 false alarm
* src/fileio.c (file_name_case_insensitive_p):
Don’t compile the (DARWIN_OS_CASE_SENSITIVE_FIXME == 2)
code unless DARWIN_OS_CASE_SENSITIVE_FIXME is 2.
Problem reported by Philipp Stephani in:
http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00495.html
Paul Eggert [Fri, 19 May 2017 03:27:11 +0000 (20:27 -0700)]
Port --enable-gcc-warnings to clang 3.9.1
* configure.ac (WERROR_CFLAGS): Omit -Wdouble-promotion if clang.
Problem reported by Philipp Stephani in:
http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00495.html
Paul Eggert [Fri, 19 May 2017 03:02:42 +0000 (20:02 -0700)]
Clean up compiler warning in emacs-module.c
* src/emacs-module.c (MODULE_SETJMP_1): Use the local var
instead of leaving it unused, to pacify picky compilers.
(module_reset_handlerlist): Now takes a dummy pointer to a struct
handler *, instead of a dummy pointer to an int. All uses changed.
Eli Zaretskii [Thu, 18 May 2017 20:18:29 +0000 (23:18 +0300)]
Support hscrolling only the current line
* src/xdisp.c (hscrolling_current_line_p): New function.
(init_iterator): If auto-hscrolling just the current line, don't
increment the iterator's first_visible_x and last_visible_x
variables.
(hscroll_window_tree): Recompute window's hscroll when moving
vertically to another screen line.
(redisplay_window): If we are hscrolling only the current line,
disable the optimizations that rely on the current matrix being
up-to-date.
(display_line): Accept an additional argument CURSOR_VPOS, the
vertical position of the current screen line which might need
hscrolling; all callers changed. Compute first_visible_x and
last_visible_x specially when auto-hscrolling current line, by
repeating the calculation that is done in init_iterator in other
modes.
(syms_of_xdisp) <auto-hscroll-mode>: No longer boolean, it can now
accept a 3rd value 'current-line, to turn on the mode where
only the current line is hscrolled.
* etc/NEWS: Mention the new auto-hscroll-mode value.
Eli Zaretskii [Thu, 18 May 2017 19:54:35 +0000 (22:54 +0300)]
Fix last change in line-move-finish
* lisp/simple.el (line-move-finish): Fix last change. This corrects a
regression in C-n and C-p when lines are truncated, introduced by the
change in 2017-05-10.
Tino Calancha [Thu, 18 May 2017 05:47:06 +0000 (14:47 +0900)]
Use the expression angle units while simplifying it
Don't use the angle mode, use the angle units included
in the expression instead (Bug#23889).
* lisp/calc/calc-alg.el (calc-input-angle-units): New defun.
(math-simplify): Use it.
* lisp/calc/calc-forms.el (math-to-hms, math-from-hms):
Don't use calc-angle-mode if math-simplifying-units is non-nil.
* lisp/calc/calc-math.el (calcFunc-nroot, math-from-radians)
(math-to-radians-2, math-from-radians-2): Don't convert angle
to radians if math-simplifying-units is non-nil.
* test/lisp/calc/calc-tests.el (test-calc-23889): Add test.
Paul Eggert [Wed, 17 May 2017 20:35:52 +0000 (13:35 -0700)]
Avoid undefined behavior in struct sockaddr
Problem noted by Philipp Stephani in:
http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00391.html
* src/conf_post.h (ATTRIBUTE_MAY_ALIAS, DECLARE_POINTER_ALIAS):
New macros.
* src/process.c (conv_sockaddr_to_lisp, conv_lisp_to_sockaddr)
(connect_network_socket, network_interface_info)
(server_accept_connection): Use it when aliasing non-char objects.
Stefan Monnier [Wed, 17 May 2017 19:44:36 +0000 (15:44 -0400)]
* lisp/vc/smerge-mode.el (smerge-refine-regions): Work in multi-bufs
Rename from smerge-refine-subst. Allow the `beg's to be markers.
Add autoload cookie.
(smerge--refine-forward): Rename from smerge-refine-forward.
(smerge--refine-chopup-region): Rename from smerge-refine-chopup-region.
Assume that its `beg` arg is a marker.
(smerge--refine-highlight-change): Rename from
smerge-refine-highlight-change. Remove `buf` arg.
(smerge-refine-subst): Redefine as an obsolete alias.
Paul Eggert [Wed, 17 May 2017 17:58:11 +0000 (10:58 -0700)]
Work around AddressSanitizer bug with vfork
Problem reported by Jim Meyering in:
http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00246.html
* src/conf_post.h (vfork) [ADDRESS_SANITIZER]: Define to fork.
Unfortunately with the AddressSanitizer in Fedora 25 x86-64, the
vforked child messes up the parent’s shadow memory. This is too
bad, as we’d rather have AddressSanitizer catch memory-access bugs
related to vfork.
Paul Eggert [Wed, 17 May 2017 17:27:31 +0000 (10:27 -0700)]
Catch IPv4/IPv6 issues at compile time
* src/process.c (connect_network_socket): Use verify,
not eassert, so that any problems are caught at compile-time.
Avoid dodgy cast by using a local var of the correct type.