Mercurial > emacs
comparison lisp/diff-mode.el @ 100171:d42aff5ca541
* align.el:
* allout.el:
* apropos.el:
* arc-mode.el:
* autoinsert.el:
* avoid.el:
* battery.el:
* bookmark.el:
* buff-menu.el:
* calculator.el:
* chistory.el:
* cmuscheme.el:
* comint.el:
* compare-w.el:
* dabbrev.el:
* delim-col.el:
* desktop.el:
* diff-mode.el:
* diff.el:
* dired-aux.el:
* dired-x.el:
* dired.el:
* dos-vars.el:
* ediff-diff.el:
* ediff-help.el:
* ediff-init.el:
* ediff-merg.el:
* ediff-mult.el:
* ediff-ptch.el:
* ediff-vers.el:
* ediff-wind.el:
* ediff.el:
* emerge.el:
* facemenu.el:
* faces.el:
* ffap.el:
* filecache.el:
* find-dired.el:
* font-core.el:
* font-lock.el:
* forms.el:
* fringe.el:
* help-at-pt.el:
* hippie-exp.el:
* ido.el:
* image-file.el:
* imenu.el:
* indent.el:
* info.el:
* isearchb.el:
* iswitchb.el:
* jit-lock.el:
* jka-compr.el:
* log-edit.el:
* lpr.el:
* ls-lisp.el:
* man.el:
* menu-bar.el:
* midnight.el:
* mouse-sel.el:
* mouse.el:
* msb.el:
* outline.el:
* paren.el:
* pcmpl-cvs.el:
* pcmpl-gnu.el:
* pcomplete.el:
* pcvs-info.el:
* pcvs-parse.el:
* printing.el:
* ps-mule.el:
* ps-print.el:
* replace.el:
* ruler-mode.el:
* saveplace.el:
* sb-image.el:
* scroll-bar.el:
* sha1.el:
* shadowfile.el:
* shell.el:
* sort.el:
* speedbar.el:
* strokes.el:
* tempo.el:
* term.el:
* terminal.el:
* time-stamp.el:
* time.el:
* tree-widget.el:
* type-break.el:
* vc-cvs.el:
* vc-hg.el:
* vc-mcvs.el:
* vc-rcs.el:
* vc-sccs.el:
* vc.el:
* view.el:
* w32-vars.el:
* whitespace.el:
* wid-edit.el: Remove leading * from docstrings of defcustoms,
deffaces, defconsts and defuns.
author | Lute Kamstra <lute@gnu.org> |
---|---|
date | Wed, 03 Dec 2008 05:48:14 +0000 |
parents | 841e92880f11 |
children | fbcc7e272f87 |
comparison
equal
deleted
inserted
replaced
100170:86455974b971 | 100171:d42aff5ca541 |
---|---|
37 | 37 |
38 ;; Todo: | 38 ;; Todo: |
39 | 39 |
40 ;; - Improve `diff-add-change-log-entries-other-window', | 40 ;; - Improve `diff-add-change-log-entries-other-window', |
41 ;; it is very simplistic now. | 41 ;; it is very simplistic now. |
42 ;; | 42 ;; |
43 ;; - Add a `delete-after-apply' so C-c C-a automatically deletes hunks. | 43 ;; - Add a `delete-after-apply' so C-c C-a automatically deletes hunks. |
44 ;; Also allow C-c C-a to delete already-applied hunks. | 44 ;; Also allow C-c C-a to delete already-applied hunks. |
45 ;; | 45 ;; |
46 ;; - Try `diff <file> <hunk>' to try and fuzzily discover the source location | 46 ;; - Try `diff <file> <hunk>' to try and fuzzily discover the source location |
47 ;; of a hunk. Show then the changes between <file> and <hunk> and make it | 47 ;; of a hunk. Show then the changes between <file> and <hunk> and make it |
75 Else, it jumps to the new file." | 75 Else, it jumps to the new file." |
76 :type 'boolean | 76 :type 'boolean |
77 :group 'diff-mode) | 77 :group 'diff-mode) |
78 | 78 |
79 (defcustom diff-update-on-the-fly t | 79 (defcustom diff-update-on-the-fly t |
80 "*Non-nil means hunk headers are kept up-to-date on-the-fly. | 80 "Non-nil means hunk headers are kept up-to-date on-the-fly. |
81 When editing a diff file, the line numbers in the hunk headers | 81 When editing a diff file, the line numbers in the hunk headers |
82 need to be kept consistent with the actual diff. This can | 82 need to be kept consistent with the actual diff. This can |
83 either be done on the fly (but this sometimes interacts poorly with the | 83 either be done on the fly (but this sometimes interacts poorly with the |
84 undo mechanism) or whenever the file is written (can be slow | 84 undo mechanism) or whenever the file is written (can be slow |
85 when editing big diffs)." | 85 when editing big diffs)." |
86 :type 'boolean | 86 :type 'boolean |
87 :group 'diff-mode) | 87 :group 'diff-mode) |
88 | 88 |
89 (defcustom diff-advance-after-apply-hunk t | 89 (defcustom diff-advance-after-apply-hunk t |
90 "*Non-nil means `diff-apply-hunk' will move to the next hunk after applying." | 90 "Non-nil means `diff-apply-hunk' will move to the next hunk after applying." |
91 :type 'boolean | 91 :type 'boolean |
92 :group 'diff-mode) | 92 :group 'diff-mode) |
93 | 93 |
94 (defcustom diff-mode-hook nil | 94 (defcustom diff-mode-hook nil |
95 "Run after setting up the `diff-mode' major mode." | 95 "Run after setting up the `diff-mode' major mode." |
515 (or (<= (point) start) | 515 (or (<= (point) start) |
516 (setq res (re-search-backward diff-file-header-re nil t)))) | 516 (setq res (re-search-backward diff-file-header-re nil t)))) |
517 res | 517 res |
518 (goto-char start) | 518 (goto-char start) |
519 (error "Can't find the beginning of the file"))))) | 519 (error "Can't find the beginning of the file"))))) |
520 | 520 |
521 | 521 |
522 (defun diff-end-of-file () | 522 (defun diff-end-of-file () |
523 (re-search-forward "^[-+#!<>0-9@* \\]" nil t) | 523 (re-search-forward "^[-+#!<>0-9@* \\]" nil t) |
524 (re-search-forward (concat "^[^-+#!<>0-9@* \\]\\|" diff-file-header-re) | 524 (re-search-forward (concat "^[^-+#!<>0-9@* \\]\\|" diff-file-header-re) |
525 nil 'move) | 525 nil 'move) |
569 (diff-end-of-hunk) | 569 (diff-end-of-hunk) |
570 (kill-region start (point))))) | 570 (kill-region start (point))))) |
571 | 571 |
572 ;; "index ", "old mode", "new mode", "new file mode" and | 572 ;; "index ", "old mode", "new mode", "new file mode" and |
573 ;; "deleted file mode" are output by git-diff. | 573 ;; "deleted file mode" are output by git-diff. |
574 (defconst diff-file-junk-re | 574 (defconst diff-file-junk-re |
575 "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode") | 575 "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode") |
576 | 576 |
577 (defun diff-beginning-of-file-and-junk () | 577 (defun diff-beginning-of-file-and-junk () |
578 "Go to the beginning of file-related diff-info. | 578 "Go to the beginning of file-related diff-info. |
579 This is like `diff-beginning-of-file' except it tries to skip back over leading | 579 This is like `diff-beginning-of-file' except it tries to skip back over leading |
618 (forward-line -1))) | 618 (forward-line -1))) |
619 ;; File starts *after* the starting point: we really weren't in | 619 ;; File starts *after* the starting point: we really weren't in |
620 ;; a file diff but elsewhere. | 620 ;; a file diff but elsewhere. |
621 (goto-char orig) | 621 (goto-char orig) |
622 (signal (car err) (cdr err))))) | 622 (signal (car err) (cdr err))))) |
623 | 623 |
624 (defun diff-file-kill () | 624 (defun diff-file-kill () |
625 "Kill current file's hunks." | 625 "Kill current file's hunks." |
626 (interactive) | 626 (interactive) |
627 (let ((orig (point)) | 627 (let ((orig (point)) |
628 (start (progn (diff-beginning-of-file-and-junk) (point))) | 628 (start (progn (diff-beginning-of-file-and-junk) (point))) |
1633 ;; to the new file, otherwise go to the old. But that means that by | 1633 ;; to the new file, otherwise go to the old. But that means that by |
1634 ;; default we use the old file, which is the opposite of the default | 1634 ;; default we use the old file, which is the opposite of the default |
1635 ;; for diff-goto-source, and is thus confusing. Also when you don't | 1635 ;; for diff-goto-source, and is thus confusing. Also when you don't |
1636 ;; know about it it's pretty surprising. | 1636 ;; know about it it's pretty surprising. |
1637 ;; TODO: make it possible to ask explicitly for this behavior. | 1637 ;; TODO: make it possible to ask explicitly for this behavior. |
1638 ;; | 1638 ;; |
1639 ;; This is duplicated in diff-test-hunk. | 1639 ;; This is duplicated in diff-test-hunk. |
1640 (diff-find-source-location nil reverse) | 1640 (diff-find-source-location nil reverse) |
1641 (cond | 1641 (cond |
1642 ((null line-offset) | 1642 ((null line-offset) |
1643 (error "Can't find the text to patch")) | 1643 (error "Can't find the text to patch")) |