Allow commands that call `yes-or-no-p' to be repeatable again
* lisp/subr.el (y-or-n-p): Enable commands that call this function
to be repeatable (bug#45999). This stopped working after this
function started using read-from-minibuffer.
* src/fns.c (Fyes_or_no_p): Ditto.
Po Lu [Mon, 11 Jul 2022 11:36:01 +0000 (19:36 +0800)]
Improve behavior of `lost-selection-mode' with multiple buffers
* etc/NEWS: Announce new hook `post-select-region-hook'.
* lisp/select.el (lost-selection-last-region-buffer): New
variable.
(lost-selection-post-select-region-function): New function.
Deactivate the mark if the buffer changed.
(lost-selection-mode): Add new hook.
* src/keyboard.c (command_loop_1): Run that hook when
appropriate.
(syms_of_keyboard): New hook `post-select-region-hook'.
Daniel Martín [Sun, 10 Jul 2022 20:36:28 +0000 (22:36 +0200)]
Fix memory leak in ns_draw_relief
* src/nsterm.h (struct ns_output): New fields to store the relief
colors.
* src/nsterm.m (ns_setup_relief_colors): New function to keep the
relief colors as part of the ns_output structure.
(ns_draw_relief): Remove static local variables. Assigning them to
nil caused a memory leak of NSColor instances (bug#56462). Call
ns_setup_relief_colors instead.
* lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Fix filling
when called directly with `M-x lisp-fill-paragraph' instead of via
`M-q' (bug#56476).
Stefan Kangas [Sun, 26 Dec 2021 20:59:16 +0000 (21:59 +0100)]
Make crm-default-separator obsolete as per FIXME
* lisp/emacs-lisp/crm.el (crm-default-separator): Make into
obsolete variable alias for crm-separator.
(crm-separator): Update docstring for above change.
Stefan Kangas [Mon, 11 Jul 2022 09:17:09 +0000 (11:17 +0200)]
Re-add comment on autoloading cookies in preloaded files
This comment was removed in 2009, but it is useful to explain why
we are keeping these autoload cookies.
* lisp/bindings.el:
* lisp/font-core.el:
* lisp/format.el:
* lisp/international/mule-cmds.el: Re-add comment on autoloading.
* lisp/font-core.el (font-lock-defaults): Re-add autoload cookie,
despite the fact that this file is preloaded.
* src/character.h (str_to_multibyte):
* src/character.c (str_to_multibyte): Change signature and simplify;
the conversion is no longer done in-place.
* src/fns.c (string_to_multibyte): Drop temporary buffer and memcpy;
adapt to new str_to_multibyte signature.
* src/print.c (print_string): Drop memcpy; adapt call to str_to_multibyte.
* test/src/fns-tests.el (fns--string-to-unibyte): Rename to...
(fns--string-to-unibyte-multibyte): ... this and strengthen, so that
the test covers string-to-multibyte reasonably well.
Stefan Kangas [Sun, 10 Jul 2022 16:44:43 +0000 (18:44 +0200)]
Rename new option to browse-url-default-scheme
* lisp/net/browse-url.el (browse-url-default-scheme): Rename from
'browse-url-guess-default-scheme'. Update caller.
Suggested by Eli Zaretskii <eliz@gnu.org>.
Stefan Kangas [Sun, 10 Jul 2022 15:09:18 +0000 (17:09 +0200)]
Don't use purecopy in dictionary.el
* lisp/net/dictionary.el (dictionary-pre-buffer)
(dictionary-display-dictionary-line)
(dictionary-display-more-info, dictionary-display-strategy-line)
(dictionary-display-match-lines): Don't use purecopy; it has no
effect here.
Eli Zaretskii [Sun, 10 Jul 2022 08:32:05 +0000 (11:32 +0300)]
Fix the startup.el behavior when 'face-font-rescale-alist' is non-nil
* lisp/startup.el (command-line-1, normal-top-level): Reset the
default face's font only if 'face-font-rescale-alist' affects that
face's font. For the use case where it matters, see
https://lists.gnu.org/archive/html/emacs-devel/2022-07/msg00157.html.
Make the 'inhibit-startup-screen' and non-inhibit branches behave
the same in that case.
Stefan Kangas [Thu, 7 Jul 2022 11:25:23 +0000 (13:25 +0200)]
Drop support for the dead third-party w3 package
The w3 package was removed from GNU ELPA in 2020 as it doesn't run on
a recent Emacs, and development had stopped over a decade before that.
If anyone wants to revive the w3 package, they should look this all
over, but it doesn't make sense for us to maintain this support code.
Ref: https://debbugs.gnu.org/25395
* lisp/net/browse-url.el (browse-url-w3): Make obsolete.
(browse-url--browser-defcustom-type)
(browse-url-default-browser):
* lisp/ffap.el (ffap-url-at-point, ffap-file-at-point):
* lisp/net/newst-plainview.el (newsticker--buffer-do-insert-text):
* lisp/net/newst-reader.el (newsticker-html-renderer)
(newsticker-show-news):
* lisp/net/newst-treeview.el (newsticker--treeview-render-text):
* lisp/org/ol.el (org-store-link):
* lisp/url/url.el (url-retrieve): Remove w3 support code and related
documentation and comments. (Bug#56435)
* test/lisp/net/browse-url-tests.el
(browse-url-tests-browser-kind): Adjust test for above changes.
* etc/TODO: Remove TODO to install W3.
* doc/misc/org.org (Handling Links): Don't mention W3.
* lisp/msb.el (msb--few-menus, msb--very-many-menus): Check for
eww-mode instead of w3-mode.
Stefan Kangas [Sat, 9 Jul 2022 14:19:07 +0000 (16:19 +0200)]
Improve introductory section of TRAMP manual
* doc/misc/tramp.texi (Top, Overview): Explain what TRAMP is
without contrasting to Ange FTP. (Bug#56440)
(Frequently Asked Questions): Move information on Ange FTP here.
Stefan Kangas [Sat, 9 Jul 2022 09:29:25 +0000 (11:29 +0200)]
New command emacs-news-toggle-tag
* lisp/textmodes/emacs-news-mode.el (emacs-news-toggle-tag): New
command.
(emacs-news-mode-map): Bind above new command to "C-c C-t".
* test/lisp/textmodes/emacs-news-mode-resources/toggle-tag.erts:
* test/lisp/textmodes/emacs-news-mode-tests.el: New files.
Po Lu [Sat, 9 Jul 2022 08:18:35 +0000 (16:18 +0800)]
Improve drag-and-drop emulation time handling
* src/xselect.c (x_handle_selection_request): Use
display-specific pending DND time.
(x_set_pending_dnd_time): Delete function.
* src/xterm.c (x_dnd_do_unsupported_drop, handle_one_xevent):
Set dpyinfo->pending_dnd_time instead.
* src/xterm.h (struct x_display_info): New field
`pending_dnd_time'. Make handling pending drops
display-specific to avoid interference when there are multiple
displays.
Po Lu [Sat, 9 Jul 2022 04:50:06 +0000 (04:50 +0000)]
Fix race conditions handling selection clear events on Haiku
* src/haiku_select.cc (be_handle_clipboard_changed_message):
Include current clipboard count.
(be_selection_outdated_p): New function.
* src/haikuselect.c (haiku_handle_selection_clear): Ignore
outdated events.
(haiku_selection_disowned): New argument `count'. Include it in
the timestamp field of the selection clear event.
* src/haikuselect.h: Update prototypes.
* src/systime.h: Define `Time' to an appropriate value on Haiku.
Po Lu [Sat, 9 Jul 2022 01:07:07 +0000 (09:07 +0800)]
Add new minor mode to deactivate the region once PRIMARY is lost
* doc/emacs/killing.texi (Primary Selection): Document new minor
mode `lost-selection-mode'.
* etc/NEWS: Announce new minor mode.
* lisp/select.el (lost-selection-function): New function.
(lost-selection-mode): New global minor mode.
Po Lu [Sat, 9 Jul 2022 00:05:30 +0000 (08:05 +0800)]
Speed up querying for window manager support
* src/xterm.c (handle_one_xevent): Clear net_supported_window if
it is destroyed.
(x_get_wm_check_window): New function.
(x_wm_supports_1): First try net_supported_window. If it still
exists, don't ask for _NET_SUPPORTING_WM_CHECK.
Juri Linkov [Fri, 8 Jul 2022 17:58:33 +0000 (20:58 +0300)]
* lisp/isearch.el (isearch-search-fun-in-noncontiguous-region): New function.
(isearch-search-fun-in-text-property): Refactor body to
'search-within-boundaries', then call it (bug#14013).
(search-within-boundaries): New function refactored from
isearch-search-fun-in-text-property.
* test/lisp/isearch-tests.el: Add tests for new search functions.
(isearch--test-search-within-boundaries): New function.
(isearch--test-search-fun-in-text-property)
(isearch--test-search-fun-in-noncontiguous-region): New tests.
Juri Linkov [Fri, 8 Jul 2022 17:47:11 +0000 (20:47 +0300)]
Display the number of invisible matches for isearch-lazy-count (bug#40808)
* lisp/isearch.el (lazy-count-invisible-format): New variable.
(isearch-mode): Set isearch-lazy-count-invisible to nil.
(isearch-lazy-count-format): Use lazy-count-invisible-format and
isearch-lazy-count-invisible.
(isearch-range-invisible): Handle the value 'can-be-opened' of
'search-invisible' and don't open overlays for it, just check
if these overlays can be opened.
(isearch-lazy-count-invisible): New variable.
(isearch-lazy-highlight-new-loop): Set isearch-lazy-count-invisible to nil.
(isearch-lazy-highlight-search): Let-bind search-invisible either to t
for non-nil isearch-lazy-count, or to 'can-be-opened'.
(isearch-lazy-highlight-match): Don't highlight matches intended
to be counted only, not highlighted.
(isearch-lazy-highlight-buffer-update): Separately count invisible
matches by isearch-lazy-count-invisible.
* lisp/info.el (Info-isearch-filter): Check if search-invisible is t.
Fix file-name-case-insensitive-p in ffap (bug#56443)
Don't crash if the file name argument to file-name-case-insensitive-p,
after expansion, doesn't have a parent directory. This occurs
when calling ffap on something that looks like an email address.
* src/fileio.c (Ffile_name_case_insensitive_p): Return nil if no file
or parent directory could be found.
* test/src/fileio-tests.el (fileio-tests--identity-expand-handler)
(fileio--file-name-case-insensitive-p): New test.
Stefan Kangas [Fri, 8 Jul 2022 10:04:17 +0000 (12:04 +0200)]
Stop ffap-machine-at-point from pinging random hosts
Having this on by default is highly problematic from a security and
privacy standpoint, as it risks having outgoing traffic that could
potentially reveal sensitive data (passwords, names, etc.).
It also seems to be causing issues for users, see e.g.
https://github.com/emacs-helm/helm/issues/648
* lisp/ffap.el (ffap-machine-p-known): Change default to 'accept'.
Po Lu [Fri, 8 Jul 2022 05:41:50 +0000 (13:41 +0800)]
Reduce synchronization setting frame alpha
* src/xterm.c (x_set_frame_alpha): Don't synchronize while
setting alpha property, and don't ask for the current value of
the opacity property, which is much more expensive than changing
it.