(tab-bar-format-history): Don't use this recently added variable
because now it's possible to customize the option 'tab-bar-format'
to remove 'tab-bar-format-history' from it that gives the same result.
Juri Linkov [Fri, 13 Aug 2021 07:10:29 +0000 (10:10 +0300)]
Add save-some-buffers-root to save-some-buffers-default-predicate (bug#46374)
* lisp/files.el (save-some-buffers-default-predicate): Add choice
'save-some-buffers-root'.
(save-some-buffers-root): New predicate function.
(save-some-buffers): Check if 'pred' returns a lexically-bound lambda,
then use it as 'pred'.
Alan Mackenzie [Thu, 12 Aug 2021 19:04:28 +0000 (19:04 +0000)]
CC Mode: Enhance C++ Mode raw strings to multi-line strings for any language
* lisp/progmodes/cc-defs.el (cadar, caddr, cdddr): Add defsubsts for these for
when they are missing from the host Emacs.
(c-point): Add new `position' 'boll "beginning of logical line".
(c-clear-char-properties): Return the position of the lowest removed
property.
* lisp/progmodes/cc-engine.el (c-full-pp-to-literal): Fix for rare case where
LIMIT < START in parse-partial-sexp.
(c-old-beg-rs, c-old-end-rs, c-raw-string-end-delim-disrupted)
(c-raw-string-pos, c-raw-string-in-end-delim, c-depropertize-raw-string)
(c-depropertize-raw-strings-in-region, c-before-change-check-raw-strings)
(c-propertize-raw-string-id, c-propertize-raw-string-opener): Old functions
and variables removed or renamed "raw" -> "ml" and adapted.
(c-old-beg-ml, c-old-1-beg-ml, c-old-end-ml, c-beg-pos, c-end-pos)
(c-ml-string-end-delim-disrupted, c-depropertize-ml-string-delims)
(c-ml-string-delims-around-point,c-position-wrt-ml-delims)
(c-before-change-check-ml-strings, c-after-change-unmark-ml-strings)
(c-maybe-re-mark-ml-string, c-propertize-ml-string-id)
(c-propertize-ml-string-opener, c-depropertize-ml-string)
(c-depropertize-ml-strings-in-region): New functions and variables adapted and
possibly renamed from "raw" -> "ml".
(c-ml-string-make-closer-re, c-ml-string-make-opener-re)
(c-c++-make-ml-string-closer-re, c-c++-make-ml-string-opener-re)
(c-get-ml-closer, c-ml-string-opener-around-point)
(c-ml-string-opener-intersects-region, c-ml-string-opener-at-or-around-point)
(c-ml-string-back-to-neutral, c-ml-string-in-end-delim, c-neutralize-pos)
(c-neutralized-prop): New functions and variables.
* lisp/progmodes/cc-fonts.el (c-basic-matchers-before): Replace
c-font-lock-raw-strings with c-font-lock-ml-strings.
(c-font-lock-ml-strings): New function taking the place of the old
c-font-lock-ml-strings.
* lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): Move
c-depropertize-CPP to the second item of the C++ entry, and replace
c-before-change-check-raw-strings by c-before-change-check-ml-strings. Add a
new entry for Pike Mode.
(c-before-font-lock-functions): (Replace c-after-change-unmark-raw-strings by
c-after-change-unmark-ml-strings in the C++ entry, and add a new entry for
Pike Mode.
(c-ml-string-backslash-escapes, c-ml-string-non-punc-skip-chars)
(c-ml-string-opener-re, c-ml-string-max-opener-len, c-ml-string-any-closer-re)
(c-ml-string-max-closer-len, c-ml-string-max-closer-len-no-leader)
(c-ml-string-back-closer-re, c-make-ml-string-closer-re-function)
(c-make-ml-string-opener-re-function, c-ml-string-cpp-or-opener-re)
(c-cpp-or-ml-match-offset): New c-lang-defconsts and c-land-defvars.
(c-multiline-string-start-char): Remove the Pike Mode setting.
* lisp/progmodes/cc-mode.el (c-depropertize-CPP): Test for general ml strings
rather than C++ raw strings.
(c-unescaped-nls-in-string-p): Handle languages with ml strings.
(c-clear-string-fences): Fix bug with wrong parenthesisation.
(c-before-change-check-unbalanced-strings)
(c-after-change-mark-abnormal-strings, c-after-change-escape-NL-in-string):
Adapt for multi-line strings.
Michael Albinus [Thu, 12 Aug 2021 18:09:48 +0000 (20:09 +0200)]
Improve connection type `pipe' for remote processes
* doc/misc/tramp.texi (Remote processes): New subsection "Remote
process connection type".
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
Use `tramp-process-connection-type' as default connection type.
Improve check for `:connection-type'.
* lisp/net/tramp-sh.el (tramp-sh-handle-make-process):
Use `tramp-process-connection-type' as default connection type.
Improve check for `:connection-type'. Send "stty -icrnl" when
connection type is a pipe.
* lisp/net/tramp.el (tramp-process-connection-type): Allow all
possible values.
(tramp-handle-make-process): Use `tramp-process-connection-type'
as default connection type. Improve check for `:connection-type'.
* lisp/startup.el (normal-top-level): Make startup more robust --
we may not be allowed to create any directories when running under
test mode (bug#48350).
Allow using XLFD font names with dashes in the family name
* src/font.c (font_parse_xlfd_1): Rename from font_parse_xlfd to
allow calling twice from a wrapper (bug#35816).
(font_parse_xlfd): Wrapper function -- first try to parse in the
normal way, and then try to guess that the hyphenated bits are in
the family name.
Peter Münster [Wed, 11 Aug 2021 16:02:25 +0000 (18:02 +0200)]
Add new image-dired commands
* lisp/image-dired.el (image-dired-delete-marked): Factored out
(bug#50000).
(image-dired-display-thumbs): From here.
(image-dired-tag-marked-thumbnails): New command.
(image-dired-delete-marked): Ditto.
Peter Münster [Wed, 11 Aug 2021 12:03:23 +0000 (14:03 +0200)]
Mark marked images in Image-Dired mode
* lisp/image-dired.el (image-dired-thumb-update-marks): New
function that makes the marks visible in the thumbnail buffer
(bug#49988).
(image-dired-thumb-margin, image-dired-thumb-mark-color): New user
options.
Peter Münster [Wed, 11 Aug 2021 11:39:53 +0000 (13:39 +0200)]
Let image-dired-mouse-toggle-mark act on active region
* lisp/image-dired.el (image-dired-mouse-toggle-mark): When region is
active, then toggle marks of all images within (bug#49987).
(image-dired-mouse-toggle-mark-1): Separated out into function.
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...)