Alan Mackenzie [Mon, 27 Jun 2016 11:34:02 +0000 (11:34 +0000)]
Amend a cache so that typing into C++ raw strings has no undue delay.
Also amend the code so that low-level searches to the end of literals are done
only when these positions get used.
* lisp/progmodes/cc-engine.el (c-crosses-statement-barrier-p): Use the new
c-literal-start instead of c-literal-limit.
(c-state-semi-nonlit-pos-cache): Change the structure of this cache, such that
it stores details of the literal at a point, rather than merely points outside
of literals.
(c-state-semi-pp-to-literal, c-state-full-pp-to-literal)
(c-cache-to-parse-ps-state, c-parse-ps-state-to-cache, c-ps-state-cache-pos)
(c-parse-ps-state-below, c-literal-start): New functions.
(c-state-semi-safe-place): Removed.
(c-in-literal): Use c-state-semi-pp-to-literal, so as not to scan to its end.
(c-literal-limits, c-determine-limit-get-base): consequential amendments.
(c-find-decl-spots, c-before-change-check-<>-operators, c-raw-string-pos)
(c-guess-basic-syntax (CASE 2)): Avoid needless scans to end of literals.
* lisp/progmodes/cc-fonts.el (c-font-lock-doc-comments): Avoid needless scans
to end of literals.
* lisp/progmodes/cc-mode.el (c-fl-decl-start): Avoid needless scans to end of
literals.
* lisp/progmodes/cc-cmds.el (c-beginning-of-defun, c-end-of-defun)
(c-defun-name, c-declaration-limits): Avoid needless scans to end of literals.
Paul Eggert [Sun, 26 Jun 2016 21:27:21 +0000 (23:27 +0200)]
Try other addresses when connecting to multihomed
Problem reported by Juliusz Chroboczek (Bug#17976)
and by Artur Malabarba (Bug#23620).
Patch from a suggestion by Andreas Schwab in:
http://bugs.gnu.org/17976#39
This patch is for non-MS-Windows platforms.
I don't know the situation on MS-Windows.
* src/process.c (connecting_status):
New function, for (connect . ADDRINFOS).
(connect_network_socket, check_for_dns, wait_for_socket_fds)
(wait_while_connecting, wait_reading_process_output, status_notify):
Use it.
(decode_status, Fmake_network_process):
Support (connect . ADDRINFOS) status.
(connect_network_socket) [!WINDOWSNT]:
If the connection failed and there are other addresses to try, do not
signal an error; instead, loop around to try the next address.
(wait_reading_process_output): Advance to the next address
if there are multiple addresses and the first remaining address
failed.
* src/process.h (struct Lisp_Process.status): Adjust comment
to describe (connect . ADDRINFOS).
Paul Eggert [Sun, 26 Jun 2016 20:21:49 +0000 (22:21 +0200)]
Fix GNUC_PREREQ for GCC 2.8.1 etc.
Problem reported by Eli Zaretskii in:
http://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00608.html
* src/conf_post.h (GNUC_PREREQ): Port to GCC versions like GCC
2.8.1 (1998), which come before GCC 3.0 and which have nonzero
patchlevel numbers.
Eli Zaretskii [Sun, 26 Jun 2016 16:51:22 +0000 (19:51 +0300)]
Don't set 'bidi-paragraph-direction' in 'ansi-term'
* lisp/term.el (ansi-term): Remove unnecessary setting of
'bidi-paragraph-direction'. The underlying problem is solved in
bidi.c by changing the regexps that define the paragraph beginning
and end. (Bug#20611)
Paul Eggert [Sun, 26 Jun 2016 10:44:39 +0000 (12:44 +0200)]
Fix GNUC_PREREQ off-by-1 typo
Problem reported by Martin Rudalics in:
http://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00587.html
* src/conf_post.h (GNUC_PREREQ) [__GNUC_PATCHLEVEL__]:
Fix < vs <= typo.
Michael Albinus [Sun, 26 Jun 2016 10:30:21 +0000 (12:30 +0200)]
Fix some oddities in Tramp's rsync and smb methods
* lisp/net/tramp-sh.el (tramp-methods) <rsync>: Add "-p" and
"-s" arguments.
(tramp-do-copy-or-rename-file-out-of-band):
Call `file-name-directory' also for remote NEWNAME.
* test/lisp/net/tramp-tests.el (tramp-test15-copy-directory):
Do not skip for tramp-smb.el. Test als COPY-CONTENTS case.
(tramp-test24-file-name-completion): Improve check for
hostname completion.
(tramp--test-rsync-p): New defun.
(tramp-test31-special-characters)
(tramp-test31-special-characters-with-stat)
(tramp-test31-special-characters-with-perl)
(tramp-test31-special-characters-with-ls, tramp-test32-utf8)
(tramp-test32-utf8-with-stat, tramp-test32-utf8-with-perl)
(tramp-test32-utf8-with-ls): Skip for "rsync".
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory):
Check also for CIFS capabilities.
Alan Third [Fri, 17 Jun 2016 23:02:32 +0000 (00:02 +0100)]
Move text line right when in box (bug#23755)
* src/nsterm.m (ns_draw_glyph_string_foreground): Create to take
CHAR_GLYPH specific code and move glyphs right if within a box.
(ns_draw_glyph_string): Move CHAR_GLYPH specific code into above
function.
Mark Oteiza [Sat, 25 Jun 2016 14:31:04 +0000 (10:31 -0400)]
Teach net-utils more iproute2 and nl80211 tools
* lisp/net/net-utils.el (iwconfig-program): Add iw(8).
(iwconfig-program-options): Add "dev" argument for iw. Another useful
option is "phy"; beyond that one needs to know the interface name.
(netstat-program): Add ss(8).
(route-program): Add ip(8).
(route-program-options): Add "route" argument for ip.
Alan Mackenzie [Fri, 24 Jun 2016 16:03:29 +0000 (16:03 +0000)]
Ensure hack-local-variables is run in a fundamental mode buffer.
This fixes bug #23827.
* src/buffer.c (set-buffer-major-mode): Run `fundamental-mode' when the buffer
gets set to that mode, so that `run-mode-hooks', and thus
`hack-local-variables' get run.
Alan Mackenzie [Fri, 24 Jun 2016 13:26:34 +0000 (13:26 +0000)]
Implement ' separators in C++ integer literals.
* lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): insert
c-before-after-change-digit-quote into the C++ value.
(c-before-font-lock-functions): Insert c-depropertize-new-text into the values
for all languages. Insert c-before-after-change-digit-quote into the C++
value.
* lisp/progmodes/cc-mode.el (c-depropertize-CPP): Wrap the function in
c-save-buffer-state.
(c-depropertize-new-text, c-before-after-change-digit-quote): New functions.
Paul Eggert [Fri, 24 Jun 2016 11:49:32 +0000 (13:49 +0200)]
Update from gnulib
This incorporates:
2016-06-24 intprops: port better to GCC 7
2016-06-13 xalloc-oversized: port to GCC 7; fewer warnings
* doc/misc/texinfo.tex, lib/xalloc-oversized.h, lib/intprops.h:
Copy from gnulib.
Paul Eggert [Fri, 24 Jun 2016 00:19:13 +0000 (02:19 +0200)]
Clarify intent of FACE_FROM_ID and IMAGE_FROM_ID
* src/dispextern.h (FACE_OPT_FROM_ID): Don’t use FACE_FROM_ID,
since it is intended to be used only when it returns a non-null
pointer, and here the pointer might be null.
(IMAGE_OPT_FROM_ID): Don’t use IMAGE_FROM_ID, for similar reasons.
Eli Zaretskii [Thu, 23 Jun 2016 19:22:39 +0000 (22:22 +0300)]
Improve results of 'upcase' for characters with title-case
* lisp/international/characters.el (standard-case-table): Swap the
order of some lines, to have 'upcase' return the upper-case
variant, not the title-case, for some characters whose lower-case
map to the same codepoints. (Bug#23833)
Alan Mackenzie [Thu, 23 Jun 2016 16:12:45 +0000 (16:12 +0000)]
Make typing into incomplete C++ raw strings work, and make it work fast enough
* lisp/progmodes/cc-engine.el (c-beginning-of-macro, c-state-pp-to-literal):
Put `save-match-data' around calls to `looking-at' to enable the use of the
match data in higher level functions.
* lisp/progmodes/cc-fonts.el (c-font-lock-declarations)
(c-font-lock-cut-off-declarators): Use `limit' rather than `(point-max)' as a
limit to speed up handling of C++ raw strings.
Eli Zaretskii [Thu, 23 Jun 2016 15:09:14 +0000 (18:09 +0300)]
Fix documentation of 'assoc-string' and 'compare-strings'
* src/minibuf.c (Fassoc_string): Clarify how CASE-FOLD affects the
string comparison. (Bug#23833)
* src/fns.c (Fcompare_strings): Fix the description of how
IGNORE-CASE affects the comparison.
* doc/lispref/strings.texi (Text Comparison): Clarify how
CASE-FOLD affects the string comparison in 'assoc-string'. Fix
the description of how IGNORE-CASE affects the comparison in
'compare-strings'.
Dmitry Gutov [Wed, 22 Jun 2016 18:20:06 +0000 (21:20 +0300)]
Error on multibyte characters in HTTP request
* lisp/url/url-http.el (url-http-create-request): Check the
constructed request in the end to verify that it does not contain
multibyte characters (bug#23750).
Eli Zaretskii [Wed, 22 Jun 2016 15:55:14 +0000 (18:55 +0300)]
Fix test for whether the '.el' file is newer than '.elc'
* src/lread.c (Fload): Don't overwrite the last character of the
file name in FOUND with 'c', unless the file name ended in ".elc"
to begin with. Don't treat empty files as byte-compiled. See
http://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00463.html
for more details of the problem this caused.
Eli Zaretskii [Wed, 22 Jun 2016 15:41:13 +0000 (18:41 +0300)]
Fix 'insert-file-contents' when REPLACE is non-nil
* src/fileio.c (maybe_move_gap): New function to move the gap to
the end of a buffer, if it isn't there already.
(Finsert_file_contents): Call 'maybe_move_gap' before using
conversion_buffer's text as a C 'char' array. (Bug#23659)
* src/coding.c (decode_eol): Compute the byte increment before
calling del_range_2, because the latter can invalidate the pointer
to buffer text.
Paul Eggert [Wed, 22 Jun 2016 01:04:16 +0000 (03:04 +0200)]
Improve --without-x GCC pacification
* src/composite.c (autocmp_chars):
* src/conf_post.h (DebPrint) [HAVE_NTGUI && !DebPrint && !EMACSDEBUG]:
Use simpler ((void) 0) for no-op expression returning void.
* src/dispextern.h [HAVE_WINDOW_SYSTEM]:
Include fontset.h, for face_for_char.
(FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_FOR_CHAR):
Now inline functions instead of macros. This avoids the need for
all those casts to void.
(FACE_SUITABLE_FOR_ASCII_CHAR_P): Omit 2nd (unused) arg.
All uses changed.
* src/frame.c (Ficonify_frame, Fset_frame_position):
* src/xdisp.c (Fmove_point_visually, show_mouse_face):
* src/xdisp.c (note_mode_line_or_margin_highlight)
(note_mouse_highlight):
Assume HAVE_WINDOW_SYSTEM for simplicity, since the code should
now work either way without generating warnings.
* src/frame.c (display_available) [HAVE_WINDOW_SYSTEM]: New function.
(window_system_available) [HAVE_WINDOW_SYSTEM]: Move to frame.h.
(decode_window_system_frame): Use check_window_system instead of
rolling the code ourself. Return needed only if HAVE_WINDOW_SYSTEM.
(decode_window_system_frame, check_window_system):
Merge the HAVE_WINDOW_SYSTEM and !HAVE_WINDOW_SYSTEM versions into one.
* src/frame.c (Ficonify_frame, Fset_frame_position):
* src/xdisp.c (show_mouse_face, define_frame_cursor1)
(note_mouse_highlight):
Narrow the scope of the HAVE_WINDOW_SYSTEM #ifdef;
this is a better way to pacify GCC.
* src/xdisp.c (x_set_left_fringe, x_set_right_fringe)
(x_set_right_divider_width, x_set_bottom_divider_width):
* src/xfns.c (x_set_internal_border_width):
Don’t use what are now function calls as lvalues.
* src/frame.h (WINDOW_SYSTEM_RETURN): New macro.
(decode_window_system_frame, check_window_system):
Use it, to avoid the need for duplicate declarations.
(window_system_available): Now an inline function.
(display_available): New decl.
(frame_dimension): New inline function.
(FRAME_FRINGE_COLS, FRAME_LEFT_FRINGE_WIDTH)
(FRAME_RIGHT_FRINGE_WIDTH, FRAME_TOTAL_FRINGE_WIDTH)
(FRAME_INTERNAL_BORDER_WIDTH, FRAME_RIGHT_DIVIDER_WIDTH)
(FRAME_BOTTOM_DIVIDER_WIDTH):
Use it, to avoid the need for duplicate definitions.
Now inline functions instead of macros.
* src/gnutls.c (gnutls_log_function2i): Remove.
* src/gnutls.h (GNUTLS_LOG2i): Use ‘message’ directly.
This avoids complaints about gnutls_log_function2i being defined
and not used on older platforms that do not need to call GNUTLS_LOG2i.
* src/image.c (DefaultDepthOfScreen) [0]: Remove unused macro.
* src/lisp.h (AUTO_STRING_WITH_LEN): Revert change from ‘type id =
expr’ to ‘type id; id = expr’, as this would suppress valid
jump-misses-init diagnostics. Let’s find a better way to address
the problem.
* src/vm-limit.c (__MALLOC_HOOK_VOLATILE):
Define only if needed.
* src/xdisp.c (handle_single_display_spec):
Simplify fringe_bitmap computation.
(define_frame_cursor1): Do nothing unless in a window system.
All callers changed and simplified.
* src/xfaces.c (realize_default_face):
Use a simpler way to pacify GCC when a return value is not used
on some platforms.
Eli Zaretskii [Tue, 21 Jun 2016 13:14:10 +0000 (16:14 +0300)]
Fix vertical layout calculations when newline has line-height property
* src/xdisp.c (move_it_in_display_line_to): Reset the iterator's
'constrain_row_ascent_descent_p' flag after processing the
newline, similar to what 'display_line' does. Without this, the
flag remains set once set by x_produce_glyphs, and causes the
vertical layout calculations to go awry, because Emacs thinks the
screen lines have zero height. (Bug#23850)
* src/lisp.h (AUTO_STRING_WITH_LEN): Avoid initialization to
prevent "jump-misses-init" compiler warnings.
* src/w32fns.c (check_w32_winkey_state): Define and use only if
WINDOWSNT.
(Fx_show_tip): Declare 'f'.
(Fx_file_dialog): Declare 'filter_a' only if not NTGUI_UNICODE.
(w32_strerror): Use format specifier %d for sprintf argument of
type int.
(emacs_abort): Cast sprintf argument of type DWORD to unsigned
int, and use format specifier %x, for compatibility with Cygwin.
(unicode_append_menu) [NTGUI_UNICODE]:
* src/w32menu.c [NTGUI_UNICODE] (get_menu_item_info)
(set_menu_item_info, unicode_append_menu)
(unicode_message_box):
* src/menu.c [NTGUI_UNICODE] (unicode_append_menu): Define as
functions rather than macros to avoid "address will always
evaluate as true" compiler warnings.
* src/w32font.c (w32_to_x_charset): Use format specifier %d for
sprintf argument of type int.
* src/w32term.c (x_draw_glyphless_glyph_string_foreground): Cast
sprintf argument of type int to unsigned int to match %X format
specifier.
(w32_scroll_bar_handle_click):
(w32_horizontal_scroll_bar_handle_click): Declare 'f'.
* src/font.c (font_open_entity): Declare 'min_width' where it is
first set, and only if HAVE_WINDOW_SYSTEM.
* src/frame.c [!HAVE_WINDOW_SYSTEM] (decode_window_system_frame):
Define _Noreturn version to avoid "suggest attribute noreturn"
compiler warning.
(check_window_system): Declare as _Noreturn.
(Ficonify_frame):
(Fset_frame_position): Don’t declare and set 'f'.
* src/xdisp.c (handle_single_display_spec): Declare
'fringe_bitmap' only if HAVE_WINDOW_SYSTEM.
(append_space_for_newline): Declare 'g' where it is first set.
(Fmove_point_visually): Declare and set 'target_is_eol_p' only if
HAVE_WINDOW_SYSTEM.
(show_mouse_face): Declare and set 'f' and 'phys_cursor_on_p' only
if HAVE_WINDOW_SYSTEM.
(note_mode_line_or_margin_highlight):
(note_mouse_highlight): Declare and set 'cursor' and 'pointer'
only if HAVE_WINDOW_SYSTEM.
* src/xfaces.c (realize_default_face): Declare and set 'face' only
if HAVE_X_WINDOWS. Remove redundant #ifdef.
Michael Albinus [Mon, 20 Jun 2016 12:41:41 +0000 (14:41 +0200)]
Weaken test conditions in filenotify-tests.el
* test/lisp/filenotify-tests.el (file-notify--test-with-events):
Fix thinko in test.
(file-notify-test02-events, file-notify-test04-file-validity)
(file-notify-test07-backup)
(file-notify-test08-watched-file-in-watched-dir): Make test
conditions more weak. (Bug#23618)
Paul Eggert [Mon, 20 Jun 2016 00:05:39 +0000 (02:05 +0200)]
Minor ABLOCKS_BUSY cleanups in alloc.c
* src/alloc.c (ABLOCKS_BUSY): Rename arg to avoid potential clash
with member ‘abase’ in definiens.
(lisp_align_malloc, lisp_align_free): Use bool for boolean.
Avoid compiler warning with fewer casts.
(lisp_align_free): Check busy-field values; this can help the
compiler a bit when optimizing, too.
Alan Mackenzie [Sun, 19 Jun 2016 12:06:24 +0000 (12:06 +0000)]
Fix CC Mode fontification problem apparent in test file decls-6.cc.
* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Recognize
"bar (gnu);" as a declarator only when the construct is directly inside a
class (etc.) called "bar".
(c-directly-in-class-called-p): New function.
Alan Mackenzie [Sun, 19 Jun 2016 11:25:07 +0000 (11:25 +0000)]
c-renarrow-state-cache: take care when new point is inside old brace pair.
Also add display of point-min to the c-parse-state debugging output.
* lisp/progmodes/cc-engine.el (c-renarrow-state-cache): When the new
point is inside an old recorded brace pair, clear the cache.
(c-debug-parse-state): Output the value of point-min.
Paul Eggert [Sat, 18 Jun 2016 22:54:28 +0000 (00:54 +0200)]
Merge from origin/emacs-25
d1efbaf Fix documentation of completion functions 65c96cc Clarify documentation of 'font-lock-maximum-decoration' 2ad3d01 * doc/misc/cl.texi (Usage): Add some more details. b49cb0a Fbackward_prefix_chars: stay within buffer bounds
Eli Zaretskii [Sat, 18 Jun 2016 09:50:57 +0000 (12:50 +0300)]
Clarify documentation of 'font-lock-maximum-decoration'
* doc/emacs/display.texi (Font Lock): Explain how to make the
customization of 'font-lock-maximum-decoration' effective for an
existing buffer. (Bug#23783)
Stefan Monnier [Sat, 18 Jun 2016 04:52:58 +0000 (00:52 -0400)]
map.el (map-merge*): Use `map-into' at beginning rather than end
* lisp/emacs-lisp/map.el (map-merge): Use `map-into' for the first map,
and don't use of an intermediate alist.
(map-merge-with): Same, plus use `cl-callf' to try and avoid performing
3 lookups per inner iteration.
Noam Postavsky [Sat, 4 Jun 2016 13:02:20 +0000 (09:02 -0400)]
Fbackward_prefix_chars: stay within buffer bounds
The commit 1fd3172d "(Fbackward_prefix_chars): Set point properly while
scanning" (1998-03-18), moved the check against of the position against the
buffer beginning out the loop condition so that we might end up checking
the syntax of characters before the beginning of the buffer. This can
cause segfaults or trigger a "Point before start of properties" error in
`update_interval' (called indirectly from `char_quoted').
* src/syntax.c (Fbackward_prefix_chars): Stop the loop when beginning of
buffer is reached (Bug #3552, Bug #17132, Bug #19379).
Paul Eggert [Wed, 15 Jun 2016 05:40:18 +0000 (22:40 -0700)]
Fix ifdef-vs-if typo with RANDR13_LIBRARY
* src/xfns.c (x_get_monitor_attributes_xrandr): Use #if, not #ifdef.
This ports to systems that predate xrandr 1.3. See Christian Lynbech in:
http://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00198.html
Alan Mackenzie [Wed, 15 Jun 2016 22:06:14 +0000 (22:06 +0000)]
Speed up CC Mode's font locking by taking some code out of a hot loop.
* lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Remove code which
tests for bare declarators.
(c-font-lock-cut-off-declarators): New function.
(c-complex-decl-matchers): insert c-font-lock-cut-off-declarators.
Stephen Berman [Wed, 15 Jun 2016 18:08:16 +0000 (20:08 +0200)]
Improve last todo-mode fix
* lisp/calendar/todo-mode.el (todo-read-category): Use
set-keymap-parent instead of copy-keymap, and default (as
previously) to the global binding (for rationale, see
http://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00217.html).
Stefan Monnier [Wed, 15 Jun 2016 17:21:59 +0000 (13:21 -0400)]
Automatically find vars and functions via definition-prefixes
* lisp/help-fns.el (help-definition-prefixes): New var and function.
(help--loaded-p, help--load-prefixes, help--symbol-completion-table):
New functions.
(describe-function, describe-variable): Use them.
* lisp/emacs-lisp/radix-tree.el (radix-tree--prefixes)
(radix-tree-prefixes, radix-tree-from-map): New functions.
* lisp/progmodes/cc-mode.el (c-or-c++-mode): A new function which
analyses contents of the buffer to determine whether it looks like C++
source code and based on that enables c-mode or c++-mode.
(c-or-c++-mode--regexp): Regular expression which, when matches
a buffer, signals file is C++.
Alan Mackenzie [Wed, 15 Jun 2016 15:57:37 +0000 (15:57 +0000)]
Parse compound identifiers in C++ member initialization lists.
* lisp/progmodes/cc-engine.el (c-back-over-compound-identifier): New function.
(c-back-over-member-initializer-braces, c-back-over-list-of-member-inits)
(c-back-over-member-initializers): Call c-back-over-compound-identifier rather
than c-simple-skip-symbol-backward.
Paul Eggert [Wed, 15 Jun 2016 05:40:18 +0000 (22:40 -0700)]
Fix ifdef-vs-if typo with RANDR13_LIBRARY
* src/xfns.c (x_get_monitor_attributes_xrandr): Use #if, not #ifdef.
This ports to systems that predate xrandr 1.3. See Christian Lynbech in:
http://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00198.html
Paul Eggert [Tue, 14 Jun 2016 19:19:36 +0000 (12:19 -0700)]
Port to platforms where char * has top bit set
This fixes a five-year-old FIXME comment. Although I don’t know
of a platform where this is a problem in practice, better safe
than sorry.
* src/doc.c (Fdocumentation): If SUBRP, simply use doc as integer,
as it is now an integer, not char *.
(store_function_docstring): Offset is now EMACS_INT, not ptrdiff_t;
this is a file offset and EMACS_INT is better if --with-wide-int.
If SUBRP, simply store the offset rather than negating it and
converting it to char *.
* src/lisp.h (struct Lisp_Subr.doc): Now EMACS_INT, not char *.
Paul Eggert [Mon, 13 Jun 2016 21:50:08 +0000 (14:50 -0700)]
Call tzset after setting TZ
* src/editfns.c (tzlookup): Call tzset after setting TZ, so that
the setting change propagates into Emacs local time (Bug#23600).
(emacs_setenv_TZ): Clarify comments.