Function: gud-query-cmdline

gud-query-cmdline is a byte-compiled function defined in gud.el.gz.

Signature

(gud-query-cmdline MINOR-MODE &optional INIT DEFAULT-LIST)

Documentation

Prompt for a command to run the debugger.

MINOR-MODE is the name of the debugger to run. INIT is the initial command, before any history is available. DEFAULT-LIST is a list of default commands, accessible via M-x next-history-element (next-history-element).

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/gud.el.gz
(defun gud-query-cmdline (minor-mode &optional init default-list)
  "Prompt for a command to run the debugger.
MINOR-MODE is the name of the debugger to run.  INIT is the initial
command, before any history is available.  DEFAULT-LIST is a list of
default commands, accessible via \\[next-history-element]."
  (let* ((hist-sym (gud-symbol 'history nil minor-mode))
	 (cmd-name (gud-val 'command-name minor-mode)))
    (unless (boundp hist-sym) (set hist-sym nil))
    (read-from-minibuffer
     (format "Run %s (like this): " minor-mode)
     (or (car-safe (symbol-value hist-sym))
	 (concat (or cmd-name (symbol-name minor-mode))
		 " "
		 (or init
		     (let ((file nil)
                           (files (directory-files default-directory)))
                       ;; On remote systems, this may be slow, so avoid it.
                       (when (or (not (file-remote-p default-directory))
                                 (length< files 50))
                         (dolist (f files)
			   (if (and (file-executable-p f)
				    (not (file-directory-p f))
				    (or (not file)
                                        (file-newer-than-file-p f file)))
			       (setq file f)))
                            file)))))
     gud-minibuffer-local-map nil
     hist-sym
     default-list)))