* src/buffer.h (struct buffer): New field 'long_line_optimizations_p'.
* src/buffer.c (syms_of_buffer): New variable 'long-line-threshold'.
(reset_buffer): Initialize the 'long_line_optimizations_p' field.
(Fbuffer_swap_text): Handle it.
* src/xdisp.c (redisplay_window): Set 'long_line_optimizations_p' when
a buffer contains long lines.
(init_iterator): Use 'long_line_optimizations_p'.
(get_narrowed_begv): Update.
(SET_WITH_NARROWED_BEGV): New macro.
(unwind_narrowed_begv): New internal function used by the new macro.
(back_to_previous_line_start, get_visually_first_element,
move_it_vertically_backward): Use the new macro.
* src/search.c (find_newline1): Make it externally visible.
* src/lisp.h: Make 'find_newline1' externally visible.
* src/dispextern.h (struct it): Update comment. Remove the
'WITH_NARROWED_BEGV' macro.
* etc/NEWS: Mention the 'long-line-threshold' variable.
Eli Zaretskii [Sat, 9 Jul 2022 10:16:12 +0000 (13:16 +0300)]
Fix segfault in composite.c
* src/composite.c (find_automatic_composition): Don't use
narrowed_begv if it's zero. This avoids segfault in
BACKWARD_CHAR, since zero is not a valid buffer position.
Actually fix the long lines display bug (bug#56393).
* src/dispextern.h (struct it): New 'narrowed_begv' field.
* src/dispextern.h (WITH_NARROWED_BEGV): New macro.
* src/xdisp.c (get_narrowed_begv): New function.
(init_iterator): Initilize the 'narrowed_begv' field.
(back_to_previous_line_start, get_visually_first_element,
move_it_vertically_backward): Use the new macro.
* src/dispextern.h: Prototype of 'get_narrowed_begv'.
* src/window.c (window_body_height): Make it externally visible.
* src/window.h: Prototype of 'window_body_height'.
* src/composite.c (find_automatic_composition): Optimize display in buffers
with very long lines with 'get_narrowed_begv'.
* lisp/files.el (auto-narrow--reset-isearch-lazy-highlight): New internal
function.
(auto-narrow-pre-command-function, auto-narrow-post-command-function): Use the
new internal function.
* lisp/isearch.el (isearch-search): Set isearch-lazy-highlight to nil before
widening in auto-narrow-mode.
* lisp/files.el (auto-narrow--isearch-lazy-highlight): New internal variable.
(auto-narrow-pre-command-function, auto-narrow-post-command-function): Use it.
* lisp/files.el (auto-narrow-display-length): Improve docstring.
(auto-narrow-widen-automatically): Add 'undo' to the command list.
(auto-narrow-hook): New defcustom.
(auto-narrow-pre-command-function, auto-narrow-post-command-function):
Move initialization code.
(auto-narrow-mode): Do not make the 'auto-narrow-mode' permanent local
anymore.
* lisp/font-lock.el (turn-off-font-lock-mode): New convenience function.
* src/xdisp.c (set_vertical_scroll_bar): Fix typo.
(redisplay_window): Use the new convenience function.
* src/buffer.h (BUFFER_NEEDS_AUTO_NARROWING_P,
BUFFER_AUTO_NARROWED_NON_NARROWED_P): Two new convenience functions.
* src/window.c (Frecenter): Do not recenter auto-narrowed buffers that
are not actually narrowed.
Actually fix the long lines display bug (bug#56393).
* lisp/files.el (auto-narrow-mode): New minor mode.
(auto-narrow-pre-command-function, auto-narrow-post-command-function):
New auxiliary functions for the minor mode.
(auto-narrow-display-length, auto-narrow-widen-automatically): New
defcustoms for the minor mode.
(auto-narrow--widen-automatically, auto-narrow--isearch-widen-automatically,
auto-narrow--initialized): New internal variables for the minor mode.
* src/buffer.h (struct buffer): New internal variable for the minor mode.
(bset_auto_narrow__narrowing_state, BUFFER_AUTO_NARROWED_P): New
auxiliary functions.
* src/buffer.c (init_buffer_once, syms_of_buffer): New internal variable
for the minor mode. Update the docstring of mode-line-format.
* src/fileio.c (Finsert_file_contents): Detect whether the minor mode should
be entered when the buffer is displayed.
(syms_of_fileio): New defcustom for the minor mode.
* src/keyboard.c (syms_of_keyboard): New hook functions for the minor mode.
(command_loop_1): Execute the hook functions.
* src/xdisp.c (redisplay_window): Enter the minor mode when the buffer is
displayed.
(decode_mode_spec): Indicate when the minor mode is active
in the modeline. Indicate the buffer position relative to the whole buffer.
(set_vertical_scroll_bar): Indicate the buffer position relative to the
whole buffer.
(syms_of_xdisp): Two new symbols.
* lisp/isearch.el (isearch-widen-automatically): New defcustom.
(isearch-search): Use the new defcustom.
* lisp/bindings.el (mode-line-modes): Do not propertize the indication
in the modeline when the new minor mode is active.
* etc/NEWS: Announce the new minor mode, and remove the unobsoletion
indication for 'longlines-mode'.
* lisp/longlines.el: Reobsolete longlines-mode.
* doc/emacs/display.texi (Auto-Narrowing): New section, describing the new
minor mode.
(Display): Entry for the new section.
* doc/emacs/trouble.texi (Long Lines): Remove the section.
(Lossage): Remove the entry for the Long Lines section.
* doc/emacs/emacs.texi (Top): Remove the entry for the Long Lines section.
Stefan Kangas [Tue, 5 Jul 2022 17:37:55 +0000 (19:37 +0200)]
Rename new option to remote-file-name-inhibit-auto-save-visited
* lisp/files.el (remote-file-name-inhibit-auto-save-visited):
Rename from 'auto-save-visited-remote-files' and invert logic.
(auto-save-visited-mode): Adjust accordingly. (Bug#41333)
Suggested by Michael Albinus <michael.albinus@gmx.de>.
* lisp/replace.el (read-regexp-map): New map.
(read-regexp--case-fold, read-regexp-toggle-case-folding)
(read-regexp): Factor out to avoid hard-coding `M-c'.
Stefan Kangas [Tue, 5 Jul 2022 12:16:08 +0000 (14:16 +0200)]
New user option auto-save-visited-remote-files
* lisp/files.el (auto-save-visited-remote-files): New user option.
(auto-save-visited-mode): Use above new variable to decide whether
or not to save remote files. (Bug#41333)
Stefan Kangas [Tue, 5 Jul 2022 11:34:24 +0000 (13:34 +0200)]
New user option auto-save-visited-mode-predicate
* lisp/files.el (auto-save-visited-mode-predicate): New defcustom.
(auto-save-visited-mode): Use above new variable as a predicate to
decide whether or not to save a buffer.
* lisp/international/emoji.el (emoji-insert): Remove the prefix
action from this command, since the same is already available on
`C-x 8 e s', and we're considering using the prefix to copy to the
kill ring.
Po Lu [Tue, 5 Jul 2022 06:55:24 +0000 (14:55 +0800)]
Allow immediately saving XDS drops
This fixes things with programs that have a very timeout, such
as Chromium, within which it isn't practical for the user to
confirm the default file name.
* lisp/x-dnd.el (x-dnd-direct-save-function): Add new choices to
defcustom.
(x-dnd-init-frame): Use fast protocol requests.
(x-dnd-save-direct-immediately): New function.
(x-dnd-handle-xds-drop): Fix nil values of selected file name.
Paul Eggert [Tue, 5 Jul 2022 04:12:45 +0000 (23:12 -0500)]
Quote configure.ac arguments more consistently
This should help avoid further Autoconf portability gotchas such as
the one recently fixed in 2022-06-27T04:26:01Z!meyering@fb.com.
* autogen.sh (autoconf_min): Adjust pattern to match
updated configure.ac.
* configure.ac: Quote arguments more consistently,
as per the Autoconf manual.
Po Lu [Tue, 5 Jul 2022 03:03:11 +0000 (11:03 +0800)]
Don't take XCB socket every time we want the no of the next request
* src/xterm.c (x_ignore_errors_for_next_request, x_uncatch_errors)
(x_check_errors, x_had_errors_p): Don't call XNextRequest
redundantly. Use NextRequest if it was immediately preceded by
XNextRequest, which updates dpy->request.
Alexander Adolf [Sat, 2 Jul 2022 15:27:55 +0000 (17:27 +0200)]
Add reverse mapping for EUDC attribute names
* lisp/net/eudc.el (eudc-translate-query): new optional parameter to
reverse the mapping direction
(eudc-translate-attribute-list): new optional parameter to
reverse the mapping direction
Paul Eggert [Mon, 4 Jul 2022 21:21:35 +0000 (16:21 -0500)]
Fix core dump with x-get-local-selection
* src/xselect.c (Fx_get_local_selection): Check that VALUE has 4
elements, since x_get_local_selection can dump core otherwise.
This pacifies gcc -Wanalyzer-null-dereference, which found the
problem.
Stefan Kangas [Mon, 4 Jul 2022 12:10:04 +0000 (14:10 +0200)]
Remove remaining Helper-help support from view-mode
* lisp/view.el (view-old-Helper-return-blurb): Make obsolete.
(view--enable, view--disable): Delete remaining Helper-help support
code; view-mode stopped using it in 1995.
Eli Zaretskii [Mon, 4 Jul 2022 11:59:58 +0000 (14:59 +0300)]
; Fix documentation of 'file-parent-directory'
* doc/lispref/files.texi (Directory Names):
* lisp/files.el (file-parent-directory): Improve wording of the
documentation of 'file-parent-directory'. (Bug#56355)
* lisp/thumbs.el (thumbs-call-convert): Pass 'action-prefix' and
'action' as a combined parameter. Do not pass 'arg' if it is nil.
(thumbs-modify-image): Do not pass "" as 'arg' to
'thumbs-call-convert' (bug#56375).
Some time in the past this was converted from using the shell to
passing the parameters directly, but the fallout was not handled
correctly.
Stefan Kangas [Mon, 4 Jul 2022 10:12:45 +0000 (12:12 +0200)]
New command help-fns-edit-mode-cancel
* lisp/help-fns.el (help-fns-edit-mode-cancel): New command.
(help-fns--edit-value-mode-map): Bind it to 'C-c C-k'.
(help-fns-edit-variable): Advertise it in help text.
Po Lu [Mon, 4 Jul 2022 05:41:20 +0000 (13:41 +0800)]
Always wait for XdndStatus before sending XdndDrop
* src/xterm.c (x_dnd_do_drop): New function.
(x_dnd_begin_drag_and_drop): Clear new flag.
(handle_one_xevent): Use that function; send drops upon receipt
of pending XdndStatus, to avoid race conditions where we don't
yet know the selected action.
Po Lu [Mon, 4 Jul 2022 03:32:05 +0000 (11:32 +0800)]
Display list of traps and handlers when crashing due to an X error
* src/xterm.c (x_connection_closed): Print list of installed
error handlers if not crashing due to an IO error.
(NO_INLINE): Include error serial in error message.
Florian Rommel [Fri, 3 Jun 2022 01:03:03 +0000 (03:03 +0200)]
Add support for fullscreen values fullheight and fullwidth on PGTK
* src/pgtkterm.c (window_state_event): Support values fullheight and
fullwidth for the fullscreen frame-parameter
* doc/lispref/frames.texi (Size Parameters): Document inability to
actively set hullheight/fullwidth for PGTK frames
* configure.ac: Bump GTK version for PGTK
* etc/NEWS: Change GTK version in PGTK announcement
Juri Linkov [Sun, 3 Jul 2022 17:00:11 +0000 (20:00 +0300)]
* lisp/mwheel.el: More fixes for global-text-scale (bug#48307)
(mouse-wheel-global-text-scale): Move down closer to mouse-wheel-text-scale.
(mouse-wheel-scroll-amount): Add :value global-text-scale and mention it
in the docstring.
(mouse-wheel-global-text-scale, mouse-wheel--setup-bindings):
Add mouse-wheel-down-alternate-event and mouse-wheel-up-alternate-event.
Allow a list of modifiers for 'text-scale'.
Stefan Monnier [Sun, 3 Jul 2022 15:12:45 +0000 (11:12 -0400)]
lisp/elec-pair.el: Simplify last change
* lisp/elec-pair.el (electric-pair--with-syntax):
Rename from `electric-pair--with-text-syntax`.
Make `start` mandatory. Run `body` in the normal syntax if `start` is nil.
(electric-pair--with-syntax-1): New function, extracted from
`electric-pair--with-text-syntax`.
(electric-pair-syntax-info, electric-pair--balance-info):
Adjust calls accordingly.
Stefan Kangas [Sun, 3 Jul 2022 12:40:21 +0000 (14:40 +0200)]
Improve navigation keybindings in emacs-news-mode
* lisp/textmodes/emacs-news-mode.el (emacs-news-common-map): New
defvar-keymap. Bind navigation commands as in 'org-mode' and
'outline-minor-mode'.
(emacs-news-mode-map): Inherit from 'emacs-news-common-map'.
(emacs-news-view-mode-map): New defvar-keymap; inherit from
'emacs-news-common-map'.
Eli Zaretskii [Sun, 3 Jul 2022 12:37:50 +0000 (15:37 +0300)]
Fix implementation of 'reset' face values
* src/xfaces.c (Finternal_merge_in_global_face)
(gui_supports_face_attributes_p): Only modify local copy of face
attributes when replacing 'reset' pseudo-values with real values.
(Bug#38771)