Juri Linkov [Wed, 11 Aug 2021 07:06:29 +0000 (10:06 +0300)]
* lisp/replace.el (perform-replace): Use 'remove-function' (bug#49963).
Don't let-bind the value of 'isearch-filter-predicate' to protect
from changing the global value, since with a buffer-local value
it still changes the global value. So after using 'add-function' on the
global value of 'isearch-filter-predicate', call 'remove-function' to remove
'region-filter' from the global value in 'unwind-protect'.
* doc/misc/gnus.texi (Topic Variables): Document it.
* lisp/gnus/gnus-topic.el (gnus-topic-prepare-topic): New user option.
(gnus-topic-prepare-topic): Use it.
More robust auto-detect of grep-highlight-matches (bug#49978)
* lisp/progmodes/grep.el (grep-compute-defaults):
Don't require "grep --help" to finish with exit status 0 (BSD grep
does not) and check the output in a slightly more robust way.
* lisp/gnus/nnrss.el (nnrss-get-namespace-prefix): Use the car of
parameter el to match what dom-search expects.
* test/lisp/gnus/nnrss-tests.el (test-nnrss-xml): Adjust to what
xml-parse-region produces (bug#34685).
Tramp string-search and string-replace compatibility functions
Add a `string-search` compatibility function for use in Tramp with
Emacs version prior to 28, and fix the existing `string-replace`
compatibility function so that it uses the right semantics.
* lisp/net/tramp-compat.el (tramp-compat-string-replace):
Use case-sensitive matching and literal replacement.
(tramp-compat-string-search): New function.
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions)
(tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-make-process, tramp-sh-handle-process-file):
* lisp/net/tramp.el (tramp-handle-make-process):
Use `tramp-compat-string-search` instead of `string-match-p`.
`string-search` is easier to understand, less error-prone, much
faster, does not pollute the regexp cache, and does not mutate global
state. Use it where applicable and obviously safe (erring on the
conservative side).
Tassilo Horn [Sun, 8 Aug 2021 14:45:50 +0000 (16:45 +0200)]
Un-obsolete dired-in-this-tree-p and use it again in certain places.
This reverts parts of b425966b07, and 7b50ed553f, i.e. it reverts the
obsoletion of dired-in-this-tree-p and switches some new callers of
file-in-directory-p back to using dired-in-this-tree-p.
It turned out that using file-in-directory-p can be a major
performance regression in case you have a dired buffer of a remote
directory which has become (almost) inaccessible.
Any attempt to open a new dired buffer is checking if a buffer for
that directory already exists (in terms of dired-buffers-for-dir)
which meant that file-in-directory-p was called with the directory of
any existing dired buffer including the inaccessible one where the
file-truename call in file-in-directory-p could block for seconds or
even minutes.
* lisp/dired.el (dired-in-this-tree-p): Undo obsoletion.
(dired-buffers-for-dir): Use dired-in-this-tree-p as before.
* lisp/dired-aux.el (dired-kill-tree,dired-tree-down): Une
dired-in-this-tree-p as before.
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
Eric Abrahamsen [Fri, 6 Aug 2021 00:53:05 +0000 (17:53 -0700)]
Further fix to filtering Gnus search group names
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output): Group
names in the GROUPS argument may be prefixed or not, depending on
which server we're searching, so always enforce prefix policy within
the function.
Make `q' in `org-agenda' work even with `debug-on-error' set
* lisp/org/org-agenda.el (org-agenda-get-restriction-and-command):
Using `error' here will trigger users with `debug-on-error' so use
`user-error' instead (bug#49920). It would probably be preferable
to rewrite this to not use the error system to do control flow.
* lisp/progmodes/perl-mode.el: Handle variables first to avoid
conflicting with keywords. This fixes cases like "$package"
(bug#49906).
Copyright-paperwork-exempt: yes
Allow building on MacOS with MacPorts and libgccjit
* configure.ac: Check for the "port" command (MacPorts).
Add the required lib/include directories for nativecomp.
* src/Makefile.in (LIBGCCJIT_CFLAGS, LIBGCCJIT_LIBS): Split into
two parts to allow including -L/-I for MacPorts.
(LIBES): Adjust.
(EMACS_CFLAGS): Ditto.
dick r. chiang [Fri, 6 Aug 2021 11:24:53 +0000 (13:24 +0200)]
Fix problem with occasional stalls in `url-retrieve-synchronously'
* lisp/url/url.el (url-retrieve-synchronously): Use
`accept-process-output' on a null process. That is the safer, more
conventional way of achieving non-blocking sleep-for (bug#49897).
Eli Zaretskii [Fri, 6 Aug 2021 07:51:45 +0000 (10:51 +0300)]
Fix automatic hscrolling when line numbers are displayed
* src/xdisp.c (hscroll_window_tree): When line numbers are
displayed, account for the the line-number space when calculating
the desired X coordinate on the left. (Bug#49891)
Eli Zaretskii [Fri, 6 Aug 2021 06:46:39 +0000 (09:46 +0300)]
Make sure installed *.eln files have correct permissions
* Makefile.in (install-eln): Add "umask 022" to ensure the *.eln
files are accessible from the user's Emacs session. Suggested by
Wilhelm Kirschbaum <wkirschbaum@gmail.com>. (Bug#49864)
ERC right stamps: also use latest buffer's window's width (Bug#44140)
* lisp/erc/erc-stamp.el (erc-insert-timestamp-right): Use latest
buffer's window's width to position the timestamp, if both
`erc-timestamp-right-column' and `erc-fill-column' are not set (or
`erc-fill-mode' is off). This is what the documentation says, but was
not implemented. Also fix the bug of using selected window's width
instead of the (or some) window showing the buffer. The latest
window's width is saved in `erc-timestamp-last-window-width' and used
when the buffer is no more shown. In case the buffer was never shown,
which I'm not sure can happen, either use `fill-column' if set, or
give up on aligning and just output the timestamp (modulo the kludge)
right after message text. While here, fix the off by one calculation
of point start when the reference is the window's width.
Dmitry Gutov [Fri, 6 Aug 2021 00:30:10 +0000 (03:30 +0300)]
Change how project-find-file's completion works
* lisp/progmodes/project.el (project--completing-read-strict):
Allow to choose a non-existent file, with confirmation
(bug#49204).
Don't use the string at point as a "real" default, and instead
only include it in "future history": meaning, it will be inserted
on 'M-n' (bug#49865).
Juri Linkov [Thu, 5 Aug 2021 23:36:22 +0000 (02:36 +0300)]
Add function minibuffer-restore-windows (bug#45072)
* lisp/minibuffer.el (minibuffer-restore-windows): New function
that removes the completions buffer. Add it to minibuffer-exit-hook.
* src/minibuf.c (read-minibuffer-restore-windows): Mention
minibuffer-restore-windows.
Eli Zaretskii [Thu, 5 Aug 2021 17:42:10 +0000 (20:42 +0300)]
Fix files-tests on non-Posix systems
* test/lisp/files-tests.el (files-test-auto-save-name-default)
(files-test-auto-save-name-transform)
(files-test-auto-save-name-unique, files-test-lock-name-default)
(files-test-lock-name-unique): Skip the drive letter in absolute
file names on MS-Windows/MS-DOS when comparing file names against
the expected ones.
(files-tests-file-name-non-special--subprocess): Skip test on
MS-Windows/MS-DOS.
The current method of propagating constants through setq was unsound
because it relied on each setq form only being traversed at most once
during optimisation, which isn't necessarily true in general; it could
be made to miscompile code in rare cases.
Since it was only used in limited circumstances, disabling this
optimisation doesn't cost us much.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Don't update the known value when traversing `setq`.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.
Make `M-j' work reliably if `comment-auto-fill-only-comments' is set
* lisp/simple.el (default-indent-new-line): Force breaking the
line when called interactively (bug#49849). (Perhaps the
interactive command should be rebound and call this function
instead...)
dickmao [Tue, 3 Aug 2021 16:02:48 +0000 (12:02 -0400)]
ffap ido accommodation
Now that ffap-file-finder can be ido-find-file, the
noninteractive portion of find-file-at-point cannot
assume ffap-file-finder always takes an argument
(ido-find-file does not).
* lisp/ffap.el (find-file-at-point): Do not call ffap-file-finder.
* test/lisp/ffap-tests.el (ffap-ido-mode): Test it.
Miha Rihtaršič [Wed, 4 Aug 2021 07:15:25 +0000 (09:15 +0200)]
Use `abort-minibuffers' in delsel
* lisp/delsel.el (minibuffer-keyboard-quit): Use
`abort-minibuffers' (bug#49821).
Previously, C-g was bound to abort-recursive-edit, now it is bound to
abort-minibuffers. However, after requiring delsel, it gets bound to
minibuffer-keyboard-quit, which still uses abort-recursive-edit. Use
the new function instead.
* lisp/emacs-lisp/cl-generic.el (cl-generic-generalizers): Evaluate
forms that are eql specializers. Provide backward compatibility
with a warning.
* test/lisp/emacs-lisp/cl-generic-tests.el: Add a test.
* lisp/emacs-lisp/bindat.el (bindat--type): Adhere to the new rule.
* lisp/emacs-lisp/edebug.el (edebug--match-&-spec-op): Adhere to the new rule.
* lisp/emacs-lisp/map.el (map-into): Adhere to the new rule.
* lisp/emacs-lisp/radix-tree.el (map-into): Adhere to the new rule.
* lisp/frame.el (cl-generic-define-context-rewriter): Adhere to the new rule.
* lisp/gnus/gnus-search.el
(gnus-search-transform-expression): Adhere to the new rule.
* lisp/image/image-converter.el
(image-converter--probe image-converter--convert): Adhere to the new rule.
* lisp/mail/smtpmail.el (smtpmail-try-auth-method): Adhere to the new rule.
* lisp/progmodes/elisp-mode.el
(xref-backend-definitions)
(xref-backend-apropos): Adhere to the new rule.
* lisp/progmodes/etags.el (xref-backend-identifier-at-point)
(xref-backend-identifier-completion-table)
(xref-backend-identifier-completion-ignore-case)
(xref-backend-definitions)(xref-backend-apropos): Adhere to the new rule.
* test/lisp/emacs-lisp/checkdoc-tests.el
(checkdoc-cl-defmethod-with-types-ok)
(checkdoc-cl-defmethod-qualified-ok)
(checkdoc-cl-defmethod-with-extra-qualifier-ok): Adhere to the new rule.
Michael Albinus [Tue, 3 Aug 2021 20:08:18 +0000 (22:08 +0200)]
Code cleanup for Tramp's yubikey integration
* lisp/net/tramp-sh.el (tramp-actions-before-shell)
(tramp-actions-copy-out-of-band):
Use `tramp-security-key-confirm-regexp'.
* lisp/net/tramp.el (tramp-security-key-confirm-regexp): Rename from
`tramp-yubikey-regexp'. Adapt docstring.
(tramp-security-key-confirmed-regexp): New defcustom.
(tramp-action-show-and-confirm-message):
Redisplay. Use `tramp-security-key-confirmed-regexp'.
Phil Sainty [Sat, 16 Jan 2021 12:25:13 +0000 (01:25 +1300)]
Make `global-so-long-mode' use `buffer-line-statistics'
* lisp/so-long.el: (so-long-statistics-excessive-p): New predicate
function using `buffer-line-statistics'.
(so-long-predicate): Use `so-long-statistics-excessive-p' by default.
* etc/NEWS: Describe changes.
* test/lisp/so-long-tests/so-long-tests-helpers.el:
* test/lisp/so-long-tests/so-long-tests.el: Update tests.
Also improve the existing `so-long-tests-predicate' tests.
A more general solution to bug#45084 has been implemented via
new user options `so-long-mode-preserved-variables' and
`so-long-mode-preserved-minor-modes'.
See the previous commit (before this revert) for details.
Phil Sainty [Sun, 10 Jan 2021 02:02:58 +0000 (15:02 +1300)]
Support 'preserved' variables and minor modes in `so-long-mode'
The default values support preserving the state of `view-mode' when
switching to (and reverting from) `so-long-mode' (bug#45084).
* lisp/so-long.el (so-long-mode-preserved-variables)
(so-long-mode-preserved-minor-modes): New user options.
(so-long-mode-maintain-preserved-variables)
(so-long-mode-maintain-preserved-minor-modes): New functions.
(so-long-remember-all, so-long-after-change-major-mode)
(so-long-mode-revert): Use them.
Phil Sainty [Sat, 20 Mar 2021 08:48:18 +0000 (21:48 +1300)]
; so-long-tests.el: Suppress expected warnings
* test/lisp/so-long-tests/so-long-tests.el
(so-long-tests-invisible-buffer-function): Suppress warning about
obsolete function `run-window-configuration-change-hook', as we are
using it intentionally (see the preceding code comments and URL for
details).
Phil Sainty [Sun, 10 Jan 2021 02:20:51 +0000 (15:20 +1300)]
; * lisp/so-long.el: Minor bug fixes
(so-long-disable-minor-modes): Don't call the mode function to disable
the mode unless it was actually enabled.
(so-long-restore-minor-modes, so-long-restore-variables): Use the
remembered list values, which might be different to the defaults.
Also comments, and spelling consistency changes for the so-long tests
(a fixup for commit 83bc4ad369 which had only addressed so-long.el,
and not the test files).
This doesn't affect buffers which are simply in `fundamental-mode' by
default. It only affects buffers for which `set-auto-mode' has been
called (normally via `find-file') without establishing a different
major mode.
Phil Sainty [Sun, 10 Jan 2021 01:29:32 +0000 (14:29 +1300)]
Increase `so-long-threshold' and `so-long-max-lines' defaults
* lisp/so-long.el (so-long-threshold, so-long-max-lines): Increase
default values to reduce false-positives.
* etc/NEWS: Describe changes.
Lines shorter than 10,000 characters shouldn't generally be causing
problems, so testing this explicitly will largely eliminate
false-positives. We must also increase the maximum number of lines
to check, because 'minified' code may still include newlines, and so
there may be many lines shorter than the new threshold before we find
a line which exceeds it.
Previously we used a minimum-effort heuristic, testing a very small
number of lines against a maximum length which, while not remotely
long enough to cause problems, would nevertheless be uncommon in any
normal file of programming code (and hence indicative that the file
was likely to be minified code).
Testing indicates that the performance penalty for the larger values
should be negligible.
* Fix error while disassembling native code on macOS
* lisp/emacs-lisp/disass.el (disassemble-internal): Make sure the
regexp that searches for a symbol takes into account of llvm-objdump's
output format.
* lisp/erc/erc-ibuffer.el (erc-modified): Don't use `length' on dotted
lists (and not even to test if there is more than one element, for
that matter). Use `cdr' instead.
Stephen Gildea [Mon, 2 Aug 2021 04:00:37 +0000 (21:00 -0700)]
mh-junk: adjust messages for allow/block actions
* lisp/mh-e/mh-junk.el: Remove messages that get overwritten quickly.
Keep messages that give status for slow operations. Add information
that might be useful for debugging failures.
Stefan Monnier [Sun, 1 Aug 2021 22:13:41 +0000 (18:13 -0400)]
* lisp/mwheel.el: Don't use `custom-initialize-delay`.
Set up the keybindings when loading the file.
(mouse-wheel--installed-bindings-alist): Move to beginning.
(mouse-wheel-change-button): Don't update bindings when they're not installed.
(mouse-wheel--setup-bindings): New function extracted from `mouse-wheel-mode`.
(<topleve>): Call it when loading the file.
(mouse-wheel-mode): Use the default :initializer.