emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: vc-follow-symlinks confirm message is not read only


From: Luc Teirlinck
Subject: Re: vc-follow-symlinks confirm message is not read only
Date: Wed, 5 May 2004 18:36:43 -0500 (CDT)

Stefan Monnier wrote:

   > When visiting a symbolic link to a file under CVS control and
   > vc-follow-symlinks's value is ask, Emacs display following message:
   >    "Symbolic link to CVS-controlled source file; follow link? "
   > This message is not read only, so you delete it to press DEL key.

   I suspect that your inhibit-read-only variable was somehow incorrectly bound
   to t temporarily while the question was displayed.
   To figure out why, we'd need at least a backtrace (set debug-on-quit to
   t and hit C-g when the writable prompt appears).

find-file-noselect-1 binds inhibit-read-only to t, probably for very
good reasons.  _Somewhere_ it has to be rebound to nil.  The most
conservative way to do this is:

===File ~/vc-hooks-diff=====================================
*** vc-hooks.el 23 Apr 2004 17:10:10 -0500      1.168
--- vc-hooks.el 05 May 2004 18:16:29 -0500      
***************
*** 751,758 ****
               (message "Followed link to %s" buffer-file-name)
               (vc-find-file-hook))
              (t
!              (if (yes-or-no-p (format
!         "Symbolic link to %s-controlled source file; follow link? " 
link-type))
                   (progn (vc-follow-link)
                          (message "Followed link to %s" buffer-file-name)
                          (vc-find-file-hook))
--- 751,759 ----
               (message "Followed link to %s" buffer-file-name)
               (vc-find-file-hook))
              (t
!              (if (let ((inhibit-read-only t)) 
!                    (yes-or-no-p (format
!       "Symbolic link to %s-controlled source file; follow link? " link-type)))
                   (progn (vc-follow-link)
                          (message "Followed link to %s" buffer-file-name)
                          (vc-find-file-hook))
============================================================

If we go for this conservative solution, we should _clearly_ point out
in the documentation of find-file-hook that inhibit-read-only is, by
default, bound to t during the execution of those functions.  Currently
there seems to be no mention whatsoever of that.  This suggests the
following alternative solution (but this one has at least some danger
of breaking stuff):

===File ~/files-diff========================================
*** files.el    01 May 2004 10:36:39 -0500      1.690
--- files.el    05 May 2004 18:11:28 -0500      
***************
*** 1573,1579 ****
               view-read-only
               (not (eq (get major-mode 'mode-class) 'special)))
        (view-mode-enter))
!     (run-hooks 'find-file-hook)))
  
  (defmacro report-errors (format &rest body)
    "Eval BODY and turn any error into a FORMAT message.
--- 1573,1580 ----
               view-read-only
               (not (eq (get major-mode 'mode-class) 'special)))
        (view-mode-enter))
!     (let ((inhibit-read-only nil))
!       (run-hooks 'find-file-hook))))
  
  (defmacro report-errors (format &rest body)
    "Eval BODY and turn any error into a FORMAT message.
============================================================




reply via email to

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