Juri Linkov [Sun, 15 Sep 2019 20:52:22 +0000 (23:52 +0300)]
Use images for new/close buttons in tab-bar and tab-line.
* etc/images/tabs/new.xpm:
* etc/images/tabs/close.xpm:
New files.
* lisp/tab-bar.el (tab-bar-separator): New face.
(tab-bar-separator, tab-bar-button-new, tab-bar-button-close):
Use display property with images in default values.
* lisp/tab-line.el (tab-line-button-new, tab-line-button-close):
Use display property with images in default values.
* src/xdisp.c (tab_bar_item_info): Add new arg close_p and set it
to the value of property `close' at charpos.
(get_tab_bar_item): Add new arg close_p.
(handle_tab_bar_click): Add ctrl_modifier when close_p is non-nil.
(Fdump_tab_bar_row): Fix crash for non-X builds.
Juri Linkov [Sun, 15 Sep 2019 20:40:47 +0000 (23:40 +0300)]
Fix assertion violations due to non-ASCII text in tabs
* src/xdisp.c (tab_bar_height, redisplay_tab_bar)
(display_tab_bar): If the Lisp string to be displayed in the
tab-bar window is multibyte, tell the display
engine to treat it as multibyte, instead of relying on the
initial determination by init_iterator (which is based on the
multibyteness of the current buffer). (Bug#37385)
Juri Linkov [Sat, 7 Sep 2019 20:04:24 +0000 (23:04 +0300)]
* lisp/tab-bar.el (tab-bar-make-keymap-1): Don't use fixed "Current tab".
* lisp/tab-bar.el (tab-bar-make-keymap-1):
* lisp/tab-line.el (tab-line-tab-name-add):
Add space after Unicode char to avoid char clobbering on terminals.
Juri Linkov [Thu, 5 Sep 2019 19:27:42 +0000 (22:27 +0300)]
Don't use hook pre-redisplay-functions. Set buffer-local tab-line-format.
* lisp/tab-line.el (tab-line-format): Move to C.
(tab-line-update-window-parameter): Remove function.
(global-tab-line-mode): Set the default value of tab-line-format.
* src/window.c (window_body_height): Add WINDOW_TAB_LINE_HEIGHT.
(Fwindow_tab_line_height): New function.
(coordinates_in_window): Use window_wants_tab_line with
CURRENT_TAB_LINE_HEIGHT.
(window_relative_x_coord): Add ON_TAB_LINE.
(Fcoordinates_in_window_p): Add ON_TAB_LINE.
(window_from_coordinates): Add new arg tab_bar_p.
(Fwindow_line_height): Use window_wants_tab_line with
WINDOW_TAB_LINE_HEIGHT.
(Fwindow_lines_pixel_dimensions): Add WINDOW_TAB_LINE_HEIGHT.
(make_window): Set tab_line_height to -1.
(window_wants_tab_line): New function.
(window_internal_height): Use window_wants_tab_line.
(window_scroll_pixel_based): Add WINDOW_TAB_LINE_HEIGHT.
(Frecenter): Set minimize_tab_bar_window_p to 1.
(GCALIGNED_STRUCT): Add frame_tab_bar_lines and frame_tab_bar_height.
(Fcurrent_window_configuration): Set frame_tab_bar_lines and
frame_tab_bar_height.
(set_window_scroll_bars): Add WINDOW_TAB_LINE_HEIGHT.
(syms_of_window): Add Qtab_line_format and Swindow_tab_line_height.
* src/xdisp.c (window_box_height): Add window_wants_tab_line with
MATRIX_TAB_LINE_ROW and CURRENT_TAB_LINE_HEIGHT.
(pos_visible_p): Use window_wants_tab_line.
Add WINDOW_TAB_LINE_HEIGHT.
(get_glyph_string_clip_rects): Add WINDOW_TAB_LINE_HEIGHT.
(get_phys_cursor_geometry): Add WINDOW_TAB_LINE_HEIGHT.
(remember_mouse_glyph): Use MATRIX_TAB_LINE_ROW for part
ON_TAB_LINE.
(init_iterator): Use MATRIX_TAB_LINE_ROW for TAB_LINE_FACE_ID.
Add WINDOW_TAB_LINE_HEIGHT. Add window_wants_tab_line.
(Fwindow_text_pixel_size): Add WINDOW_TAB_LINE_HEIGHT.
(prepare_menu_bars): Call update_tab_bar.
(update_tab_bar, build_desired_tab_bar_string)
(display_tab_bar_line, tab_bar_height, Ftab_bar_height)
(redisplay_tab_bar, tab_bar_item_info, get_tab_bar_item)
(handle_tab_bar_click, note_tab_bar_highlight): New functions.
(compute_window_start_on_continuation_line): Use window_wants_tab_line.
(try_cursor_movement): Use window_wants_tab_line with
CURRENT_TAB_LINE_HEIGHT.
(redisplay_window): Use window_wants_tab_line with
CURRENT_TAB_LINE_HEIGHT.
(try_window_reusing_current_matrix): Use window_wants_tab_line
with WINDOW_TAB_LINE_HEIGHT.
(Fdump_tab_bar_row): New function.
(compute_line_metrics): Add WINDOW_TAB_LINE_HEIGHT.
(display_line): Use window_wants_tab_line.
(display_mode_line): Set tab_line_p to true if face_id is
TAB_LINE_FACE_ID.
(Fformat_mode_line): Handle Qtab_line and Qtab_bar.
(gui_clear_end_of_line): Add WINDOW_TAB_LINE_HEIGHT.
(erase_phys_cursor): Use WINDOW_TAB_LINE_HEIGHT.
(show_mouse_face): Use tab_bar_window.
(note_mode_line_or_margin_highlight): Use MATRIX_TAB_LINE_ROW for
area ON_TAB_LINE.
(note_mouse_highlight): Call note_tab_bar_highlight,
(expose_frame): Handle tab_bar_window.
(syms_of_xdisp): Add Sdump_tab_bar_row and Stab_bar_height.
(auto-resize-tab-bars, auto-raise-tab-bar-buttons)
(tab-bar-border, tab-bar-button-margin, tab-bar-button-relief)
(tab-bar-max-label-size): New variables.
* src/xfaces.c (lookup_basic_face): Add TAB_LINE_FACE_ID and
TAB_BAR_FACE_ID.
(syms_of_xfaces): Define Qtab_bar and Qtab_line.
* src/xfns.c (x_set_tab_bar_lines, x_change_tab_bar_height):
New functions.
(xic_set_statusarea): Add FRAME_TABBAR_TOP_HEIGHT.
(frame_geometry): Add FRAME_TAB_BAR_HEIGHT and Qtab_bar_size.
* src/xterm.c (x_draw_image_relief): Use tab_bar_button_relief.
(x_draw_image_relief): Use TAB_BAR_FACE_ID.
(handle_one_xevent): Handle tab_bar_window.
(x_set_window_size_1): Add FRAME_TABBAR_WIDTH.
(x_create_terminal): Set change_tab_bar_height_hook.
Paul Eggert [Sat, 31 Aug 2019 17:35:08 +0000 (10:35 -0700)]
Check instead of relying on NOTREACHED
NOTREACHED was designed for traditional lint decades ago,
and _Noreturn now normally subsumes its function.
In the one case in Emacs where NORETURN might help and _Noreturn does
not, check for NOTREACHED instead of assuming it.
* lib-src/etags.c (main):
* src/xterm.c (x_connection_closed):
Remove NOTREACHED after a call to a _Noreturn function, as NOTREACHED
is no longer needed there. Also, one of the NOTREACHEDs was
misplaced, which defeated traditional lint checking anyway.
* lib-src/pop.c (pop_getline): Redo so as to not need NOTREACHED.
* src/emacs.c (main): Use eassume (false) rather than NOTREACHED,
so that running with ENABLE_CHECKING catches any internal error
causing the toplevel Frecursive_edit to return.
Paul Eggert [Fri, 30 Aug 2019 07:24:07 +0000 (00:24 -0700)]
emacsclient: adjust to new config file location
* lib-src/emacsclient.c (open_config): New arg XDG, to respect
XDG_CONFIG_HOME, consistently with Emacs proper. Caller changed.
Use XDG convention if available, falling back on the old names
if not.
Paul Eggert [Fri, 30 Aug 2019 05:29:52 +0000 (22:29 -0700)]
Prefer ~/.config/emacs to ~/.emacs.d if neither exists
That way, when Emacs starts in a fresh home directory,
it prefers the new (XDG) convention rather than the old one.
* lisp/files.el (locate-user-emacs-file): Make the parent
directories of user-emacs-directory if needed. This is useful
if user-emacs-directory is "~/.config/emacs" and "~/.config"
does not yet exist.
* lisp/startup.el (command-line):
* lisp/subr.el (user-emacs-directory):
Prefer XDG_CONFIG_HOME to ~/.emacs.d if neither exists.
Paul Eggert [Wed, 28 Aug 2019 18:34:48 +0000 (11:34 -0700)]
Don't worry about pre-1.0.0 alsa-lib include
Problem reported by Ergus in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00563.html
* configure.ac (ALSA_SUBDIR_INCLUDE): Do not define.
* src/sound.c: Assume ALSA_SUBDIR_INCLUDE.
Paul Eggert [Tue, 27 Aug 2019 21:21:45 +0000 (14:21 -0700)]
Use XDG conventions more consistently
Fit in better with the XDG conventions.
Something like this was suggested in 2008 (Bug#583)
and the XDG conventions seem to have settled down by now.
* doc/emacs/custom.texi (Init File, Init Syntax, Find Init):
* doc/lispref/files.texi (Standard File Names):
* doc/lispref/os.texi (Init File):
* doc/misc/url.texi (Customization):
* etc/NEWS:
Adjust accordingly.
* lisp/startup.el (startup--load-user-init-file):
If init-file-name is nil, do not load from it; instead
just use the alt-file.
(find-init-path): Remove; no longer used.
(command-line): Don't check twice for XDG.
Look at XDG_CONFIG_HOME instead of assuming it's ~/.config.
Prefer XDG configuration if it exists; the user can disable
this by setting XDG_CONFIG_HOME to some other place.
* lisp/subr.el (user-emacs-directory):
Prefer XDG configuration if it exists.
Juri Linkov [Tue, 27 Aug 2019 20:48:57 +0000 (23:48 +0300)]
Browser-like Info-history button menu (bug#37184)
* doc/misc/info.texi (Help-Int): Using tool-bar to navigate history.
* lisp/info.el (Info-history-menu): New function.
(Info-history-back-menu, Info-history-forward-menu): New commands.
(Info-mode-map): Bind Info-history-back-menu and
Info-history-forward-menu to tool-bar on C-key.
Eli Zaretskii [Tue, 27 Aug 2019 15:47:24 +0000 (18:47 +0300)]
Fix crashes on MS-Windows when using GnuTLS connections
* src/gnutls.c (init_gnutls_functions) [WINDOWSNT]: Define and
load gnutls_free by an explicit call to GetProcAddress.
(gnutls_free) [WINDOWSNT]: Define as a macro that dereferences
a function pointer. (Bug#31946)
(Fgnutls_format_certificate): Use make_string_from_bytes
instead of going through an intermediate malloc'ed buffer.
Alex Branham [Thu, 15 Aug 2019 16:02:38 +0000 (11:02 -0500)]
Fix filename completion in shell mode buffers
* lisp/shell.el (shell-dynamic-complete-functions): Move
pcomplete-completions-at-point down the list so that filename
completion has a chance to complete before pcompletion.
Mauro Aranda [Tue, 27 Aug 2019 06:41:44 +0000 (08:41 +0200)]
Make link widgets obey mouse-1-click-follows-link
* lisp/wid-edit.el (widget-link-keymap): New variable, a keymap to use
inside a link widget.
('link widget): Restore the :follow-link property and add
widget-link-keymap as the :keymap property (bug#15682).
Mauro Aranda [Tue, 27 Aug 2019 06:40:32 +0000 (08:40 +0200)]
Adapt recentf.el to the change in the Widget Library
* lisp/recentf.el (recentf-open-files-item): Stop overriding
:follow-link property of the link widgets, since now it should
work as expected (bug#15682).
Paul Eggert [Tue, 27 Aug 2019 01:57:56 +0000 (18:57 -0700)]
Fix Tramp rounding of file sizes and inode numbers
* lisp/net/tramp-sh.el (tramp-perl-file-attributes)
(tramp-perl-directory-files-and-attributes)
(tramp-do-file-attributes-with-stat)
(tramp-do-directory-files-and-attributes-with-stat):
Format file sizes and inode numbers without trailing ".0",
to avoid rounding errors when absolute values exceed 2**53
(Bug#36940#94). This fixes the problem for Emacs 27 and later,
and doesn't hurt in earlier Emacs.
Eli Zaretskii [Mon, 26 Aug 2019 16:06:13 +0000 (19:06 +0300)]
Fix crashes in networking with GnuTLS on MS-Windows
* src/gnutls.c (init_gnutls_functions) [WINDOWSNT]: Define and
load gnutls_free.
(Fgnutls_format_certificate): Use gnutls_free instead of
xfree. This prevents crashes on MS-Windows, since the memory
being released was allocated inside GnuTLS. (Bug#31946)
Allow finding gpg2 binaries when gpg2 has an "unknown" version string
* lisp/epg-config.el (epg-find-configuration): Allow finding a
usable configuration even if the version string looks like "gpg
(GnuPG) 2.2.15-unknown" (bug#35629).
Teemu Likonen [Mon, 26 Aug 2019 05:52:54 +0000 (07:52 +0200)]
Only use --sender for gpg when gpg supports it
* lisp/epg-config.el (epg-required-version-p): New function (bug#37025).
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/epg.el (epg-start-sign):
(epg-start-encrypt): Use it to only use --sender when the gpg
binary supports it.
Paul Eggert [Sun, 25 Aug 2019 17:01:46 +0000 (10:01 -0700)]
Fix misdisplay of PNG paletted images
Problem reported by Roland Winkler (Bug#37153).
Derived from a patch suggested by YAMAMOTO Mitsuharu (Bug#37153#62).
* src/image.c (png_get_valid) [WINDOWSNT]:
Do not dynamically link this function.
(png_get_tRNS) [WINDOWSNT && PNG_tRNS_SUPPORTED]:
Dynamically link this function instead.
(png_load_body): Do not assume that every paletted image supplies
only transparency data. Fix typo in use of transparent_p.
Alan Mackenzie [Sun, 25 Aug 2019 10:21:37 +0000 (10:21 +0000)]
Introduce new value t for compilation-context-lines to eliminate scrolling
In particular, to prevent scrolling in a window lacking a left fringe.
Instead, a visible arrow "=>" is inserted before column zero. This fixes
bug #36832.
* lisp/progmodes/compile.el (compilation-context-lines): Add the new value t.
(compilation-set-window): Amend to handle compilation-context-lines being t.
(overlay-arrow-overlay): New variable holding an overlay with before-string
property "=>".
(compilation-set-overlay-arrow): New function which manipulates
overlay-arrow-overlay.
(compilation-goto-locus, compilation-find-file): In addition to calling
compilation-set-window, also call compilation-set-overlay-arrow.
* doc/emacs/building.texi (Compilation Mode): Document the new value t which
compilation-context-lines can take.
Eli Zaretskii [Sun, 25 Aug 2019 08:08:11 +0000 (11:08 +0300)]
Fix a recent change in coding.c
This partially reverts the changes in "extern function cleanup".
* src/coding.c (encode_string_utf_8, decode_string_utf_8): Now
extern again. They should NOT be static, as they are intended
to be used by the likes of json.c, where we need
highly-optimized code for processing UTF-8 strings. E.g.,
decode_string_utf_8 beats make_string_from_utf8 by a factor of
2 to 5 in a large number of scenarios.
Paul Eggert [Sat, 24 Aug 2019 22:46:31 +0000 (15:46 -0700)]
Speed up % and mod with fixnum denom
* src/data.c (integer_remainder): New function. When the
numerator is a bignum and the denominator is small, this function
uses mpz_tdiv_ui, which should be faster than mpz_tdiv_r.
(Frem, Fmod): Use it.
Paul Eggert [Sat, 24 Aug 2019 19:45:36 +0000 (12:45 -0700)]
Tweak integer mod performance
* src/data.c (integer_mod): Use mpz_tdiv_r not mpz_mod, as that’s
more similar to the fixnum case, is a bit more efficient, and
otherwise the later ‘sgn_r < 0’ code is useless anyway.
Paul Eggert [Sat, 24 Aug 2019 19:43:50 +0000 (12:43 -0700)]
Make (mod 1.0 0) consistent with (/ 1.0 0)
* src/data.c (Fmod): Do not signal an error for (mod 1.0 0), for
the same reason (/ 1.0 0) does not signal an error.
* test/src/data-tests.el (data-tests-mod-0): New test.
Paul Eggert [Sat, 24 Aug 2019 18:42:28 +0000 (11:42 -0700)]
extern function cleanup
Most of these functions can be static. A few are unused.
* src/coding.c (encode_string_utf_8, decode_string_utf_8):
Define only if ENABLE_UTF_8_CONVERTER_TEST, as they're
not needed otherwise.
* src/coding.c (encode_string_utf_8, decode_string_utf_8):
* src/data.c (integer_mod):
* src/fns.c (base64_encode_region_1, base64_encode_string_1):
* src/ftfont.c (ftfont_get_fc_charset):
Now static.
* src/sysdep.c (verrprintf): Remove; unused.
Noam Postavsky [Fri, 23 Aug 2019 00:48:19 +0000 (20:48 -0400)]
Fix non-deterministic process test
* test/src/process-tests.el (set-process-filter-t): Don't assume
subprocess output will come in a single chunk, keep waiting for more
data until next "prompt" is read from subprocess.
Robert Pluim [Sat, 24 Aug 2019 12:54:02 +0000 (14:54 +0200)]
Fix DNS tests
* test/src/process-tests.el: (lookup-family-specification,
lookup-unicode-domains, unibyte-domain-name, lookup-google,
non-existent-lookup-failure): Skip on Hydra, which doesn't have DNS.
Fix buggy test condition. (Bug#37165)
Michael Albinus [Sat, 24 Aug 2019 08:10:05 +0000 (10:10 +0200)]
Fix some problems of Bug#36940
* test/lisp/net/tramp-tests.el (tramp-test22-file-times): Do not
compare time value lists by `equal'. (Bug#36940).
(tramp-test30-make-process): Adapt "kill" message to match on macOS.
Paul Eggert [Fri, 23 Aug 2019 18:50:40 +0000 (11:50 -0700)]
Tweak gnutls-peer-status reporting
* src/gnutls.c (Fgnutls_peer_status): Report :compression and
:encrypt-then-mac only if the underlying GnuTLS library has
the corresponding features. This give the Elisp caller a bit
more information about the peer status.
* lisp/net/nsm.el (nsm-protocol-check--compression):
Don’t worry about compression in newer GnuTLS versions
that do not support compression.
Paul Eggert [Fri, 23 Aug 2019 18:17:38 +0000 (11:17 -0700)]
Clarify compiler-pacifier in frame.c
* src/frame.c (Fx_parse_geometry): Pacify the compiler in a
different way, so that the human reader can more easily see
that the initializations are unnecessary.
Noam Postavsky [Fri, 23 Aug 2019 11:59:32 +0000 (07:59 -0400)]
; Fix references to log-edit-generate-changelog-from-diff
* doc/emacs/maintaining.texi (Log Buffer):
* etc/NEWS: Replace log-edit-generate-changelog (an old name which was
changed during editing) to log-edit-generate-changelog-from-diff.