emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/diff-mode.el [emacs-unicode-2]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/diff-mode.el [emacs-unicode-2]
Date: Mon, 28 Jun 2004 04:59:06 -0400

Index: emacs/lisp/diff-mode.el
diff -c emacs/lisp/diff-mode.el:1.51.6.1 emacs/lisp/diff-mode.el:1.51.6.2
*** emacs/lisp/diff-mode.el:1.51.6.1    Fri Apr 16 12:49:49 2004
--- emacs/lisp/diff-mode.el     Mon Jun 28 07:28:28 2004
***************
*** 48,54 ****
  ;;
  ;; - Refine hunk on a word-by-word basis.
  ;;
- ;; - Use the new next-error-function to allow C-x `.
  ;; - Handle `diff -b' output in context->unified.
  
  ;;; Code:
--- 48,53 ----
***************
*** 170,196 ****
  ;;;;
  
  (defface diff-header-face
!   '((((type tty pc) (class color) (background light))
!      (:foreground "blue1" :weight bold))
!     (((type tty pc) (class color) (background dark))
!      (:foreground "green" :weight bold))
!     (((class color) (background light))
       (:background "grey85"))
!     (((class color) (background dark))
       (:background "grey45"))
      (t (:weight bold)))
    "`diff-mode' face inherited by hunk and index header faces.")
  (defvar diff-header-face 'diff-header-face)
  
  (defface diff-file-header-face
!   '((((type tty pc) (class color) (background light))
!      (:foreground "yellow" :weight bold))
!     (((type tty pc) (class color) (background dark))
!      (:foreground "cyan" :weight bold))
!     (((class color) (background light))
       (:background "grey70" :weight bold))
!     (((class color) (background dark))
       (:background "grey60" :weight bold))
      (t (:weight bold)))                       ; :height 1.3
    "`diff-mode' face used to highlight file header lines.")
  (defvar diff-file-header-face 'diff-file-header-face)
--- 169,195 ----
  ;;;;
  
  (defface diff-header-face
!   '((((class color) (min-colors 88) (background light))
       (:background "grey85"))
!     (((class color) (min-colors 88) (background dark))
       (:background "grey45"))
+     (((class color) (background light))
+      (:foreground "blue1" :weight bold))
+     (((class color) (background dark))
+      (:foreground "green" :weight bold))
      (t (:weight bold)))
    "`diff-mode' face inherited by hunk and index header faces.")
  (defvar diff-header-face 'diff-header-face)
  
  (defface diff-file-header-face
!   '((((class color) (min-colors 88) (background light))
       (:background "grey70" :weight bold))
!     (((class color) (min-colors 88) (background dark))
       (:background "grey60" :weight bold))
+     (((class color) (background light))
+      (:foreground "yellow" :weight bold))
+     (((class color) (background dark))
+      (:foreground "cyan" :weight bold))
      (t (:weight bold)))                       ; :height 1.3
    "`diff-mode' face used to highlight file header lines.")
  (defvar diff-file-header-face 'diff-file-header-face)
***************
*** 305,311 ****
  (defvar diff-narrowed-to nil)
  
  (defun diff-end-of-hunk (&optional style)
!   (if (looking-at diff-hunk-header-re) (goto-char (match-end 0)))
    (let ((end (and (re-search-forward (case style
                                       ;; A `unified' header is ambiguous.
                                       (unified (concat "^[^-+# \\]\\|"
--- 304,314 ----
  (defvar diff-narrowed-to nil)
  
  (defun diff-end-of-hunk (&optional style)
!   (when (looking-at diff-hunk-header-re)
!     (unless style
!       ;; Especially important for unified (because headers are ambiguous).
!       (setq style (cdr (assq (char-after) '((?@ . unified) (?* . context))))))
!     (goto-char (match-end 0)))
    (let ((end (and (re-search-forward (case style
                                       ;; A `unified' header is ambiguous.
                                       (unified (concat "^[^-+# \\]\\|"
***************
*** 882,890 ****
          (diff-fixup-modifs (point) (cdr diff-unhandled-changes)))))
      (setq diff-unhandled-changes nil)))
  
! ;;;;
! ;;;; The main function
! ;;;;
  
  ;;;###autoload
  (define-derived-mode diff-mode fundamental-mode "Diff"
--- 885,898 ----
          (diff-fixup-modifs (point) (cdr diff-unhandled-changes)))))
      (setq diff-unhandled-changes nil)))
  
! (defun diff-next-error (arg reset)
!   ;; Select a window that displays the current buffer so that point
!   ;; movements are reflected in that window.  Otherwise, the user might
!   ;; never see the hunk corresponding to the source she's jumping to.
!   (pop-to-buffer (current-buffer))
!   (if reset (goto-char (point-min)))
!   (diff-hunk-next arg)
!   (diff-goto-source))
  
  ;;;###autoload
  (define-derived-mode diff-mode fundamental-mode "Diff"
***************
*** 912,917 ****
--- 920,926 ----
    ;;   (set (make-local-variable 'paragraph-separate) paragraph-start)
    ;;   (set (make-local-variable 'page-delimiter) "--- [^\t]+\t")
    ;; compile support
+   (set (make-local-variable 'next-error-function) 'diff-next-error)
  
    (when (and (> (point-max) (point-min)) diff-default-read-only)
      (toggle-read-only t))
***************
*** 967,973 ****
    "Turn context diffs into unified diffs if applicable."
    (if (save-excursion
        (goto-char (point-min))
!       (looking-at "\\*\\*\\* "))
        (let ((mod (buffer-modified-p)))
        (unwind-protect
            (diff-context->unified (point-min) (point-max))
--- 976,982 ----
    "Turn context diffs into unified diffs if applicable."
    (if (save-excursion
        (goto-char (point-min))
!       (and (looking-at diff-hunk-header-re) (eq (char-after) ?*)))
        (let ((mod (buffer-modified-p)))
        (unwind-protect
            (diff-context->unified (point-min) (point-max))
***************
*** 1239,1247 ****
  (defun diff-current-defun ()
    "Find the name of function at point.
  For use in `add-log-current-defun-function'."
!   (destructuring-bind (buf line-offset pos src dst &optional switched)
!       (diff-find-source-location)
!     (save-excursion
        (beginning-of-line)
        (or (when (memq (char-after) '(?< ?-))
            ;; Cursor is pointing at removed text.  This could be a removed
--- 1248,1259 ----
  (defun diff-current-defun ()
    "Find the name of function at point.
  For use in `add-log-current-defun-function'."
!   (save-excursion
!     (when (looking-at diff-hunk-header-re)
!       (forward-line 1)
!       (while (and (looking-at " ") (not (zerop (forward-line 1))))))
!     (destructuring-bind (buf line-offset pos src dst &optional switched)
!       (diff-find-source-location)
        (beginning-of-line)
        (or (when (memq (char-after) '(?< ?-))
            ;; Cursor is pointing at removed text.  This could be a removed




reply via email to

[Prev in Thread] Current Thread [Next in Thread]