3057 |
With arg, set read-only iff arg is positive. |
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." |
If visiting file read-only and `view-read-only' is non-nil, enter view mode." |
3059 |
(interactive "P") |
(interactive "P") |
3060 |
(cond |
(if (and arg |
3061 |
((and arg (if (> (prefix-numeric-value arg) 0) buffer-read-only |
(if (> (prefix-numeric-value arg) 0) buffer-read-only |
3062 |
(not buffer-read-only))) ; If buffer-read-only is set correctly, |
(not buffer-read-only))) ; If buffer-read-only is set correctly, |
3063 |
nil) ; do nothing. |
nil ; do nothing. |
3064 |
;; Toggle. |
;; Toggle. |
3065 |
((and buffer-read-only view-mode) |
(cond |
3066 |
(View-exit-and-edit) |
((and buffer-read-only view-mode) |
3067 |
(make-local-variable 'view-read-only) |
(View-exit-and-edit) |
3068 |
(setq view-read-only t)) ; Must leave view mode. |
(make-local-variable 'view-read-only) |
3069 |
((and (not buffer-read-only) view-read-only |
(setq view-read-only t)) ; Must leave view mode. |
3070 |
(not (eq (get major-mode 'mode-class) 'special))) |
((and (not buffer-read-only) view-read-only |
3071 |
(view-mode-enter)) |
(not (eq (get major-mode 'mode-class) 'special))) |
3072 |
(t (setq buffer-read-only (not buffer-read-only)) |
(view-mode-enter)) |
3073 |
(force-mode-line-update)))) |
(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")))))) |
3079 |
|
|
3080 |
(defun insert-file (filename) |
(defun insert-file (filename) |
3081 |
"Insert contents of file FILENAME into buffer after point. |
"Insert contents of file FILENAME into buffer after point. |
4149 |
(define-key esc-map "~" 'not-modified) |
(define-key esc-map "~" 'not-modified) |
4150 |
(define-key ctl-x-map "\C-d" 'list-directory) |
(define-key ctl-x-map "\C-d" 'list-directory) |
4151 |
(define-key ctl-x-map "\C-c" 'save-buffers-kill-emacs) |
(define-key ctl-x-map "\C-c" 'save-buffers-kill-emacs) |
4152 |
|
(define-key ctl-x-map "\C-q" 'toggle-read-only) |
4153 |
|
|
4154 |
(define-key ctl-x-4-map "f" 'find-file-other-window) |
(define-key ctl-x-4-map "f" 'find-file-other-window) |
4155 |
(define-key ctl-x-4-map "r" 'find-file-read-only-other-window) |
(define-key ctl-x-4-map "r" 'find-file-read-only-other-window) |