Function: idlwave-list-load-path-shadows

idlwave-list-load-path-shadows is a byte-compiled function defined in idlwave.el.gz.

Signature

(idlwave-list-load-path-shadows ARG &optional SPECIAL-ROUTINES LOC)

Documentation

List the routines which are defined multiple times.

Search the information IDLWAVE has about IDL routines for multiple definitions. When SPECIAL-ROUTINES in non-nil, only look for shadows of these routines.

When IDL hits a routine call which is not defined, it will search on the load path in order to find a definition. The output of this command can be used to detect possible name clashes during this process.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/idlwave.el.gz
(defun idlwave-list-load-path-shadows (_arg &optional special-routines loc)
  "List the routines which are defined multiple times.
Search the information IDLWAVE has about IDL routines for multiple
definitions.
When SPECIAL-ROUTINES in non-nil, only look for shadows of these routines.

When IDL hits a routine call which is not defined, it will search on
the load path in order to find a definition.  The output of this command
can be used to detect possible name clashes during this process."
  (idlwave-routines)  ; Make sure everything is loaded.
  (unless (or idlwave-user-catalog-routines idlwave-library-catalog-routines)
    (or (y-or-n-p
	 "You don't have any user or library catalogs.  Continue anyway? ")
	(error "Abort")))
  (let* ((routines (append idlwave-system-routines
			   idlwave-compiled-routines
			   idlwave-library-catalog-routines
			   idlwave-user-catalog-routines
			   idlwave-buffer-routines
			   nil))
	 (keymap (make-sparse-keymap))
	 (props (list 'mouse-face 'highlight
		      'local-map keymap
		      'help-echo "Mouse2: Find source"))
	 (nroutines (length (or special-routines routines)))
	 (step (/ nroutines 100))
	 (n 0)
	 (cnt 0)
	 (idlwave-sort-prefer-buffer-info nil)
	 routine twins dtwins twin done props1 lroutines)

    (if special-routines
	;; Just looking for shadows of a few special routines
	(setq lroutines routines
	      routines special-routines))

    (message "Sorting routines...")
    (setq routines (sort routines
			 (lambda (a b)
			   (string< (downcase (idlwave-make-full-name
					       (nth 2 a) (car a)))
				    (downcase (idlwave-make-full-name
					       (nth 2 b) (car b)))))))
    (message "Sorting routines...done")

    (define-key keymap [(mouse-2)]
      (lambda (ev)
	(interactive "e")
	(mouse-set-point ev)
	(apply #'idlwave-do-find-module
	       (get-text-property (point) 'find-args))))
    (define-key keymap [(return)]
      (lambda ()
	(interactive)
	(apply #'idlwave-do-find-module
	       (get-text-property (point) 'find-args))))
    (message "Compiling list...( 0%%)")
    (with-current-buffer (get-buffer-create "*Shadows*")
      (setq buffer-read-only nil)
      (erase-buffer)
      (while (setq routine (pop routines))
	(if (= (mod (setq n (1+ n)) step) 0)
	    (message "Compiling list...(%2d%%)" (floor (* n 100.0) nroutines)))

	;; Get a list of all twins
	(setq twins (idlwave-routine-twins routine (or lroutines routines)))
	(if (memq routine done)
	    (setq dtwins nil)
	  (setq dtwins (idlwave-study-twins twins)))
	;; Mark all twins as dealt with
	(setq done (append twins done))
	(when (or (> (length dtwins) 1)
		  (> (idlwave-count-memq 'lib (nth 2 (car dtwins))) 1)
		  (> (idlwave-count-memq 'user (nth 2 (car dtwins))) 1)
		  (> (idlwave-count-memq 'buffer (nth 2 (car dtwins))) 1))
	  (cl-incf cnt)
	  (insert (format "\n%s%s"
			  (idlwave-make-full-name (nth 2 routine)
						  (car routine))
			  (if (eq (nth 1 routine) 'fun) "()" "")))
	  (while (setq twin (pop dtwins))
	    (setq props1 (append (list 'find-args
				       (list (nth 0 routine)
					     (nth 1 routine)
					     (nth 2 routine)))
				 props))
	    (idlwave-insert-source-location "\n   - " twin props1))))
      (goto-char (point-min))
      (setq buffer-read-only t))
    (setq loc (or loc ""))
    (if (> cnt 0)
	(progn
	  (display-buffer (get-buffer "*Shadows*"))
	  (message "%d case%s of shadowing found %s"
		   cnt (if (= cnt 1) "" "s") loc))
      (message "No shadowing conflicts found %s" loc))))