Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove ruby stuff

  • Loading branch information...
commit 6cf8ba157c59a4fc9add73ec95f389a98cc196fe 1 parent 5f3c99f
@tjake authored
Showing with 0 additions and 7,828 deletions.
  1. +0 −385 .emacs.d/lib/rdebug-mode/rdebug-annotate.el
  2. +0 −407 .emacs.d/lib/rdebug-mode/rdebug-breaks.el
  3. +0 −92 .emacs.d/lib/rdebug-mode/rdebug-cmd.el
  4. +0 −499 .emacs.d/lib/rdebug-mode/rdebug-core.el
  5. +0 −62 .emacs.d/lib/rdebug-mode/rdebug-dbg.el
  6. +0 −79 .emacs.d/lib/rdebug-mode/rdebug-error.el
  7. +0 −111 .emacs.d/lib/rdebug-mode/rdebug-fns.el
  8. +0 −230 .emacs.d/lib/rdebug-mode/rdebug-frames.el
  9. +0 −242 .emacs.d/lib/rdebug-mode/rdebug-gud.el
  10. +0 −104 .emacs.d/lib/rdebug-mode/rdebug-help.el
  11. +0 −83 .emacs.d/lib/rdebug-mode/rdebug-info.el
  12. +0 −180 .emacs.d/lib/rdebug-mode/rdebug-layouts.el
  13. +0 −118 .emacs.d/lib/rdebug-mode/rdebug-locring.el
  14. +0 −106 .emacs.d/lib/rdebug-mode/rdebug-output.el
  15. +0 −118 .emacs.d/lib/rdebug-mode/rdebug-regexp.el
  16. +0 −260 .emacs.d/lib/rdebug-mode/rdebug-secondary.el
  17. +0 −175 .emacs.d/lib/rdebug-mode/rdebug-shortkey.el
  18. +0 −568 .emacs.d/lib/rdebug-mode/rdebug-source.el
  19. +0 −392 .emacs.d/lib/rdebug-mode/rdebug-track.el
  20. +0 −150 .emacs.d/lib/rdebug-mode/rdebug-varbuf.el
  21. +0 −125 .emacs.d/lib/rdebug-mode/rdebug-vars.el
  22. +0 −132 .emacs.d/lib/rdebug-mode/rdebug-watch.el
  23. +0 −326 .emacs.d/lib/rdebug-mode/rdebug.el
  24. +0 −16 .emacs.d/lib/rinari-rhtml/DEPTREE
  25. +0 −16 .emacs.d/lib/rinari-rhtml/LICENSE
  26. +0 −10 .emacs.d/lib/rinari-rhtml/README
  27. +0 −321 .emacs.d/lib/rinari-rhtml/rhtml-erb.el
  28. +0 −177 .emacs.d/lib/rinari-rhtml/rhtml-fonts.el
  29. +0 −107 .emacs.d/lib/rinari-rhtml/rhtml-mode.el
  30. +0 −58 .emacs.d/lib/rinari-rhtml/rhtml-navigation.el
  31. +0 −93 .emacs.d/lib/rinari-rhtml/rhtml-ruby-hook.el
  32. +0 −522 .emacs.d/lib/rinari-rhtml/rhtml-sgml-hacks.el
  33. +0 −58 .emacs.d/lib/rinari-rhtml/test.rhtml
  34. +0 −200 .emacs.d/lib/ruby-electric.el
  35. +0 −1,204 .emacs.d/lib/ruby-mode.el
  36. +0 −102 .emacs.d/mode-ruby.el
View
385 .emacs.d/lib/rdebug-mode/rdebug-annotate.el
@@ -1,385 +0,0 @@
-;;; rdebug-annotate.el --- Ruby debugger output filtering - which
-;;; includes annotation handling.
-
-;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
-;; Copyright (C) 2008 Anders Lindgren
-
-;; $Id: rdebug-annotate.el 786 2008-04-02 00:50:27Z rockyb $
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; This file contains code dealing with filter of debugger output a large
-;; part of which may contain annotations.
-
-;;; Code:
-
-(require 'gud)
-(require 'gdb-ui)
-(require 'rdebug-dbg)
-(require 'rdebug-error)
-(require 'rdebug-fns)
-(require 'rdebug-info)
-(require 'rdebug-layouts)
-(require 'rdebug-locring)
-(require 'rdebug-regexp)
-(require 'rdebug-shortkey)
-(require 'rdebug-source)
-(require 'rdebug-vars)
-
-(defvar rdebug-non-annotated-text-kind nil
- "Represent what non-annotated text is.
-
-This can be:
- * nil -- plain shell output
- * :output -- output from the command being debugged
- * :info -- text for the \"info\" secondary window.
- * :message -- message the text to the echo area.
- * :cmd -- a command + result, which might go into the \"info\" window.
-
-See the function `rdebug-cmd-process' for details on :cmd.")
-
-(defvar rdebug-annotation-setup-map
- (progn
- (define-hash-table-test 'str-hash 'string= 'sxhash)
- (let ((map (make-hash-table :test 'str-hash)))
- (puthash "breakpoints" 'rdebug-setup-breakpoints-buffer map)
- ;;(puthash "error" 'rdebug-setup-error-buffer map)
- (puthash "frame" 'rdebug-setup-frame-buffer map)
- (puthash "variables" 'rdebug-setup-variables-buffer map)
- (puthash "watch" 'rdebug-setup-watch-buffer map)
- (puthash "output" 'rdebug-setup-output-buffer map)
- (puthash "info" 'rdebug-setup-info-buffer map)
- (puthash "help" 'rdebug-setup-secondary-window-help-buffer map)
- map)))
-
-(defun rdebug-temp-show (text)
- "Arrange to show string as in sort of temporary way. Perhaps like a tooltip"
- (tooltip-show text))
-
-(defun rdebug-marker-filter-next-item (string)
- "The next item for the rdebug marker filter to process.
-
-Return (item . rest) or nil."
- (rdebug-debug-message "ACC: %S" string)
- (cond
- ;; Empty line, we're done.
- ((equal (length string) 0)
- nil)
- ;; A single ^Z, this could become a new annotation, so lets stop here.
- ((string= string "\032")
- nil)
- ;; A half-baked annotation, lets stop here.
- ((and (string-match "^\032\032" string)
- (not (string-match "\n" string)))
- nil)
- (t
- (let ((split-point
- (cond ((string-match "\032\032" string)
- (let ((beg (match-beginning 0)))
- (if (equal beg 0)
- (if (string-match "^\032\032" string 2)
- (match-beginning 0)
- (length string))
- beg)))
- ((eq (elt string (- (length string) 1)) ?\32)
- -1)
- (t
- (length string)))))
- (cons (substring string 0 split-point) (substring string split-point))))))
-
-;; There's no guarantee that Emacs will hand the filter the entire
-;; marker at once; it could be broken up across several strings. We
-;; might even receive a big chunk with several markers in it. If we
-;; receive a chunk of text which looks like it might contain the
-;; beginning of a marker, we save it here between calls to the
-;; filter.
-(defun gud-rdebug-marker-filter (string)
- "Filter function for process output of the rdebug Ruby debugger."
- (rdebug-debug-enter "gud-rdebug-marker-filter:"
- (rdebug-debug-message "GOT: %S" string)
- (if rdebug-non-annotated-text-kind
- (rdebug-debug-message " Text is %S" rdebug-non-annotated-text-kind))
- (setq gud-marker-acc (concat gud-marker-acc string))
- (rdebug-debug-message "TOT: %S" gud-marker-acc)
- (let ((shell-output "") ; Output to debugger shell window.
- (done nil)
- item)
- ;; The following loop peels of one "item" at a time. An item is
- ;; a un-annotated section or an annotation. (This is taken care
- ;; of by the `rdebug-marker-filter-next-item' function.)
- ;;
- ;; An Annotation can be a one-liner (where anything following
- ;; the annotation is treated as un-annotated text) or a full
- ;; annotation (which stretches to the next annotation).
- ;;
- ;; The concept of one-liners (no phun intended) is to allow
- ;; continuous output, a "starting" annotation simply sets up the
- ;; environment for sending lines to the output window, any text
- ;; following it right now, or in later chunks of data, is
- ;; redirected to the output window.
- (while (and (not done)
- (let ((pair (rdebug-marker-filter-next-item gud-marker-acc)))
- (rdebug-debug-message "Next item: %S" pair)
- (and pair
- (progn
- (setq item (car pair))
- (setq gud-marker-acc (cdr pair))
- t))))
- ;; Note: Regexp:s are greedy, i.e. the char parts wins over
- ;; the .* part.
- (if (not (string-match "^\032\032\\([-a-z]*\\).*\n" item))
- ;; Non-annotated text (or the content of one-liners) goes
- ;; straight into the debugger shell window, or to the
- ;; output window.
- (cond ((and (eq rdebug-non-annotated-text-kind :output)
- rdebug-use-separate-io-buffer)
- (rdebug-process-annotation "starting" item))
- ((eq rdebug-non-annotated-text-kind :info)
- (rdebug-process-annotation "info" item))
- (t
- (if (eq rdebug-non-annotated-text-kind :cmd)
- (rdebug-cmd-process item))
- (setq shell-output (concat shell-output item))))
- ;; Handle annotation.
- (let* ((line-end (match-end 0))
- (name (match-string 1 item))
- ;; "prompt" is needed to handle "quit" in the shell correctly.
- (one-liner
- (member name
- '("" "exited" "source" "prompt" "starting")))
- (next-annotation (string-match "\032\032"
- gud-marker-acc)))
- ;; For one-liners, shuffle some text back to the accumulator.
- (when one-liner
- (setq gud-marker-acc (concat (substring item line-end)
- gud-marker-acc))
- (setq item (substring item 0 line-end)))
- (if (or next-annotation
- one-liner)
- ;; ok, annotation complete, process it and remove it
- (let* ((contents (substring item line-end))
- (old-kind rdebug-non-annotated-text-kind))
- (rdebug-debug-message "Name: %S Content: %S Kind: %S"
- name contents
- rdebug-non-annotated-text-kind)
-
- ;; This is a global state flag, this allows us to
- ;; redirect any further text to the output buffer.
- (set
- (make-local-variable 'rdebug-non-annotated-text-kind)
- (cond ((string= name "starting")
- :output)
- ((string= name "prompt")
- (rdebug-cmd-clear)
- :cmd)
- ((string= name "exited")
- ;; Create a fake command whose output we
- ;; handle in the cmd system. (We might not
- ;; receive all of the message at once, we we
- ;; need some kind of accumukator, which the
- ;; cmd system provides.)
- (setq rdebug-inferior-status "exited")
- (rdebug-cmd-clear)
- (setq rdebug-call-queue
- (cons '("***exited***" :message)
- rdebug-call-queue))
- :cmd)
- (t nil)))
-
- (when (and (eq old-kind :cmd)
- (not (eq rdebug-non-annotated-text-kind :cmd)))
- (rdebug-debug-message
- "New kind: %S" rdebug-non-annotated-text-kind)
- (rdebug-cmd-done))
-
- ;; Process the annotation.
- (cond ((string= name "starting")
- (setq rdebug-inferior-status "running"))
- ((string= name "stopped")
- (setq rdebug-inferior-status "stopped"))
- ((string= name "exited")
- (setq rdebug-inferior-status "exited"))
- ((string= name "pre-prompt")
- ;; Strip of the trailing \n (this is probably
- ;; a bug in processor.rb).
- (if (string= (substring contents -1) "\n")
- (setq contents (substring contents 0 -1)))
- (if (string-match "post-mortem" contents)
- (setq rdebug-inferior-status "crashed"))
- (setq shell-output (concat shell-output contents)))
- ((string= name "source")
- (if (string-match gud-rdebug-marker-regexp item)
- ;; Extract the frame position from the marker.
- (setq gud-last-frame
- (cons (match-string 1 item)
- (string-to-number
- (match-string 2 item))))))
- (t (rdebug-process-annotation name contents))))
- ;; This is not a one-liner, and we haven't seen the next
- ;; annotation, so we have to treat this as a partial
- ;; annotation. Save it and hope that the we can process
- ;; it the next time we're called.
- (setq gud-marker-acc (concat item gud-marker-acc))
- (setq done t)))))
-
- (when gud-last-frame
- ;; Display the source file where we want it, gud will only pick
- ;; an arbitrary window.
- (rdebug-pick-source-window)
- (rdebug-set-frame-arrow (gud-find-file (car gud-last-frame)))
- (if (equal 0 rdebug-frames-current-frame-number)
- (rdebug-locring-add gud-last-frame
- rdebug-source-location-ring)))
- (rdebug-short-key-mode-maybe-activate)
-
- (unless (string= shell-output "")
- (rdebug-debug-message "Output: %S" shell-output))
- (rdebug-debug-message "REM: %S" gud-marker-acc)
-
- shell-output)))
-
-(defun rdebug-process-annotation (name contents)
- "Called after `gud-rdebug-marker-filter' found a complete
-`name' annotation with string `contents'. Send it to the right
-place for processing."
- (rdebug-debug-enter (format "rdebug-process-annotation %s" name)
- ;; Ruby-debug uses the name "starting" for process output (just like
- ;; GDB). However, it's better to present the buffer as "output" to
- ;; the user. Ditto for "display" and "watch".
- (cond ((string= name "starting")
- (setq name "output"))
- ((string= name "display")
- (setq name "watch"))
- ((string= name "stack")
- (setq name "frame"))
- ((string= name "error-begin")
- (setq name "error")))
- ;; New "info"
- (if (string= name "exited")
- (setq name "info"))
- (if (string= name "error")
- (rdebug-errmsg contents))
- (let ((setup-func (gethash name rdebug-annotation-setup-map)))
- (when setup-func
- (let ((buf (rdebug-get-buffer name gud-target-name))
- ;; Buffer local, doesn't survive the buffer change.
- (comint-buffer gud-comint-buffer))
- (with-current-buffer buf
- (setq buffer-read-only t)
- (let ((inhibit-read-only t))
- (set (make-local-variable 'rdebug-current-line-number)
- (line-number-at-pos))
- (set (make-local-variable 'gud-last-frame) gud-last-frame)
- (if rdebug-accumulative-buffer
- (goto-char (point-max))
- (erase-buffer))
- (insert contents)
- (funcall setup-func buf comint-buffer))))))
- (cond ((and (string= name "info")
- (not (string= contents "")))
- (save-selected-window
- (rdebug-display-info-buffer))))))
-
-
-;; ------------------------------------------------------------
-;; Mode line displayer.
-;;
-
-;; The variable rdebug-mode-line-process uses this to generate the
-;; actual string to display.
-(defun rdebug-display-inferior-status ()
- "Return a (propertized) string, or nil, to be displayed in the mode line."
- (if (and gud-comint-buffer
- (buffer-name gud-comint-buffer)
- (get-buffer-process gud-comint-buffer)
- rdebug-inferior-status)
- (let ((s rdebug-inferior-status))
- (cond ((string= rdebug-inferior-status "running")
- (setq s (propertize s 'face font-lock-type-face)))
- (t
- (setq s (propertize s 'face font-lock-warning-face))))
- (concat ":" s))
- ;; No process, don't display anything.
- nil))
-
-;; ------------------------------------------------------------
-;; Command output parser.
-;;
-
-(defvar rdebug-cmd-acc ""
- "The accumulated output of the current command.
-
-Note, on some systems the external process echoes the command,
-which is included in the output.")
-
-;; Called when a new command starts.
-(defun rdebug-cmd-clear ()
- "Called when the Rdebug filter find the start of a new commands."
- (rdebug-debug-enter "rdebug-cmd-clear"
- (setq rdebug-cmd-acc "")))
-
-;; Called with command output, this can be called any number of times.
-(defun rdebug-cmd-process (s)
- "Called when the Rdebug filter find the command output.
-This may be called any number of times."
- (rdebug-debug-enter (format "rdebug-cmd-process %S" s)
- (setq rdebug-cmd-acc (concat rdebug-cmd-acc s))))
-
-;; Called when command has finished.
-(defun rdebug-cmd-done ()
- "Called when the Rdebug filter find the end of a commands."
- (rdebug-debug-enter "rdebug-cmd-done"
- ;; car-safe is used since rdebug-call-queue can be empty.
- (let ((entry (car-safe rdebug-call-queue))
- (text rdebug-cmd-acc))
- (when entry
- (rdebug-debug-message "Entry: %S Acc:%S" rdebug-call-queue rdebug-cmd-acc)
- (setq rdebug-call-queue (cdr rdebug-call-queue))
- (let ((saved-cmd (car entry))
- (options (cdr entry)))
- ;; In cast the external process echoed the actual command,
- ;; remove it.
- (when (and (>= (length text)
- (length saved-cmd))
- (string= saved-cmd (substring text 0 (length saved-cmd))))
- (setq text (substring text (+ 1 (length saved-cmd)))))
- (rdebug-debug-message "Text: %S" text)
- ;; Optionally display the result.
- (if (memq :tooltip options)
- (rdebug-temp-show text))
- (if (memq :info options)
- (rdebug-process-annotation "info" text))
- (when (memq :message options)
- ;; Remove trailing newlines (chomp).
- (while (and (> (length text) 0)
- (eq (elt text (- (length text) 1)) ?\n))
- (setq text (substring text 0 -1)))
- (message text)))))))
-
-
-;; -------------------------------------------------------------------
-;; The end.
-;;
-
-(provide 'rdebug-annotate)
-
-;;; Local variables:
-;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
-;;; End:
-
-;;; rdebug-annotate.el ends here
View
407 .emacs.d/lib/rdebug-mode/rdebug-breaks.el
@@ -1,407 +0,0 @@
-;;; rdebug-breaks.el --- This file contains code dealing with the Ruby
-;;; debugger's breakpoints and the breakpoint secondary buffer.
-
-;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
-;; Copyright (C) 2008 Anders Lindgren
-
-;; $Id: rdebug-breaks.el 780 2008-03-21 19:04:12Z rockyb $
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; This file contains code dealing with the breakpoints and the
-;; breakpoints secondary buffer.
-
-;;; Code:
-
-(require 'rdebug-dbg)
-(require 'rdebug-gud)
-(require 'rdebug-regexp)
-(require 'rdebug-secondary)
-(require 'rdebug-source)
-(require 'rdebug-vars)
-
-(defun rdebug-display-breakpoints-buffer ()
- "Display the rdebug breakpoints buffer."
- (interactive)
- (rdebug-display-secondary-buffer "breakpoints"))
-
-(defvar rdebug-breakpoint-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map [double-mouse-1] 'rdebug-goto-breakpoint-mouse)
- (define-key map [mouse-2] 'rdebug-goto-breakpoint-mouse)
- (define-key map [mouse-3] 'rdebug-goto-breakpoint-mouse)
- (define-key map "t" 'rdebug-toggle-breakpoint)
- (define-key map "i" 'rdebug-add-breakpoint-condition)
- (define-key map [insert] 'rdebug-add-breakpoint-condition)
- (rdebug-populate-digit-keys map)
- (define-key map [(control m)] 'rdebug-goto-breakpoint)
- (define-key map [?d] 'rdebug-delete-breakpoint)
- (rdebug-populate-secondary-buffer-map map)
-
- ;; --------------------
- ;; The "Breakpoints window" submenu.
- (let ((submenu (make-sparse-keymap)))
- (define-key-after map [menu-bar debugger breakpoints]
- (cons "Breakpoints window" submenu)
- 'placeholder))
-
- (define-key map [menu-bar debugger breakpoints toggle]
- '(menu-item "Toggle breakpoint" rdebug-toggle-breakpoint))
-
- (define-key map [menu-bar debugger breakpoints goto]
- '(menu-item "Goto breakpoint" rdebug-goto-breakpoint))
-
- (define-key map [menu-bar debugger breakpoints delete]
- '(menu-item "Delete breakpoint" rdebug-delete-breakpoint))
-
- map)
- "Keymap to navigate/set/enable rdebug breakpoints.")
-
-;; Here the "anchored match" method is used, see `font-lock-keywords'
-;; for details.
-(defvar rdebug-breakpoint-font-lock-keywords
- '(("\\([0-9]+\\) +\\(\\(n\\)\\|\\(y\\)\\) +at "
- (1 font-lock-constant-face)
- (3 font-lock-type-face nil t) ; t = ok if not present
- (4 font-lock-warning-face nil t) ; ditto.
- ;; File name and line
- ("\\(.*\\):\\([0-9]+\\)$"
- nil ; Preform (not used)
- nil ; Postfrom (not used)
- (1 font-lock-warning-face)
- (2 font-lock-constant-face))
- ;; Class:function
- ("\\(.*\\):\\([a-zA-Z_].+\\)$"
- nil ; Preform (not used)
- nil ; Postfrom (not used)
- (1 font-lock-type-face)
- (2 font-lock-function-name-face))))
- "Rules for coloring the rdebug breakpoints buffer.")
-
-(defun rdebug-breakpoint-mode ()
- "Major mode for displaying breakpoints in the `rdebug' Ruby debugger.
-
-\\{rdebug-breakpoint-mode-map}"
- (kill-all-local-variables)
- (setq major-mode 'rdebug-breakpoint-mode)
- (setq mode-name "RDEBUG Breakpoints")
- (use-local-map rdebug-breakpoint-mode-map)
- (setq buffer-read-only t)
- (set (make-local-variable 'rdebug-secondary-buffer) t)
- (setq mode-line-process 'rdebug-mode-line-process)
- (set (make-local-variable 'font-lock-defaults)
- '(rdebug-breakpoint-font-lock-keywords))
- (run-mode-hooks 'rdebug-breakpoint-mode-hook))
-
-
-(defun rdebug-setup-breakpoints-buffer (buf comint-buffer)
- "Detect breakpoint lines and set up keymap and mouse navigation.
-Argument BUF is the buffer to set up.
-Argument COMINT-BUFFER is the assocaited gud process buffer."
- (rdebug-debug-enter "rdebug-setup-breakpoints-buffer"
- (with-current-buffer buf
- (let ((inhibit-read-only t)
- (old-line-number (buffer-local-value 'rdebug-current-line-number
- buf)))
- (rdebug-breakpoint-mode)
- (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-breakpoint-mode-map)))
- (forward-line)))
- (goto-line old-line-number)))
- (rdebug-breakpoint-parse-and-update-cache)
- (rdebug-breakpoint-update-icons (rdebug-breakpoint-all))))
-
-
-(defvar rdebug-breakpoint-cache '()
- "The cached return value of `rdebug-breakpoint-all'.
-
-Buffer-local to the debugger shell window.")
-
-
-;; Implementation note: If Emacs could talk directly to the Ruby
-;; debugger, this would be roughly "Debugger.breakpoints". Since we
-;; currently can't do that we parse the content of the breakpoints
-;; window.
-;;
-;; Note: The :function kind is not yet implemented.
-(defun rdebug-breakpoint-parse-and-update-cache ()
- "Build up the return value of `rdebug-breakpoint-all'."
- (save-excursion
- (goto-char (point-min))
- (let ((res '()))
- (while (not (eobp))
- (when (looking-at rdebug-breakpoint-regexp)
- (push (list :file
- ;; Break point number
- (string-to-number (match-string 1))
- ;; Enabled
- (string= (match-string 2) "y")
- ;; File name
- (file-truename
- (match-string-no-properties 3))
- ;; Line number
- (string-to-number (match-string 4)))
- res))
- (forward-line 1))
- ;; The result goes into a buffer-local variable in the debugger
- ;; shell. (This ensures that this would work in a multi-session
- ;; environment.)
- (if gud-comint-buffer
- (with-current-buffer gud-comint-buffer
- (set (make-local-variable 'rdebug-breakpoint-cache)
- (nreverse res)))))))
-
-
-(defun rdebug-breakpoint-all ()
- "Return a list of all breakpoints.
-
-Each entry in the list is on the form:
-
- (:file number enabled file line)
-
-or
-
- (:function number enabled class function)"
- (and gud-comint-buffer
- (buffer-local-value 'rdebug-breakpoint-cache gud-comint-buffer)))
-
-
-(defun rdebug-file-and-line-arg ()
- "Return the current file and line number as a list."
- (save-excursion
- (beginning-of-line)
- (list (buffer-file-name) (+ 1 (count-lines (point-min) (point))))))
-
-(defun rdebug-breakpoint-on-line (file line)
- "Return a list of the breakpoints on the file FILE and current source LINE."
- (let ((res '()))
- (dolist (entry (rdebug-breakpoint-all))
- (if (and (eq (nth 0 entry) :file)
- (string= (nth 3 entry) file)
- (equal (nth 4 entry) line))
- (push entry res)))
- res))
-
-
-(defun rdebug-toggle-source-breakpoint (file line)
- "Toggle break point in FILE on current source LINE."
- (interactive (rdebug-file-and-line-arg))
- (cond ((eq major-mode 'rdebug-breakpoint-mode)
- (rdebug-delete-breakpoint))
- ((null file)
- ;; Do nothing.
- )
- (t
- (let ((bps (rdebug-breakpoint-on-line file line)))
- (if bps
- (gud-call (format "delete %s" (nth 1 (car bps))))
- (gud-call (format "break %s:%d" file line)))))))
-
-
-(defun rdebug-toggle-source-breakpoint-enabled (file line)
- "Enable or disable a breakpoint in FILE on the current source LINE."
- (interactive (rdebug-file-and-line-arg))
- (cond ((eq major-mode 'rdebug-breakpoint-mode)
- (rdebug-toggle-breakpoint))
- ((null file)
- ;; Do nothing.
- )
- (t
- (let ((bps (rdebug-breakpoint-on-line file line)))
- (if bps
- ;; Note: If the line contains more than one simply use the
- ;; first one.
- (let ((entry (car bps)))
- (if (nth 2 entry)
- (gud-call (format "disable %s" (nth 1 entry)))
- (gud-call (format "enable %s" (nth 1 entry)))))
- (gud-call (format "break %s:%d" file line)))))))
-
-
-;; ---------------------------------------------------------
-;; Commands of the rdebug breakpoints buffer.
-;;
-
-(defun rdebug-delete-breakpoint (&optional pt)
- "Deletes the breakpoint at PT in the breakpoints buffer."
- (interactive "d")
- (save-excursion
- (if pt
- (goto-char pt))
- (let ((s (buffer-substring (line-beginning-position) (line-end-position))))
- (when (string-match rdebug-breakpoint-regexp s)
- (let ((bpnum (substring s (match-beginning 1) (match-end 1))))
- (gud-call (format "delete %s" bpnum)))))))
-
-(defun rdebug-goto-breakpoint (pt)
- "Displays the location in a source file of the selected breakpoint.
-Argument PT indicates the file and line where the breakpoint should be set."
- (interactive "d")
- (save-excursion
- (goto-char pt)
- (let ((s (buffer-substring (line-beginning-position) (line-end-position))))
- (when (string-match rdebug-breakpoint-regexp s)
- (rdebug-display-line
- (substring s (match-beginning 3) (match-end 3))
- (string-to-number (substring s (match-beginning 4) (match-end 4))))
- ))))
-
-
-(defun rdebug-goto-breakpoint-mouse (event)
- "Displays the location in a source file of the selected breakpoint."
- (interactive "e")
- (with-current-buffer (window-buffer (posn-window (event-end event)))
- (rdebug-goto-breakpoint (posn-point (event-end event)))))
-
-
-(defun rdebug-get-breakpoint-number (pt)
- "Return the current breakpoint number in the breakpoint secondary window or nil if none found."
- (interactive "d")
- (save-excursion
- (goto-char pt)
- (let ((s (buffer-substring (line-beginning-position) (line-end-position))))
- (if (string-match rdebug-breakpoint-regexp s)
- (substring s (match-beginning 1) (match-end 1))
- nil))))
-
-(defun rdebug-toggle-breakpoint (&optional pt)
- "Toggle the breakpoint at PT in the breakpoints buffer."
- (interactive "d")
- (save-excursion
- (if pt
- (goto-char pt))
- (let ((s (buffer-substring (line-beginning-position) (line-end-position))))
- (when (string-match rdebug-breakpoint-regexp s)
- (let* ((enabled
- (string= (substring s (match-beginning 2) (match-end 2)) "y"))
- (cmd (if enabled "disable" "enable"))
- (bpnum (substring s (match-beginning 1) (match-end 1))))
- (gud-call (format "%s breakpoint %s" cmd bpnum)))))))
-
-(defun rdebug-add-breakpoint-condition (pt)
- "Add an expression as a condition to the break `rdebug' Ruby debugger."
- (interactive "d")
- (let ((bpnum (rdebug-get-breakpoint-number pt))
- (expr (read-string "Ruby expression for breakpoint condition: ")))
- (if bpnum
- (gud-call (format "condition %s %s" bpnum expr))
- (message "Breakpoint number not found"))))
-
-
-;; -----------------------------------------------
-;; Breakpoint icon support.
-;;
-
-;; This is a trivial implementation, it has the following shortcomings:
-;;
-;; * It assumes that the buffer content doesn't change, if it does it
-;; will not be able to remove the icon.
-;;
-;; * No support for displaying an icon in a newly opened file.
-;;
-;; * It has no support for more than one session.
-
-;; Note: This is implemented on top of `gdb-ui'. In the future, it
-;; would be better if that code is generalized.
-
-(require 'gdb-ui)
-
-;; This is a local variable, should not be placed in rdebug-vars.el.
-(defvar rdebug-breakpoint-icons-current-state nil)
-
-(defun rdebug-breakpoint-remove-icon (entry)
- "Remove the the source buffer the fringe breakpoint icon breakpoint ENTRY."
- (if (eq (nth 0 entry) :file)
- (let ((buf (find-buffer-visiting (nth 3 entry))))
- (if buf
- (save-current-buffer
- (set-buffer buf)
- (save-excursion
- (goto-line (nth 4 entry))
- (gdb-remove-breakpoint-icons (point) (point))))))))
-
-(defun rdebug-breakpoint-remove-all-icons ()
- "Remove all breakpoint fringe icons."
- (interactive)
- (dolist (entry rdebug-breakpoint-icons-current-state)
- (rdebug-breakpoint-remove-icon entry))
- (setq rdebug-breakpoint-icons-current-state nil))
-
-
-(defun rdebug-breakpoint-add-icon (entry)
- (if (eq (nth 0 entry) :file)
- (let ((buf (find-buffer-visiting (nth 3 entry))))
- (if buf
- (save-current-buffer
- (set-buffer buf)
- (save-excursion
- (goto-line (nth 4 entry))
- ;; Workaround for bug in `gdb-ui'. (It checks
- ;; `left-fringe-width' but it doesn't interpret the
- ;; `nil' value correctly.
- (let ((gdb-buffer-fringe-width (car (window-fringes))))
- (gdb-put-breakpoint-icon (nth 2 entry)
- (number-to-string (nth 1 entry))))))))))
-
-(defun rdebug-breakpoint-list-member (file line list)
- (let ((res nil))
- (dolist (entry list)
- (if (and (equal file (nth 3 entry))
- (equal line (nth 4 entry)))
- (setq res t)))
- res))
-
-;; bpts has the same representation as returned by `rdebug-breakpoint-all'.
-(defun rdebug-breakpoint-update-icons (bpts)
- ;; Make sure there are is only one reference for each line.
- (let ((state '()))
- ;; An enabled breakpoint take precedence.
- (dolist (enabled '(t nil))
- (dolist (bpt bpts)
- (if (and (eq (nth 0 bpt) :file)
- (eq (nth 2 bpt) enabled)
- (not (rdebug-breakpoint-list-member
- (nth 3 bpt) (nth 4 bpt) state)))
- (setq state (cons bpt state)))))
- (dolist (entry rdebug-breakpoint-icons-current-state)
- (unless (member entry state)
- (rdebug-breakpoint-remove-icon entry)))
- (dolist (entry state)
- (unless (member entry rdebug-breakpoint-icons-current-state)
- (rdebug-breakpoint-add-icon entry)))
- (setq rdebug-breakpoint-icons-current-state state)))
-
-;; -------------------------------------------------------------------
-;; The end.
-;;
-
-(provide 'rdebug-breaks)
-
-;;; Local variables:
-;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
-;;; End:
-
-(provide 'rdebug-breaks)
-
-;;; rdebug-breaks.el ends here
View
92 .emacs.d/lib/rdebug-mode/rdebug-cmd.el
@@ -1,92 +0,0 @@
-;;; rdebug-cmd.el --- Ruby debugger command buffer
-
-;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
-;; Copyright (C) 2008 Anders Lindgren
-
-;; $Id: rdebug-cmd.el 822 2008-04-27 08:28:29Z rockyb $
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; See the manual and the file `rdebug.el' for more information.
-
-;; This file contains code dealing primarily with the command buffer.
-
-;;; Code:
-
-(require 'ring)
-(require 'rdebug-locring)
-
-(defun rdebug-command-initialization ()
- "Initialization of command buffer common to `rdebug' and`rdebug-track-attach'."
-
- ;; This opens up "Gud" menu, which isn't used since we've got our
- ;; own "Debugger" menu.
- ;; (set (make-local-variable 'gud-minor-mode) 'rdebug)
-
- (set (make-local-variable 'rdebug-call-queue) '())
- (set (make-local-variable 'rdebug-original-read-only) buffer-read-only)
- (make-local-variable 'rdebug-source-location-ring-size) ; ...to global val.
- (set (make-local-variable 'rdebug-source-location-ring)
- (make-ring rdebug-source-location-ring-size))
- (make-local-variable 'rdebug-source-location-ring-index)
- (rdebug-locring-clear)
-
- (gud-def gud-args "info args" "a"
- "Show arguments of current stack frame.")
- (gud-def gud-break "break %d%f:%l""\C-b"
- "Set breakpoint at current line.")
- (gud-def gud-cont "continue" "\C-r"
- "Continue with display.")
- (gud-def gud-down "down %p" "<"
- "Down N stack frames (numeric arg).")
- (gud-def gud-finish "finish" "\C-f"
- "Finish executing current function.")
- (gud-def gud-source-resync "up 0" "\C-l"
- "Show current source window")
- (gud-def gud-remove "clear %d%f:%l" "\C-d"
- "Remove breakpoint at current line")
- (gud-def gud-quit "quit" "Q"
- "Quit debugger.")
-
- (gud-def gud-statement "eval %e" "\C-e"
- "Execute Ruby statement at point.")
- (gud-def gud-tbreak "tbreak %d%f:%l" "\C-t"
- "Set temporary breakpoint at current line.")
- (gud-def gud-up "up %p"
- ">" "Up N stack frames to a newer frame (numeric arg).")
- (gud-def gud-where "where"
- "T" "Show stack trace.")
-
- (local-set-key [M-insert] 'rdebug-internal-short-key-mode)
- (local-set-key [M-down] 'rdebug-locring-newer)
- (local-set-key [M-up] 'rdebug-locring-older)
- (local-set-key [M-S-down] 'rdebug-locring-newest)
- (local-set-key [M-S-up] 'rdebug-locring-oldest)
- ;; (local-set-key "\C-i" 'gud-gdb-complete-command)
- (local-set-key "\C-c\C-n" 'comint-next-prompt)
- (local-set-key "\C-c\C-p" 'comint-previous-prompt))
-
-;; stopping location motion routines.
-
-(provide 'rdebug-cmd)
-
-;;; Local variables:
-;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
-;;; End:
-
-;;; rdebug-cmd.el ends here
View
499 .emacs.d/lib/rdebug-mode/rdebug-core.el
@@ -1,499 +0,0 @@
-;;; rdebug-core.el --- Core parts of the Ruby debugger user
-;;; interface. It pulls in other parts of the debugger.
-
-;; Copyright (C) 2006, 2007, 2008 Rocky Bernstein (rocky@gnu.org)
-;; Copyright (C) 2007, 2008 Anders Lindgren
-
-;; $Id: rdebug-core.el 786 2008-04-02 00:50:27Z rockyb $
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; See the manual and the file `rdebug.el' for more information.
-
-;; This file implements the core of the debugger.
-
-;;; Code:
-
-;; -------------------------------------------------------------------
-;; Consistency checks.
-;;
-
-(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))
-
-
-;; -------------------------------------------------------------------
-;; Dependencies.
-;;
-
-(require 'gud)
-(require 'cl)
-
-(require 'rdebug)
-(require 'rdebug-annotate)
-(require 'rdebug-dbg)
-(require 'rdebug-cmd)
-(require 'rdebug-layouts)
-(require 'rdebug-source)
-(require 'rdebug-regexp)
-(require 'rdebug-vars)
-
-(defun rdebug-get-script-name (args)
- "Parse command line ARGS.
-
-A list containing the script name, and whether the annotate
-option was set is returned.
-
-Initially annotate should be set to nil. Argument ARGS contains
-a tokenized list of the command line."
- ;; Parse the following:
- ;;
- ;; [ruby ruby-options] rdebug rdebug-options script-name script-options
- (and args
- (let ((name nil)
- (annotate-p nil))
- ;; Strip of optional "ruby" or "ruby182" etc.
- (when (string-match "^ruby[0-9]*$"
- (file-name-sans-extension
- (file-name-nondirectory (car args))))
- (pop args)
- (while (and args
- (string-match "^-" (car args)))
- (if (member (car args) '("-e" "-r" "-I" "-C" "-F" "-K"))
- (pop args))
- (pop args)))
- ;; Remove "rdebug" from "rdebug --rdebug-options script
- ;; --script-options"
- (pop args)
- ;; Skip to the first non-option argument.
- (while (and args
- (not name))
- (let ((arg (pop args)))
- (cond
- ;; Annotation or emacs option with level number.
- ((or (member arg '("--annotate" "-A"))
- (equal arg "--emacs"))
- (setq annotate-p t)
- (pop args))
- ;; Combined annotation and level option.
- ((string-match "^--annotate=[0-9]" arg)
- (setq annotate-p t))
- ;; Options with arguments.
- ((member arg '("-h" "--host" "-p" "--port"
- "-I" "--include" "-r" "--require"))
- (pop args))
- ((string-match "^-" arg)
- nil)
- (t
- (setq name arg)))))
- (and name
- (list name annotate-p)))))
-
-;; -------------------------------------------------------------------
-;; Window configuration state support.
-;;
-
-(defun rdebug-set-window-configuration-state (state &optional dont-restore)
- "Change window configuration state.
-
-Two states are supported, `original' and `debugger'.
-
-When `dont-restore' is non-nil, the old window layout is not
-restored. This is used when a new layout is being drawn, for
-example when the debugger starts."
- (rdebug-debug-message "Setting state to %s (was %s)"
- state rdebug-window-configuration-state)
- (when (not (eq state rdebug-window-configuration-state))
- ;; Save the previous state.
- (cond ((not (eq rdebug-window-configuration-state 'original))
- (setq rdebug-debugger-window-configuration
- (current-window-configuration)))
- ((eq rdebug-window-configuration-state 'original)
- (setq rdebug-original-window-configuration
- (current-window-configuration))))
- (unless dont-restore
- ;; Switch to the saved state,
- (cond
- ((not (eq state 'original))
- (if rdebug-debugger-window-configuration
- (set-window-configuration rdebug-debugger-window-configuration)))
- ((eq state 'original)
- (if rdebug-original-window-configuration
- (set-window-configuration rdebug-original-window-configuration)))))
- (setq rdebug-window-configuration-state state)))
-
-
-;; have to bind rdebug-file-queue before installing the kill-emacs-hook
-(defvar rdebug-file-queue nil
- "Queue of Makefile temp files awaiting execution.
-Currently-active file is at the head of the list.")
-
-(defun rdebug-goto-traceback-line (pt)
- "Display the location PT in a source file of the Ruby traceback line."
- (interactive "d")
- (save-excursion
- (goto-char pt)
- (let ((s (buffer-substring (line-beginning-position) (line-end-position)))
- (gud-comint-buffer (current-buffer)))
- (when (string-match rdebug-traceback-line-re s)
- (rdebug-display-line
- (substring s (match-beginning 1) (match-end 1))
- (string-to-number (substring s (match-beginning 2) (match-end 2))))
- ))))
-
-(defun rdebug-goto-dollarbang-traceback-line (pt)
- "Display the location PT in a source file of the Ruby $! traceback line."
- (interactive "d")
- (save-excursion
- (goto-char pt)
- (let ((s (buffer-substring (line-beginning-position) (line-end-position)))
- (gud-comint-buffer (current-buffer)))
- (when (string-match rdebug-dollarbang-traceback-line-re s)
- (rdebug-display-line
- (substring s (match-beginning 1) (match-end 1))
- (string-to-number (substring s (match-beginning 2) (match-end 2))))
- ))))
-
-;; -------------------------------------------------------------------
-;; Secondary buffers.
-;;
-
-(require 'rdebug-secondary)
-(require 'rdebug-breaks)
-(require 'rdebug-frames)
-(require 'rdebug-help)
-(require 'rdebug-output)
-(require 'rdebug-varbuf)
-(require 'rdebug-watch)
-
-
-;; -------------------------------------------------------------------
-;; Windows.
-;;
-
-(defun rdebug-setup-windows (&optional erase)
- "Create the debugger user interface window layout.
-
-If ERASE is non-nil, the content of the windows are erased
-\(this does not apply to accumulative windows).
-
-This function displays the source file (or, in some cases, a
-buffer list) and creates the window layout. The variable
-`rdebug-window-layout-function' controls the function that is
-used to perform the actual layout.
-
-This is only used when `rdebug-many-windows' is non-nil."
- (rdebug-debug-enter "rdebug-setup-windows"
- (rdebug-set-window-configuration-state 'debugger t)
- (pop-to-buffer gud-comint-buffer)
- (maphash
- (lambda (name func)
- (if erase
- (let ((buf (rdebug-get-existing-buffer name gud-target-name)))
- (if buf
- (with-current-buffer buf
- (let ((inhibit-read-only t))
- (erase-buffer))))))
- (rdebug-process-annotation name ""))
- rdebug-annotation-setup-map)
- (let ((buf
- (cond (gud-last-last-frame
- (gud-find-file (car gud-last-last-frame)))
- (gud-target-name
- (gud-find-file gud-target-name)))))
- ;; Put a buffer in window if we can't find a source file.
- (unless buf (setq buf (get-buffer-create "*scratch*")))
- (funcall rdebug-window-layout-function buf gud-target-name))))
-
-
-(defun rdebug-setup-windows-initially ()
- "Like `rdebug-setup-windows', but erase the content of accumulative windows.
-This is called when the debugger starts."
- (rdebug-setup-windows t))
-
-
-(defun rdebug-restore-debugger-window-layout ()
- "Restore the initial ruby debugger window layout."
- (interactive)
- (when rdebug-many-windows
- (rdebug-setup-windows)))
-
-(defun rdebug-display-debugger-window-configuration ()
- "Switch from the \"original\" to the \"debugger\" window layout.
-
-The rdebug debugger remembers, and can switch between, two window layouts:
- * original -- the window layout when the debugger was started.
- * debugger -- the window layout of the debugger, plus all changes made
- since the debugger started.
-
-The check-marks in the \"Window Layout\" menu indicates the
-active window layout.
-
-The function `rdebug-display-original-window-configuration'
-switch to the \"original\" window configuration.
-
-The function `rdebug-restore-debugger-window-layout' restores the
-window layout to the state it was when the debugger started."
- (interactive)
- (rdebug-set-window-configuration-state 'debugger)
- (message
- "Type `M-x rdebug-display-original-window-configuration RET' to restore."))
-
-
-;;This function is called upon quitting the debugger and
-;;`rdebug-many-windows' is not nil. See also
-;;`rdebug-display-debugger-window-configuration'."
-
-(defun rdebug-display-original-window-configuration ()
- "Switch from the \"debugger\" to the \"original\" window layout.
-
-The rdebug debugger remembers, and can switch between, two window layouts:
- * original -- the window layout when the debugger was started.
- * debugger -- the window layout of the debugger, plus all changes made
- since the debugger started.
-
-The check-marks in the \"Window Layout\" menu indicates the
-active window layout.
-
-The function `rdebug-display-debugger-window-configuration'
-switch to the \"debugger\" window configuration."
- (interactive)
- (rdebug-set-window-configuration-state 'original)
- (message
- "Type `M-x rdebug-display-debugger-window-configuration RET' to restore."))
-
-
-;; -------------------------------------------------------------------
-;; The `rdebug' command and support functions.
-;;
-
-(defun rdebug-process-sentinel (process event)
- "Restore the original window configuration when the debugger process exits."
- (rdebug-debug-enter "rdebug-process-sentinel"
- (rdebug-debug-message "status=%S event=%S state=%S"
- (process-status process)
- event
- rdebug-window-configuration-state)
- (gud-sentinel process event)
- ;; This will "flush" the last annotation. Especially "output"
- ;; (a.k.a. "starting") annotations don't have an end markers, if
- ;; the last command printed something.
- (if (string= event "finished\n")
- (gud-rdebug-marker-filter "\032\032\n"))
- ;; When the debugger process exited, when the comint buffer has no
- ;; buffer process (nil). When the debugger processes is replaced
- ;; with another process we should not restore the window
- ;; configuration.
- (when (and (or (eq rdebug-restore-original-window-configuration t)
- (and (eq rdebug-restore-original-window-configuration :many)
- rdebug-many-windows))
- (or (rdebug-dead-process-p)
- (eq process (get-buffer-process gud-comint-buffer)))
- (eq rdebug-window-configuration-state 'debugger)
- (not (eq (process-status process) 'run)))
- (rdebug-internal-short-key-mode-off)
- (rdebug-set-window-configuration-state 'original)
- (rdebug-reset-keymaps))))
-
-
-;; Perform initializations common to all debuggers.
-;; The first arg is the specified command line,
-;; which starts with the program to debug.
-;; The other three args specify the values to use
-;; for local variables in the debugger buffer.
-(defun rdebug-common-init (rdebug-buffer-name rdebug-cmd-buffer target-name
- program args
- marker-filter
- &optional find-file)
- "Perform initializations common to all debuggers.
-
-RDEBUG-BUFFER-NAME is the specified command line, which starts
-with the program to debug. PROGRAM, ARGS and MARKER-FILTER
-specify the values to use for local variables in the debugger
-buffer."
- (if rdebug-cmd-buffer
- (progn
- (pop-to-buffer rdebug-cmd-buffer)
- (when (and rdebug-cmd-buffer (get-buffer-process rdebug-cmd-buffer))
- (error "This program is already being debugged"))
- (apply 'make-comint rdebug-buffer-name program nil args)
- (or (bolp) (newline)))
- (pop-to-buffer (setq rdebug-cmd-buffer
- (apply 'make-comint rdebug-buffer-name program nil
- args))))
-
- ;; Since comint clobbered the mode, we don't set it until now.
- (gud-mode)
- (set (make-local-variable 'gud-target-name) target-name)
- (set (make-local-variable 'gud-marker-filter) marker-filter)
- (set (make-local-variable 'gud-minor-mode) 'rdebug)
- (set (make-local-variable 'gud-last-frame) nil)
- (set (make-local-variable 'gud-last-last-frame) nil)
-
- (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter)
- (set-process-sentinel (get-buffer-process (current-buffer)) 'gud-sentinel)
- (gud-set-buffer))
-
-;;;###autoload
-(defun rdebug (command-line)
- "Invoke the rdebug Ruby debugger and start the Emacs user interface.
-
-String COMMAND-LINE specifies how to run rdebug.
-
-By default, the \"standard\" user window layout looks like the following:
-
-+----------------------------------------------------------------------+
-| Toolbar |
-+-----------------------------------+----------------------------------+
-| Debugger shell | Variables buffer |
-+-----------------------------------+----------------------------------+
-| | |
-| Source buffer | Output buffer |
-| | |
-+-----------------------------------+----------------------------------+
-| Stack Frame buffer | Breakpoints buffer |
-+-----------------------------------+----------------------------------+
-
-The variable `rdebug-window-layout-function' can be
-customized so that another layout is used. In addition to a
-number of predefined layouts it's possible to define a function
-to perform a custom layout.
-
-If `rdebug-many-windows' is nil, only a traditional debugger
-shell and source window is opened.
-
-The directory containing the debugged script becomes the initial
-working directory and source-file directory for your debugger.
-
-The custom variable `gud-rdebug-command-name' sets the command
-and options used to invoke rdebug."
- (interactive
- (let ((init (buffer-file-name)))
- (setq init (and init
- (file-name-nondirectory init)))
- (list (gud-query-cmdline 'rdebug init))))
- (rdebug-debug-enter "rdebug"
- (rdebug-set-window-configuration-state 'debugger t)
- ;; Parse the command line and pick out the script name and whether
- ;; --annotate has been set.
- (let* ((words (with-no-warnings
- (split-string-and-unquote command-line)))
- (script-name-annotate-p (rdebug-get-script-name
- (gud-rdebug-massage-args "1" words)))
- (target-name (file-name-nondirectory (car script-name-annotate-p)))
- (annotate-p (cadr script-name-annotate-p))
- (cmd-buffer-name (format "rdebug-cmd-%s" target-name))
- (rdebug-cmd-buffer-name (format "*%s*" cmd-buffer-name))
- (rdebug-cmd-buffer (get-buffer rdebug-cmd-buffer-name))
- (program (car words))
- (args (cdr words))
- (gud-chdir-before-run nil))
-
- ;; `gud-rdebug-massage-args' needs whole `command-line'.
- ;; command-line is refered through dynamic scope.
- (rdebug-common-init cmd-buffer-name rdebug-cmd-buffer target-name
- program args
- 'gud-rdebug-marker-filter
- 'gud-rdebug-find-file)
- (setq comint-process-echoes t)
-
- (setq rdebug-inferior-status "running")
-
- (rdebug-command-initialization)
-
- ;; Setup exit callback so that the original frame configuration
- ;; can be restored.
- (let ((process (get-buffer-process gud-comint-buffer)))
- (when process
- (unless (equal rdebug-line-width 120)
- (gud-call (format "set width %d" rdebug-line-width)))
- (set-process-sentinel process
- 'rdebug-process-sentinel)))
-
-
- ;; Add the buffer-displaying commands to the Gud buffer,
- ;; FIXME: combine with code in rdebug-track.el; make common
- ;; command buffer mode map.
- (let ((prefix-map (make-sparse-keymap)))
- (define-key (current-local-map) gud-key-prefix prefix-map)
- (define-key prefix-map "t" 'rdebug-goto-traceback-line)
- (define-key prefix-map "!" 'rdebug-goto-dollarbang-traceback-line)
- (rdebug-populate-secondary-buffer-map-plain prefix-map))
-
- (rdebug-populate-common-keys (current-local-map))
- (rdebug-populate-debugger-menu (current-local-map))
-
- (setq comint-prompt-regexp (concat "^" rdebug-input-prompt-regexp))
- (setq paragraph-start comint-prompt-regexp)
-
- (setcdr (assq 'rdebug-debugger-support-minor-mode minor-mode-map-alist)
- rdebug-debugger-support-minor-mode-map-when-active)
- (when rdebug-many-windows
- (rdebug-setup-windows-initially))
-
- (run-hooks 'rdebug-mode-hook))))
-
-
-(defadvice gud-reset (before rdebug-reset)
- "Rdebug cleanup - remove debugger's internal buffers (frame, breakpoints, etc.)."
- (rdebug-breakpoint-remove-all-icons)
- (dolist (buffer (buffer-list))
- (when (string-match "\\*rdebug-[a-z]+\\*" (buffer-name buffer))
- (let ((w (get-buffer-window buffer)))
- (when w
- (delete-window w)))
- (kill-buffer buffer))))
-(ad-activate 'gud-reset)
-
-(defun rdebug-reset ()
- "Rdebug cleanup - remove debugger's internal buffers (frame, breakpoints, etc.)."
- (interactive)
- (rdebug-breakpoint-remove-all-icons)
- (dolist (buffer (buffer-list))
- (when (string-match "\\*rdebug-[a-z]+\\*" (buffer-name buffer))
- (let ((w (get-buffer-window buffer)))
- (when w
- (delete-window w)))
- (kill-buffer buffer))))
-
-(defun rdebug-reset-keymaps()
- "This unbinds the special debugger keys of the source buffers."
- (interactive)
- (setcdr (assq 'rdebug-debugger-support-minor-mode minor-mode-map-alist)
- rdebug-debugger-support-minor-mode-map-when-deactive))
-
-
-(defun rdebug-customize ()
- "Use `customize' to edit the settings of the `rdebug' debugger."
- (interactive)
- (customize-group 'rdebug))
-
-
-;; -------------------------------------------------------------------
-;; The end.
-;;
-
-(provide 'rdebug-core)
-
-;;; Local variables:
-;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
-;;; End:
-
-;;; rdebug-core.el ends here
View
62 .emacs.d/lib/rdebug-mode/rdebug-dbg.el
@@ -1,62 +0,0 @@
-;;; rdebug-dbg.el --- Ruby debugger frames buffer
-
-;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
-;; Copyright (C) 2008 Anders Lindgren
-
-;; $Id: rdebug-dbg.el 702 2008-02-17 22:00:36Z rockyb $
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; See the manual and the file `rdebug.el' for more information.
-
-;; This file contains internal debug trace support.
-
-;;; Code:
-
-(require 'rdebug-vars)
-
-(defun rdebug-debug-message (&rest args)
- (if rdebug-debug-active
- (let ((buf (get-buffer-create "*Xrdebug*")))
- (with-current-buffer buf
- (save-excursion
- (goto-char (point-max))
- ;; 32 = space.
- (insert (make-string (* 4 rdebug-debug-depth) 32))
- (insert (apply #'format args))
- (insert "\n"))))))
-
-
-(defmacro rdebug-debug-enter (str &rest body)
- (declare (indent 1) (debug t))
- `(progn
- (rdebug-debug-message "--> %s" ,str)
- (setq rdebug-debug-depth (+ rdebug-debug-depth 1))
- (unwind-protect
- (progn
- ,@body)
- (setq rdebug-debug-depth (max 0 (- rdebug-debug-depth 1)))
- (rdebug-debug-message "<-- %s" ,str))))
-
-(provide 'rdebug-dbg)
-
-;;; Local variables:
-;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
-;;; End:
-
-;;; rdebug-dbg.el ends here
View
79 .emacs.d/lib/rdebug-mode/rdebug-error.el
@@ -1,79 +0,0 @@
-;;; rdebug-error.el --- Ruby debugger error buffer
-
-;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
-;; Copyright (C) 2008 Anders Lindgren
-
-;; $Id: rdebug-error.el 713 2008-02-21 02:56:48Z rockyb $
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; See the manual and the file `rdebug.el' for more information.
-
-;; This file contains code dealing with the error secondary buffer.
-
-;;; Code:
-
-(require 'rdebug-dbg)
-(require 'rdebug-fns)
-(require 'rdebug-secondary)
-(require 'rdebug-source)
-
-(defun rdebug-display-error-buffer ()
- "Display the rdebug error buffer."
- (interactive)
- (rdebug-display-secondary-buffer "error"))
-
-(defvar rdebug-error-mode-map
- (let ((map (make-sparse-keymap)))
- (rdebug-populate-secondary-buffer-map map)
- map)
- "Keymap used in the error buffer in the `rdebug' Ruby debugger.")
-
-(defun rdebug-error-mode ()
- "Major mode for displaying the script error in the `rdebug' Ruby debugger.
-
-\\{rdebug-error-mode}"
- (interactive)
- (kill-all-local-variables)
- (setq major-mode 'rdebug-error-mode)
- (setq mode-name "RDEBUG Error")
- (setq buffer-read-only t)
- (set (make-local-variable 'rdebug-secondary-buffer) t)
- (setq mode-line-process 'rdebug-mode-line-process)
- (use-local-map rdebug-error-mode-map)
- (run-mode-hooks 'rdebug-error-mode-hook))
-
-(defun rebug-setup-error-buffer (buf comint-buffer)
- (rdebug-debug-enter "rebug-setup-error-buffer"
- (with-current-buffer buf
- (rdebug-error-mode)
- (set (make-local-variable 'gud-comint-buffer) comint-buffer))))
-
-(defun rdebug-errmsg (msg)
-;;; (with-current-buffer (rdebug-get-buffer "error" gud-target-name)
-;;; (goto-char (point-max))
-;;; (insert msg))
- (message (chomp msg)))
-
-(provide 'rdebug-error)
-
-;;; Local variables:
-;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
-;;; End:
-
-;;; rdebug-error.el ends here
View
111 .emacs.d/lib/rdebug-mode/rdebug-fns.el
@@ -1,111 +0,0 @@
-;;; rdebug-fns.el --- Ruby debugger miscellaneous functions
-
-;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
-;; Copyright (C) 2008 Anders Lindgren
-
-;; $Id: rdebug-frames.el 711 2008-02-20 07:09:17Z andersl $
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; See the manual and the file `rdebug.el' for more information.
-
-;; This file contains code dealing with the frames secondary buffer.
-
-;;; Code:
-
-(require 'gud)
-(require 'rdebug-vars)
-
-(defun chomp(string &optional multiple)
- "Remove trailing \n if it's there"
- (if multiple
- (progn
- (while (and (> (length string) 0)
- (eq (elt string (- (length string) 1)) ?\n))
- (setq string (substring string 0 -1)))
- string)
- (if (> (length string) 0)
- (let ((s string))
- (if (string= "\n" (substring s -1))
- (substring s 0 -1)
- s))
- "")))
-
-(defun rdebug-dead-process-p ()
- "Return true if the rdebug comint-process is dead or exited."
- ;; FIXME? Use a variable in gud-comint-buffer's status?
- (or (not gud-comint-buffer)
- (null (get-buffer-process gud-comint-buffer))
- (not (member (process-status gud-comint-buffer) '(run open)))))
-
-(defun rdebug-get-secondary-buffer-name (name)
- "Get the rdebug NAME secondary buffer. If none found return nil."
- (let ((target-name
- (or (and gud-comint-buffer
- (buffer-local-value 'gud-target-name
- gud-comint-buffer))
- gud-target-name)))
- (cond ((and (string= "cmd" name) gud-comint-buffer)
- (buffer-name gud-comint-buffer))
- (t (format "*rdebug-%s-%s*" name target-name)))))
-
-(defun rdebug-set-frame-top-arrow (buf)
- "Set the fringe arrow in BUF to indicate the top frame."
- (with-current-buffer buf
- (setq fringe-indicator-alist
- '((overlay-arrow . right-triangle)))))
-
-(defun rdebug-set-frame-not-top-arrow (buf)
- "Set the fringe arrow in BUF to indicate a frame other than the top frame."
- (with-current-buffer buf
- (setq fringe-indicator-alist
- '((overlay-arrow . hollow-right-triangle)))))
-
-(defun rdebug-set-frame-arrow (buf)
- "Set the fringe arrow in buffer BUF."
- (if (equal 0 rdebug-frames-current-frame-number)
- (rdebug-set-frame-top-arrow buf)
- (rdebug-set-frame-not-top-arrow buf)))
-
-;; 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)
- (with-no-warnings
- (split-string-and-unquote (substring string (cdr rfs))
- sep))))))))
- )
-
-
-(provide 'rdebug-fns)
-
-;;; Local variables:
-;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
-;;; End:
-
-;;; rdebug-fns.el ends here
View
230 .emacs.d/lib/rdebug-mode/rdebug-frames.el
@@ -1,230 +0,0 @@
-;;; rdebug-frames.el --- Ruby debugger frames buffer
-
-;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
-;; Copyright (C) 2008 Anders Lindgren
-
-;; $Id: rdebug-frames.el 735 2008-02-29 15:24:51Z rockyb $
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; See the manual and the file `rdebug.el' for more information.
-
-;; This file contains code dealing with the frames secondary buffer.
-
-;;; Code:
-
-(require 'rdebug-dbg)
-(require 'rdebug-fns)
-(require 'rdebug-regexp)
-(require 'rdebug-secondary)
-(require 'rdebug-source)
-
-(defun rdebug-display-frame-buffer ()
- "Display the rdebug stack-frame buffer."
- (interactive)
- (rdebug-display-secondary-buffer "frame"))
-
-(defvar rdebug-frames-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map [double-mouse-1] 'rdebug-goto-frame-mouse)
- (define-key map [mouse-2] 'rdebug-goto-frame-mouse)
- (define-key map [mouse-3] 'rdebug-goto-frame-mouse)
- (define-key map [(control m)] 'rdebug-goto-frame)
- (define-key map "0" 'rdebug-goto-frame-n)
- (define-key map "1" 'rdebug-goto-frame-n)
- (define-key map "2" 'rdebug-goto-frame-n)
- (define-key map "3" 'rdebug-goto-frame-n)
- (define-key map "4" 'rdebug-goto-frame-n)
- (define-key map "5" 'rdebug-goto-frame-n)
- (define-key map "6" 'rdebug-goto-frame-n)
- (define-key map "7" 'rdebug-goto-frame-n)
- (define-key map "8" 'rdebug-goto-frame-n)
- (define-key map "9" 'rdebug-goto-frame-n)
- (rdebug-populate-secondary-buffer-map map)
-
- ;; --------------------
- ;; The "Stack window" submenu.
- (let ((submenu (make-sparse-keymap)))
- (define-key-after map [menu-bar debugger stack]
- (cons "Stack window" submenu)
- 'placeholder))
-
- (define-key map [menu-bar debugger stack goto]
- '(menu-item "Goto frame" rdebug-goto-frame))
- map)
- "Keymap to navigate rdebug stack frames.")
-
-(defun rdebug-goto-frame (pt)
- "Show the rdebug stack frame corresponding at PT in the rdebug stack buffer."
- (interactive "d")
- (save-excursion
- (goto-char pt)
- (let ((s (concat "-->" (buffer-substring (line-beginning-position)
- (line-end-position))))
- (s2 (if (= (line-number-at-pos (line-end-position 2))
- (line-number-at-pos (point-max)))
- nil
- ;;else
- (buffer-substring (line-beginning-position 2)
- (line-end-position 2)))))
- (when (or (string-match rdebug-stack-frame-regexp s)
- ;; need to match 1st line last to get the match position right
- (and s2 (string-match rdebug-stack-frame-2nd-regexp s2)
- (string-match rdebug-stack-frame-1st-regexp s)))
- (let ((frame (substring s (match-beginning 2) (match-end 2))))
- (gud-call (concat "frame " frame)))))))
-
-(defun rdebug-goto-frame-mouse (event)
- "Show the rdebug stack frame under the mouse in the rdebug stack buffer."
- (interactive "e")
- (with-current-buffer (window-buffer (posn-window (event-end event)))
- (rdebug-goto-frame (posn-point (event-end event)))))
-
-;; The following is split in two to facilitate debugging.
-(defun rdebug-goto-frame-n-internal (keys)
- (if (and (stringp keys)
- (= (length keys) 1))
- (progn
- (setq rdebug-goto-entry-acc (concat rdebug-goto-entry-acc keys))
- ;; Try to find the longest suffix.
- (let ((acc rdebug-goto-entry-acc))
- (while (not (string= acc ""))
- (if (not (rdebug-goto-entry-try acc))
- (setq acc (substring acc 1))
- (gud-call (format "frame %s" acc))
- ;; Break loop.
- (setq acc "")))))
- (message "`rdebug-goto-frame-n' must be bound to a number key")))
-
-(defun rdebug-goto-frame-n ()
- "Go to the frame number indicated by the accumulated numeric keys just entered.
-
-This function is usually bound to a numeric key in a 'frame'
-secondary buffer. To go to an entry above 9, just keep entering
-the number. For example, if you press 1 and then 9, frame 1 is selected
-\(if it exists) and then frame 19 (if that exists). Entering any
-non-digit will start entry number from the beginning again."
- (interactive)
- (if (not (eq last-command 'rdebug-goto-frame-n))
- (setq rdebug-goto-entry-acc ""))
- (rdebug-goto-frame-n-internal (this-command-keys)))
-
-(defun rdebug-frames-match-current-line (limit)
- (and rdebug-frames-current-frame-number
- (re-search-forward
- (concat "^ *#"
- (number-to-string rdebug-frames-current-frame-number)
- ;; At least one space (so that we don't match #1 when looking for #10).
- " +"
- ;; The entire line.
- ".*"
- "\n"
- ;; And the next, if this entry was split into two.
- "\\( *[^# ].*$\\)?") limit t)))
-
-(defvar rdebug-frames-current-frame-face 'highlight)
-
-;; Example of frame buffer content:
-;;
-;; #0 Integer.under_cover at line test.rb:13
-;; #1 ClassA::Nested::DeepDown.under_cover(p#ClassA::Nested::DeepD...)
-;; at line test.rb:12
-;; #2 Object.sune(s#String, i#Fixnum) at line test.rb:24
-;; #3 at line test.rb:27
-
-(defvar rdebug-frames-font-lock-keywords
- '(
- ;; Parameters and first type entry.
- ("\\<\\([a-zA-Z_][a-zA-Z0-9_]*\\)#\\([a-zA-Z_][a-zA-Z0-9_]*\\)\\>"
- (1 font-lock-variable-name-face)
- (2 font-lock-type-face))
- ;; "::Type", which occurs in class name of function and in parameter list.
- ("::\\([a-zA-Z_][a-zA-Z0-9_]*\\)"
- (1 font-lock-type-face))
- ;; The frame number and first type name, if present.
- ("^ *#\\([0-9]+\\) *\\(\\([a-zA-Z_][a-zA-Z0-9_]*\\)[.:]\\)?"
- (1 font-lock-constant-face)
- (3 font-lock-type-face nil t)) ; t means optional.
- ;; File name and line number.
- ("at line \\(.*\\):\\([0-9]+\\)$"
- (1 font-lock-warning-face)
- (2 font-lock-constant-face))
- ;; Function name.
- ("\\<\\([a-zA-Z_][a-zA-Z0-9_]*\\)\\.\\([a-zA-Z_][a-zA-Z0-9_]*\\)"
- (1 font-lock-type-face)
- (2 font-lock-function-name-face))
- (rdebug-frames-match-current-line
- (0 rdebug-frames-current-frame-face append)))
- "Font-lock rules for the stack frame window in `rdebug'.")
-
-(defun rdebug-frames-mode ()
- "Major mode for displaying the stack trace in the `rdebug' Ruby debugger.
-\\{rdebug-frames-mode-map}"
- (interactive)
- (kill-all-local-variables)
- (setq major-mode 'rdebug-frames-mode)
- (setq mode-name "RDEBUG Stack Frames")
- (set (make-local-variable 'rdebug-secondary-buffer) t)
- (setq mode-line-process 'rdebug-mode-line-process)
- (use-local-map rdebug-frames-mode-map)
- (set (make-local-variable 'font-lock-defaults)
- '(rdebug-frames-font-lock-keywords))
- (run-mode-hooks 'rdebug-frames-mode-hook))
-
-;; Note: This function can't restore the original point alone, since
-;; the point is already at the end of the buffer when this is called.
-(defun rdebug-setup-frame-buffer (buf comint-buffer)
- "Find the current frame and display the corresponding source line.
-
-Also, cleans the buffer somewhat and sets up help for the font-lock rules."
- (rdebug-debug-enter "rdebug-setup-stack-buffer"
- (with-current-buffer buf
- (let ((inhibit-read-only t)
- (current-frame-number 0))
- (rdebug-frames-mode)
- (set (make-local-variable 'gud-comint-buffer) comint-buffer)
- (goto-char (point-min))
- (when (re-search-forward "-->" nil t)
- (beginning-of-line)
- (setq overlay-arrow-position (make-marker))
- (set-marker overlay-arrow-position (point))
- (when (looking-at rdebug-stack-frame-1st-regexp)
- (setq current-frame-number
- (string-to-number
- (match-string rdebug-stack-frame-number-group)))
- (set (make-local-variable 'rdebug-frames-current-frame-number)
- current-frame-number)
- (with-current-buffer comint-buffer
- (setq rdebug-frames-current-frame-number current-frame-number))
- (when gud-last-frame
- (rdebug-set-frame-arrow (gud-find-file (car gud-last-frame))))
- (rdebug-set-frame-arrow buf)))
- ;; Remove initial ' ' or '-->'.
- (save-excursion
- (goto-char (point-max))
- (beginning-of-line)
- (if (> (point) 4)
- (delete-rectangle 4 (point))))))))
-
-(provide 'rdebug-frames)
-
-;;; Local variables:
-;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
-;;; End:
-
-;;; rdebug-frames.el ends here
View
242 .emacs.d/lib/rdebug-mode/rdebug-gud.el
@@ -1,242 +0,0 @@
-;;; rdebug-gud.el --- rdebug interface to gud.
-
-;; Copyright (C) 2007, 2008 Rocky Bernstein (rocky@gnu.org)
-;; Copyright (C) 2007, 2008 Anders Lindgren
-
-;; $Id: rdebug-gud.el 821 2008-04-25 02:54:44Z rockyb $
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; See the manual and the file `rdebug.el' for more information.
-
-;; This file contains rdebug Emacs routines which interface with gud.
-
-;;; Code:
-
-;; -------------------------------------------------------------------
-;; Dependencies.
-;;
-
-(require 'gud)
-(require 'rdebug-error)
-(require 'rdebug-fns)
-(require 'rdebug-regexp)
-(require 'rdebug-vars)
-
-
-(defun gud-rdebug-massage-args (file args)
- "Change FILE and list ARGS before running the debugger.
-
-gud requires this routine to be defined."
- args)
-
-
-(defun gud-rdebug-find-file (file)
- "`rdebug' and `gud' call this with FILE when they encounter a Ruby program file."
-
- (find-file-noselect file 'nowarn))
-
-(defun rdebug-display-line (file line &optional move-arrow)
- "Arrange for marker to appear in at FILE and LINE.
-The line marker might appear in the Emacs fringe or as an overlay arroe.
-Optional argument MOVE-ARROW indicates whether to move any previous indicator."
- (if file
- (let ((oldpos (and gud-overlay-arrow-position
- (marker-position gud-overlay-arrow-position)))
- (oldbuf (and gud-overlay-arrow-position
- (marker-buffer gud-overlay-arrow-position))))
- (gud-display-line file line)
- (unless move-arrow
- (when gud-overlay-arrow-position
- (set-marker gud-overlay-arrow-position oldpos oldbuf))))))
-
-(defun rdebug-stepping (step-or-next &optional arg)
- (or arg (setq arg 1))
- ;;(if (not (member '('rdebug-next 'rdebug-step 'digit-argument) last-command))
- ;; (setq rdebug-stepping-prefix ""))
- (unless (member rdebug-stepping-prefix '("" "+" "-"))
- (setq rdebug-stepping-prefix ""))
- (rdebug-call (format "%s%s %d" step-or-next rdebug-stepping-prefix arg)))
-
-
-
-;; -------------------------------------------------------------------
-;; Rdebug commands.
-;;
-
-(defun rdebug-call (cmd)
- "Run a debugger command with some error checking."
- (if (rdebug-dead-process-p)
- (rdebug-errmsg
- "Can't find a live debugger process buffer to feed the command to.")
- (gud-call cmd)))
-
-(defun rdebug-call-return (cmd &rest options)
- "Register a debugger command whose output should be handled specially.
-
-OPTIONS is zero or more indicators what should happen with the
-output. The following are supported:
- * :tooltip -- Show the result in a tool-tip.
- * :info -- Show the result in the info secondary buffer."
- (if (rdebug-dead-process-p)
- (rdebug-errmsg
- "Can't find a live debugger process buffer to feed the command to.")
- (with-current-buffer gud-comint-buffer
- (setq rdebug-call-queue
- (append rdebug-call-queue (list (cons cmd options))))
- (gud-call cmd))))
-
-(defun rdebug-continue (&optional arg)
- "Run a debugger \"continue\" command.
-
-With a numeric ARG, continue to that line number of the current file."
- (interactive "p")
- (if arg
- (rdebug-call (format "continue %d" arg))
- (rdebug-call (format "continue"))))
-
-
-(defun rdebug-next (&optional arg)
- "Run a debugger \"next\" command, respecting `rdebug-stepping-prefix'.
-
-With a numeric ARG, continue to that line number of the current file."
- (interactive "p")
- (rdebug-stepping "next" arg))
-
-(defvar rdebug-stepping-prefix ""
- "The kind of stepping modifier that is desired.
-
-This variable will have a string value which is either \"\",
-\"+\", or \"-\"; this string is be appended to the debugger
-stepping commands (\"next\", or \"step\").")
-
-(defun rdebug-print-cmd (expr &optional cmd)
- "Run a debugger print (pl, ps, pp, p) command on `EXPR'; `CMD' is the command to run."
- (interactive "s")
- (unless cmd (setq cmd "pp"))
- (rdebug-call-return (format "%s %s " cmd expr) :tooltip))
-
-(defun rdebug-print-list-region (from to)
- "Run a debugger \"pl\" command on the marked region."
- (interactive "r")
- (if (> from to)
- (let ((tem to))
- (setq to from from tem)))
- (rdebug-print-cmd (buffer-substring from to) "pl"))
-
-(defun rdebug-print-region (from to)
- "Run a debugger \"p\" command on the marked region."
- (interactive "r")
- (if (> from to)
- (let ((tem to))
- (setq to from from tem)))
- (rdebug-print-cmd (buffer-substring from to) "p"))
-
-(defun rdebug-print-sorted-region (from to)
- "Run a debugger \"ps\" command on the marked region."
- (interactive "r")
- (if (> from to)
- (let ((tem to))
- (setq to from from tem)))
- (rdebug-print-cmd (buffer-substring from to) "ps"))
-
-(defun rdebug-pretty-print-region (from to)
- "Run a debugger \"pp\" command on the marked region."
- (interactive "r")
- (if (> from to)
- (let ((tem to))
- (setq to from from tem)))
- (rdebug-print-cmd (buffer-substring from to) "pp"))
-
-
-;;
-;; The following two commands should be seen as proof-of-concept
-;; functions for the info buffer.
-;;
-
-(defun rdebug-pretty-print-to-buffer (s)
- "Pretty print expression to the info buffer."
- (interactive "sPretty print: ")
- (rdebug-call-return (format "pp %s" s) :info))
-
-(defun rdebug-pretty-print-region-to-buffer (from to)
- "Pretty print expression in region to the info buffer."
- (interactive "r")
- (rdebug-call-return (format "pp %s" (buffer-substring from to)) :info))
-
-
-
-(defun rdebug-quit ()
- "Kill the debugger process associated with the current buffer.
-
-When `rdebug-many-windows' is active, the original window layout
-is restored."
- (interactive)
- (if (yes-or-no-p "Really quit? ")
- (rdebug-call "quit unconditionally")))
-
-(defun rdebug-restart ()
- "Restart the debugged Ruby script.
-
-An exec restart is used."
- (interactive)
- (if (yes-or-no-p "Restart? ")
- (rdebug-call "restart")))
-
-(defun rdebug-set-stepping-prefix ()
- "Set the granularity of stepping on the subsequent 'next' or 'step' command.
-As long as repeated next or step commands are given, they inherit this setting."
- (interactive)
- (setq rdebug-stepping-prefix (this-command-keys)))
-
-(defun rdebug-step (&optional arg)
- "Run a debugger \"next\" command, respecting `rdebug-stepping-prefix'.
-
-With a numeric ARG, continue to that line number of the current file."
- (interactive "p")
- (rdebug-stepping "step" arg))
-
-(defun rdebug-newer-frame ()
- "Run a debugger \"down\" command to an newer frame.
-
-If we try to go down from frame 0, wrap to the end of the file"
- (interactive)
- (let* ((buf-name (rdebug-get-secondary-buffer-name "frame"))
- (buf (or (get-buffer buf-name) (current-buffer))))
- (with-current-buffer buf
- ;; Should we add a mode to disable wrapping?
- (if (equal rdebug-frames-current-frame-number 0)
- (rdebug-call "frame -1")
- (rdebug-call "down 1")))))
-
-(defun rdebug-older-frame ()
- "Run a debugger \"up\" command to an older frame."
- (interactive)
- (let* ((buf-name (rdebug-get-secondary-buffer-name "frame"))
- (buf (or (get-buffer buf-name) (current-buffer))))
- (with-current-buffer buf
- ;; Should we add a mode to disable wrapping?
- (rdebug-call "up 1"))))
-
-(provide 'rdebug-gud)
-
-;;; Local variables:
-;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
-;;; End:
-
-;;; rdebug-gud.el ends here
View
104 .emacs.d/lib/rdebug-mode/rdebug-help.el
@@ -1,104 +0,0 @@
-;;; rdebug-help.el --- Ruby debugger help
-
-;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
-;; Copyright (C) 2008 Anders Lindgren
-
-;; $Id: rdebug-help.el 711 2008-02-20 07:09:17Z andersl $
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; See the manual and the file `rdebug.el' for more information.
-
-;; This file contains code dealing with the help buffer.
-
-;;; Code:
-
-(defvar rdebug-secondary-window-help-mode-map
- (let ((map (make-sparse-keymap)))
- (suppress-keymap map)
- (rdebug-populate-secondary-buffer-map map)
- map)
- "Keymap used in the help buffer in the `rdebug' Ruby debugger.")
-
-(defun rdebug-secondary-window-help-mode ()
- "Major mode for the secondary buffer help text in the `rdebug' Ruby debugger.
-
-\\{rdebug-secondary-window-help-mode-map}"
- (interactive)
- (kill-all-local-variables)
- (setq major-mode 'rdebug-secondary-window-help-mode)
- (setq mode-name "RDEBUG Help")
- (setq buffer-read-only t)
- (set (make-local-variable 'rdebug-secondary-buffer) t)
- (setq mode-line-process 'rdebug-mode-line-process)
- (use-local-map rdebug-secondary-window-help-mode-map)
- (run-mode-hooks 'rdebug-secondary-window-help-mode-hook))
-
-(defun rdebug-display-secondary-window-help-buffer ()
- "Display the rdebug help buffer."
- (interactive)
- (rdebug-display-secondary-buffer "help"))
-
-(defun rdebug-setup-secondary-window-help-buffer (buf comint-buffer)
- (rdebug-debug-enter "rdebug-setup-secondary-window-help-buffer"
- (with-current-buffer buf
- (rdebug-secondary-window-help-mode)
- (set (make-local-variable 'gud-comint-buffer) comint-buffer)
- (insert "\
-
-This is a rdebug secondary window, you can use it to watch a
-number of help buffers. Use capital letters to switch between the
-available buffers. Lower case letters (and other key
-combinations) are used to issue buffer-specific commands.
-
-Press `C-h m' for more help, when the individual buffers are visible.
-
- B - Breakpoints buffer.
- C - Command buffer (the debugger shell)
- O - Output window
- S - go to source frame
- T - Stack trace buffer
- V - Variables buffer
- W - Watch buffer
-
- SPC - step (into)
- + - set for step+ and next+
- - - set for step- and next-
- _ - set to remove +/-
- c - continue
- f - finish (step out)
- n - next (step over)
- p - print
- q - quit
- r - run (restart)
- R - run (restart)
- s - step (into)
-
- > - go down frame (with numeric argument goes down that many frames)
- < - go up one frame (with numeric argument goes down that many frames)
-
- ? - This help text.
-"))))
-
-(provide 'rdebug-help)
-
-;;; Local variables:
-;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
-;;; End:
-
-;;; rdebug-help.el ends here
View
83 .emacs.d/lib/rdebug-mode/rdebug-info.el
@@ -1,83 +0,0 @@
-;;; rdebug-info.el --- This file contains code dealing with the Ruby
-;;; debugger's info secondary buffer.
-
-;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
-;; Copyright (C) 2008 Anders Lindgren
-
-;; $Id: rdebug-breaks.el 670 2008-02-06 18:15:28Z rockyb $
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; See the manual and the file `rdebug.el' for more information.
-
-
-;;; Code:
-
-(require 'rdebug-dbg)
-(require 'rdebug-gud)
-(require 'rdebug-regexp)
-(require 'rdebug-secondary)
-(require 'rdebug-source)
-(require 'rdebug-vars)
-
-(defun rdebug-display-info-buffer ()
- "Display the rdebug breakpoints buffer."
- (interactive)
- (rdebug-display-secondary-buffer "info"))
-
-(defvar rdebug-info-mode-map
- (let ((map (make-sparse-keymap)))
- (rdebug-populate-secondary-buffer-map map)
- map)
- "Keymap for the Rdebug info secondary buffer.")
-
-(defun rdebug-info-mode ()
- "Major mode for Ruby debugger info buffer.
-
-\\{rdebug-info-mode-map}"
- (kill-all-local-variables)
- (setq major-mode 'rdebug-info-mode)
- (setq mode-name "RDEBUG Info")
- (use-local-map rdebug-info-mode-map)
- (setq buffer-read-only t)
- (set (make-local-variable 'rdebug-secondary-buffer) t)
- (setq mode-line-process 'rdebug-mode-line-process)
- (run-mode-hooks 'rdebug-info-mode-hook))
-
-(defun rdebug-setup-info-buffer (buf comint-buffer)
- "Setup the Rdebug debugger info buffer."
- (rdebug-debug-enter "rdebug-setup-info-buffer"
- (with-current-buffer buf
- (let ((inhibit-read-only t)
- (old-line-number (buffer-local-value 'rdebug-current-line-number
- buf)))
- (rdebug-info-mode)
- (goto-line old-line-number)))))
-
-
-;; -------------------------------------------------------------------
-;; The end.
-;;
-
-(provide 'rdebug-info)
-
-;;; Local variables:
-;;; eval:(put 'rdebug-debug-enter 'lisp-indent-hook 1)
-;;; End:
-
-;;; rdebug-info.el ends here
View
180 .emacs.d/lib/rdebug-mode/rdebug-layouts.el
@@ -1,180 +0,0 @@
-;;; rdebug-layouts.el --- Ruby debugger window layouts.
-
-;; Copyright (C) 2008 Rocky Bernstein (rocky@gnu.org)
-;; Copyright (C) 2008 Anders Lindgren
-
-;; $Id: rdebug-layouts.el 723 2008-02-24 04:51:39Z rockyb $
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; This is file contains the window layouts that come with rdebug; the
-;; code where can be consulted as a guide for creating other window
-;; layouts.
-
-;; See the manual and the file `rdebug.el' for overall information on
-;; the ruby debugger rdebug.
-
-;;; Code:
-
-(defun rdebug-get-buffer (name script-name)
- "Return a rdebug buffer for displaying NAME when debugging SCRIPT-NAME.
-If the buffer doesn't exists it is created."
- (get-buffer-create (format "*rdebug-%s-%s*" name script-name)))
-
-
-(defun rdebug-get-existing-buffer (name script-name)
- "Return a rdebug buffer for displaying NAME when debugging SCRIPT-NAME.
-Return nil if the buffer doesn't exists."
- (get-buffer (format "*rdebug-%s-%s*" name script-name)))
-
-
-(defun rdebug-window-layout-conservative (src-buf name)
- "A conservative rdebug window layout with three windows.
-
-This window layout mimics the traditional debugger shell and
-source window layout, it only add one secondary window.
-Initially, the secondary window displays output of the debugged
-process, but any secondary buffer can be displayed, press `?' in
-the window for more details.
-Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
- (delete-other-windows)
- (split-window-horizontally)
- (other-window 1)
- (switch-to-buffer src-buf)
- (other-window 1)
- (when rdebug-use-separate-io-buffer
- (split-window nil 20)
- (set-window-buffer
- (selected-window) (rdebug-get-buffer "output" name)))
- (other-window 1))
-
-(defun rdebug-window-layout-rocky (src-buf name)
- "Rocky's window layout.
-
-3 windows. The source window is on top 4/5 of height. The
-bottom is split between the command windows and a stack window.
-
-See `rdebug' for more information.
-Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
- (delete-other-windows)
- (split-window nil ( / ( * (window-height) 4) 5))
- (set-window-buffer
- (selected-window) src-buf)
- (other-window 1)
- (set-window-buffer
- (selected-window) (rdebug-get-buffer "frame" name))
- (split-window-horizontally)
- (set-window-buffer
- (selected-window) (rdebug-get-buffer "cmd" name))
- (goto-char (point-max)))
-
-(defun rdebug-window-layout-rocky2 (src-buf name)
- "This layout is standard window without the output window, see `rdebug'.
-for more information.
-Argument SRC-BUF is the NAME of the buffer containing the Ruby source program that was initially run."
- (delete-other-windows)
- (split-window nil ( / ( * (window-height) 3) 4))
- (set-window-buffer
- (selected-window) src-buf)
- (split-window nil ( / (window-height) 3))
- (split-window-horizontally)
- (set-window-buffer
- (selected-window) (rdebug-get-buffer "frame" name))
- (other-window 1)
- (set-window-buffer
- (selected-window) (rdebug-get-buffer "variables" name))
- (other-window 1)
- (switch-to-buffer src-buf)
- (other-window 1)
- (set-window-buffer
- (selected-window) (rdebug-get-buffer "cmd" name))
- (goto-char (point-max)))
-
-(defun rdebug-window-layout-stack-of-windows (src-buf name)
- "A rdebug window layout with several secondary windows to the right.
-The debugger shell and the source code window is to the left.
-Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
- (delete-other-windows)
- (split-window-horizontally)
- (split-window nil 20)
- (set-window-buffer
- (selected-window) (rdebug-get-buffer "cmd" name))
- (other-window 1)
- (switch-to-buffer src-buf)
- (other-window 1)
- (split-window)
- (split-window)
- (set-window-buffer
- (selected-window) (rdebug-get-buffer "variables" name))
- (other-window 1)
- (set-window-buffer
- (selected-window) (rdebug-get-buffer "frame" name))
- (when rdebug-use-separate-io-buffer
- (other-window 1)
- (split-window)
- (set-window-buffer
- (selected-window) (rdebug-get-buffer "output" name)))
- (other-window 1)
- (set-window-buffer
- (selected-window) (rdebug-get-buffer "breakpoints" name))
- (other-window 1))
-
-;; The default layout
-(defun rdebug-window-layout-standard (src-buf name)
- "The default rdebug window layout, see `rdebug' for more information.
-Argument SRC-BUF the buffer containing the Ruby source program that was initially run. NAME is the name of that buffer."
- (delete-other-windows)
- (split-window nil ( / ( * (window-height) 3) 4))
- (split-window nil ( / (window-height) 3))
- (split-window-horizontally)
- (other-window 1)
- (set-window-buffer
- (selected-window) (rdebug-get-buffer "variables" name))
- (other-window 1)
- (switch-to-buffer src-buf)
- (when rdebug-use-separate-io-buffer</