From: Gerd Moellmann Date: Thu, 4 Nov 1999 20:52:05 +0000 (+0000) Subject: (gud-perldb-massage-args): Handle the case "perl -e 0" X-Git-Tag: emacs-pretest-21.0.90~6173 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a09754e6c6ca945105c1cbfc91d246dab551f501;p=emacs.git (gud-perldb-massage-args): Handle the case "perl -e 0" the default when invoking perldb in a non-Perl buffer) and other cases involving -e or --. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 29bfa1aeeab..83c1597fb1d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,17 @@ +1999-11-04 John Tobey + + * gud.el (gud-perldb-massage-args): Handle the case "perl -e 0", + the default when invoking perldb in a non-Perl buffer, and other + cases involving -e or --. + 1999-11-04 Gerd Moellmann + * simple.el (previous-matching-history-element) + (next-history-element): Use delete-field instead of erase-field. + + * isearch.el (isearch-ring-advance-edit, isearch-complete-edit): + Use delete-field instead of erase-field. + * faces.el (secondary-selection): Change background to yellow. * complete.el (PC-do-completion): Use minibuffer-prompt-end to diff --git a/lisp/gud.el b/lisp/gud.el index 036515176ae..2cddf1a3f53 100644 --- a/lisp/gud.el +++ b/lisp/gud.el @@ -1184,27 +1184,48 @@ directories if your program contains sources from more than one directory." ;;; History of argument lists passed to perldb. (defvar gud-perldb-history nil) +;; Convert a command line as would be typed normally to run a script +;; into one that invokes an Emacs-enabled debugging session. +;; "-d" in inserted as the first switch, and "-emacs" is inserted where +;; it will be $ARGV[0] (see perl5db.pl). (defun gud-perldb-massage-args (file args) - (let (new-args) + (let* ((new-args '("-d")) + (seen-e nil) + (shift (lambda () + (setq new-args (cons (car args) new-args)) + (setq args (cdr args))))) + ;; Pass all switches and -e scripts through. (while (and args - (string-match "^-[^-]" (car args))) - (setq new-args (cons (car args) new-args)) - (setq args (cdr args))) - - (if args - (progn - (setq new-args (cons (car args) new-args)) - (setq args (cdr args))) - (setq new-args (cons "--" new-args))) + (string-match "^-" (car args)) + (not (equal "-" (car args))) + (not (equal "--" (car args)))) + (when (equal "-e" (car args)) + ;; -e goes with the next arg, so shift one extra. + (or (funcall shift) + ;; -e as the last arg is an error in Perl. + (error "No code specified for -e.")) + (setq seen-e t)) + (funcall shift)) + + (when (not seen-e) + (if (or (not args) + (string-match "^-" (car args))) + (error "Can't use stdin as the script to debug.")) + ;; This is the program name. + (funcall shift)) + + ;; If -e specified, make sure there is a -- so -emacs is not taken + ;; as -e macs. + (if (and args (equal "--" (car args))) + (funcall shift) + (and seen-e (setq new-args (cons "--" new-args)))) (setq new-args (cons "-emacs" new-args)) - (while args - (setq new-args (cons (car args) new-args)) - (setq args (cdr args))) + (funcall shift)) - (cons "-d" (nreverse new-args)))) + (nreverse new-args))) ;; There's no guarantee that Emacs will hand the filter the entire ;; marker at once; it could be broken up across several strings. We