• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/

Lines Matching +defs:log +defs:view +defs:file +defs:re

9 ;; This file is part of GNU Emacs.
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 ;; to the corresponding source file.
45 ;; - Try `diff <file> <hunk>' to try and fuzzily discover the source location
46 ;; of a hunk. Show then the changes between <file> and <hunk> and make it
47 ;; possible to apply them to <file>, <hunk-src>, or <hunk-dst>.
60 (defvar add-log-buffer-file-name-function)
74 (defcustom diff-jump-to-old-file nil
75 "*Non-nil means `diff-goto-source' jumps to the old file.
76 Else, it jumps to the new file."
82 When editing a diff file, the line numbers in the hunk headers
85 undo mechanism) or whenever the file is written (can be slow
112 ("N" . diff-file-next)
114 ("P" . diff-file-prev)
116 ("K" . diff-file-kill)
118 ("}" . diff-file-next)
119 ("{" . diff-file-prev)
126 ;;("f" . diff-goto-source) ;find-file
139 ;;("r" . diff-restrict-view)
151 ("\C-c\C-n" . diff-restrict-view)
205 (defface diff-file-header
215 "`diff-mode' face used to highlight file header lines."
218 (put 'diff-file-header-face 'face-alias 'diff-file-header)
219 (defvar diff-file-header-face 'diff-file-header)
222 '((t :inherit diff-file-header))
302 '((t :inherit diff-file-header))
318 ;; If the text does not include any diff markers and if we're not
322 (let ((re (save-excursion
323 (if (re-search-backward "^[><!][ \t]" start t)
328 (while (re-search-backward re start t)
342 (0 diff-header-face) (2 diff-file-header-face prepend))
371 (defconst diff-hunk-header-re "^\\(@@ -[0-9,]+ \\+[0-9,]+ @@.*\\|\\*\\{15\\}.*\n\\*\\*\\* .+ \\*\\*\\*\\*\\|[0-9]+\\(,[0-9]+\\)?[acd][0-9]+\\(,[0-9]+\\)?\\)$")
372 (defconst diff-file-header-re (concat "^\\(--- .+\n\\+\\+\\+ \\|\\*\\*\\* .+\n--- \\|[^-+!<>0-9@* ]\\).+\n" (substring diff-hunk-header-re 1)))
376 (when (looking-at diff-hunk-header-re)
381 (let ((end (and (re-search-forward (case style
384 diff-file-header-re))
395 (unless (looking-at diff-hunk-header-re)
398 (re-search-backward diff-hunk-header-re)
401 (defun diff-beginning-of-file ()
403 (unless (looking-at diff-file-header-re)
406 (re-search-backward diff-file-header-re)
407 (error (error "Can't find the beginning of the file")))))
409 (defun diff-end-of-file ()
410 (re-search-forward "^[-+#!<>0-9@* \\]" nil t)
411 (re-search-forward (concat "^[^-+#!<>0-9@* \\]\\|" diff-file-header-re)
417 ;; Define diff-{hunk,file}-{prev,next}
419 diff-hunk diff-hunk-header-re "hunk" diff-end-of-hunk diff-restrict-view)
421 diff-file diff-file-header-re "file" diff-end-of-hunk)
423 (defun diff-restrict-view (&optional arg)
424 "Restrict the view to the current hunk.
425 If the prefix ARG is given, restrict the view to the current file instead."
428 (if arg (diff-beginning-of-file) (diff-beginning-of-hunk))
430 (progn (if arg (diff-end-of-file) (diff-end-of-hunk))
432 (set (make-local-variable 'diff-narrowed-to) (if arg 'file 'hunk))))
440 (nexthunk (when (re-search-forward diff-hunk-header-re nil t)
444 (diff-beginning-of-file) (diff-hunk-next) (point)))
445 (nextfile (ignore-errors (diff-file-next) (point)))
451 ;; It's the only hunk for this file, so kill the file.
452 (diff-file-kill)
456 (defun diff-file-kill ()
457 "Kill current file's hunks."
459 (diff-beginning-of-file)
465 (re-search-backward "^Index: " prevhunk t)))
468 (diff-end-of-file)
478 (while (re-search-forward (concat "^\\(Index: .*\n\\)"
481 diff-file-header-re "\\)")
487 (defun diff-count-matches (re start end)
491 (while (re-search-forward re end t) (incf n))
522 (defun diff-filename-drop-dir (file)
523 (when (string-match "/" file) (substring file (match-end 0))))
547 (defun diff-tell-file-name (old name)
548 "Tell Emacs where the find the source file of the current hunk.
549 If the OLD prefix arg is passed, tell the file NAME of the old file."
552 (fs (diff-hunk-file-names current-prefix-arg)))
553 (unless fs (error "No file name to look for"))
554 (list old (read-file-name (format "File for %s: " (car fs))
555 nil (diff-find-file-name old) t))))
556 (let ((fs (diff-hunk-file-names old)))
557 (unless fs (error "No file name to look for"))
560 (defun diff-hunk-file-names (&optional old)
561 "Give the list of file names textually mentioned for the current hunk."
563 (unless (looking-at diff-file-header-re)
564 (or (ignore-errors (diff-beginning-of-file))
565 (re-search-forward diff-file-header-re nil t)))
579 (re-search-backward "^Index: \\(.+\\)" limit t)))
582 (when (re-search-backward
588 (defun diff-find-file-name (&optional old prefix)
589 "Return the file corresponding to the current patch.
590 Non-nil OLD means that we want the old file.
593 (unless (looking-at diff-file-header-re)
594 (or (ignore-errors (diff-beginning-of-file))
595 (re-search-forward diff-file-header-re nil t)))
596 (let ((fs (diff-hunk-file-names old)))
604 (if (and newfile (file-exists-p newfile)) (return newfile))))
605 ;; look for each file in turn. If none found, try again but
608 (file nil nil))
610 (setq file (do* ((files files (cdr files))
611 (file (car files) (car files)))
612 ((or (null file) (file-exists-p file))
613 file))))
614 file))
616 (and (string-match "\\.rej\\'" (or buffer-file-name ""))
617 (let ((file (substring buffer-file-name 0 (match-beginning 0))))
618 (when (file-exists-p file) file)))
619 ;; If we haven't found the file, maybe it's because we haven't paid
622 (boundp 'cvs-pcl-cvs-dirchange-re)
624 (re-search-backward cvs-pcl-cvs-dirchange-re nil t))
625 (diff-find-file-name old (match-string 1)))
627 (let ((file (read-file-name (format "Use file %s: " (or (first fs) ""))
630 (cons (cons fs file) diff-remembered-files-alist))
631 file)))))
635 "Call `ediff-patch-file' on the current buffer."
638 (ediff-patch-file nil (current-buffer))
639 (wrong-number-of-arguments (ediff-patch-file))))
660 (while (and (re-search-forward "^\\(\\(---\\) .+\n\\(\\+\\+\\+\\) .+\\|@@ -\\([0-9]+\\),\\([0-9]+\\) \\+\\([0-9]+\\),\\([0-9]+\\) @@.*\\)$" nil t)
664 ;; we matched a file header
685 (if (not (save-excursion (re-search-forward "^-" nil t)))
712 (if (not (save-excursion (re-search-forward "^+" nil t)))
750 (while (and (re-search-forward "^\\(\\(\\*\\*\\*\\) .+\n\\(---\\) .+\\|\\*\\{15\\}.*\n\\*\\*\\* \\([0-9]+\\),\\(-?[0-9]+\\) \\*\\*\\*\\*\\)$" nil t)
754 ;; we matched a file header
764 (unless (re-search-forward
822 (while (and (re-search-forward "^\\(\\([-*][-*][-*] \\)\\(.+\\)\n\\([-+][-+][-+] \\)\\(.+\\)\\|\\*\\{15\\}.*\n\\*\\*\\* \\(.+\\) \\*\\*\\*\\*\\|@@ -\\([0-9,]+\\) \\+\\([0-9,]+\\) @@.*\\)$" nil t)
826 ;; a file header
965 ;; (re-search-forward diff-hunk-header-re (cdr diff-unhandled-changes))
1008 ;; "\\|\\*\\*\\* " ; context diff hunk or file start
1009 ;; "\\|--- [^\t]+\t")) ; context or unidiff file
1026 ;; Turn off this little trick in case the buffer is put in view-mode.
1027 (add-hook 'view-mode-hook
1032 ;; add-log support
1033 (set (make-local-variable 'add-log-current-defun-function)
1035 (set (make-local-variable 'add-log-buffer-file-name-function)
1036 'diff-find-file-name))
1054 ;; An empty diff file means there's no more diffs to integrate, so we
1055 ;; can just remove the file altogether. Very handy for .rej files if we
1057 (when (and buffer-file-name
1058 (eq 0 (nth 7 (file-attributes buffer-file-name))))
1059 (delete-file buffer-file-name)))
1069 (and (looking-at diff-hunk-header-re) (eq (char-after) ?*)))
1085 (and (re-search-forward "^@@ [-0-9]+,\\([0-9]+\\) [+0-9]+,\\([0-9]+\\) @@"
1116 ((not (looking-at diff-hunk-header-re))
1192 (re-search-forward "^--- " nil t)
1209 (re-search-forward "^---$" nil t)
1266 (re (concat "^[ \t\n ]*"
1272 (forw (and (re-search-forward re nil t)
1275 (re-search-backward re nil t)
1284 (defun diff-find-source-location (&optional other-file reverse)
1286 BUF is the buffer corresponding to the source file.
1294 (let* ((other (diff-xor other-file diff-jump-to-old-file))
1310 (unless (re-search-forward "^--- \\([0-9,]+\\)" nil t)
1313 (file (or (diff-find-file-name other) (error "Can't find the file")))
1314 (buf (find-file-noselect file)))
1316 (when (> (prefix-numeric-value other-file) 8)
1317 (setq diff-jump-to-old-file other))
1352 (defvar diff-apply-hunk-to-backup-file nil)
1355 "Apply the current hunk to the source file and go to the next.
1356 By default, the new source file is patched, but if the variable
1357 `diff-jump-to-old-file' is non-nil, then the old source file is
1364 ;; If REVERSE go to the new file, otherwise go to the old.
1370 (and buffer-file-name
1371 (backup-file-name-p buffer-file-name)
1372 (not diff-apply-hunk-to-backup-file)
1373 (not (set (make-local-variable 'diff-apply-hunk-to-backup-file)
1375 (file-name-nondirectory
1376 buffer-file-name)))))))
1379 (format "Use %s\\[diff-apply-hunk] to apply it to the other file"
1409 ;; If REVERSE go to the new file, otherwise go to the old.
1417 (defun diff-goto-source (&optional other-file event)
1419 `diff-jump-to-old-file' (or its opposite if the OTHER-FILE prefix arg
1420 is given) determines whether to jump to the old or the new file.
1422 then `diff-jump-to-old-file' is also set, for the next invocations."
1430 (diff-find-source-location other-file rev)
1438 For use in `add-log-current-defun-function'."
1440 (when (looking-at diff-hunk-header-re)
1442 (re-search-forward "^[^ ]" nil t))
1456 (add-log-current-defun))))
1459 (add-log-current-defun))))))
1472 (file1 (make-temp-file "diff1"))
1473 (file2 (make-temp-file "diff2"))
1474 (coding-system-for-read buffer-file-coding-system)
1490 ;; Remove the file-header.
1491 (when (re-search-forward diff-hunk-header-re nil t)
1502 (delete-file file1)
1503 (delete-file file2))))
1512 ;; (diff-find-file-name, diff-mode): add smarts to find the right file
1513 ;; for *.rej files (that lack any file name indication).
1516 ;; added support for "\ No newline at end of file".
1520 ;; - have diff-kill-hunk call diff-kill-file if it's the only hunk.
1521 ;; - diff-kill-file now tries to kill the leading garbage as well.
1531 ;; (ediff=patch-file): add bindings to call ediff-patch.
1532 ;; (diff-find-file-name): taken out of diff-goto-source.
1537 ;; (diff-beginning-of-file, diff-prev-file): fixed wrong parenthesis.