* [jidanni@jidanni.org: diff-default-read-only doesn't]
@ 2006-05-31 19:13 Richard Stallman
2006-06-02 23:17 ` Chong Yidong
0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2006-05-31 19:13 UTC (permalink / raw)
Would someone please DTRT and ack?
------- Start of forwarded message -------
To: bug-gnu-emacs@gnu.org
From: Dan Jacobson <jidanni@jidanni.org>
Date: Wed, 31 May 2006 01:59:45 +0800
Subject: diff-default-read-only doesn't
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed
version=3.0.4
emacs-version "22.0.50.1":
diff-default-read-only doesn't make the *Diff* buffer read only.
The only place it is used,
(when (and (> (point-max) (point-min)) diff-default-read-only)
it is never reached, as if it were, there would be no way to put stuff
in that buffer in the first place, hence the point-max jazz, I guess.
_______________________________________________
bug-gnu-emacs mailing list
bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs
------- End of forwarded message -------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [jidanni@jidanni.org: diff-default-read-only doesn't]
2006-05-31 19:13 [jidanni@jidanni.org: diff-default-read-only doesn't] Richard Stallman
@ 2006-06-02 23:17 ` Chong Yidong
2006-06-04 2:24 ` Richard Stallman
0 siblings, 1 reply; 3+ messages in thread
From: Chong Yidong @ 2006-06-02 23:17 UTC (permalink / raw)
Cc: emacs-devel
Richard Stallman <rms@gnu.org> writes:
> Would someone please DTRT and ack?
>
> From: Dan Jacobson <jidanni@jidanni.org>
> Subject: diff-default-read-only doesn't
> To: bug-gnu-emacs@gnu.org
>
> emacs-version "22.0.50.1":
> diff-default-read-only doesn't make the *Diff* buffer read only.
> The only place it is used,
> (when (and (> (point-max) (point-min)) diff-default-read-only)
> it is never reached, as if it were, there would be no way to put stuff
> in that buffer in the first place, hence the point-max jazz, I guess.
How about this patch? It makes `diff-mode' set buffer-read-only to t
whenever diff-default-read-only is non-nil. It also adds
(inhibit-read-only t) to several interactive commands in diff-mode and
the `M-x diff' code in diff.el.
*** emacs/lisp/diff-mode.el.~1.88.~ 2006-05-17 13:33:39.000000000 -0400
--- emacs/lisp/diff-mode.el 2006-06-02 19:07:52.000000000 -0400
***************
*** 438,444 ****
(firsthunk (ignore-errors
(goto-char start)
(diff-beginning-of-file) (diff-hunk-next) (point)))
! (nextfile (ignore-errors (diff-file-next) (point))))
(goto-char start)
(if (and firsthunk (= firsthunk start)
(or (null nexthunk)
--- 438,445 ----
(firsthunk (ignore-errors
(goto-char start)
(diff-beginning-of-file) (diff-hunk-next) (point)))
! (nextfile (ignore-errors (diff-file-next) (point)))
! (inhibit-read-only t))
(goto-char start)
(if (and firsthunk (= firsthunk start)
(or (null nexthunk)
***************
*** 457,463 ****
(ignore-errors
(diff-hunk-prev) (point))))
(index (save-excursion
! (re-search-backward "^Index: " prevhunk t))))
(when index (setq start index))
(diff-end-of-file)
(if (looking-at "^\n") (forward-char 1)) ;`tla' generates such diffs.
--- 458,465 ----
(ignore-errors
(diff-hunk-prev) (point))))
(index (save-excursion
! (re-search-backward "^Index: " prevhunk t)))
! (inhibit-read-only t))
(when index (setq start index))
(diff-end-of-file)
(if (looking-at "^\n") (forward-char 1)) ;`tla' generates such diffs.
***************
*** 490,495 ****
--- 492,498 ----
(interactive)
(beginning-of-line)
(let ((pos (point))
+ (inhibit-read-only t)
(start (progn (diff-beginning-of-hunk) (point))))
(unless (looking-at "@@ -\\([0-9]+\\),[0-9]+ \\+\\([0-9]+\\),[0-9]+ @@")
(error "diff-split-hunk only works on unified context diffs"))
***************
*** 993,1000 ****
;; 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))
;; setup change hooks
(if (not diff-update-on-the-fly)
(add-hook 'write-contents-functions 'diff-write-contents-hooks nil t)
--- 996,1003 ----
;; compile support
(set (make-local-variable 'next-error-function) 'diff-next-error)
! (if diff-default-read-only
! (setq buffer-read-only t))
;; setup change hooks
(if (not diff-update-on-the-fly)
(add-hook 'write-contents-functions 'diff-write-contents-hooks nil t)
***************
*** 1355,1360 ****
--- 1358,1364 ----
(file1 (make-temp-file "diff1"))
(file2 (make-temp-file "diff2"))
(coding-system-for-read buffer-file-coding-system)
+ (inhibit-read-only t)
old new)
(unwind-protect
(save-excursion
*** emacs/lisp/diff.el.~1.59.~ 2006-02-07 17:37:23.000000000 -0500
--- emacs/lisp/diff.el 2006-06-02 19:12:49.000000000 -0400
***************
*** 67,75 ****
(if diff-new-temp-file (delete-file diff-new-temp-file))
(save-excursion
(goto-char (point-max))
! (insert (format "\nDiff finished%s. %s\n"
! (if (equal 0 code) " (no differences)" "")
! (current-time-string)))))
;;;###autoload
(defun diff (old new &optional switches no-async)
--- 67,86 ----
(if diff-new-temp-file (delete-file diff-new-temp-file))
(save-excursion
(goto-char (point-max))
! (let ((inhibit-read-only t))
! (insert (format "\nDiff finished%s. %s\n"
! (if (equal 0 code) " (no differences)" "")
! (current-time-string))))))
!
! (defun diff-insertion-filter (proc string)
! (with-current-buffer (process-buffer proc)
! (let ((moving (= (point) (process-mark proc)))
! (inhibit-read-only t))
! (save-excursion
! (goto-char (process-mark proc))
! (insert string)
! (set-marker (process-mark proc) (point)))
! (if moving (goto-char (process-mark proc))))))
;;;###autoload
(defun diff (old new &optional switches no-async)
***************
*** 113,118 ****
--- 124,130 ----
" "))
(buf (get-buffer-create "*Diff*"))
(thisdir default-directory)
+ (inhibit-read-only t)
proc)
(save-excursion
(display-buffer buf)
***************
*** 133,138 ****
--- 145,151 ----
(progn
(setq proc (start-process "Diff" buf shell-file-name
shell-command-switch command))
+ (set-process-filter proc 'diff-insertion-filter)
(set-process-sentinel
proc (lambda (proc msg)
(with-current-buffer (process-buffer proc)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [jidanni@jidanni.org: diff-default-read-only doesn't]
2006-06-02 23:17 ` Chong Yidong
@ 2006-06-04 2:24 ` Richard Stallman
0 siblings, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2006-06-04 2:24 UTC (permalink / raw)
Cc: emacs-devel
How about this patch? It makes `diff-mode' set buffer-read-only to t
whenever diff-default-read-only is non-nil. It also adds
(inhibit-read-only t) to several interactive commands in diff-mode and
the `M-x diff' code in diff.el.
Please do what you think is right.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-06-04 2:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-31 19:13 [jidanni@jidanni.org: diff-default-read-only doesn't] Richard Stallman
2006-06-02 23:17 ` Chong Yidong
2006-06-04 2:24 ` Richard Stallman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.