* lisp/battery.el (battery-status-function): In Termux, neither
/sys/ or /proc/ are readable on phones that are not rooted. This
patch makes Emacs verify if they are readable before it attemps
reading them (bug#53026).
* lisp/progmodes/python.el (python-shell-send-string-no-output): Don't
let-bind comint-preoutput-filter-functions globally for all comint
processes. Modify the behaviour of only the current python
process (bug#53219).
Dmitry Gutov [Fri, 14 Jan 2022 02:30:16 +0000 (04:30 +0200)]
Steamline xref-query-replace-in-results
* lisp/progmodes/xref.el (xref-query-replace-in-results):
Steamline the most common scenario
(https://lists.gnu.org/archive/html/emacs-devel/2022-01/msg00864.html).
Eli Zaretskii [Thu, 13 Jan 2022 14:40:28 +0000 (16:40 +0200)]
Improve documentation of 'isearch-emoji-by-name'
* lisp/isearch.el (isearch-menu-bar-map, isearch-emoji-by-name):
Fix wording of documentation.
* etc/NEWS: Fix wording of the 'isearch-emoji-by-name' entry.
* doc/emacs/search.texi (Special Isearch): Fix wording of the
documentation of 'isearch-emoji-by-name'; move it out of the
enumeration that deals with non-ASCII characters in general.
Eli Zaretskii [Thu, 13 Jan 2022 14:18:50 +0000 (16:18 +0200)]
Fix frame-undeletion menu items
* lisp/menu-bar.el (menu-bar-file-menu): Fix wording of the new
menu items and their help-echo. Don't show "Undelete Frame"
in the menu unless there is a frame to undelete.
Gregory Heytings [Thu, 13 Jan 2022 08:31:43 +0000 (10:31 +0200)]
Undelete deleted frames.
* lisp/frame.el (undelete-frame): New command.
(undelete-frame--handle-delete-frame): New auxiliary function.
(undelete-frame--deleted-frames): New auxiliary variables.
(undelete-frame-mode): New minor mode.
(ctl-x-5-map): Bind the new command.
* etc/NEWS: Document the new command and minor mode.
* src/frame.c (Fdelete_frame): Update docstring, and mention the
minor mode.
* lisp/menu-bar.el (menu-bar-file-menu): Add an entry for the
new command.
* doc/emacs/frames.tex (Frame Commands): Document the new command
and minor mode.
Po Lu [Thu, 13 Jan 2022 01:32:14 +0000 (09:32 +0800)]
Use XI2 focus events on X toolkit builds
* src/xfns.c (setup_xi_event_mask): Set focus masks on both the
shell window and the frame window.
* src/xterm.c (x_detect_focus_change): Enable XI2 focus code on
Xt.
Eric Abrahamsen [Wed, 12 Jan 2022 22:58:46 +0000 (14:58 -0800)]
Rework setting/unsetting of gnus-registry-enabled
The basic idea is, we're moving the setting/unsetting of
`gnus-registry-enabled' so that it is a more reliable indicator of
whether the registry is actually available or not.
* lisp/gnus/gnus-registry.el (gnus-registry-load): Move the setting of
`gnus-registry-enabled' here, after we're sure the registry actually
has been loaded.
(gnus-registry-initialize): Move it out of here. All this function
does is conditionally call `gnus-registry-load'.
(gnus-registry-register-message-ids): Only check
`gnus-registry-enabled', since we'd more confident about this
now. Sort checks in order of increasing complexity.
(gnus-registry-clear): Unset `gnus-registry-enabled'.
(gnus-registry-install-hooks): This function should only install
hooks, not set variables.
(gnus-registry-unload-hook): Change the unload hook to call
`gnus-registry-clear', as that will do all the necessary
work (including calling `gnus-registry-unload-hook')
Daniel Martín [Wed, 12 Jan 2022 17:43:15 +0000 (19:43 +0200)]
Add isearch-emoji-by-name
* lisp/isearch.el (isearch-emoji-by-name): Add a new command to insert
Emoji characters into incremental search strings. (Bug#52605)
(isearch-mode-map): Bind it to 'C-x 8 e RET'.
(isearch-menu-bar-map): Add it to the menu bar.
* doc/emacs/search.texi (Special Isearch): Update the documentation to
mention the new command.
* etc/NEWS: And advertise it.
Fix closure-conversion of shadowed captured lambda-lifted vars
Lambda-lifted variables (ones passed explicitly to lambda-lifted
functions) that are also captured in an outer closure and shadowed
were renamed incorrectly (bug#51982).
Reported by Paul Pogonyshev.
* lisp/emacs-lisp/cconv.el (cconv--lifted-arg): New.
(cconv-convert): Provide correct definiens for the closed-over
variable.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
* test/lisp/emacs-lisp/cconv-tests.el (cconv-tests--intern-all)
(cconv-closure-convert-remap-var): Add tests.
Jim Porter [Tue, 4 Jan 2022 20:58:38 +0000 (12:58 -0800)]
Follow POSIX/GNU argument conventions for 'eshell-eval-using-options'
* lisp/eshell/esh-opt.el (eshell--split-switch): New function.
(eshell-set-option): Allow setting a supplied value instead of always
consuming from 'eshell--args'.
(eshell--process-option): Support consuming option values specified as
a single token.
(eshell--process-args): For short options, pass full switch token to
'eshell--process-option'.
* test/lisp/eshell/esh-opt-tests.el (esh-opt-process-args-test): Fix
test.
(test-eshell-eval-using-options): Add tests for various types of
options.
* doc/misc/eshell.texi (Defining new built-in commands): New
subsection, describe how to use 'eshell-eval-using-options'.
Eli Zaretskii [Wed, 12 Jan 2022 14:52:14 +0000 (16:52 +0200)]
Avoid assertion violations with variable-weight fonts
* src/font.c (font_score, font_delete_unmatched): Don't assume
weight, slant, and width properties of the font must be fixnums:
some variable-weight fonts violate that assumption. Reported
by Sean Whitton <spwhitton@spwhitton.name>. This is for builds
with Fontconfig < v2.11.91, for which the fix in
'ftfont_pattern_entity' cannot work. (Bug#52888)
Don't fail flymake-tests if `gcc` actually is Clang
* test/lisp/progmodes/flymake-tests.el (flymake-tests--gcc-is-clang)
(different-diagnostic-types, included-c-header-files): Skip tests that
depend on the `gcc` command really being GCC and not Clang.
* lisp/gnus/gnus-art.el (gnus-treat-emphasize): Don't do emphasis
in text/html parts, because this leads to mis-filled text
(especially with *...* that's boldified, which typically becomes
much wider).
Paul Eggert [Tue, 11 Jan 2022 16:58:18 +0000 (08:58 -0800)]
Clean up filelock code related to errno
Reduce dependency on Haiku internals, by not assuming that
Haiku errno values (which are negative) are neither -1 nor -2.
This removes an #ifdef HAIKU while still maintaining
portability to Haiku.
* src/filelock.c (NEGATIVE_ERRNO, ANOTHER_OWNS_IT, I_OWN_IT):
New constants, which should work regardless of whether
we are on Haiku or B_USE_POSITIVE_POSIX_ERRORS is defined.
(current_lock_owner, lock_if_free, lock_file, unlock_file)
(Ffile_locked_p): Use them, without assuming anything about errno
value sign.
Po Lu [Tue, 11 Jan 2022 11:06:41 +0000 (19:06 +0800)]
Stop ungrabbing when freeing XI devices
This breaks when x_free_xi_devices is called from a
HierarchyChange event where a master device has been removed or
a slave device has been detached, and it should no longer be
required since we now rely on passive grabs.
* src/xterm.c (x_init_master_valuators): Stop calling
XIUngrabDevice on all devices.
When calling outline-on-heading-p, set its argument INVISIBLE-OK to t,
so when <backtab> (bound to outline-cycle-buffer) hides the current outline
at a deep level, <backtab> should continue cycling outlines even when
the current outline heading is invisible. It worked this way before
the recent change that moved cycling keys from font-lock text properties
to outline-minor-mode keymap with :filter.
Stefan Monnier [Tue, 11 Jan 2022 03:40:55 +0000 (22:40 -0500)]
(files-tests--with-buffer-offer-save): Turn it into a function
* test/lisp/files-tests.el (files-tests--with-buffer-offer-save):
Turn it into a function.
(files-tests-save-buffers-kill-emacs--asks-to-save-buffers)
(files-tests-buffer-offer-save): Adjust calls accordingly
Sam Steingold [Sun, 9 Jan 2022 23:30:25 +0000 (18:30 -0500)]
Use 'auth-info-password' in tests
* test/lisp/auth-source-tests.el (auth-source-test-searches):
(auth-source-test-secrets-create-secret):
(auth-source-test-netrc-create-secret, auth-source-delete):
Use 'auth-info-password' instead of ad hoc code.
Sam Steingold [Sun, 9 Jan 2022 22:36:38 +0000 (17:36 -0500)]
Update for the recent change
* doc/misc/auth.texi (Help for developers): Document
'auth-source-pick-first-password' and 'auth-info-password'.
Update the 'auth-source-search' example.
Karl Fogel [Mon, 10 Jan 2022 19:20:29 +0000 (13:20 -0600)]
Document external maintenance of some packages
Document the fact that some packages in Emacs are externally
maintained, and specifically document Org Mode's external maintenance.
For more context, see the thread that starts here:
https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg00366.html
From: Karl Fogel
To: Emacs Devel
Subject: Improving documentation of Org Mode integration into Emacs.
Date: Sat, 04 Dec 2021 15:14:59 -0600
Message-ID: <87zgpgax7w.fsf@red-bean.com>
Juri Linkov [Mon, 10 Jan 2022 18:29:53 +0000 (20:29 +0200)]
Add diff-mode-read-only to enable shorter keys in diff-mode
To be able to use outline-minor-mode-cycle keys in diff-mode,
outline-minor-mode should be higher in minor-mode-map-alist,
and a new variable diff-mode-read-only should be set
when the diff-mode buffer is read-only.
https://lists.gnu.org/archive/html/emacs-devel/2022-01/msg00740.html
* lisp/vc/diff-mode.el: Add diff-mode-read-only to minor-mode-map-alist.
(diff-mode-read-only): New buffer-local variable.
(diff-mode): Set diff-mode-read-only to t when buffer-read-only is non-nil.
Update diff-mode-read-only in read-only-mode-hook.
Remove buffer-read-only from minor-mode-overriding-map-alist.
Remove view-mode-hook because now view-mode is higher than
diff-mode-read-only in minor-mode-map-alist.
* lisp/vc/vc-git.el (vc-git-stash-show):
* lisp/vc/vc.el (vc-diff-internal): Set buffer-read-only to t
before calling diff-mode that will set diff-mode-read-only.
Juri Linkov [Mon, 10 Jan 2022 18:20:09 +0000 (20:20 +0200)]
* lisp/outline.el: Don't set outline-minor font-lock text property 'keymap'.
Instead of adding font-lock text property 'keymap' with
outline-minor-mode-cycle on headings in outline-minor-mode,
check for outline-minor-mode-cycle and outline-on-heading-p
in :filter on keys from the keymap of outline-minor-mode.
https://lists.gnu.org/archive/html/emacs-devel/2022-01/msg00180.html
(outline-minor-mode-cycle--bind): Add a condition on outline-minor-mode-cycle
and outline-on-heading-p in :filter.
(outline-font-lock-keywords): Remove if-branches for outline-minor-mode-cycle
that added keymap.
(outline-minor-mode-highlight-buffer): Don't put keymap on overlays.
(outline-minor-mode): Rewrite :keymap setting to rely on
easy-mmode-define-keymap, and add :inherit outline-minor-mode-cycle-map.
Don't check for outline-minor-mode-cycle to add font-lock keywords.
(outline--insert-open-button, outline--insert-close-button):
Remove :parent outline-minor-mode-cycle-map.