 ;;; Code:
 
 (if (< emacs-major-version 22)
-  (error
-   "This version of rdebug.el needs at least Emacs 22 or greater - you have version %d."
-   emacs-major-version))
+    (error
+     "This version of rdebug.el needs at least Emacs 22 or greater - you have version %d."
+     emacs-major-version))
 (require 'gud)
 
 
list of that and whether the annotate option was set. Initially
annotate should be set to nil."
  (let ((arg (pop args)))
     (cond 
      ((not arg) (list nil annotate-p))
      ((string-match "^--annotate=[1-9]" arg)
       (rdebug-get-script-name args t))
      ((equal "--annotate" arg)
       (rdebug-get-script-name (cdr args) t))
      ((equal "-A" arg)
       (rdebug-get-script-name (cdr args) t))
      ((member arg '("-h" "--host" "-p" "--port"
		    "-I", "--include" "-r" "--require"))
       (if args 
	   (rdebug-get-script-name (cdr args) annotate-p)
       ;else
	 (list nil annotate-p)))
      ((string-match "^-[a-zA-z]" arg) (rdebug-get-script-name args annotate-p))
      ((string-match "^--[a-zA-z]+" arg) (rdebug-get-script-name args annotate-p))
      ((string-match "^rdebug" arg) (rdebug-get-script-name args annotate-p))
     ; found script name (or nil
      (t (list arg annotate-p)))))

; From Emacs 23
(unless (fboundp 'split-string-and-unquote)
  (defun split-string-and-unquote (string &optional separator)
  "Split the STRING into a list of strings.
It understands Emacs Lisp quoting within STRING, such that
  (split-string-and-unquote (combine-and-quote-strings strs)) == strs
The SEPARATOR regexp defaults to \"\\s-+\"."
  (let ((sep (or separator "\\s-+"))
	(i (string-match "[\"]" string)))
    (if (null i)
	(split-string string sep t)	; no quoting:  easy
      (append (unless (eq i 0) (split-string (substring string 0 i) sep t))
	      (let ((rfs (read-from-string string i)))
		(cons (car rfs)
		      (split-string-and-unquote (substring string (cdr rfs))
						sep)))))))
)


(defun rdebug-set-window-configuration-state (state &optional dont-restore)

(defun rdebug--setup-breakpoints-buffer (buf comint-buffer)
  "Detects breakpoint lines and sets up keymap and mouse navigation."
  (rdebug-debug-enter "rdebug--setup-breakpoints-buffer"
    (with-current-buffer buf
      (let ((inhibit-read-only t) (flag))
        (rdebug-breakpoints-mode)
        (set (make-local-variable 'gud-comint-buffer) comint-buffer)
        (goto-char (point-min))
        (while (not (eobp))
          (let ((b (line-beginning-position)) (e (line-end-position)))
            (when (string-match rdebug--breakpoint-regexp
                                (buffer-substring b e))
              (add-text-properties b e
                                   (list 'mouse-face 'highlight
                                         'keymap rdebug-breakpoints-mode-map))
              (add-text-properties
               (+ b (match-beginning 1)) (+ b (match-end 1))
               (list 'face font-lock-constant-face
                     'font-lock-face font-lock-constant-face))
              (setq flag (char-after (+ b (match-beginning 2))))
              (add-text-properties
               (+ b (match-beginning 2)) (+ b (match-end 2))
               (if (eq flag ?y)
                   '(face font-lock-warning-face)
                 '(face font-lock-type-face)))
              (add-text-properties
               (+ b (match-beginning 3)) (+ b (match-end 3))
               (list 'face font-lock-comment-face
                     'font-lock-face font-lock-comment-face))
              (add-text-properties
               (+ b (match-beginning 4)) (+ b (match-end 4))
               (list 'face font-lock-constant-face
                     'font-lock-face font-lock-constant-face))
;;;             ;; fontify "keep/del"
;;;             (let ((face (if (string= "keep" (buffer-substring
;;;                                              (+ b (match-beginning 2))
