emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/files.el


From: Andre Spiegel
Subject: [Emacs-diffs] Changes to emacs/lisp/files.el
Date: Tue, 16 Jul 2002 13:40:37 -0400

Index: emacs/lisp/files.el
diff -c emacs/lisp/files.el:1.594 emacs/lisp/files.el:1.595
*** emacs/lisp/files.el:1.594   Sun Jul 14 11:30:54 2002
--- emacs/lisp/files.el Tue Jul 16 13:40:37 2002
***************
*** 3057,3076 ****
  With arg, set read-only iff arg is positive.
  If visiting file read-only and `view-read-only' is non-nil, enter view mode."
    (interactive "P")
!   (cond
!    ((and arg (if (> (prefix-numeric-value arg) 0) buffer-read-only
!              (not buffer-read-only))) ; If buffer-read-only is set correctly,
!     nil)                              ; do nothing.
!    ;; Toggle.
!    ((and buffer-read-only view-mode)
!     (View-exit-and-edit)
!     (make-local-variable 'view-read-only)
!     (setq view-read-only t))          ; Must leave view mode.
!    ((and (not buffer-read-only) view-read-only
!        (not (eq (get major-mode 'mode-class) 'special)))
!     (view-mode-enter))
!    (t (setq buffer-read-only (not buffer-read-only))
!       (force-mode-line-update))))
  
  (defun insert-file (filename)
    "Insert contents of file FILENAME into buffer after point.
--- 3057,3081 ----
  With arg, set read-only iff arg is positive.
  If visiting file read-only and `view-read-only' is non-nil, enter view mode."
    (interactive "P")
!   (if (and arg 
!            (if (> (prefix-numeric-value arg) 0) buffer-read-only
!              (not buffer-read-only)))  ; If buffer-read-only is set correctly,
!       nil                            ; do nothing.
!     ;; Toggle.
!     (cond
!      ((and buffer-read-only view-mode)
!       (View-exit-and-edit)
!       (make-local-variable 'view-read-only)
!       (setq view-read-only t))                ; Must leave view mode.
!      ((and (not buffer-read-only) view-read-only
!            (not (eq (get major-mode 'mode-class) 'special)))
!       (view-mode-enter))
!      (t (setq buffer-read-only (not buffer-read-only))
!         (force-mode-line-update)))
!     (if (vc-backend buffer-file-name)
!         (message (substitute-command-keys
!                   (concat "File is under version-control, "
!                           "consider \\[vc-next-action] to check in/out"))))))
  
  (defun insert-file (filename)
    "Insert contents of file FILENAME into buffer after point.
***************
*** 4144,4149 ****
--- 4149,4155 ----
  (define-key esc-map "~" 'not-modified)
  (define-key ctl-x-map "\C-d" 'list-directory)
  (define-key ctl-x-map "\C-c" 'save-buffers-kill-emacs)
+ (define-key ctl-x-map "\C-q" 'toggle-read-only)
  
  (define-key ctl-x-4-map "f" 'find-file-other-window)
  (define-key ctl-x-4-map "r" 'find-file-read-only-other-window)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]