; Improve documentation of "shadow cursor"

* etc/NEWS:
* doc/emacs/files.texi (Diff Mode):
* lisp/vc/diff-mode.el (diff-refine): Improve the documentation of
the "shadow cursor" shown by Diff mode.
This commit is contained in:
Eli Zaretskii 2026-07-30 08:14:26 +03:00
parent c6d6033360
commit ad60eb855d
3 changed files with 28 additions and 7 deletions

View file

@ -1808,11 +1808,20 @@ Move to the next hunk-start (@code{diff-hunk-next}). With prefix
argument @var{n}, move forward to the @var{n}th next hunk.
@vindex diff-refine
By default, Diff mode @dfn{refines} hunks as Emacs displays them,
highlighting their changes with better granularity. Alternatively, if
you set @code{diff-refine} to the symbol @code{navigation}, Diff mode
only refines the hunk you move to with this command or with
@code{diff-hunk-prev}.
By default, Diff mode automatically @dfn{refines} hunks as Emacs
displays them, highlighting their changes with better granularity.
Alternatively, if you set @code{diff-refine} to the symbol
@code{navigation}, Diff mode only refines the hunk you move to with this
command or with @code{diff-hunk-prev}. Finally, you can set
@code{diff-refine} to @code{nil} and manually refine hunks using
@kbd{C-c C-b} (@code{diff-refine-hunk}), described below.
@cindex shadow cursor (Diff mode)
@vindex smerge-refine-shadow-cursor
By default, refining a hunk in any way displays a @dfn{shadow cursor} at
one of the two edges of the refined region, to better show where the
refined region starts or ends. This can be controlled by customizing
the variable @code{smerge-refine-shadow-cursor}.
@findex diff-hunk-prev
@item M-p
@ -1895,7 +1904,8 @@ parts of the buffer where the hunks' file names are specified.
@item C-c C-b
Highlight the changes of the hunk at point with a finer granularity
(@code{diff-refine-hunk}). This allows you to see exactly which parts
of each changed line were actually changed.
of each changed line were actually changed. Refining a hunk by default
shows a ``shadow cursor'' at one of the two edges of the refined region.
@vindex diff-refine
By default, Diff mode refines hunks as Emacs displays them, so you may

View file

@ -2566,6 +2566,14 @@ started inside Emacs.
*** 'diff-mode' now refrains from automatically refining big hunks.
What is big is defined by the new 'diff-refine-threshold' user option.
+++
*** Refining a hunk shows a "shadow cursor" at the beginning/end of region.
By default, the shadow cursor looks like an empty rectangle the size of
a character cell. It is displayed at the beginning or the end of the
refined region, to better show where the refined region starts or ends.
This can be controlled by the new user option
'smerge-refine-shadow-cursor', which also affects SMerge mode, see below.
---
*** New command 'diff-kill-ring-save'.
This command copies to the 'kill-ring' a region of text modified

View file

@ -107,7 +107,10 @@ The value `font-lock' means to refine during font-lock.
The value `navigation' means to refine each hunk as you visit it
with `diff-hunk-next' or `diff-hunk-prev'.
You can always manually refine a hunk with `diff-refine-hunk'."
You can always manually refine a hunk with `diff-refine-hunk'.
By default, refining a hunk in any way displays the \"shadow cursor\"
at one end of the refined region. See `smerge-refine-shadow-cursor'."
:version "27.1"
:type '(choice (const :tag "Don't refine hunks" nil)
(const :tag "Refine hunks during font-lock" font-lock)