summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-14 12:34:50 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-14 12:34:50 +0000
commit7eedd308b841e7b8eb4bc36211d28faf3521ee92 (patch)
treeecd5b90f08c40699d50303cb142baa8d3568f127 /misc
parent5c16b21f44c3f035c87ad7fcb3df868700960a39 (diff)
downloadbundler-7eedd308b841e7b8eb4bc36211d28faf3521ee92.tar.gz
Removed old elisp files. New upstream repository was moved https://github.com/ruby/elisp.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'misc')
-rw-r--r--misc/README9
-rw-r--r--misc/inf-ruby.el418
-rw-r--r--misc/rdoc-mode.el166
-rw-r--r--misc/ruby-additional.el181
-rw-r--r--misc/ruby-electric.el583
-rw-r--r--misc/ruby-style.el81
-rw-r--r--misc/rubydb2x.el104
-rw-r--r--misc/rubydb3x.el115
8 files changed, 0 insertions, 1657 deletions
diff --git a/misc/README b/misc/README
index 08a9010f58..7bc7e7b505 100644
--- a/misc/README
+++ b/misc/README
@@ -1,12 +1,3 @@
README this file
-inf-ruby.el program to run ruby under emacs
rb_optparse.bash bash completion script
rb_optparse.zsh zsh completion script
-rdoc-mode.el RDoc mode for emacs
-ruby-mode.el ruby mode for emacs
-ruby-style.el Ruby's C/C++ mode style for emacs
-rubydb2x.el ruby debugger support for emacs 19.2x or before
-rubydb3x.el ruby debugger support for emacs 19.3x or later
-ruby-electric.el emacs minor mode providing electric commands
-
-Check out https://github.com/ruby-debug/ also.
diff --git a/misc/inf-ruby.el b/misc/inf-ruby.el
deleted file mode 100644
index b3f4f10267..0000000000
--- a/misc/inf-ruby.el
+++ /dev/null
@@ -1,418 +0,0 @@
-;;; -*-Emacs-Lisp-*-
-;;;
-;;; $Id$
-;;; $Author$
-;;;
-;;; Inferior Ruby Mode - ruby process in a buffer.
-;;; adapted from cmuscheme.el
-;;;
-;;; Usage:
-;;;
-;;; (0) check ruby-program-name variable that can run your environment.
-;;;
-;;; (1) modify .emacs to use ruby-mode
-;;; for example :
-;;;
-;;; (autoload 'ruby-mode "ruby-mode"
-;;; "Mode for editing ruby source files" t)
-;;; (setq auto-mode-alist
-;;; (append '(("\\.rb$" . ruby-mode)) auto-mode-alist))
-;;; (setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
-;;; interpreter-mode-alist))
-;;;
-;;; (2) set to load inf-ruby and set inf-ruby key definition in ruby-mode.
-;;;
-;;; (autoload 'run-ruby "inf-ruby"
-;;; "Run an inferior Ruby process")
-;;; (autoload 'inf-ruby-keys "inf-ruby"
-;;; "Set local key defs for inf-ruby in ruby-mode")
-;;; (add-hook 'ruby-mode-hook
-;;; '(lambda ()
-;;; (inf-ruby-keys)
-;;; ))
-;;;
-;;; HISTORY
-;;; senda - 8 Apr 1998: Created.
-;;; $Log$
-;;; Revision 1.7 2004/07/27 08:11:36 matz
-;;; * eval.c (rb_eval): copy on write for argument local variable
-;;; assignment.
-;;;
-;;; * eval.c (assign): ditto.
-;;;
-;;; * eval.c (rb_call0): update ruby_frame->argv with the default
-;;; value used for the optional arguments.
-;;;
-;;; * object.c (Init_Object): "===" calls rb_obj_equal() directly.
-;;; [ruby-list:39937]
-;;;
-;;; Revision 1.6 2002/09/07 14:35:46 nobu
-;;; * misc/inf-ruby.el (inferior-ruby-error-regexp-alist): regexp
-;;; alist for error message from ruby.
-;;;
-;;; * misc/inf-ruby.el (inferior-ruby-mode): fixed for Emacs.
-;;;
-;;; * misc/inf-ruby.el (ruby-send-region): compilation-parse-errors
-;;; doesn't parse first line, so insert separators before each
-;;; evaluations.
-;;;
-;;; Revision 1.5 2002/08/19 10:05:47 nobu
-;;; * misc/inf-ruby.el (inf-ruby-keys): ruby-send-definition
-;;; conflicted with ruby-insert-end.
-;;;
-;;; * misc/inf-ruby.el (inferior-ruby-mode): compilation-minor-mode.
-;;;
-;;; * misc/inf-ruby.el (ruby-send-region): send as here document to
-;;; adjust source file/line. [ruby-talk:47113], [ruby-dev:17965]
-;;;
-;;; * misc/inf-ruby.el (ruby-send-terminator): added to make unique
-;;; terminator.
-;;;
-;;; Revision 1.4 2002/01/29 07:16:09 matz
-;;; * file.c (rb_stat_rdev_major): added. [new]
-;;;
-;;; * file.c (rb_stat_rdev_minor): added. [new]
-;;;
-;;; * file.c (rb_stat_inspect): print mode in octal.
-;;;
-;;; Revision 1.3 1999/12/01 09:24:18 matz
-;;; 19991201
-;;;
-;;; Revision 1.2 1999/08/13 05:45:18 matz
-;;; 1.4.0
-;;;
-;;; Revision 1.1.1.1.2.1 1999/07/15 07:59:59 matz
-;;; 990715
-;;;
-;;; Revision 1.1.1.1 1999/01/20 04:59:36 matz
-;;; ruby 1.3 cycle
-;;;
-;;; Revision 1.1.2.1 1998/12/16 07:30:36 matz
-;;; first public release of 1.1d (pre1.2) series
-;;;
-;;; Revision 1.4 1998/05/20 02:45:58 senda
-;;; default program to irb
-;;;
-;;; Revision 1.3 1998/04/10 04:11:30 senda
-;;; modification by Matsumoto san (1.1b9_09)
-;;; remove-in-string defined
-;;; global variable :
-;;; inferior-ruby-first-prompt-pattern
-;;; inferior-ruby-prompt-pattern
-;;; defined
-;;;
-;;; Revision 1.2 1998/04/09 07:53:42 senda
-;;; remove M-C-x in inferior-ruby-mode
-;;;
-;;; Revision 1.1 1998/04/09 07:28:36 senda
-;;; Initial revision
-;;;
-;;;
-
-(require 'comint)
-(require 'compile)
-(require 'ruby-mode)
-
-;;
-;; you may change these variables
-;;
-;(defvar ruby-program-name "rbc --noreadline"
-; "*Program invoked by the run-ruby command")
-;
-;(defvar inferior-ruby-first-prompt-pattern "^rbc0> *"
-; "first prompt regex pattern of ruby interpreter.")
-;
-;(defvar inferior-ruby-prompt-pattern "^\\(rbc.[>*\"'] *\\)+"
-; "prompt regex pattern of ruby interpreter.")
-
-;;;; for irb
-(defvar ruby-program-name "irb --inf-ruby-mode"
- "*Program invoked by the run-ruby command")
-
-(defvar inferior-ruby-first-prompt-pattern "^irb(.*)[0-9:]+0> *"
- "first prompt regex pattern of ruby interpreter.")
-
-(defvar inferior-ruby-prompt-pattern "^\\(irb(.*)[0-9:]+[>*\"'] *\\)+"
- "prompt regex pattern of ruby interpreter.")
-
-;;
-;; mode variables
-;;
-(defvar inferior-ruby-mode-hook nil
- "*Hook for customising inferior-ruby mode.")
-(defvar inferior-ruby-mode-map nil
- "*Mode map for inferior-ruby-mode")
-
-(defconst inferior-ruby-error-regexp-alist
- '(("SyntaxError: compile error\n^\\([^\(].*\\):\\([1-9][0-9]*\\):" 1 2)
- ("^\tfrom \\([^\(].*\\):\\([1-9][0-9]*\\)\\(:in `.*'\\)?$" 1 2)))
-
-(cond ((not inferior-ruby-mode-map)
- (setq inferior-ruby-mode-map
- (copy-keymap comint-mode-map))
-; (define-key inferior-ruby-mode-map "\M-\C-x" ;gnu convention
-; 'ruby-send-definition)
-; (define-key inferior-ruby-mode-map "\C-x\C-e" 'ruby-send-last-sexp)
- (define-key inferior-ruby-mode-map "\C-c\C-l" 'ruby-load-file)
-))
-
-;;;###autoload
-(defun inf-ruby-keys ()
- "Set local key defs for inf-ruby in ruby-mode"
- (define-key ruby-mode-map "\M-\C-x" 'ruby-send-definition)
-; (define-key ruby-mode-map "\C-x\C-e" 'ruby-send-last-sexp)
- (define-key ruby-mode-map "\C-c\C-b" 'ruby-send-block)
- (define-key ruby-mode-map "\C-c\M-b" 'ruby-send-block-and-go)
- (define-key ruby-mode-map "\C-c\C-x" 'ruby-send-definition)
- (define-key ruby-mode-map "\C-c\M-x" 'ruby-send-definition-and-go)
- (define-key ruby-mode-map "\C-c\C-r" 'ruby-send-region)
- (define-key ruby-mode-map "\C-c\M-r" 'ruby-send-region-and-go)
- (define-key ruby-mode-map "\C-c\C-z" 'switch-to-ruby)
- (define-key ruby-mode-map "\C-c\C-l" 'ruby-load-file)
- (define-key ruby-mode-map "\C-c\C-s" 'run-ruby)
-)
-
-(defvar ruby-buffer nil "current ruby (actually irb) process buffer.")
-
-(defun inferior-ruby-mode ()
- "Major mode for interacting with an inferior ruby (irb) process.
-
-The following commands are available:
-\\{inferior-ruby-mode-map}
-
-A ruby process can be fired up with M-x run-ruby.
-
-Customisation: Entry to this mode runs the hooks on comint-mode-hook and
-inferior-ruby-mode-hook (in that order).
-
-You can send text to the inferior ruby process from other buffers containing
-Ruby source.
- switch-to-ruby switches the current buffer to the ruby process buffer.
- ruby-send-definition sends the current definition to the ruby process.
- ruby-send-region sends the current region to the ruby process.
-
- ruby-send-definition-and-go, ruby-send-region-and-go,
- switch to the ruby process buffer after sending their text.
-For information on running multiple processes in multiple buffers, see
-documentation for variable ruby-buffer.
-
-Commands:
-Return after the end of the process' output sends the text from the
- end of process to point.
-Return before the end of the process' output copies the sexp ending at point
- to the end of the process' output, and sends it.
-Delete converts tabs to spaces as it moves back.
-Tab indents for ruby; with argument, shifts rest
- of expression rigidly with the current line.
-C-M-q does Tab on each line starting within following expression.
-Paragraphs are separated only by blank lines. # start comments.
-If you accidentally suspend your process, use \\[comint-continue-subjob]
-to continue it."
- (interactive)
- (comint-mode)
- ;; Customise in inferior-ruby-mode-hook
- ;(setq comint-prompt-regexp "^[^>\n]*>+ *")
- (setq comint-prompt-regexp inferior-ruby-prompt-pattern)
- ;;(scheme-mode-variables)
- (ruby-mode-variables)
- (setq major-mode 'inferior-ruby-mode)
- (setq mode-name "Inferior Ruby")
- (setq mode-line-process '(":%s"))
- (use-local-map inferior-ruby-mode-map)
- (setq comint-input-filter (function ruby-input-filter))
- (setq comint-get-old-input (function ruby-get-old-input))
- (make-local-variable 'compilation-error-regexp-alist)
- (setq compilation-error-regexp-alist inferior-ruby-error-regexp-alist)
- (compilation-shell-minor-mode t)
- (run-hooks 'inferior-ruby-mode-hook))
-
-(defvar inferior-ruby-filter-regexp "\\`\\s *\\S ?\\S ?\\s *\\'"
- "*Input matching this regexp are not saved on the history list.
-Defaults to a regexp ignoring all inputs of 0, 1, or 2 letters.")
-
-(defun ruby-input-filter (str)
- "Don't save anything matching inferior-ruby-filter-regexp"
- (not (string-match inferior-ruby-filter-regexp str)))
-
-;; adapted from replace-in-string in XEmacs (subr.el)
-(defun remove-in-string (str regexp)
- "Remove all matches in STR for REGEXP and returns the new string."
- (let ((rtn-str "") (start 0) match prev-start)
- (while (setq match (string-match regexp str start))
- (setq prev-start start
- start (match-end 0)
- rtn-str (concat rtn-str (substring str prev-start match))))
- (concat rtn-str (substring str start))))
-
-(defun ruby-get-old-input ()
- "Snarf the sexp ending at point"
- (save-excursion
- (let ((end (point)))
- (re-search-backward inferior-ruby-first-prompt-pattern)
- (remove-in-string (buffer-substring (point) end)
- inferior-ruby-prompt-pattern)
- )))
-
-(defun ruby-args-to-list (string)
- (let ((where (string-match "[ \t]" string)))
- (cond ((null where) (list string))
- ((not (= where 0))
- (cons (substring string 0 where)
- (ruby-args-to-list (substring string (+ 1 where)
- (length string)))))
- (t (let ((pos (string-match "[^ \t]" string)))
- (if (null pos)
- nil
- (ruby-args-to-list (substring string pos
- (length string)))))))))
-
-;;;###autoload
-(defun run-ruby (cmd)
- "Run an inferior Ruby process, input and output via buffer *ruby*.
-If there is a process already running in `*ruby*', switch to that buffer.
-With argument, allows you to edit the command line (default is value
-of `ruby-program-name'). Runs the hooks `inferior-ruby-mode-hook'
-\(after the `comint-mode-hook' is run).
-\(Type \\[describe-mode] in the process buffer for a list of commands.)"
-
- (interactive (list (if current-prefix-arg
- (read-string "Run Ruby: " ruby-program-name)
- ruby-program-name)))
- (if (not (comint-check-proc "*ruby*"))
- (let ((cmdlist (ruby-args-to-list cmd)))
- (set-buffer (apply 'make-comint "ruby" (car cmdlist)
- nil (cdr cmdlist)))
- (inferior-ruby-mode)))
- (setq ruby-program-name cmd)
- (setq ruby-buffer "*ruby*")
- (pop-to-buffer "*ruby*"))
-
-(defconst ruby-send-terminator "--inf-ruby-%x-%d-%d-%d--"
- "Template for irb here document terminator.
-Must not contain ruby meta characters.")
-
-(defconst ruby-eval-separator "")
-
-(defun ruby-send-region (start end)
- "Send the current region to the inferior Ruby process."
- (interactive "r")
- (let (term (file (buffer-file-name)) line)
- (save-excursion
- (save-restriction
- (widen)
- (goto-char start)
- (setq line (+ start (forward-line (- start)) 1))
- (goto-char start)
- (while (progn
- (setq term (apply 'format ruby-send-terminator (random) (current-time)))
- (re-search-forward (concat "^" (regexp-quote term) "$") end t)))))
- ;; compilation-parse-errors parses from second line.
- (save-excursion
- (let ((m (process-mark (ruby-proc))))
- (set-buffer (marker-buffer m))
- (goto-char m)
- (insert ruby-eval-separator "\n")
- (set-marker m (point))))
- (comint-send-string (ruby-proc) (format "eval <<'%s', nil, %S, %d\n" term file line))
- (comint-send-region (ruby-proc) start end)
- (comint-send-string (ruby-proc) (concat "\n" term "\n"))))
-
-(defun ruby-send-definition ()
- "Send the current definition to the inferior Ruby process."
- (interactive)
- (save-excursion
- (ruby-end-of-defun)
- (let ((end (point)))
- (ruby-beginning-of-defun)
- (ruby-send-region (point) end))))
-
-;(defun ruby-send-last-sexp ()
-; "Send the previous sexp to the inferior Ruby process."
-; (interactive)
-; (ruby-send-region (save-excursion (backward-sexp) (point)) (point)))
-
-(defun ruby-send-block ()
- "Send the current block to the inferior Ruby process."
- (interactive)
- (save-excursion
- (ruby-end-of-block)
- (end-of-line)
- (let ((end (point)))
- (ruby-beginning-of-block)
- (ruby-send-region (point) end))))
-
-(defun switch-to-ruby (eob-p)
- "Switch to the ruby process buffer.
-With argument, positions cursor at end of buffer."
- (interactive "P")
- (if (get-buffer ruby-buffer)
- (pop-to-buffer ruby-buffer)
- (error "No current process buffer. See variable ruby-buffer."))
- (cond (eob-p
- (push-mark)
- (goto-char (point-max)))))
-
-(defun ruby-send-region-and-go (start end)
- "Send the current region to the inferior Ruby process.
-Then switch to the process buffer."
- (interactive "r")
- (ruby-send-region start end)
- (switch-to-ruby t))
-
-(defun ruby-send-definition-and-go ()
- "Send the current definition to the inferior Ruby.
-Then switch to the process buffer."
- (interactive)
- (ruby-send-definition)
- (switch-to-ruby t))
-
-(defun ruby-send-block-and-go ()
- "Send the current block to the inferior Ruby.
-Then switch to the process buffer."
- (interactive)
- (ruby-send-block)
- (switch-to-ruby t))
-
-(defvar ruby-source-modes '(ruby-mode)
- "*Used to determine if a buffer contains Ruby source code.
-If it's loaded into a buffer that is in one of these major modes, it's
-considered a ruby source file by ruby-load-file.
-Used by these commands to determine defaults.")
-
-(defvar ruby-prev-l/c-dir/file nil
- "Caches the last (directory . file) pair.
-Caches the last pair used in the last ruby-load-file command.
-Used for determining the default in the
-next one.")
-
-(defun ruby-load-file (file-name)
- "Load a Ruby file into the inferior Ruby process."
- (interactive (comint-get-source "Load Ruby file: " ruby-prev-l/c-dir/file
- ruby-source-modes t)) ; T because LOAD
- ; needs an exact name
- (comint-check-source file-name) ; Check to see if buffer needs saved.
- (setq ruby-prev-l/c-dir/file (cons (file-name-directory file-name)
- (file-name-nondirectory file-name)))
- (comint-send-string (ruby-proc) (concat "(load \""
- file-name
- "\"\)\n")))
-
-(defun ruby-proc ()
- "Returns the current ruby process. See variable ruby-buffer."
- (let ((proc (get-buffer-process (if (eq major-mode 'inferior-ruby-mode)
- (current-buffer)
- ruby-buffer))))
- (or proc
- (error "No current process. See variable ruby-buffer"))))
-
-;;; Do the user's customisation...
-
-(defvar inf-ruby-load-hook nil
- "This hook is run when inf-ruby is loaded in.
-This is a good place to put keybindings.")
-
-(run-hooks 'inf-ruby-load-hook)
-
-(provide 'inf-ruby)
-
-;;; inf-ruby.el ends here
diff --git a/misc/rdoc-mode.el b/misc/rdoc-mode.el
deleted file mode 100644
index c26c2ee564..0000000000
--- a/misc/rdoc-mode.el
+++ /dev/null
@@ -1,166 +0,0 @@
-;;
-;; rdoc-mode.el
-;; Major mode for RDoc editing
-;;
-
-;; Created: Fri Sep 18 09:04:49 JST 2009
-
-;; License: Ruby's
-
-(require 'derived)
-
-;;;###autoload
-(define-derived-mode rdoc-mode text-mode "RDoc"
- "Major mode for RD editing.
-\\{rdoc-mode-map}"
- (make-local-variable 'paragraph-separate)
- (setq paragraph-separate "^\\(=+\\|\\*+\\)[ \t\v\f]*\\|^\\s *$")
- (make-local-variable 'paragraph-start)
- (setq paragraph-start paragraph-separate)
- (make-local-variable 'require-final-newline)
- (setq require-final-newline t)
- (make-local-variable 'font-lock-defaults)
- (setq font-lock-defaults '((rdoc-font-lock-keywords) t nil))
- (make-local-variable 'font-lock-keywords)
- (setq font-lock-keywords rdoc-font-lock-keywords)
- (make-local-variable 'outline-regexp)
- (setq outline-regexp "^\\(=+\\)[ \t\v\f]*")
- (outline-minor-mode t)
- (setq show-trailing-whitespace t)
- (rdoc-setup-keys)
- (setq indent-tabs-mode nil)
- (run-hooks 'rdoc-mode-hook)
- )
-
-(defun rdoc-fill-paragraph (&optional justify region)
- "Fills paragraph, except for cited region"
- (interactive (progn
- (barf-if-buffer-read-only)
- (list (if current-prefix-arg 'full))))
- (save-excursion
- (beginning-of-line)
- (save-restriction
- (let ((pos (point)) beg end indent hanging)
- (cond
- ((looking-at "^ +\\(\\*\\s *\\)")
- (setq indent (- (match-end 0) (match-beginning 0))
- hanging (- (match-end 1) (match-beginning 1))))
- ((looking-at "^ +")
- (setq indent (- (match-end 0) (match-beginning 0)))
- (when (and (re-search-backward "^[^ ]\\|^\\( *\\(\\* *\\)\\)" nil t)
- (match-beginning 1)
- (= indent (- (match-end 1) (match-beginning 1))))
- (setq hanging (- (match-end 2) (match-beginning 2)))
- (setq beg (match-beginning 1))))
- ((setq beg t)))
- (when beg
- (when indent
- (goto-char pos)
- (while (progn (beginning-of-line 2)
- (and (looking-at "^\\( +\\)\\S ")
- (= indent (- (match-end 1) (match-beginning 1))))))
- (setq end (point))
- (when (and beg (not region))
- (setq region (list beg end))
- (narrow-to-region beg end)
- ))
- (goto-char pos)
- (fill-paragraph justify region)
- (when (and indent
- (or (goto-char beg) t)
- (or (beginning-of-line 2) t)
- (looking-at "^\\( +\\)")
- (= (- indent hanging) (- (match-end 0) (match-beginning 0))))
- (insert-char ?\s hanging)
- (beginning-of-line)
- (narrow-to-region (point) end)
- (fill-paragraph justify (list (point) end))))))))
-
-(defun rdoc-setup-keys ()
- (interactive)
- (define-key rdoc-mode-map "\M-q" 'rdoc-fill-paragraph)
- )
-
-(defvar rdoc-heading1-face 'font-lock-keywordoc-face)
-(defvar rdoc-heading2-face 'font-lock-type-face)
-(defvar rdoc-heading3-face 'font-lock-variable-name-face)
-(defvar rdoc-heading4-face 'font-lock-comment-face)
-(defvar rdoc-bold-face 'font-lock-function-name-face)
-(defvar rdoc-emphasis-face 'font-lock-function-name-face)
-(defvar rdoc-code-face 'font-lock-keyword-face)
-(defvar rdoc-description-face 'font-lock-constant-face)
-
-(defvar rdoc-font-lock-keywords
- (list
- (list "^=([^=\r\n].*)?$"
- 0 rdoc-heading1-face)
- (list "^==([^=\r\n].*)?$"
- 0 rdoc-heading2-face)
- (list "^===([^=\r\n].*)?$"
- 0 rdoc-heading3-face)
- (list "^====+.*$"
- 0 rdoc-heading4-face)
- (list "\\(^\\|[ \t\v\f]\\)\\(\\*\\(\\sw\\|[-_:]\\)+\\*\\)\\($\\|[ \t\v\f]\\)"
- 2 rdoc-bold-face) ; *bold*
- (list "\\(^\\|[ \t\v\f]\\)\\(_\\(\\sw\\|[-_:]\\)+_\\)\\($\\|[ \t\v\f]\\)"
- 2 rdoc-emphasis-face) ; _emphasis_
- (list "\\(^\\|[ \t\v\f]\\)\\(\\+\\(\\sw\\|[-_:]\\)+\\+\\)\\($\\|[ \t\v\f]\\)"
- 2 rdoc-code-face) ; +code+
- (list "<em>[^<>]*</em>" 0 rdoc-emphasis-face)
- (list "<i>[^<>]*</i>" 0 rdoc-emphasis-face)
- (list "<b>[^<>]*</b>" 0 rdoc-bold-face)
- (list "<tt>[^<>]*</tt>" 0 rdoc-code-face)
- (list "<code>[^<>]*</code>" 0 rdoc-code-face)
- (list "^\\([-*]\\|[0-9]+\\.\\|[A-Za-z]\\.\\)\\s "
- 1 rdoc-description-face) ; bullet | numbered | alphabetically numbered
- (list "^\\[[^\]]*\\]\\|\\S .*::\\)\\([ \t\v\f]\\|$\\)"
- 1 rdoc-description-face) ; labeled | node
- ;(list "^[ \t\v\f]+\\(.*\\)" 1 rdoc-verbatim-face)
- ))
-
-(defun rdoc-imenu-create-index ()
- (let ((root '(nil . nil))
- cur-alist
- (cur-level 0)
- (pattern (concat outline-regexp "\\(.*?\\)[ \t\v\f]*$"))
- (empty-heading "-")
- (self-heading ".")
- pos level heading alist)
- (save-excursion
- (goto-char (point-min))
- (while (re-search-forward pattern (point-max) t)
- (setq heading (match-string-no-properties 2)
- level (min 6 (length (match-string-no-properties 1)))
- pos (match-beginning 1))
- (if (= (length heading) 0)
- (setq heading empty-heading))
- (setq alist (list (cons heading pos)))
- (cond
- ((= cur-level level) ; new sibling
- (setcdr cur-alist alist)
- (setq cur-alist alist))
- ((< cur-level level) ; first child
- (dotimes (i (- level cur-level 1))
- (setq alist (list (cons empty-heading alist))))
- (if cur-alist
- (let* ((parent (car cur-alist))
- (self-pos (cdr parent)))
- (setcdr parent (cons (cons self-heading self-pos) alist)))
- (setcdr root alist)) ; primogenitor
- (setq cur-alist alist
- cur-level level))
- (t ; new sibling of an ancestor
- (let ((sibling-alist (last (cdr root))))
- (dotimes (i (1- level))
- (setq sibling-alist (last (cdar sibling-alist))))
- (setcdr sibling-alist alist)
- (setq cur-alist alist
- cur-level level))))))
- (cdr root)))
-
-(defun rdoc-set-imenu-create-index-function ()
- (setq imenu-create-index-function 'rdoc-imenu-create-index))
-
-(add-hook 'rdoc-mode-hook 'rdoc-set-imenu-create-index-function)
-
-(provide 'rdoc-mode)
diff --git a/misc/ruby-additional.el b/misc/ruby-additional.el
deleted file mode 100644
index 432adfedb6..0000000000
--- a/misc/ruby-additional.el
+++ /dev/null
@@ -1,181 +0,0 @@
-;;; ruby-additional.el --- ruby-mode extensions yet to be merged into Emacs
-
-;; Authors: Yukihiro Matsumoto, Nobuyoshi Nakada, Akinori MUSHA
-;; URL: https://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/misc/
-;; Created: 3 Sep 2012
-;; Package-Requires: ((emacs "24.3") (ruby-mode "1.2"))
-;; Keywords: ruby, languages
-
-;;; Commentary:
-;;
-;; This package contains ruby-mode extensions yet to be merged into
-;; the latest released version of Emacs distribution. For older
-;; versions of Emacs, use ruby-mode.el bundled with CRuby.
-
-;;; Code:
-
-(eval-when-compile
- (require 'ruby-mode))
-
-(eval-after-load 'ruby-mode
- '(progn
- (define-key ruby-mode-map "\C-c\C-e" 'ruby-insert-end)
-
- (defun ruby-insert-end ()
- (interactive)
- (if (eq (char-syntax (preceding-char)) ?w)
- (insert " "))
- (insert "end")
- (save-excursion
- (if (eq (char-syntax (following-char)) ?w)
- (insert " "))
- (ruby-indent-line t)
- (end-of-line)))
-
- (defconst ruby-default-encoding-map
- '((us-ascii . nil) ;; Do not put coding: us-ascii
- (utf-8 . nil) ;; Do not put coding: utf-8
- (shift-jis . cp932) ;; Emacs charset name of Shift_JIS
- (shift_jis . cp932) ;; MIME charset name of Shift_JIS
- (japanese-cp932 . cp932)) ;; Emacs charset name of CP932
- )
-
- (custom-set-default 'ruby-encoding-map ruby-default-encoding-map)
-
- (defcustom ruby-encoding-map ruby-default-encoding-map
- "Alist to map encoding name from Emacs to Ruby.
-Associating an encoding name with nil means it needs not be
-explicitly declared in magic comment."
- :type '(repeat (cons (symbol :tag "From") (symbol :tag "To")))
- :group 'ruby)
-
- (defun ruby-mode-set-encoding ()
- "Insert or update a magic comment header with the proper encoding.
-`ruby-encoding-map' is looked up to convert an encoding name from
-Emacs to Ruby."
- (let* ((nonascii
- (save-excursion
- (widen)
- (goto-char (point-min))
- (re-search-forward "[^\0-\177]" nil t)))
- (coding-system
- (or coding-system-for-write
- buffer-file-coding-system))
- (coding-system
- (and coding-system
- (coding-system-change-eol-conversion coding-system nil)))
- (coding-system
- (and coding-system
- (or
- (coding-system-get coding-system :mime-charset)
- (let ((coding-type (coding-system-get coding-system :coding-type)))
- (cond ((eq coding-type 'undecided)
- (if nonascii
- (or (and (coding-system-get coding-system :prefer-utf-8)
- 'utf-8)
- (coding-system-get default-buffer-file-coding-system :coding-type)
- 'ascii-8bit)))
- ((memq coding-type '(utf-8 shift-jis))
- coding-type)
- (t coding-system))))))
- (coding-system
- (or coding-system
- 'us-ascii))
- (coding-system
- (let ((cons (assq coding-system ruby-encoding-map)))
- (if cons (cdr cons) coding-system)))
- (coding-system
- (and coding-system
- (symbol-name coding-system))))
- (if coding-system
- (save-excursion
- (widen)
- (goto-char (point-min))
- (if (looking-at "^#!") (beginning-of-line 2))
- (cond ((looking-at "\\s *#.*-\*-\\s *\\(en\\)?coding\\s *:\\s *\\([-a-z0-9_]*\\)\\s *\\(;\\|-\*-\\)")
- (unless (string= (match-string 2) coding-system)
- (goto-char (match-beginning 2))
- (delete-region (point) (match-end 2))
- (and (looking-at "-\*-")
- (let ((n (skip-chars-backward " ")))
- (cond ((= n 0) (insert " ") (backward-char))
- ((= n -1) (insert " "))
- ((forward-char)))))
- (insert coding-system)))
- ((looking-at "\\s *#.*coding\\s *[:=]"))
- (t (when ruby-insert-encoding-magic-comment
- (insert "# -*- coding: " coding-system " -*-\n"))))))))
-
- (define-key ruby-mode-map "\C-cU" 'ruby-encode-decode-unicode)
-
- (defun ruby-encode-unicode (beg end)
- "Convert non-ascii string in the given region to \\u{} form."
- (interactive "r")
- (setq end (set-marker (make-marker) end))
- (goto-char beg)
- (while (and (< (point) end)
- (re-search-forward "\\([\C-@-\C-I\C-K\C-_\C-?]+\\)\\|[^\C-@-\C-?]+" end t))
- (let ((str (match-string-no-properties 0)) sep b e f)
- (if (match-beginning 1)
- (setq b "" e "" sep ""
- f (lambda (c)
- (cond ((= c ?\t) "\\t")
- ((= c ?\r) "\\r")
- ((= c ?\e) "\\e")
- ((= c ?\f) "\\f")
- ((= c ?\b) "\\b")
- ((= c ?\v) "\\v")
- ((= c ?\C-?) "\\c?")
- ((concat "\\c" (char-to-string (logior c #x40)))))))
- (setq b "\\u{" e "}" sep " " f (lambda (c) (format "%x" c))))
- (setq str (mapconcat f str sep))
- (delete-region (match-beginning 0) (match-end 0))
- (insert b str e))))
-
- (defun ruby-decode-unicode (beg end)
- "Convert escaped Unicode in the given region to raw string."
- (interactive "r")
- (setq end (set-marker (make-marker) end))
- (goto-char beg)
- (while (and (< (point) end)
- (re-search-forward "\\\\u\\([0-9a-fA-F]\\{4\\}\\)\\|\\\\u{\\([0-9a-fA-F \t]+\\)}" end t))
- (let ((b (match-beginning 0)) (e (match-end 0))
- (s (match-string-no-properties 1)))
- (if s
- (setq s (cons s nil))
- (goto-char (match-beginning 2))
- (while (looking-at "[ \t]*\\([0-9a-fA-F]+\\)")
- (setq s (cons (match-string-no-properties 1) s))
- (goto-char (match-end 0))))
- (setq s (mapconcat (lambda (c) (format "%c" (string-to-int c 16)))
- (nreverse s) ""))
- (delete-region b e)
- (insert s))
- ))
-
- (defun ruby-encode-decode-unicode (dec beg end)
- "Convert Unicode <-> \\u{} in the given region."
- (interactive "P\nr")
- (if dec (ruby-decode-unicode beg end) (ruby-encode-unicode beg end)))
-
- (defun ruby-insert-heredoc-code-block (arg)
- "Insert indented here document code block"
- (interactive "P")
- (let ((c (if arg "~" "-")))
- (insert "\"#{<<" c "\"{#\"}\\n#{<<" c "'};'}\""))
- (end-of-line)
- (if (eobp) (insert "\n") (forward-char))
- (indent-region (point)
- (progn (insert "{#\n" "};\n") (point)))
- (beginning-of-line 0))
- (define-key ruby-mode-map "\C-cH" 'ruby-insert-heredoc-code-block)
- ))
-
-;; monkey-patching ruby-mode.el in Emacs 24, as r49872.
-(when (and (boundp 'ruby-syntax-before-regexp-re)
- (not (string-match ruby-syntax-before-regexp-re "foo {|" 1)))
- (replace-regexp-in-string "\\[\\[" "\\&{|" ruby-syntax-before-regexp-re))
-
-(provide 'ruby-additional)
-
-;;; ruby-additional.el ends here
diff --git a/misc/ruby-electric.el b/misc/ruby-electric.el
deleted file mode 100644
index 61e84d2adb..0000000000
--- a/misc/ruby-electric.el
+++ /dev/null
@@ -1,583 +0,0 @@
-;;; ruby-electric.el --- Minor mode for electrically editing ruby code
-;;
-;; Authors: Dee Zsombor <dee dot zsombor at gmail dot com>
-;; Yukihiro Matsumoto
-;; Nobuyoshi Nakada
-;; Akinori MUSHA <knu@iDaemons.org>
-;; Jakub Kuźma <qoobaa@gmail.com>
-;; Maintainer: Akinori MUSHA <knu@iDaemons.org>
-;; Created: 6 Mar 2005
-;; URL: https://github.com/knu/ruby-electric.el
-;; Keywords: languages ruby
-;; License: The same license terms as Ruby
-;; Version: 2.3.1
-
-;;; Commentary:
-;;
-;; `ruby-electric-mode' accelerates code writing in ruby by making
-;; some keys "electric" and automatically supplying with closing
-;; parentheses and "end" as appropriate.
-;;
-;; This work was originally inspired by a code snippet posted by
-;; [Frederick Ros](https://github.com/sleeper).
-;;
-;; Add the following line to enable ruby-electric-mode under
-;; ruby-mode.
-;;
-;; (eval-after-load "ruby-mode"
-;; '(add-hook 'ruby-mode-hook 'ruby-electric-mode))
-;;
-;; Type M-x customize-group ruby-electric for configuration.
-
-;;; Code:
-
-(require 'ruby-mode)
-
-(eval-when-compile
- (require 'cl))
-
-(defgroup ruby-electric nil
- "Minor mode providing electric editing commands for ruby files"
- :group 'ruby)
-
-(defconst ruby-electric-expandable-bar-re
- "\\s-\\(do\\|{\\)\\s-*|")
-
-(defconst ruby-electric-delimiters-alist
- '((?\{ :name "Curly brace" :handler ruby-electric-curlies :closing ?\})
- (?\[ :name "Square brace" :handler ruby-electric-matching-char :closing ?\])
- (?\( :name "Round brace" :handler ruby-electric-matching-char :closing ?\))
- (?\' :name "Quote" :handler ruby-electric-matching-char)
- (?\" :name "Double quote" :handler ruby-electric-matching-char)
- (?\` :name "Back quote" :handler ruby-electric-matching-char)
- (?\| :name "Vertical bar" :handler ruby-electric-bar)
- (?\# :name "Hash" :handler ruby-electric-hash)))
-
-(defvar ruby-electric-matching-delimeter-alist
- (apply 'nconc
- (mapcar #'(lambda (x)
- (let ((delim (car x))
- (plist (cdr x)))
- (if (eq (plist-get plist :handler) 'ruby-electric-matching-char)
- (list (cons delim (or (plist-get plist :closing)
- delim))))))
- ruby-electric-delimiters-alist)))
-
-(defvar ruby-electric-expandable-keyword-re)
-
-(defmacro ruby-electric--try-insert-and-do (string &rest body)
- (declare (indent 1))
- `(let ((before (point))
- (after (progn
- (insert ,string)
- (point))))
- (unwind-protect
- (progn ,@body)
- (delete-region before after)
- (goto-char before))))
-
-(defconst ruby-modifier-beg-symbol-re
- (regexp-opt ruby-modifier-beg-keywords 'symbols))
-
-(defun ruby-electric--modifier-keyword-at-point-p ()
- "Test if there is a modifier keyword at point."
- (and (looking-at ruby-modifier-beg-symbol-re)
- (let ((end (match-end 1)))
- (not (looking-back "\\."))
- (save-excursion
- (let ((indent1 (ruby-electric--try-insert-and-do "\n"
- (ruby-calculate-indent)))
- (indent2 (save-excursion
- (goto-char end)
- (ruby-electric--try-insert-and-do " x\n"
- (ruby-calculate-indent)))))
- (= indent1 indent2))))))
-
-(defconst ruby-block-mid-symbol-re
- (regexp-opt ruby-block-mid-keywords 'symbols))
-
-(defun ruby-electric--block-mid-keyword-at-point-p ()
- "Test if there is a block mid keyword at point."
- (and (looking-at ruby-block-mid-symbol-re)
- (looking-back "^\\s-*")))
-
-(defconst ruby-block-beg-symbol-re
- (regexp-opt ruby-block-beg-keywords 'symbols))
-
-(defun ruby-electric--block-beg-keyword-at-point-p ()
- "Test if there is a block beginning keyword at point."
- (and (looking-at ruby-block-beg-symbol-re)
- (if (string= (match-string 1) "do")
- (looking-back "\\s-")
- (not (looking-back "\\.")))
- ;; (not (ruby-electric--modifier-keyword-at-point-p)) ;; implicit assumption
- ))
-
-(defcustom ruby-electric-keywords-alist
- '(("begin" . end)
- ("case" . end)
- ("class" . end)
- ("def" . end)
- ("do" . end)
- ("else" . reindent)
- ("elsif" . reindent)
- ("end" . reindent)
- ("ensure" . reindent)
- ("for" . end)
- ("if" . end)
- ("module" . end)
- ("rescue" . reindent)
- ("unless" . end)
- ("until" . end)
- ("when" . reindent)
- ("while" . end))
- "Alist of keywords and actions to define how to react to space
-or return right after each keyword. In each (KEYWORD . ACTION)
-cons, ACTION can be set to one of the following values:
-
- `reindent' Reindent the line.
-
- `end' Reindent the line and auto-close the keyword with
- end if applicable.
-
- `nil' Do nothing.
-"
- :type '(repeat (cons (string :tag "Keyword")
- (choice :tag "Action"
- :menu-tag "Action"
- (const :tag "Auto-close with end"
- :value end)
- (const :tag "Auto-reindent"
- :value reindent)
- (const :tag "None"
- :value nil))))
- :set (lambda (sym val)
- (set sym val)
- (let (keywords)
- (dolist (x val)
- (let ((keyword (car x))
- (action (cdr x)))
- (if action
- (setq keywords (cons keyword keywords)))))
- (setq ruby-electric-expandable-keyword-re
- (concat (regexp-opt keywords 'symbols)
- "$"))))
- :group 'ruby-electric)
-
-(defvar ruby-electric-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map " " 'ruby-electric-space/return)
- (define-key map [remap delete-backward-char] 'ruby-electric-delete-backward-char)
- (define-key map [remap newline] 'ruby-electric-space/return)
- (define-key map [remap newline-and-indent] 'ruby-electric-space/return)
- (define-key map [remap electric-newline-and-maybe-indent] 'ruby-electric-space/return)
- (define-key map [remap reindent-then-newline-and-indent] 'ruby-electric-space/return)
- (dolist (x ruby-electric-delimiters-alist)
- (let* ((delim (car x))
- (plist (cdr x))
- (name (plist-get plist :name))
- (func (plist-get plist :handler))
- (closing (plist-get plist :closing)))
- (define-key map (char-to-string delim) func)
- (if closing
- (define-key map (char-to-string closing) 'ruby-electric-closing-char))))
- map)
- "Keymap used in ruby-electric-mode")
-
-(defcustom ruby-electric-expand-delimiters-list '(all)
- "*List of contexts where matching delimiter should be inserted.
-The word 'all' will do all insertions."
- :type `(set :extra-offset 8
- (const :tag "Everything" all)
- ,@(apply 'list
- (mapcar #'(lambda (x)
- `(const :tag ,(plist-get (cdr x) :name)
- ,(car x)))
- ruby-electric-delimiters-alist)))
- :group 'ruby-electric)
-
-(defcustom ruby-electric-newline-before-closing-bracket nil
- "*Non-nil means a newline should be inserted before an
-automatically inserted closing bracket."
- :type 'boolean :group 'ruby-electric)
-
-(defcustom ruby-electric-autoindent-on-closing-char nil
- "*Non-nil means the current line should be automatically
-indented when a closing character is manually typed in."
- :type 'boolean :group 'ruby-electric)
-
-(defvar ruby-electric-mode-hook nil
- "Called after `ruby-electric-mode' is turned on.")
-
-;;;###autoload
-(define-minor-mode ruby-electric-mode
- "Toggle Ruby Electric minor mode.
-With no argument, this command toggles the mode. Non-null prefix
-argument turns on the mode. Null prefix argument turns off the
-mode.
-
-When Ruby Electric mode is enabled, an indented 'end' is
-heuristicaly inserted whenever typing a word like 'module',
-'class', 'def', 'if', 'unless', 'case', 'until', 'for', 'begin',
-'do' followed by a space. Single, double and back quotes as well
-as braces are paired auto-magically. Expansion does not occur
-inside comments and strings. Note that you must have Font Lock
-enabled."
- ;; initial value.
- nil
- ;;indicator for the mode line.
- " REl"
- ;;keymap
- ruby-electric-mode-map
- (if ruby-electric-mode
- (run-hooks 'ruby-electric-mode-hook)))
-
-(defun ruby-electric-space/return-fallback ()
- (if (or (eq this-original-command 'ruby-electric-space/return)
- (null (ignore-errors
- ;; ac-complete may fail if there is nothing left to complete
- (call-interactively this-original-command)
- (setq this-command this-original-command))))
- ;; fall back to a globally bound command
- (let ((command (global-key-binding (char-to-string last-command-event) t)))
- (and command
- (call-interactively (setq this-command command))))))
-
-(defun ruby-electric-space/return (arg)
- (interactive "*P")
- (and (boundp 'sp-last-operation)
- (setq sp-delayed-pair nil))
- (cond ((or arg
- (region-active-p))
- (or (= last-command-event ?\s)
- (setq last-command-event ?\n))
- (ruby-electric-replace-region-or-insert))
- ((ruby-electric-space/return-can-be-expanded-p)
- (let (action)
- (save-excursion
- (goto-char (match-beginning 0))
- (let* ((keyword (match-string 1))
- (allowed-actions
- (cond ((ruby-electric--modifier-keyword-at-point-p)
- '(reindent)) ;; no end necessary
- ((ruby-electric--block-mid-keyword-at-point-p)
- '(reindent)) ;; ditto
- ((ruby-electric--block-beg-keyword-at-point-p)
- '(end reindent)))))
- (if allowed-actions
- (setq action
- (let ((action (cdr (assoc keyword ruby-electric-keywords-alist))))
- (and (memq action allowed-actions)
- action))))))
- (cond ((eq action 'end)
- (ruby-indent-line)
- (save-excursion
- (newline)
- (ruby-electric-end)))
- ((eq action 'reindent)
- (ruby-indent-line)))
- (ruby-electric-space/return-fallback)))
- ((and (eq this-original-command 'newline-and-indent)
- (ruby-electric-comment-at-point-p))
- (call-interactively (setq this-command 'comment-indent-new-line)))
- (t
- (ruby-electric-space/return-fallback))))
-
-(defun ruby-electric--get-faces-at-point ()
- (let* ((point (point))
- (value (or
- (get-text-property point 'read-face-name)
- (get-text-property point 'face))))
- (if (listp value) value (list value))))
-
-(defun ruby-electric--faces-include-p (pfaces &rest faces)
- (and ruby-electric-mode
- (loop for face in faces
- thereis (memq face pfaces))))
-
-(defun ruby-electric--faces-at-point-include-p (&rest faces)
- (apply 'ruby-electric--faces-include-p
- (ruby-electric--get-faces-at-point)
- faces))
-
-(defun ruby-electric-code-face-p (faces)
- (not (ruby-electric--faces-include-p
- faces
- 'font-lock-string-face
- 'font-lock-comment-face
- 'enh-ruby-string-delimiter-face
- 'enh-ruby-heredoc-delimiter-face
- 'enh-ruby-regexp-delimiter-face
- 'enh-ruby-regexp-face)))
-
-(defun ruby-electric-code-at-point-p ()
- (ruby-electric-code-face-p
- (ruby-electric--get-faces-at-point)))
-
-(defun ruby-electric-string-face-p (faces)
- (ruby-electric--faces-include-p
- faces
- 'font-lock-string-face
- 'enh-ruby-string-delimiter-face
- 'enh-ruby-heredoc-delimiter-face
- 'enh-ruby-regexp-delimiter-face
- 'enh-ruby-regexp-face))
-
-(defun ruby-electric-string-at-point-p ()
- (ruby-electric-string-face-p
- (ruby-electric--get-faces-at-point)))
-
-(defun ruby-electric-comment-at-point-p ()
- (ruby-electric--faces-at-point-include-p
- 'font-lock-comment-face))
-
-(defun ruby-electric-escaped-p()
- (let ((f nil))
- (save-excursion
- (while (char-equal ?\\ (preceding-char))
- (backward-char 1)
- (setq f (not f))))
- f))
-
-(defun ruby-electric-command-char-expandable-punct-p(char)
- (or (memq 'all ruby-electric-expand-delimiters-list)
- (memq char ruby-electric-expand-delimiters-list)))
-
-(defun ruby-electric-space/return-can-be-expanded-p()
- (and (ruby-electric-code-at-point-p)
- (looking-back ruby-electric-expandable-keyword-re)))
-
-(defun ruby-electric-replace-region-or-insert ()
- (and (region-active-p)
- (bound-and-true-p delete-selection-mode)
- (fboundp 'delete-selection-helper)
- (delete-selection-helper (get 'self-insert-command 'delete-selection)))
- (insert (make-string (prefix-numeric-value current-prefix-arg)
- last-command-event))
- (setq this-command 'self-insert-command))
-
-(defmacro ruby-electric-insert (arg &rest body)
- `(cond ((and
- (null ,arg)
- (ruby-electric-command-char-expandable-punct-p last-command-event))
- (let ((region-beginning
- (cond ((region-active-p)
- (prog1
- (save-excursion
- (goto-char (region-beginning))
- (insert last-command-event)
- (point))
- (goto-char (region-end))))
- (t
- (insert last-command-event)
- nil)))
- (faces-at-point
- (ruby-electric--get-faces-at-point)))
- ,@body
- (and region-beginning
- ;; If no extra character is inserted, go back to the
- ;; region beginning.
- (eq this-command 'self-insert-command)
- (goto-char region-beginning))))
- ((ruby-electric-replace-region-or-insert))))
-
-(defun ruby-electric-curlies (arg)
- (interactive "*P")
- (ruby-electric-insert
- arg
- (cond
- ((or (ruby-electric-code-at-point-p)
- (ruby-electric--faces-include-p
- faces-at-point
- 'enh-ruby-string-delimiter-face
- 'enh-ruby-regexp-delimiter-face))
- (save-excursion
- (insert "}")
- (font-lock-fontify-region (line-beginning-position) (point)))
- (cond
- ((or (ruby-electric-string-at-point-p) ;; %w{}, %r{}, etc.
- (looking-back "%[QqWwRrxIis]{"))
- (if region-beginning
- (forward-char 1)))
- (ruby-electric-newline-before-closing-bracket
- (cond (region-beginning
- (save-excursion
- (goto-char region-beginning)
- (newline))
- (newline)
- (forward-char 1)
- (indent-region region-beginning (line-end-position)))
- (t
- (insert " ")
- (save-excursion
- (newline)
- (ruby-indent-line t)))))
- (t
- (if region-beginning
- (save-excursion
- (goto-char region-beginning)
- (insert " "))
- (insert " "))
- (insert " ")
- (backward-char 1)
- (and region-beginning
- (forward-char 1)))))
- ((ruby-electric-string-at-point-p)
- (let ((start-position (1- (or region-beginning (point)))))
- (cond
- ((char-equal ?\# (char-before start-position))
- (unless (save-excursion
- (goto-char (1- start-position))
- (ruby-electric-escaped-p))
- (insert "}")
- (or region-beginning
- (backward-char 1))))
- ((or
- (ruby-electric-command-char-expandable-punct-p ?\#)
- (save-excursion
- (goto-char start-position)
- (ruby-electric-escaped-p)))
- (if region-beginning
- (goto-char region-beginning))
- (setq this-command 'self-insert-command))
- (t
- (save-excursion
- (goto-char start-position)
- (insert "#"))
- (insert "}")
- (or region-beginning
- (backward-char 1))))))
- (t
- (delete-char -1)
- (ruby-electric-replace-region-or-insert)))))
-
-(defun ruby-electric-hash (arg)
- (interactive "*P")
- (ruby-electric-insert
- arg
- (if (ruby-electric-string-at-point-p)
- (let ((start-position (1- (or region-beginning (point)))))
- (cond
- ((char-equal (following-char) ?')) ;; likely to be in ''
- ((save-excursion
- (goto-char start-position)
- (ruby-electric-escaped-p)))
- (region-beginning
- (save-excursion
- (goto-char (1+ start-position))
- (insert "{"))
- (insert "}"))
- (t
- (insert "{")
- (save-excursion
- (insert "}")))))
- (delete-char -1)
- (ruby-electric-replace-region-or-insert))))
-
-(defun ruby-electric-matching-char (arg)
- (interactive "*P")
- (ruby-electric-insert
- arg
- (let ((closing (cdr (assoc last-command-event
- ruby-electric-matching-delimeter-alist))))
- (cond
- ;; quotes
- ((char-equal closing last-command-event)
- (cond ((not (ruby-electric-string-face-p faces-at-point))
- (if region-beginning
- ;; escape quotes of the same kind, backslash and hash
- (let ((re (format "[%c\\%s]"
- last-command-event
- (if (char-equal last-command-event ?\")
- "#" "")))
- (bound (point)))
- (save-excursion
- (goto-char region-beginning)
- (while (re-search-forward re bound t)
- (let ((end (point)))
- (replace-match "\\\\\\&")
- (setq bound (+ bound (- (point) end))))))))
- (insert closing)
- (or region-beginning
- (backward-char 1)))
- (t
- (and (eq last-command 'ruby-electric-matching-char)
- (char-equal (following-char) closing) ;; repeated quotes
- (delete-char 1))
- (setq this-command 'self-insert-command))))
- ((ruby-electric-code-at-point-p)
- (insert closing)
- (or region-beginning
- (backward-char 1)))))))
-
-(defun ruby-electric-closing-char(arg)
- (interactive "*P")
- (cond
- (arg
- (ruby-electric-replace-region-or-insert))
- ((and
- (eq last-command 'ruby-electric-curlies)
- (= last-command-event ?})
- (not (char-equal (preceding-char) last-command-event))) ;; {}
- (if (char-equal (following-char) ?\n) (delete-char 1))
- (delete-horizontal-space)
- (forward-char))
- ((and
- (= last-command-event (following-char))
- (not (char-equal (preceding-char) last-command-event))
- (memq last-command '(ruby-electric-matching-char
- ruby-electric-closing-char))) ;; ()/[] and (())/[[]]
- (forward-char))
- (t
- (ruby-electric-replace-region-or-insert)
- (if ruby-electric-autoindent-on-closing-char
- (ruby-indent-line)))))
-
-(defun ruby-electric-bar(arg)
- (interactive "*P")
- (ruby-electric-insert
- arg
- (cond ((and (ruby-electric-code-at-point-p)
- (looking-back ruby-electric-expandable-bar-re))
- (save-excursion (insert "|")))
- (t
- (delete-char -1)
- (ruby-electric-replace-region-or-insert)))))
-
-(defun ruby-electric-delete-backward-char(arg)
- (interactive "*p")
- (cond ((memq last-command '(ruby-electric-matching-char
- ruby-electric-bar))
- (delete-char 1))
- ((eq last-command 'ruby-electric-curlies)
- (cond ((eolp)
- (cond ((char-equal (preceding-char) ?\s)
- (setq this-command last-command))
- ((char-equal (preceding-char) ?{)
- (and (looking-at "[ \t\n]*}")
- (delete-char (- (match-end 0) (match-beginning 0)))))))
- ((char-equal (following-char) ?\s)
- (setq this-command last-command)
- (delete-char 1))
- ((char-equal (following-char) ?})
- (delete-char 1))))
- ((eq last-command 'ruby-electric-hash)
- (and (char-equal (preceding-char) ?{)
- (delete-char 1))))
- (delete-char (- arg)))
-
-(put 'ruby-electric-delete-backward-char 'delete-selection 'supersede)
-
-(defun ruby-electric-end ()
- (interactive)
- (if (eq (char-syntax (preceding-char)) ?w)
- (insert " "))
- (insert "end")
- (save-excursion
- (if (eq (char-syntax (following-char)) ?w)
- (insert " "))
- (ruby-indent-line t)))
-
-(provide 'ruby-electric)
-
-;;; ruby-electric.el ends here
diff --git a/misc/ruby-style.el b/misc/ruby-style.el
deleted file mode 100644
index fa35897931..0000000000
--- a/misc/ruby-style.el
+++ /dev/null
@@ -1,81 +0,0 @@
-;;; -*- emacs-lisp -*-
-;;;
-;;; ruby-style.el -
-;;;
-;;; C/C++ mode style for Ruby.
-;;;
-;;; $Author$
-;;; created at: Thu Apr 26 13:54:01 JST 2007
-;;;
-;;; Put this file under a directory contained in ``load-path'', and
-;;; then load it.
-;;; To switch to the "ruby" style automatically if it looks like a
-;;; source file of ruby, add ruby-style-c-mode to c-mode-hook:
-;;;
-;;; (require 'ruby-style)
-;;; (add-hook 'c-mode-hook 'ruby-style-c-mode)
-;;; (add-hook 'c++-mode-hook 'ruby-style-c-mode)
-;;;
-;;; Customize the c-default-style variable to set the default style
-;;; for each CC major mode.
-
-(defconst ruby-style-revision "$Revision$"
- "Ruby style revision string.")
-
-(defconst ruby-style-version
- (and
- (string-match "[0-9.]+" ruby-style-revision)
- (substring ruby-style-revision (match-beginning 0) (match-end 0)))
- "Ruby style version number.")
-
-(defun ruby-style-case-indent (x)
- (save-excursion
- (back-to-indentation)
- (unless (progn (backward-up-list) (back-to-indentation)
- (> (point) (cdr x)))
- (goto-char (cdr x))
- (if (looking-at "\\<case\\|default\\>") '*))))
-
-(defun ruby-style-label-indent (x)
- (save-excursion
- (back-to-indentation)
- (unless (progn (backward-up-list) (back-to-indentation)
- (>= (point) (cdr x)))
- (goto-char (cdr x))
- (condition-case ()
- (progn
- (backward-up-list)
- (backward-sexp 2)
- (if (looking-at "\\<switch\\>") '/))
- (error)))))
-
-(require 'cc-styles)
-(c-add-style
- "ruby"
- '("bsd"
- (c-basic-offset . 4)
- (tab-width . 8)
- (indent-tabs-mode . nil)
- (setq show-trailing-whitespace t)
- (c-offsets-alist
- (case-label . *)
- (label . (ruby-style-label-indent *))
- (statement-case-intro . *)
- (statement-case-open . *)
- (statement-block-intro . (ruby-style-case-indent +))
- (access-label /)
- )))
-
-;;;###autoload
-(defun ruby-style-c-mode ()
- (interactive)
- (if (or (let ((name (buffer-file-name))) (and name (string-match "/ruby\\>" name)))
- (save-excursion
- (goto-char (point-min))
- (let ((head (progn (forward-line 100) (point)))
- (case-fold-search nil))
- (goto-char (point-min))
- (re-search-forward "Copyright (C) .* Yukihiro Matsumoto" head t))))
- (c-set-style "ruby")))
-
-(provide 'ruby-style)
diff --git a/misc/rubydb2x.el b/misc/rubydb2x.el
deleted file mode 100644
index a74265fb0e..0000000000
--- a/misc/rubydb2x.el
+++ /dev/null
@@ -1,104 +0,0 @@
-(require 'gud)
-(provide 'rubydb)
-
-;; ======================================================================
-;; rubydb functions
-
-;;; History of argument lists passed to rubydb.
-(defvar gud-rubydb-history nil)
-
-(defun gud-rubydb-massage-args (file args)
- (cons "-I" (cons "." (cons "-r" (cons "debug" (cons file 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
-;; 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.
-(defvar gud-rubydb-marker-acc "")
-
-(defun gud-rubydb-marker-filter (string)
- (save-match-data
- (setq gud-marker-acc (concat gud-marker-acc string))
- (let ((output ""))
-
- ;; Process all the complete markers in this chunk.
- (while (string-match "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
- gud-marker-acc)
- (setq
-
- ;; Extract the frame position from the marker.
- gud-last-frame
- (cons (substring gud-marker-acc (match-beginning 1) (match-end 1))
- (string-to-int (substring gud-marker-acc
- (match-beginning 2)
- (match-end 2))))
-
- ;; Append any text before the marker to the output we're going
- ;; to return - we don't include the marker in this text.
- output (concat output
- (substring gud-marker-acc 0 (match-beginning 0)))
-
- ;; Set the accumulator to the remaining text.
- gud-marker-acc (substring gud-marker-acc (match-end 0))))
-
- ;; Does the remaining text look like it might end with the
- ;; beginning of another marker? If it does, then keep it in
- ;; gud-marker-acc until we receive the rest of it. Since we
- ;; know the full marker regexp above failed, it's pretty simple to
- ;; test for marker starts.
- (if (string-match "\032.*\\'" gud-marker-acc)
- (progn
- ;; Everything before the potential marker start can be output.
- (setq output (concat output (substring gud-marker-acc
- 0 (match-beginning 0))))
-
- ;; Everything after, we save, to combine with later input.
- (setq gud-marker-acc
- (substring gud-marker-acc (match-beginning 0))))
-
- (setq output (concat output gud-marker-acc)
- gud-marker-acc ""))
-
- output)))
-
-(defun gud-rubydb-find-file (f)
- (find-file-noselect f))
-
-(defvar rubydb-command-name "ruby"
- "File name for executing ruby.")
-
-;;;###autoload
-(defun rubydb (command-line)
- "Run rubydb on program FILE in buffer *gud-FILE*.
-The directory containing FILE becomes the initial working directory
-and source-file directory for your debugger."
- (interactive
- (list (read-from-minibuffer "Run rubydb (like this): "
- (if (consp gud-rubydb-history)
- (car gud-rubydb-history)
- (concat rubydb-command-name " "))
- nil nil
- '(gud-rubydb-history . 1))))
-
- (gud-overload-functions '((gud-massage-args . gud-rubydb-massage-args)
- (gud-marker-filter . gud-rubydb-marker-filter)
- (gud-find-file . gud-rubydb-find-file)
- ))
- (gud-common-init command-line)
-
- (gud-def gud-break "b %l" "\C-b" "Set breakpoint at current line.")
-; (gud-def gud-remove "clear %l" "\C-d" "Remove breakpoint at current line")
- (gud-def gud-step "s" "\C-s" "Step one source line with display.")
- (gud-def gud-next "n" "\C-n" "Step one line (skip functions).")
- (gud-def gud-cont "c" "\C-r" "Continue with display.")
- (gud-def gud-finish "finish" "\C-f" "Finish executing current function.")
- (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).")
- (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).")
- (gud-def gud-print "p %e" "\C-p" "Evaluate ruby expression at point.")
-
- (setq comint-prompt-regexp "^(rdb:-) ")
- (setq paragraph-start comint-prompt-regexp)
- (run-hooks 'rubydb-mode-hook)
- )
diff --git a/misc/rubydb3x.el b/misc/rubydb3x.el
deleted file mode 100644
index 9d6bc57d5a..0000000000
--- a/misc/rubydb3x.el
+++ /dev/null
@@ -1,115 +0,0 @@
-(require 'gud)
-(provide 'rubydb)
-
-;; ======================================================================
-;; rubydb functions
-
-;;; History of argument lists passed to rubydb.
-(defvar gud-rubydb-history nil)
-
-(if (fboundp 'gud-overload-functions)
- (defun gud-rubydb-massage-args (file args)
- (cons "-r" (cons "debug" (cons file args))))
- (defun gud-rubydb-massage-args (file args)
- (cons "-r" (cons "debug" 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
-;; 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.
-(defvar gud-rubydb-marker-acc "")
-(make-variable-buffer-local 'gud-rubydb-marker-acc)
-
-(defun gud-rubydb-marker-filter (string)
- (setq gud-rubydb-marker-acc (concat gud-rubydb-marker-acc string))
- (let ((output ""))
-
- ;; Process all the complete markers in this chunk.
- (while (string-match "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
- gud-rubydb-marker-acc)
- (setq
-
- ;; Extract the frame position from the marker.
- gud-last-frame
- (cons (substring gud-rubydb-marker-acc (match-beginning 1) (match-end 1))
- (string-to-int (substring gud-rubydb-marker-acc
- (match-beginning 2)
- (match-end 2))))
-
- ;; Append any text before the marker to the output we're going
- ;; to return - we don't include the marker in this text.
- output (concat output
- (substring gud-rubydb-marker-acc 0 (match-beginning 0)))
-
- ;; Set the accumulator to the remaining text.
- gud-rubydb-marker-acc (substring gud-rubydb-marker-acc (match-end 0))))
-
- ;; Does the remaining text look like it might end with the
- ;; beginning of another marker? If it does, then keep it in
- ;; gud-rubydb-marker-acc until we receive the rest of it. Since we
- ;; know the full marker regexp above failed, it's pretty simple to
- ;; test for marker starts.
- (if (string-match "\032.*\\'" gud-rubydb-marker-acc)
- (progn
- ;; Everything before the potential marker start can be output.
- (setq output (concat output (substring gud-rubydb-marker-acc
- 0 (match-beginning 0))))
-
- ;; Everything after, we save, to combine with later input.
- (setq gud-rubydb-marker-acc
- (substring gud-rubydb-marker-acc (match-beginning 0))))
-
- (setq output (concat output gud-rubydb-marker-acc)
- gud-rubydb-marker-acc ""))
-
- output))
-
-(defun gud-rubydb-find-file (f)
- (save-excursion
- (let ((buf (find-file-noselect f)))
- (set-buffer buf)
-;; (gud-make-debug-menu)
- buf)))
-
-(defvar rubydb-command-name "ruby"
- "File name for executing ruby.")
-
-;;;###autoload
-(defun rubydb (command-line)
- "Run rubydb on program FILE in buffer *gud-FILE*.
-The directory containing FILE becomes the initial working directory
-and source-file directory for your debugger."
- (interactive
- (list (read-from-minibuffer "Run rubydb (like this): "
- (if (consp gud-rubydb-history)
- (car gud-rubydb-history)
- (concat rubydb-command-name " "))
- nil nil
- '(gud-rubydb-history . 1))))
-
- (if (not (fboundp 'gud-overload-functions))
- (gud-common-init command-line 'gud-rubydb-massage-args
- 'gud-rubydb-marker-filter 'gud-rubydb-find-file)
- (gud-overload-functions '((gud-massage-args . gud-rubydb-massage-args)
- (gud-marker-filter . gud-rubydb-marker-filter)
- (gud-find-file . gud-rubydb-find-file)))
- (gud-common-init command-line rubydb-command-name))
-
- (gud-def gud-break "b %l" "\C-b" "Set breakpoint at current line.")
-; (gud-def gud-remove "clear %l" "\C-d" "Remove breakpoint at current line")
- (gud-def gud-step "s" "\C-s" "Step one source line with display.")
- (gud-def gud-next "n" "\C-n" "Step one line (skip functions).")
- (gud-def gud-cont "c" "\C-r" "Continue with display.")
- (gud-def gud-finish "finish" "\C-f" "Finish executing current function.")
- (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).")
- (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).")
- (gud-def gud-print "p %e" "\C-p" "Evaluate ruby expression at point.")
-
- (setq comint-prompt-regexp "^(rdb:-) ")
- (if (boundp 'comint-last-output-start)
- (set-marker comint-last-output-start (point)))
- (set (make-local-variable 'paragraph-start) comint-prompt-regexp)
- (run-hooks 'rubydb-mode-hook)
- )