help-emacs-windows
[Top][All Lists]
Advanced

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

Re: [h-e-w] eval-after-load vs clearcase


From: Richard Y. Kim
Subject: Re: [h-e-w] eval-after-load vs clearcase
Date: Tue, 9 Apr 2002 10:10:24 -0700

I think I figured out what is going on with eval-after-load
and file-name-handler-alist after spending some time using
gdb on emacs.  Here is the summary:

1. Doing `M-x clearcase-integrate' breaks `eval-after-load', i.e., the
   forms registered to be evaluated upon loading of an elisp file,
   e.g., "bookmark", does not get evaluated.

    (clearcase-integrate)
    (setq foo nil)
    (eval-after-load "bookmark" '(progn (setq foo t)))
    (load-library "bookmark")
    (or foo (error "clearcase broke eval-after-load"))

2. This can be tracked down to the fact that
   `clearcase-suppress-vc-within-mvfs-file-name-handler'
   is added to `file-name-handler-alist' with the regexp of ".*"
   which matches all files including all files specified to the
   `load' call.

3. In terms of emacs source code, the related call sequence is:

    Fload() 
      openp() => return -2
        Ffind_file_name_handler () => returns non-nil

   Ffind_file_name_handler returning non-nil in turn makes openp()
   return -2. In response, Fload() uses the full-path name.

It is not clear whether this subtle interaction between
eval-after-load and file-name-handler-alist is a bug in
emacs, i.e., I could not find the answer in emacs lisp manual.

Regardless a warning in the emacs lisp manual might be useful to alert
programmers to be careful not to use such a general regexp as ".*" in
file-name-handler-alist.

One possible solution within clearcase.el is to change the way in
which vc-registered is disabled.  Here is an alternate solution using
defadvice instead of file-name-handler-alist.  [I keep all my elisp
in my own CVS database.  The diff is against /main/laptop/101 version.]

This works for me on w2k.
I believe it also works on GNU/Linux as well.
I also sent the patch below to the author of clearcase.el.


Index: clearcase.el
===================================================================
RCS file: .../elisp/misc/clearcase.el,v
retrieving revision 1.4
diff -c -r1.4 clearcase.el
*** clearcase.el        2002/04/09 16:12:25     1.4
--- clearcase.el        2002/04/09 16:35:16
***************
*** 6635,6661 ****
  ;; This stops it from futile searches for RCS directories and the like inside.
  ;; It prevents a certain amount of clutter in the MVFS' noent-cache.
  ;;
- (defun clearcase-suppress-vc-within-mvfs-file-name-handler (operation &rest 
args)
-   (clearcase-when-debugging
-    (if (fboundp 'clearcase-utl-syslog)
-        (clearcase-utl-syslog "*clearcase-fh-trace*"
-                              (cons 
"clearcase-suppress-vc-within-mvfs-file-name-handler:"
-                                    (cons operation args)))))
-   ;; Inhibit recursion:
-   ;;
-   (let ((inhibit-file-name-handlers
-          (cons 'clearcase-suppress-vc-within-mvfs-file-name-handler
-                (and (eq inhibit-file-name-operation operation)
-                     inhibit-file-name-handlers)))
-         (inhibit-file-name-operation operation))
- 
-     (cond
-      ((and (eq operation 'vc-registered)
-            (clearcase-file-would-be-in-view-p (car args)))
-       nil)
  
!      (t
!       (apply operation args)))))
  
  ;;}}}
  
--- 6635,6647 ----
  ;; This stops it from futile searches for RCS directories and the like inside.
  ;; It prevents a certain amount of clutter in the MVFS' noent-cache.
  ;;
  
! (defadvice vc-registered (around clearcase-interceptor disable compile)
!   "Disable normal behavior if in a clearcase dynamic view.
! This is enabled/disabled by clearcase-integrate/clearcase-unintegrate."
!   (if (clearcase-file-would-be-in-view-p (ad-get-arg 0))
!       nil
!     ad-do-it))
  
  ;;}}}
  
***************
*** 6781,6788 ****
    ;;    2.3 Turn off RCS/VCS/SCCS activity inside a ClearCase dynamic view.
    ;;
    (if clearcase-suppress-vc-within-mvfs
!       (add-to-list 'file-name-handler-alist
!                    (cons ".*" 
'clearcase-suppress-vc-within-mvfs-file-name-handler)))
  
  ;; Disabled for now. See comments above clearcase-vxpath-file-name-handler.
  ;;
--- 6767,6775 ----
    ;;    2.3 Turn off RCS/VCS/SCCS activity inside a ClearCase dynamic view.
    ;;
    (if clearcase-suppress-vc-within-mvfs
!       (when clearcase-suppress-vc-within-mvfs
!       (ad-enable-advice 'vc-registered 'around 'clearcase-interceptor)
!       (ad-activate 'vc-registered)))
  
  ;; Disabled for now. See comments above clearcase-vxpath-file-name-handler.
  ;;
***************
*** 6819,6827 ****
                        (memq (cdr entry)
                              '(clearcase-viewroot-relative-file-name-handler
                                clearcase-viewtag-file-name-handler
-                               
clearcase-suppress-vc-within-mvfs-file-name-handler
                                clearcase-vxpath-file-name-handler))))
!                    file-name-handler-alist)))
  
  ;;}}}
  
--- 6806,6817 ----
                        (memq (cdr entry)
                              '(clearcase-viewroot-relative-file-name-handler
                                clearcase-viewtag-file-name-handler
                                clearcase-vxpath-file-name-handler))))
!                    file-name-handler-alist))
!  
!   ;; 3. Turn on RCS/VCS/SCCS activity everywhere.
!   (ad-disable-advice 'vc-registered 'around 'clearcase-interceptor)
!   (ad-activate 'vc-registered))
  
  ;;}}}





reply via email to

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