diff options
| -rw-r--r-- | lisp/files.el | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/lisp/files.el b/lisp/files.el index 1471270d541..81143edbc63 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -3057,20 +3057,25 @@ prints a message in the minibuffer. Instead, use `set-buffer-modified-p'." | |||
| 3057 | With arg, set read-only iff arg is positive. | 3057 | With arg, set read-only iff arg is positive. |
| 3058 | If visiting file read-only and `view-read-only' is non-nil, enter view mode." | 3058 | If visiting file read-only and `view-read-only' is non-nil, enter view mode." |
| 3059 | (interactive "P") | 3059 | (interactive "P") |
| 3060 | (cond | 3060 | (if (and arg |
| 3061 | ((and arg (if (> (prefix-numeric-value arg) 0) buffer-read-only | 3061 | (if (> (prefix-numeric-value arg) 0) buffer-read-only |
| 3062 | (not buffer-read-only))) ; If buffer-read-only is set correctly, | 3062 | (not buffer-read-only))) ; If buffer-read-only is set correctly, |
| 3063 | nil) ; do nothing. | 3063 | nil ; do nothing. |
| 3064 | ;; Toggle. | 3064 | ;; Toggle. |
| 3065 | ((and buffer-read-only view-mode) | 3065 | (cond |
| 3066 | (View-exit-and-edit) | 3066 | ((and buffer-read-only view-mode) |
| 3067 | (make-local-variable 'view-read-only) | 3067 | (View-exit-and-edit) |
| 3068 | (setq view-read-only t)) ; Must leave view mode. | 3068 | (make-local-variable 'view-read-only) |
| 3069 | ((and (not buffer-read-only) view-read-only | 3069 | (setq view-read-only t)) ; Must leave view mode. |
| 3070 | (not (eq (get major-mode 'mode-class) 'special))) | 3070 | ((and (not buffer-read-only) view-read-only |
| 3071 | (view-mode-enter)) | 3071 | (not (eq (get major-mode 'mode-class) 'special))) |
| 3072 | (t (setq buffer-read-only (not buffer-read-only)) | 3072 | (view-mode-enter)) |
| 3073 | (force-mode-line-update)))) | 3073 | (t (setq buffer-read-only (not buffer-read-only)) |
| 3074 | (force-mode-line-update))) | ||
| 3075 | (if (vc-backend buffer-file-name) | ||
| 3076 | (message (substitute-command-keys | ||
| 3077 | (concat "File is under version-control, " | ||
| 3078 | "consider \\[vc-next-action] to check in/out")))))) | ||
| 3074 | 3079 | ||
| 3075 | (defun insert-file (filename) | 3080 | (defun insert-file (filename) |
| 3076 | "Insert contents of file FILENAME into buffer after point. | 3081 | "Insert contents of file FILENAME into buffer after point. |
| @@ -4144,6 +4149,7 @@ With prefix arg, silently save all file-visiting buffers, then kill." | |||
| 4144 | (define-key esc-map "~" 'not-modified) | 4149 | (define-key esc-map "~" 'not-modified) |
| 4145 | (define-key ctl-x-map "\C-d" 'list-directory) | 4150 | (define-key ctl-x-map "\C-d" 'list-directory) |
| 4146 | (define-key ctl-x-map "\C-c" 'save-buffers-kill-emacs) | 4151 | (define-key ctl-x-map "\C-c" 'save-buffers-kill-emacs) |
| 4152 | (define-key ctl-x-map "\C-q" 'toggle-read-only) | ||
| 4147 | 4153 | ||
| 4148 | (define-key ctl-x-4-map "f" 'find-file-other-window) | 4154 | (define-key ctl-x-4-map "f" 'find-file-other-window) |
| 4149 | (define-key ctl-x-4-map "r" 'find-file-read-only-other-window) | 4155 | (define-key ctl-x-4-map "r" 'find-file-read-only-other-window) |