Po Lu [Wed, 13 Jul 2022 03:01:59 +0000 (11:01 +0800)]
Fix closing displays when preserving selections is enabled
* src/frame.c (delete_frame): Bind `x-auto-preserve-selections'
to nil if deleting display.
* src/xselect.c (x_clear_frame_selections): Pass original frame
to that function.
* src/xterm.c (x_preserve_selections): Fix determining the new
owner.
(syms_of_xterm): New defsym `x-auto-preserve-selections'.
* src/xterm.h: Update prototypes.
* doc/emacs/files.texi (Image Mode): Adjust documentation.
* lisp/image/image-converter.el (image-convert): Let the converter
know whether it's a file or not.
Stefan Kangas [Tue, 12 Jul 2022 14:32:07 +0000 (16:32 +0200)]
Make pcomplete/{rsh,rlogin} into alias for pcomplete/ssh
* lisp/pcmpl-unix.el (pcomplete/rlogin, pcomplete/rsh): Make into
aliases for 'pcomplete/ssh', as "rsh" and "rlogin" is more often than
not aliases for "ssh" on modern machines.
* lisp/eshell/em-dirs.el (eshell-dirs-initialize): Properly handle
indexing for variable aliases.
* lisp/eshell/esh-var (eshell-variable-aliases-list): Properly handle
indexing for variable aliases, and add SIMPLE-FUNCTION entry for
aliases.
(eshell-get-variable): Update how variable alias functions are called.
* test/lisp/eshell/em-alias-tests.el
(em-alias-test/alias-arg-vars-indices)
(em-alias-test/alias-arg-vars-split-indices)
(em-alias-test/alias-all-args-var-split-indices):
* test/lisp/eshell/em-dirs-tests.el (em-dirs-test/pwd-var-indices)
(em-dirs-test/oldpwd-var-indices)
(em-dirs-test/directory-ring-var-indices):
* test/lisp/eshell/esh-var-tests.el
(esh-var-test/inside-emacs-var-split-indices)
(esh-var-test/last-result-var-split-indices): New tests.
(esh-var-test/last-arg-var-split-indices): Expand test to check
conversion behavior inside double quotes (bug#56509).
Jim Porter [Sat, 9 Jul 2022 01:41:07 +0000 (18:41 -0700)]
Allow Eshell variable aliases to point to other aliases
In particular, this resolves an issue where '$+' referenced the real
environment variable '$PWD' instead of the Eshell variable alias of
the same name. This meant that changing directories in Eshell
wouldn't update the value of '$+'.
* lisp/eshell/esh-var.el (eshell-get-variable): Allow Eshell variable
aliaes to point to other aliases.
* test/lisp/eshell/em-dirs-tests.el (em-dirs-test/pwd-var)
(em-dirs-test/short-pwd-var): Adapt tests to check this case
(bug#56509).
Jim Porter [Mon, 4 Jul 2022 03:05:29 +0000 (20:05 -0700)]
Improve tests/organization for built-in variables
* lisp/eshell/em-dirs.el (eshell-inside-emacs)
(eshell-dirs-initialize): Move 'INSIDE_EMACS' from here...
* lisp/eshell/esh-var.el (eshell-inside-emacs)
(eshell-variable-aliases-alist): ... to here, and improve doc string.
* test/lisp/eshell/eshell-tests.el (eshell-test/inside-emacs-var):
Move from here...
* test/lisp/eshell/esh-var-tests.el (esh-var-test/inside-emacs-var):
... to here.
(esh-var-test/last-arg-var-indices)
(esh-var-test/last-arg-var-split-indices): New tests.
* test/lisp/eshell/em-alias-tests.el:
* test/lisp/eshell/em-dirs-tests.el:
* test/lisp/eshell-em-script-tests.el: New files.
* doc/misc/eshell.texi (Built-ins): Fix 'cd' documentation; it works
with the directory ring, not the directory stack. Move built-in
variables documentation from here...
(Variables): ... to here, and add documentation for missing built-in
variables.
* src/buffer.c (Fmake_indirect_buffer): Kill the local
buffer-stale-function variable instead of setting it
buffer-locally to the default value. This should have the same
effect, but is less confusing.
Stefan Kangas [Tue, 12 Jul 2022 11:41:28 +0000 (13:41 +0200)]
Don't mention cl-cXXXr aliases in cl-lib manual
* doc/misc/cl.texi (Lists, List Functions, Efficiency Concerns): Don't
mention 'cl-cXXXr' compatibility aliases for built-in 'cXXXr'
functions. They shouldn't be used in new code.
Stefan Kangas [Tue, 12 Jul 2022 10:11:43 +0000 (12:11 +0200)]
Make remote-shell-program default to ssh only
* lisp/files.el (remote-shell-program): Default to "ssh" only. The
other commands in this list have severe security issues, and it is
easy enough for users to customize them manually if they want to.
See also the discussion in: https://debbugs.gnu.org/56461
* lisp/play/gomoku.el (gomoku-X): Use blue rather than green for
crosses on bright background for better legibility.
(Red for naughts could be adjusted but seems just about bearable.)
This fixes bug #56502. That function and these variables were manipulated by
the former file emacs-lisp/lmenu.el that was finally expunged from directory
obsolete/ by Stefan Kangas on 2020-05-15. There remain references to them in
the *.c, and *.m files.
* src/keyboard.c (syms_of_keyboard): Remove declarations of the symbol and
variable.
* src/minibuf.c (minibuf_conform_representation): Remove.
(Ftry_completion): Don't call it.
(Ftest_completion): Don't use the obsolete Fstring_make_unibyte or
Fstring_make_multibyte; they don't serve any useful purpose here.
We don't try to equate unibyte and multibyte raw bytes in symbol
lookups elsewhere and there is no reason to do it here.
Stefan Kangas [Mon, 11 Jul 2022 15:21:23 +0000 (17:21 +0200)]
Remove dead branch from substitute-command-keys
* lisp/help.el (substitute-command-keys): Remove dead branch;
where-is-internal will follow any remaps for us. Note also that the
test case for remapping still pass.
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.