emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: Re: View Changes In File failure]


From: Chong Yidong
Subject: Re: address@hidden: Re: View Changes In File failure]
Date: Wed, 20 Sep 2006 11:17:05 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Ron <address@hidden> writes:

>> I followed your instructions precisely.  No bug.  The first thing you
>> should try is to use the latest version of Emacs in CVS, and see if
>> the bug is present.
>>
> I installed the latest version from CVS.
>
> When I do the same as in the original bug-report I get in the lower
> half of my screen a *Diff* buffer which is filled with a diff, which
> looks at good at first sight.

So your original bug was, indeed, specific to an outdated version of
Emacs.

> The only problem now is that the modeless window with the question
> buttons still is modeless, so I can't click on the *Diff* buffer to
> see it.
>
> The quality of the code regarding to the GTK binding in Emacs seems low.

This issue is not specific to GTK; it affects the no-X-toolkit
versions too.  The following patch should solve the problem by
handling "View Changes in File" similarly to "View This File".

*** emacs/lisp/files.el.~1.856.~        2006-09-08 16:32:56.000000000 -0400
--- emacs/lisp/files.el 2006-09-20 11:08:28.000000000 -0400
***************
*** 3695,3701 ****
                   (setq buffer-backed-up nil)))))))
      setmodes))
  
! (defun diff-buffer-with-file (&optional buffer)
    "View the differences between BUFFER and its associated file.
  This requires the external program `diff' to be in your `exec-path'."
    (interactive "bBuffer: ")
--- 3695,3701 ----
                   (setq buffer-backed-up nil)))))))
      setmodes))
  
! (defun diff-buffer-with-file (&optional buffer diff-buffer)
    "View the differences between BUFFER and its associated file.
  This requires the external program `diff' to be in your `exec-path'."
    (interactive "bBuffer: ")
***************
*** 3707,3713 ****
              (save-restriction
                (widen)
                (write-region (point-min) (point-max) tempfile nil 'nomessage)
!               (diff buffer-file-name tempfile nil t)
                (sit-for 0))
            (when (file-exists-p tempfile)
              (delete-file tempfile))))
--- 3707,3713 ----
              (save-restriction
                (widen)
                (write-region (point-min) (point-max) tempfile nil 'nomessage)
!               (diff buffer-file-name tempfile nil t diff-buffer)
                (sit-for 0))
            (when (file-exists-p tempfile)
              (delete-file tempfile))))
***************
*** 3729,3735 ****
         ;; Return nil to ask about BUF again.
         nil)
       "view this file")
!     (?d diff-buffer-with-file
        "view changes in file"))
    "ACTION-ALIST argument used in call to `map-y-or-n-p'.")
  
--- 3729,3741 ----
         ;; Return nil to ask about BUF again.
         nil)
       "view this file")
!     (?d (lambda (buf)
!         (let ((diff-buffer (get-buffer-create "*Diff*")))
!           (diff-buffer-with-file buf diff-buffer)
!           (view-buffer diff-buffer (lambda (ignore)
!                                      (exit-recursive-edit))))
!         (recursive-edit)
!         nil)
        "view changes in file"))
    "ACTION-ALIST argument used in call to `map-y-or-n-p'.")
  
*** emacs/lisp/diff.el.~1.60.~  2006-06-15 14:32:50.000000000 -0400
--- emacs/lisp/diff.el  2006-09-20 11:11:19.000000000 -0400
***************
*** 73,84 ****
                      (current-time-string))))))
  
  ;;;###autoload
! (defun diff (old new &optional switches no-async)
    "Find and display the differences between OLD and NEW files.
  Interactively the current buffer's file name is the default for NEW
  and a backup file for NEW is the default for OLD.
  If NO-ASYNC is non-nil, call diff synchronously.
! With prefix arg, prompt for diff switches."
    (interactive
     (let (oldf newf)
       (setq newf (buffer-file-name)
--- 73,86 ----
                      (current-time-string))))))
  
  ;;;###autoload
! (defun diff (old new &optional switches no-async diff-buffer)
    "Find and display the differences between OLD and NEW files.
  Interactively the current buffer's file name is the default for NEW
  and a backup file for NEW is the default for OLD.
  If NO-ASYNC is non-nil, call diff synchronously.
! With prefix arg, prompt for diff switches.
! If DIFF-BUFFER is non-nil, insert the diff in that buffer instead
! of displaying it."
    (interactive
     (let (oldf newf)
       (setq newf (buffer-file-name)
***************
*** 112,122 ****
                       ,(shell-quote-argument (or old-alt old))
                       ,(shell-quote-argument (or new-alt new)))
                     " "))
!        (buf (get-buffer-create "*Diff*"))
         (thisdir default-directory)
         proc)
      (save-excursion
!       (display-buffer buf)
        (set-buffer buf)
        (setq buffer-read-only nil)
        (buffer-disable-undo (current-buffer))
--- 114,125 ----
                       ,(shell-quote-argument (or old-alt old))
                       ,(shell-quote-argument (or new-alt new)))
                     " "))
!        (buf (or diff-buffer (get-buffer-create "*Diff*")))
         (thisdir default-directory)
         proc)
      (save-excursion
!       (unless diff-buffer
!       (display-buffer buf))
        (set-buffer buf)
        (setq buffer-read-only nil)
        (buffer-disable-undo (current-buffer))




reply via email to

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