From 769dd0f172ae5b1973af73eca0a1aa1c1cbf31b7 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 22 Sep 2001 19:11:24 +0000 Subject: [PATCH] (diff-default-read-only): New var. (diff-mode): Use it. --- lisp/ChangeLog | 50 +++++++++++++++++++++-------------------------- lisp/diff-mode.el | 16 +++++++++------ 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b680e0ec584..7c066f7e4c1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,12 @@ +2001-09-22 Stefan Monnier + + * diff-mode.el (diff-default-read-only): New var. + (diff-mode): Use it. + 2001-09-22 Eli Zaretskii - * 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 - * 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 - * 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 @@ -154,8 +157,8 @@ 2001-09-12 Gerd Moellmann * 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 . + from `ediff-meta-info' properties need not be an overlay. + From David Ponce . * isearch.el (isearch-intersects-p): Fix end checks. @@ -199,13 +202,13 @@ 2001-09-09 Michael Kifer - * 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 @@ -232,29 +235,20 @@ 2001-09-07 Pavel Jan,Bm(Bk - * locate.el (locate-insert-header): Remove unnecessary - whitespace. + * locate.el (locate-insert-header): Remove unnecessary whitespace. 2001-09-07 Eli Zaretskii - * 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 - * 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. diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index 6d630e5a8ad..2c86b1fbeb3 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el @@ -69,6 +69,11 @@ :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) -- 2.39.2