Function: idlwave-display-calling-sequence

idlwave-display-calling-sequence is a byte-compiled function defined in idlwave.el.gz.

Signature

(idlwave-display-calling-sequence NAME TYPE CLASS &optional INITIAL-CLASS)

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/idlwave.el.gz
(defun idlwave-display-calling-sequence (name type class
					      &optional initial-class)
  ;; Display the calling sequence of module NAME, type TYPE in class CLASS.
  (let* ((initial-class (or initial-class class))
	 (entry (or (idlwave-best-rinfo-assq name type class
					     (idlwave-routines))
		    (idlwave-rinfo-assq name type class
					idlwave-unresolved-routines)))
	 (name (or (car entry) name))
	 (class (or (nth 2 entry) class))
	 (superclasses (idlwave-all-class-inherits initial-class))
	 (twins (idlwave-routine-twins entry))
	 (dtwins (idlwave-study-twins twins))
	 (all dtwins)
	 (system (eq (car (nth 3 entry)) 'system))
	 (calling-seq (nth 4 entry))
	 (keywords (idlwave-entry-keywords entry 'do-link))
	 (html-file (car (nth 5 entry)))
	 (help-echo-kwd
	  "Button2: Insert KEYWORD (SHIFT=`/KEYWORD') | Button3: Online Help ")
	 (help-echo-use
	  "Button2/3: Online Help")
	 (help-echo-src
	  "Button2: Jump to source and back | Button3: Source in Help window.")
	 (help-echo-class
	  "Button2: Display info about same method in superclass")
	 (col 0)
	 (data (list name type class (current-buffer) nil initial-class))
	 (face 'idlwave-help-link)
	 beg props win cnt total)
    ;; Fix keywords, but don't add chained idlwave--super-classes, since these
    ;; are shown separately for that super-class
    (setq keywords (idlwave-fix-keywords name type class keywords))
    (cond
     ((null entry)
      (error "No %s %s known %s" type name
	     (if initial-class (concat "in class " initial-class) "")))
     ((or (null name) (equal name ""))
      (error "No function or procedure call at point"))
     ((null calling-seq)
      (error "Calling sequence of %s %s not available" type name))
     (t
      (move-marker idlwave-rinfo-marker (point))
      (with-current-buffer (get-buffer-create "*Help*")
	(use-local-map idlwave-rinfo-map)
	(setq buffer-read-only nil)
	(erase-buffer)
	(set (make-local-variable 'idlwave-popup-source) nil)
	(set (make-local-variable 'idlwave-current-obj_new-class)
				  idlwave-current-obj_new-class)
	(when superclasses
	  (setq props (list 'mouse-face 'highlight
			    'local-map idlwave-rinfo-mouse-map
			    'help-echo help-echo-class
			    'data (cons 'class data)))
	  (let ((classes (cons initial-class superclasses)) c)
	    (insert "Classes: ")
	    (while (setq c (pop classes))
	      (insert " ")
	      (setq beg (point))
	      (insert c)
	      (if (equal (downcase c) (downcase class))
		  (add-text-properties beg (point) (list 'face 'bold))
		;; If Method exists in a different class link it
		(if (idlwave-rinfo-assq name type c (idlwave-routines))
		    (add-text-properties beg (point) props))))
	    (insert "\n")))
	(setq props (list 'mouse-face 'highlight
			  'local-map idlwave-rinfo-mouse-map
			  'help-echo help-echo-use
			  'data (cons 'usage data)))
	(if html-file (setq props (append (list 'face face 'link html-file)
					  props)))
	(insert "Usage:    ")
	(setq beg (point))
	(insert (if class
		    (format calling-seq class name class name class name)
		  (format calling-seq name name name name))
		"\n")
	(add-text-properties beg (point) props)

	(insert "Keywords:")
	(if (null keywords)
	    (insert " No keywords accepted.")
	  (setq col 9)
	  (mapc
	   (lambda (x)
	     (if (>= (+ col 1 (length (car x)))
		     (window-width))
		 (progn
		   (insert "\n         ")
		   (setq col 9)))
	     (insert " ")
	     (setq beg (point)
		   ;; Relevant keywords already have link property attached
		   props (list 'mouse-face 'highlight
			       'local-map idlwave-rinfo-mouse-map
			       'data (cons 'keyword data)
			       'help-echo help-echo-kwd
			       'keyword (car x)))
	     (if system (setq props (append (list 'face face) props)))
	     (insert (car x))
	     (add-text-properties beg (point) props)
	     (setq col (+ col 1 (length (car x)))))
	   keywords))

	(setq cnt 1 total (length all))
	;; Here entry is (key file (list of type-conses))
	(while (setq entry (pop all))
	  (setq props (list 'mouse-face 'highlight
			    'local-map idlwave-rinfo-mouse-map
			    'help-echo help-echo-src
			    'source (list (car (car (nth 2 entry))) ;type
					  (nth 1 entry)
					  nil
					  (cdr (car (nth 2 entry))))
			    'data (cons 'source data)))
	  (idlwave-insert-source-location
	   (format "\n%-8s  %s"
		   (if (equal cnt 1)
		       (if (> total 1) "Sources:" "Source:")
		     "")
		   (if (> total 1) "- " ""))
	   entry props)
	  (cl-incf cnt)
	  (when (and all (> cnt idlwave-rinfo-max-source-lines))
	    ;; No more source lines, please
	    (insert (format
		     "\n          Source information truncated to %d entries."
		     idlwave-rinfo-max-source-lines))
	    (setq all nil)))
	(goto-char (point-min))
	(setq buffer-read-only t))
      (display-buffer "*Help*")
      (if (and (setq win (get-buffer-window "*Help*"))
	       idlwave-resize-routine-help-window)
	  (progn
	    (let ((ww (selected-window)))
	      (unwind-protect
		  (progn
		    (select-window win)
		    (enlarge-window (- (/ (frame-height) 2)
				       (window-height)))
		    (shrink-window-if-larger-than-buffer))
		(select-window ww)))))))))