]> git.eshelyaron.com Git - emacs.git/commitdiff
(diff-default-read-only): New var.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 22 Sep 2001 19:11:24 +0000 (19:11 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 22 Sep 2001 19:11:24 +0000 (19:11 +0000)
(diff-mode): Use it.

lisp/ChangeLog
lisp/diff-mode.el

index b680e0ec58485fb93a2b8a37b0e56c6a0c2ed256..7c066f7e4c1bdad66d6813c5b1472800e466347b 100644 (file)
@@ -1,7 +1,12 @@
+2001-09-22  Stefan Monnier  <monnier@cs.yale.edu>
+
+       * diff-mode.el (diff-default-read-only): New var.
+       (diff-mode): Use it.
+
 2001-09-22  Eli Zaretskii  <eliz@is.elta.co.il>
 
-       * hexl.el (hexl-mode-map): Fix the change of 2001-08-23: use
-       make-keymap instead of copy-keymap, since copying the global
+       * hexl.el (hexl-mode-map): Fix the change of 2001-08-23:
+       Use make-keymap instead of copy-keymap, since copying the global
        keymap messes up the menu bar.
 
        * info.el (Info-goto-node, Info-menu): Doc fix.  Suggested by
@@ -9,8 +14,7 @@
 
 2001-09-21  Eli Zaretskii  <eliz@is.elta.co.il>
 
-       * dired.el (dired-build-subdir-alist): Accept optional arg
-       SWITCHES.
+       * dired.el (dired-build-subdir-alist): Accept optional arg SWITCHES.
 
        * dired-aux.el (dired-insert-subdir): Pass switches to
        dired-build-subdir-alist.
@@ -33,8 +37,7 @@
 
 2001-09-19  Gerd Moellmann  <gerd@gnu.org>
 
-       * ps-bdf.el (bdf-read-bitmap): Initialize returned values to
-       defaults.
+       * ps-bdf.el (bdf-read-bitmap): Initialize returned values to defaults.
 
 2001-09-19  Vinicius Jose Latorre  <vinicius@cpqd.com.br>
 
 2001-09-12  Gerd Moellmann  <gerd@gnu.org>
 
        * ediff-mult.el (ediff-get-meta-info): Take into account that data
-       from `ediff-meta-info' properties need not be an overlay.  From
-       David Ponce <dponce@voila.fr>.
+       from `ediff-meta-info' properties need not be an overlay.
+       From David Ponce <dponce@voila.fr>.
 
        * isearch.el (isearch-intersects-p): Fix end checks.
 
 
 2001-09-09  Michael Kifer  <kifer@cs.sunysb.edu>
 
-       * ediff-init.el (ediff-highest-priority): bug fix.
+       * ediff-init.el (ediff-highest-priority): Bug fix.
 
-       * viper-cmd.el (viper-special-read-and-insert-char): new function
+       * viper-cmd.el (viper-special-read-and-insert-char): New function
        that reads a character and uses the current input method or
        iso-accents when appropriate.
 
-       * viper.el and all others: corrections to the comment blocks at
+       * viper.el and all others: Corrections to the comment blocks at
        the top.
 
 2001-09-09  Eli Zaretskii  <eliz@is.elta.co.il>
 
 2001-09-07  Pavel Jan\e,Bm\e(Bk  <Pavel@Janik.cz>
 
-       * locate.el (locate-insert-header): Remove unnecessary
-       whitespace.
+       * locate.el (locate-insert-header): Remove unnecessary whitespace.
 
 2001-09-07  Eli Zaretskii  <eliz@is.elta.co.il>
 
-       * arc-mode.el (archive-dostime): Fix a typo in minutes'
-       computation.
+       * arc-mode.el (archive-dostime): Fix a typo in minutes' computation.
 
 2001-09-07  Gerd Moellmann  <gerd@gnu.org>
 
-       * server.el (server-switch-buffer): Use get-window-with-predicate.
-
-       * textmodes/refer.el (refer-find-entry-internal): Use
-       get-window-with-predicate.
-
-       * term/sup-mouse.el (sup-pos-to-window): Use
-       get-window-with-predicate.
-
-       * term/bg-mouse.el (bg-window-from-x-y): Use
-       get-window-with-predicate.
-
-       * emacs-lisp/edebug.el (edebug-window-live-p): Use
-       get-window-with-predicate.
+       * server.el (server-switch-buffer):
+       * textmodes/refer.el (refer-find-entry-internal):
+       * term/sup-mouse.el (sup-pos-to-window):
+       * term/bg-mouse.el (bg-window-from-x-y):
+       * emacs-lisp/edebug.el (edebug-window-live-p):
+       Use get-window-with-predicate.
 
        * window.el (get-window-with-predicate): Renamed from some-window.
        (some-window): Make it an alias.
index 6d630e5a8adb319449dc72eda12c256d128beb24..2c86b1fbeb3c6eaf70cab3442ac1888b80c5d542 100644 (file)
   :group 'tools
   :group 'diff)
 
+(defcustom diff-default-read-only t
+  "If non-nil, `diff-mode' buffers default to being read-only."
+  :type 'boolean
+  :group 'diff-mode)
+
 (defcustom diff-jump-to-old-file nil
   "*Non-nil means `diff-goto-source' jumps to the old file.
 Else, it jumps to the new file."
@@ -862,10 +867,9 @@ See `after-change-functions' for the meaning of BEG, END and LEN."
 ;;;###autoload
 (define-derived-mode diff-mode fundamental-mode "Diff"
   "Major mode for viewing/editing context diffs.
-Supports unified and context diffs as well as (to a lesser extent) normal diffs.
-When the buffer is read-only, the ESC prefix is not necessary.
-This mode runs `diff-mode-hook'.
-\\{diff-mode-map}"
+Supports unified and context diffs as well as (to a lesser extent)
+normal diffs.
+When the buffer is read-only, the ESC prefix is not necessary."
   (set (make-local-variable 'font-lock-defaults) diff-font-lock-defaults)
   (set (make-local-variable 'outline-regexp) diff-outline-regexp)
   (set (make-local-variable 'imenu-generic-expression)
@@ -892,9 +896,9 @@ This mode runs `diff-mode-hook'.
   ;;    (substring buffer-file-name 0 (match-beginning 0))))
   ;; (compilation-shell-minor-mode 1)
 
-  ;; setup change hooks
-  (unless (and (bobp) (eobp))
+  (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-hooks 'diff-write-contents-hooks)
     (make-local-variable 'diff-unhandled-changes)