diff options
| author | Stefan Monnier | 2012-08-29 13:36:49 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-08-29 13:36:49 -0400 |
| commit | af070a1c6a6373b0c854ffb94ab67aaef9582bab (patch) | |
| tree | ff09ac1624d10bd42e8bcccaa139a06dd4ace2c9 | |
| parent | 35e62fc984b108f717c5525ffecf60586eb0737e (diff) | |
| download | emacs-af070a1c6a6373b0c854ffb94ab67aaef9582bab.tar.gz emacs-af070a1c6a6373b0c854ffb94ab67aaef9582bab.zip | |
* lisp/simple.el (read-only-mode): Move from lisp/files.el for bootstrapping.
* files.el (read-only-mode): Move to simple.el.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/files.el | 26 | ||||
| -rw-r--r-- | lisp/simple.el | 26 |
3 files changed, 29 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 48403c7f046..64ccde6705e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2012-08-29 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2012-08-29 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * simple.el (read-only-mode): Move from files.el for bootstrapping. | ||
| 4 | * files.el (read-only-mode): Move to simple.el. | ||
| 5 | |||
| 3 | * files.el (read-only-mode): New minor mode. | 6 | * files.el (read-only-mode): New minor mode. |
| 4 | (toggle-read-only): Use it and mark obsolete. | 7 | (toggle-read-only): Use it and mark obsolete. |
| 5 | (find-file--read-only): | 8 | (find-file--read-only): |
diff --git a/lisp/files.el b/lisp/files.el index 5c8e1ef396b..ef7f8e43a41 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -4818,32 +4818,6 @@ prints a message in the minibuffer. Instead, use `set-buffer-modified-p'." | |||
| 4818 | "Modification-flag cleared")) | 4818 | "Modification-flag cleared")) |
| 4819 | (set-buffer-modified-p arg)) | 4819 | (set-buffer-modified-p arg)) |
| 4820 | 4820 | ||
| 4821 | (define-minor-mode read-only-mode | ||
| 4822 | "Change whether the current buffer is read-only. | ||
| 4823 | With prefix argument ARG, make the buffer read-only if ARG is | ||
| 4824 | positive, otherwise make it writable. If buffer is read-only | ||
| 4825 | and `view-read-only' is non-nil, enter view mode. | ||
| 4826 | |||
| 4827 | Do not call this from a Lisp program unless you really intend to | ||
| 4828 | do the same thing as the \\[toggle-read-only] command, including | ||
| 4829 | possibly enabling or disabling View mode. Also, note that this | ||
| 4830 | command works by setting the variable `buffer-read-only', which | ||
| 4831 | does not affect read-only regions caused by text properties. To | ||
| 4832 | ignore read-only status in a Lisp program (whether due to text | ||
| 4833 | properties or buffer state), bind `inhibit-read-only' temporarily | ||
| 4834 | to a non-nil value." | ||
| 4835 | :variable buffer-read-only | ||
| 4836 | (cond | ||
| 4837 | ((and (not buffer-read-only) view-mode) | ||
| 4838 | (View-exit-and-edit) | ||
| 4839 | (make-local-variable 'view-read-only) | ||
| 4840 | (setq view-read-only t)) ; Must leave view mode. | ||
| 4841 | ((and buffer-read-only view-read-only | ||
| 4842 | ;; If view-mode is already active, `view-mode-enter' is a nop. | ||
| 4843 | (not view-mode) | ||
| 4844 | (not (eq (get major-mode 'mode-class) 'special))) | ||
| 4845 | (view-mode-enter)))) | ||
| 4846 | |||
| 4847 | (defun toggle-read-only (&optional arg interactive) | 4821 | (defun toggle-read-only (&optional arg interactive) |
| 4848 | (declare (obsolete read-only-mode "24.3")) | 4822 | (declare (obsolete read-only-mode "24.3")) |
| 4849 | (interactive (list current-prefix-arg t)) | 4823 | (interactive (list current-prefix-arg t)) |
diff --git a/lisp/simple.el b/lisp/simple.el index 1080757f7d2..7673e4c5d6e 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -6961,6 +6961,32 @@ See also `normal-erase-is-backspace'." | |||
| 6961 | (defvar vis-mode-saved-buffer-invisibility-spec nil | 6961 | (defvar vis-mode-saved-buffer-invisibility-spec nil |
| 6962 | "Saved value of `buffer-invisibility-spec' when Visible mode is on.") | 6962 | "Saved value of `buffer-invisibility-spec' when Visible mode is on.") |
| 6963 | 6963 | ||
| 6964 | (define-minor-mode read-only-mode | ||
| 6965 | "Change whether the current buffer is read-only. | ||
| 6966 | With prefix argument ARG, make the buffer read-only if ARG is | ||
| 6967 | positive, otherwise make it writable. If buffer is read-only | ||
| 6968 | and `view-read-only' is non-nil, enter view mode. | ||
| 6969 | |||
| 6970 | Do not call this from a Lisp program unless you really intend to | ||
| 6971 | do the same thing as the \\[toggle-read-only] command, including | ||
| 6972 | possibly enabling or disabling View mode. Also, note that this | ||
| 6973 | command works by setting the variable `buffer-read-only', which | ||
| 6974 | does not affect read-only regions caused by text properties. To | ||
| 6975 | ignore read-only status in a Lisp program (whether due to text | ||
| 6976 | properties or buffer state), bind `inhibit-read-only' temporarily | ||
| 6977 | to a non-nil value." | ||
| 6978 | :variable buffer-read-only | ||
| 6979 | (cond | ||
| 6980 | ((and (not buffer-read-only) view-mode) | ||
| 6981 | (View-exit-and-edit) | ||
| 6982 | (make-local-variable 'view-read-only) | ||
| 6983 | (setq view-read-only t)) ; Must leave view mode. | ||
| 6984 | ((and buffer-read-only view-read-only | ||
| 6985 | ;; If view-mode is already active, `view-mode-enter' is a nop. | ||
| 6986 | (not view-mode) | ||
| 6987 | (not (eq (get major-mode 'mode-class) 'special))) | ||
| 6988 | (view-mode-enter)))) | ||
| 6989 | |||
| 6964 | (define-minor-mode visible-mode | 6990 | (define-minor-mode visible-mode |
| 6965 | "Toggle making all invisible text temporarily visible (Visible mode). | 6991 | "Toggle making all invisible text temporarily visible (Visible mode). |
| 6966 | With a prefix argument ARG, enable Visible mode if ARG is | 6992 | With a prefix argument ARG, enable Visible mode if ARG is |