1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 20:32:00 -08:00
No description
Find a file
Dima Kogan 2c8a7e50d2 Improve diff-mode navigation/manipulation
This is Bug #17544.

Navigation and use of diff buffers had several annoying corner cases
that this patch fixes.  These corner cases were largely due to
inconsistent treatment of file headers.  Say you have a diff such as
this:

 --- aaa
 +++ bbb
 @@ -52,7 +52,7 @@
 hunk1
 @@ -74,7 +74,7 @@
 hunk2
 --- ccc
 +++ ddd
 @@ -608,6 +608,6 @@
 hunk3
 @@ -654,7 +654,7 @@
 hunk4

The file headers here are the '---' and '+++' lines.  With the point on
such a line, hunk operations would sometimes refer to the next hunk and
sometimes to the previous hunk.  Most of the time it would be the
previous hunk, which is not what the user would expect.  This patch
consistently treats such headers as the next hunk.  So with this patch,
if the point is on the '--- ccc' line, the point is seen as referring to
hunk3.

Specific behaviors this fixes are:

1. It should be possible to place the point in the middle of a diff
buffer, and press M-k repeatedly to kill hunks in the order they appear
in the buffer.  With the point on hunk1, M-k M-k would kill hunk1 then
hunk2.  With the point on hunk3, it would kill hunk3 then hunk4; this is
fine.  However, with the point on hunk2, it'd kill hunk2 then hunk1.
This is fixed by this patch.

2. Similarly, it should be possible to apply hunks in order.  Previously
with the point at the start, C-c C-a would apply the hunk1, then move
the point to the first @@ header, and thus C-c C-a would try to apply
the same hunk again.

* lisp/vc/diff-mode.el (diff--wrap-navigation): New function to add better
navigation logic to diff-{hunk,file}-{next,prev}.
(diff-hunk-next, diff-hunk-prev):
(diff-file-next, diff-file-prev): Better navigation logic if
skip-hunk-start is true, which happens when called interactively.
(diff-bounds-of-hunk, diff-find-source-location):
(diff-apply-hunk, diff-current-defun, diff-refine-hunk): Small tweaks to
improve hunk navigation.
2016-11-28 22:40:03 -05:00
admin Merge from origin/emacs-25 2016-11-19 14:43:25 -08:00
build-aux Merge from gnulib 2016-11-19 16:01:32 -08:00
doc Allow configuring which event throw-on-input should ignore (bug#19547). 2016-11-27 21:48:07 +01:00
etc Allow configuring which event throw-on-input should ignore (bug#19547). 2016-11-27 21:48:07 +01:00
leim Update copyright year to 2016 2016-01-01 01:34:24 -08:00
lib Merge from gnulib 2016-11-19 16:01:32 -08:00
lib-src Port build to gcc -fcheck-pointer-bounds 2016-11-25 21:25:55 -08:00
lisp Improve diff-mode navigation/manipulation 2016-11-28 22:40:03 -05:00
lwlib Limit <config.h>’s includes 2016-09-30 12:38:52 -07:00
m4 Merge from gnulib 2016-11-19 16:01:32 -08:00
modules Fix template for module functions 2016-11-28 07:49:28 -08:00
msdos Bump Emacs version to 26.0.50 2016-10-01 11:14:05 +03:00
nextstep Modernize usage of 'macOS' in doc and comments 2016-11-06 00:42:03 -07:00
nt Merge from origin/emacs-25 2016-11-19 14:43:25 -08:00
oldXMenu Add double-buffering support to reduce flicker 2016-10-28 19:21:39 -07:00
src Upcase Path and ComSpec in process-environment 2016-11-28 17:44:39 -05:00
test * test/lisp/ibuffer-tests.el (ibuffer-test-Bug24997): Add test for Bug#24997. 2016-11-24 10:39:33 +09:00
.dir-locals.el * .dir-locals.el (c-noise-macro-names): Remove NONVOLATILE. 2016-08-09 11:51:16 -07:00
.gitattributes Encode the shr tests files with trailing white space 2016-04-24 15:18:29 +02:00
.gitignore Update from gnulib 2016-09-15 15:55:30 -07:00
autogen.sh Port autogen.sh to Git 2.4 2016-05-14 10:24:41 -07:00
BUGS Use C-h r in BUGS 2012-05-21 20:28:12 -07:00
ChangeLog.1 Update copyright year to 2016 2016-01-01 01:34:24 -08:00
ChangeLog.2 ; Spelling fixes 2016-11-04 14:50:59 -07:00
config.bat Fix the MSDOS build 2016-04-30 13:45:33 +03:00
configure.ac Make CANNOT_DUMP work better on GNU/Linux 2016-11-20 16:59:24 -08:00
CONTRIBUTE Merge from origin/emacs-25 2016-10-10 07:35:32 -07:00
COPYING Restore files that I seem to have mistakenly deleted. 2010-12-03 14:45:09 +00:00
GNUmakefile autogen.sh now configures git only on request 2016-02-02 23:14:30 -08:00
INSTALL Merge from origin/emacs-25 2016-11-19 14:31:05 -08:00
INSTALL.REPO * INSTALL.REPO: Suggest Texinfo 4.13 or later. 2016-08-28 18:23:47 -07:00
make-dist Do not require that .git be a directory 2016-04-13 11:12:39 -07:00
Makefile.in Merge from origin/emacs-25 2016-11-19 14:31:05 -08:00
README Merge from origin/emacs-25 2016-11-19 14:31:05 -08:00

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Copyright (C) 2001-2016 Free Software Foundation, Inc.
See the end of the file for license conditions.


This directory tree holds version 26.0.50 of GNU Emacs, the extensible,
customizable, self-documenting real-time display editor.

The file INSTALL in this directory says how to build and install GNU
Emacs on various systems, once you have unpacked or checked out the
entire Emacs file tree.

See the file etc/NEWS for information on new features and other
user-visible changes in recent versions of Emacs.

The file etc/PROBLEMS contains information on many common problems that
occur in building, installing and running Emacs.

The file CONTRIBUTE contains information on contributing to Emacs as a
developer.

You may encounter bugs in this release.  If you do, please report
them; your bug reports are valuable contributions to the FSF, since
they allow us to notice and fix problems on machines we don't have, or
in code we don't use often.  Please send bug reports to the mailing
list bug-gnu-emacs@gnu.org.  If possible, use M-x report-emacs-bug.

See the "Bugs" section of the Emacs manual for more information on how
to report bugs.  (The file 'BUGS' in this directory explains how you
can find and read that section using the Info files that come with
Emacs.)  For a list of mailing lists related to Emacs, see
<http://savannah.gnu.org/mail/?group=emacs>.  For the complete
list of GNU mailing lists, see <http://lists.gnu.org/>.

The 'etc' subdirectory contains several other files, named in capital
letters, which you might consider looking at when installing GNU
Emacs.

The file 'configure' is a shell script to acclimate Emacs to the
oddities of your processor and operating system.  It creates the file
'Makefile' (a script for the 'make' program), which automates the
process of building and installing Emacs.  See INSTALL for more
detailed information.

The file 'configure.ac' is the input used by the autoconf program to
construct the 'configure' script.

The shell script 'autogen.sh' generates 'configure' and other files by
running the GNU build tools autoconf and automake, which in turn use
GNU m4 and Perl.  If you want to use it, you will need to install
recent versions of these build tools.  This should be needed only if
you edit files like 'configure.ac' that specify Emacs's autobuild
procedure.

The file 'Makefile.in' is a template used by 'configure' to create
'Makefile'.

The file 'make-dist' is a shell script to build a distribution tar
file from the current Emacs tree, containing only those files
appropriate for distribution.  If you make extensive changes to Emacs,
this script will help you distribute your version to others.

There are several subdirectories:

'src'       holds the C code for Emacs (the Emacs Lisp interpreter and
            its primitives, the redisplay code, and some basic editing
            functions).
'lisp'      holds the Emacs Lisp code for Emacs (most everything else).
'leim'      holds the original source files for the generated files
            in lisp/leim.  These form the library of Emacs input methods,
            required to type international characters that can't be
            directly produced by your keyboard.
'lib'       holds source code for libraries used by Emacs and its utilities
'lib-src'   holds the source code for some utility programs for use by or
            with Emacs, like movemail and etags.
'etc'       holds miscellaneous architecture-independent data files Emacs
            uses, like the tutorial text and tool bar images.
            The contents of the 'lisp', 'leim', 'info', and 'doc'
            subdirectories are architecture-independent too.
'info'      holds the Info documentation tree for Emacs.
'doc/emacs' holds the source code for the Emacs Manual.  If you modify the
            manual sources, you will need the 'makeinfo' program to produce
            an updated manual.  'makeinfo' is part of the GNU Texinfo
            package; you need a suitably recent version of Texinfo.
'doc/lispref'   holds the source code for the Emacs Lisp reference manual.
'doc/lispintro' holds the source code for the Introduction to Programming
                in Emacs Lisp manual.
'msdos'     holds configuration files for compiling Emacs under MS-DOS.
'nextstep'  holds instructions and some other files for compiling the
            Nextstep port of Emacs, for GNUstep and macOS Cocoa.
'nt'        holds code and documentation for building Emacs on MS-Windows.
'test'      holds tests for various aspects of Emacs's functionality.

   Building Emacs on non-Posix platforms requires tools that aren't part
of the standard distribution of the OS.  The platform-specific README
files and installation instructions should list the required tools.


NOTE ON COPYRIGHT YEARS

In copyright notices where the copyright holder is the Free Software
Foundation, then where a range of years appears, this is an inclusive
range that applies to every year in the range.  For example: 2005-2008
represents the years 2005, 2006, 2007, and 2008.


This file is part of GNU Emacs.

GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.