1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-11 08:30:45 -08:00
Commit graph

2105 commits

Author SHA1 Message Date
Sean Whitton
c499c2f67b * lisp/vc/diff-mode.el (diff-filename-drop-dir): Match backslashes. 2025-11-29 18:21:31 +00:00
Sean Whitton
1677c4681a Handle copying additions & removals between working trees
* lisp/vc/diff-mode.el (diff-file-kill): New optional DELETE
parameter.
(diff-kill-creations-deletions):
* lisp/vc/vc.el (vc--fileset-by-state): New functions.
(diff-kill-creations-deletions, diff-filename-drop-dir)
(diff-hunk-file-names, diff-file-next, diff-hunk-header-re)
(vc-dir-resynch-file): Declare.
(vc--apply-to-other-working-tree): Handle copying and moving
files in the added, removed, missing and unregistered states.
* test/lisp/vc/vc-tests/vc-tests.el
(vc-test--apply-to-other-working-tree): New test.
2025-11-29 14:35:39 +00:00
Sean Whitton
917f5e25de Fix vc-git-uncommit-revisions-from-end
* lisp/vc/vc-git.el (vc-git-uncommit-revisions-from-end): Don't
leave changes staged.
2025-11-29 14:29:58 +00:00
Sean Whitton
577821f143 * lisp/vc/vc-svn.el (vc-svn-state): Handle FILE with no directory. 2025-11-29 14:29:35 +00:00
Eli Zaretskii
a4c5e64b11 ; Rename a variable. 2025-11-28 08:45:02 +02:00
Eli Zaretskii
4b4b48d019 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs 2025-11-27 13:43:17 +02:00
Eli Zaretskii
b6163d42d2 Improve the fix for 'd' command in 'query-replace'
* lisp/misearch.el (coding-system--for-buffer-diff): Move
definition from here...
* lisp/vc/diff.el (coding-system--for-buffer-diff): ...to here.
2025-11-27 13:42:01 +02:00
Sean Whitton
77f45c5db8 * lisp/vc/vc.el (vc--apply-to-other-working-tree): Use y-or-n-p. 2025-11-27 10:55:06 +00:00
Sean Whitton
158bf5da77 Refine VC-Dir mass mark changes
* lisp/vc/vc-dir.el (vc-dir-mark-file): Prompt before unmarking
all subitems.  Use y-or-n-p and user-error instead of
yes-or-no-p and error.
(vc-dir-unmark-file): Use y-or-n-p instead of yes-or-no-p.
(vc-dir-allow-mass-mark-changes): Update docs.
2025-11-25 21:37:27 +00:00
Sean Whitton
304d4435b1 Make diff-revert-and-kill-hunk consider an active region
* lisp/vc/diff-mode.el (diff-revert-and-kill-hunk): When the
region is active, operate on all hunks it overlaps.
* doc/emacs/files.texi (Diff Mode):
* etc/NEWS: Document the change.
2025-11-25 21:07:04 +00:00
Sean Whitton
449e15de5b ; * lisp/vc/diff-mode.el (diff-goto-source): Revise docstring again. 2025-11-25 15:53:15 +00:00
Sean Whitton
59e8b7267f Make diff-apply-hunk consider an active region
* lisp/vc/diff-mode.el (diff-apply-buffer): New 'no-save'
meaning for fourth optional argument.  Reserve other non-nil
values for this argument.  Use ngettext for one message.
(diff-apply-hunk): If the region is active, apply all hunks that
the region overlaps, like diff-apply-buffer.
* doc/emacs/files.texi (Diff Mode):
* etc/NEWS: Document the change to diff-apply-hunk.
2025-11-25 14:53:19 +00:00
Sean Whitton
3f6c7d1bfb ; diff-mode-el: Improve docstrings re diff-jump-to-old-file. 2025-11-25 14:06:29 +00:00
Sean Whitton
4cc42911ed Persist Log View mode marks across buffer revert
* lisp/vc/log-view.el (vc-exec-after): Autoload.
(log-view--restore-marks): New function.
(log-view-mode): Add it to revert-buffer-restore-functions.
2025-11-24 16:04:42 +00:00
Sean Whitton
11b68c6223 New commands to rewind decentralized VCS branches
* lisp/vc/vc.el (vc--remove-revisions-from-end): New function.
(vc-uncommit-revisions-from-end, vc-delete-revisions-from-end):
* lisp/vc/log-view.el (log-view-uncommit-revisions-from-end)
(log-view-delete-revisions-from-end): New commands (bug#79408).
(log-view-mode-map): Bind them.
* doc/emacs/maintaining.texi (VC Change Log):
* doc/emacs/vc1-xtra.texi (VC Auto-Reverting):
* etc/NEWS: Document them.
2025-11-23 18:36:22 +00:00
Eli Zaretskii
bb1f70c901 Fix 'd' command in 'query-replace' in buffers not visiting files
* lisp/vc/diff.el (diff-file-local-copy): Use proper coding-system
when writing a local copy of a non-file visiting buffer.

* lisp/misearch.el (coding-system--for-buffer-diff): New variable.
(multi-file-replace-as-diff): Bind it to 'utf-8-emacs'.
(multi-file-diff-no-select): Use proper coding-system when reading
output of Diff.  (Bug#79761)
2025-11-23 10:33:49 +02:00
Sean Whitton
cd86307f26 vc-resynch-window: Restore always using vc-revert-buffer-internal
* lisp/vc/vc-dispatcher.el (auto-revert-buffers): Delete.
(vc-resynch-window): Always call vc-revert-buffer-internal.
Calling auto-revert-buffers will not necessarily revert the
current buffer, but we want it to happen synchronously.
2025-11-22 13:50:22 +00:00
Sean Whitton
54775983ac vc-git-revision-published-p: Resolve REV
* lisp/vc/vc-git.el (vc-git-revision-published-p): Resolve REV
before using it, using vc-git--rev-parse.
2025-11-22 12:46:16 +00:00
Sean Whitton
748c3b2645 New command alias vc-restore
* lisp/vc/vc.el (vc-restore): New alias.
* etc/NEWS: Announce it.
2025-11-22 12:45:55 +00:00
Sean Whitton
37d4f523d3 ; * lisp/vc/vc.el (vc-revert): Use length< and ngettext. 2025-11-20 20:54:56 +00:00
Sean Whitton
0bf1eb692b Fix '(vc-revert-file (vc-git-root)'
* lisp/vc/vc-git.el (vc-git--file-list-is-rootdir):
Merge into vc-git-command.
(vc-git-command): When operating on the repository root, first
bind default-directory to that root.  When operating on the
repository root with 'git checkout', pass "." as FILE-OR-LIST.
2025-11-20 20:42:21 +00:00
Sean Whitton
855aad48fa vc-exec-after: Drop passing zero timeout to accept-process-output
This reverts this change:

    Author:     Sean Whitton <spwhitton@spwhitton.name>
    AuthorDate: Thu Oct 30 20:45:31 2025 +0000
    Commit:     Sean Whitton <spwhitton@spwhitton.name>
    CommitDate: Fri Nov 7 15:40:25 2025 +0000

      vc-exec-after: Pass zero timeout to accept-process-output

      * lisp/vc/vc-dispatcher.el (vc-exec-after): Pass zero timeout to
      accept-process-output.
      Fix due to Spencer Baugh <sbaugh@janestreet.com>.

See thread starting at
<https://lists.gnu.org/archive/html/emacs-devel/2025-11/msg00263.html>
2025-11-20 18:15:24 +00:00
Sean Whitton
3ae79b7c05 diff-apply-hunk: Avoid display-buffer-overriding-action
* lisp/vc/diff-mode.el (diff-apply-hunk): Use ACTION argument to
display-buffer instead of display-buffer-overriding-action.
2025-11-18 12:56:25 +00:00
Sean Whitton
0d4741ec92 diff-apply-hunk: Don't display BUF in the selected window
* lisp/vc/diff-mode.el (diff-apply-hunk): Don't display BUF in
the selected window.
2025-11-14 13:00:13 +00:00
Sean Whitton
4a8b7bd217 ; * lisp/vc/vc.el (vc-revert-revision): Fix line length. 2025-11-13 18:13:58 +00:00
Sean Whitton
6b7512ed61 ; * lisp/vc/vc-dispatcher.el (vc-do-async-command): Limit precision. 2025-11-13 17:09:49 +00:00
Sean Whitton
2e8cc345d5 VC revert commands: Facilities to entirely delete revisions
* lisp/vc/vc.el (vc-revision-revert, vc-revision-cherry-pick):
Rename to ...
(vc-revert-or-delete-revision, vc-cherry-pick):
... these (bug#79408).  All uses changed.
* lisp/vc/log-view.el (log-view-revision-revert)
(log-view-revision-cherry-pick): Rename to ...
(log-view-revert-or-delete-revisions, log-view-cherry-pick):
... these.  All uses changed.
* lisp/vc/log-view.el (log-view-revert-or-delete-revisions):
* lisp/vc/vc.el (vc-revert-or-delete-revision): New INTERACTIVE
and DELETE parameters, and prefix argument.  Offer to entirely
delete REV in certain circumstances (bug#79408).
* lisp/vc/log-view.el (log-view--pick-or-revert):
* lisp/vc/vc.el (vc--pick-or-revert): New INTERACTIVE and DELETE
parameters.  All uses changes.
* lisp/vc/log-view.el (log-view-revert-revisions)
(log-view-delete-revisions):
* lisp/vc/vc.el (vc-revert-revision, vc-delete-revision): New
commands (bug#79408).
* doc/emacs/maintaining.texi (VC Change Log, VC Undo)
(Copying Between Branches):
* etc/NEWS: Document the changes.
2025-11-13 17:07:20 +00:00
Sean Whitton
5dfcba699e Revised bindings for diff-revert-and-kill-hunk
* lisp/vc/diff-mode.el (diff-mode-shared-map): Bind
diff-revert-and-kill-hunk to 'u'.
(diff-mode-map): Replace binding for diff-revert-and-kill-hunk
with 'C-c M-u'.
* doc/emacs/files.texi (Diff Mode):
* etc/NEWS: Document the change.
2025-11-13 16:22:20 +00:00
Sean Whitton
f9c94e05f5 vc-do-async-command: Print how long command took to run
* lisp/vc/vc-dispatcher.el (vc-do-async-command): Print how long
the command took to run.
2025-11-12 15:00:00 +00:00
Sean Whitton
e7696c64a9 ; * lisp/vc/vc-dispatcher.el (vc-do-command): Improve docstring. 2025-11-12 14:21:15 +00:00
Sean Whitton
1484e3108a vc-do-command: Restore using a pipe in the async case
* lisp/vc/vc-dispatcher.el (vc-do-command): Restore using a pipe
in the async case.  This was unintentionally changed when adding
support for discarding output.
2025-11-12 13:08:17 +00:00
Sean Whitton
3d844e49f7 ; * lisp/vc/vc-hooks.el: Note vc-after-revert in after-revert-hook. 2025-11-11 12:45:16 +00:00
Sean Whitton
4358838a3b vc-do-command: Support discarding standard error
* lisp/vc/vc-dispatcher.el (vc-do-command): Support discarding
standard error.
* lisp/vc/vc-hg.el (vc-hg-dir-status-files): Discard standard
error of 'hg status' to avoid parsing mistakes.
(vc-hg-command): Update docstring given new meaning of first
argument to vc-do-command.
* test/lisp/vc/vc-tests/vc-test-misc.el (vc-test-do-command-1)
(vc-test-do-command-2, vc-test-do-command-3)
(vc-test-do-command-4, vc-test-do-command-5)
(vc-test-do-command-6, vc-test-do-command-7): New tests.
2025-11-10 18:08:39 +00:00
Sean Whitton
af9a137fe8 ; vc-start-logentry: Require log-edit (bug#79803)
* lisp/vc/vc-dispatcher.el (vc-start-logentry):
Require log-edit (bug#79803).
2025-11-10 15:14:33 +00:00
Juri Linkov
e2531721b4 * lisp/vc/diff-mode.el (diff-changed-unspecified): Restore old colors.
Restore yellow colors previously used in the 'diff-changed' face.
Copy color values from 'smerge-base'.  This will distinguish them
from grey 'diff-file-header' and 'diff-hunk-header' in context diffs.
2025-11-09 20:14:12 +02:00
Sean Whitton
4fab1265f0 ; vc-do-command: Delete spurious with-current-buffer
* lisp/vc/vc-dispatcher.el (vc-do-command): Delete spurious
with-current-buffer.
2025-11-09 14:56:21 +00:00
Sean Whitton
0483178219 ; * lisp/vc/vc-dispatcher.el (vc-do-command): Reduce indentation. 2025-11-09 11:58:39 +00:00
Sean Whitton
786f9f1fd4 ; * lisp/vc/vc-dispatcher.el: Fix last change. 2025-11-09 11:52:00 +00:00
Sean Whitton
a86f8c9cbe vc-do-command: Error when BUFFER is nil, untabify
This function is shortly to gain support for separating standard
output and standard error from the child.  Commit untabifying it
first to make the diff adding the new features more readable.
This will include documented support for BUFFER nil, meaning to
discard output.

* lisp/vc/vc-dispatcher.el (vc-do-command): Untabify the source
in preparation for work on this function.  If BUFFER is nil,
signal an error, in keeping with the current docstring.
Use ensure-list.  Use equal not string= for string comparison.
2025-11-09 11:43:22 +00:00
Stefan Monnier
5c18d23d66 (diff-refine-threshold): New custom var (bug#79546)
Avoid getting stuck waiting for `diff` to refine big hunks.

* lisp/vc/diff-mode.el (diff-refine-threshold): New custom var.
(diff--refine-hunk): Add arg `skip-if-large` and use that new var if
the arg says so.
(diff-refine-hunk): Add arg `skip-if-large`.
(diff-auto-refine-mode, diff-next/prevhunk, diff--font-lock-refined):
Use it.
2025-11-07 11:13:27 -05:00
Sean Whitton
4eb36ad44d vc-exec-after: Pass zero timeout to accept-process-output
* lisp/vc/vc-dispatcher.el (vc-exec-after): Pass zero timeout to
accept-process-output.
Fix due to Spencer Baugh <sbaugh@janestreet.com>.
2025-11-07 15:40:25 +00:00
Sean Whitton
4fbc6088f2 Replace recursive calls of vc-exec-after
* lisp/vc/vc-dispatcher.el (vc-exec-after): Refactor so as to no
longer repeatedly add and remove the sentinel.  Don't have two
different ways to set mode-line-process.  Don't call
accept-process-output from the sentinel, because Emacs always
reads all available process output before calling sentinels.
2025-11-07 15:40:25 +00:00
Sean Whitton
bdaf49fd0c Merge vc--process-sentinel into vc-exec-after
* lisp/vc/vc-dispatcher.el (vc--process-sentinel, vc-exec-after):
Merge vc--process-sentinel into vc-exec-after.  Tidy up.  This
should not involve any functional changes; those are to follow.
2025-11-07 15:40:25 +00:00
Sean Whitton
816830d921 vc-start-logentry: Disable log-edit-hook when finishing immediately
* lisp/vc/vc-dispatcher.el (log-edit-hook): Declare.
(vc-start-logentry): Bind log-edit-hook to nil when finishing
the log edit immediately with a caller-supplied message.
2025-11-07 12:46:55 +00:00
Sean Whitton
bd4ac3b23b Fixes to echo area messages when creating Log Edit mode buffers
* lisp/vc/log-edit.el (log-edit): Don't emit a message when
MODE.
* lisp/vc/vc-dispatcher.el (vc-start-logentry): Use '\\<>' to
simplify the code slightly.
2025-11-06 14:34:24 +00:00
Sean Whitton
8b241f93b7 project-compile: Ignore compile-command from vc-compilation-mode
* lisp/progmodes/project.el (project-compile): Ignore
compile-command from vc-compilation-mode (bug#79658).
* lisp/vc/vc-dispatcher.el (vc-compilation-mode-hook): New
variable.
(vc-compilation-mode): Promote to its own derived mode.  Don't
use define-derived-mode in order to preserve the BACKEND
argument to this function.  Don't give it its own major mode
map, et cetera, for now.
2025-11-06 12:57:35 +00:00
Sean Whitton
63ea5e5b3a ; * lisp/vc/vc-hg.el (vc-hg--reset-back-to): Fix docstring. 2025-10-31 18:53:09 +00:00
Sean Whitton
902f4e7166 ; * lisp/vc/vc-hg.el (vc-hg--reset-back-to): Reflow. 2025-10-31 18:50:41 +00:00
Sean Whitton
1fd4d3e070 New *-revisions-from-end VC backend API functions (bug#79408)
* lisp/vc/vc-git.el (vc-git-delete-revisions-from-end)
(vc-git-uncommit-revisions-from-end):
* lisp/vc/vc-hg.el (vc-hg--assert-rev-on-current-branch)
(vc-hg--reset-back-to, vc-hg-delete-revisions-from-end)
(vc-hg-uncommit-revisions-from-end): New functions.
* lisp/vc/vc.el: Specify delete-revisions-from-end and
uncommit-revisions-from-end backend API functions (bug#79408).
2025-10-31 18:49:19 +00:00
Sean Whitton
3dc022a023 New delete-revision VC backend API function (bug#79408)
* lisp/vc/vc-git.el (vc-git--assert-revision-on-branch): New
function, factored out.
(vc-git-revision-published-p): Use it.
(vc-git-delete-revision):
* lisp/vc/vc-hg.el (vc-hg-delete-revision): New functions.
* lisp/vc/vc.el: Specify delete-revision backend API function
(bug#79408).
2025-10-27 21:12:56 +00:00