Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: dwwoelfel/.emacs.d
base: f481fd84a2
...
head fork: dwwoelfel/.emacs.d
compare: 0479763fc5
  • 6 commits
  • 17 files changed
  • 0 commit comments
  • 1 contributor
View
19 elpa/archives/gnu/archive-contents
@@ -21,10 +21,10 @@
[(0 5)
nil "Flexible inline text and code completion" tar])
(csv-mode .
- [(1 0)
+ [(1 1)
nil "Major mode for editing comma/char separated values" single])
(debbugs .
- [(0 3)
+ [(0 4)
nil "SOAP library to access debbugs servers" tar])
(dict-tree .
[(0 12 8)
@@ -84,14 +84,20 @@
[(0 1)
nil "Minor mode to edit files via hex-dump format" single])
(nlinum .
- [(1 0)
+ [(1 1)
nil "Show line numbers in the margin" single])
+ (notes-mode .
+ [(0 0)
+ nil "Indexing system for on-line note-taking" single])
(num3-mode .
- [(1 0)
+ [(1 1)
nil "highlight groups of digits in long numbers" single])
(oauth2 .
[(0 8)
nil "OAuth 2.0 Authorization Protocol" single])
+ (org .
+ [(20121112)
+ nil "Outline-based notes management and organizer" tar])
(quarter-plane .
[(0 1)
nil "Minor mode for quarter-plane style editing" single])
@@ -99,7 +105,7 @@
[(0 1)
nil "Queue data structure" single])
(rainbow-mode .
- [(0 2)
+ [(0 4)
nil "Colorize color names in buffers" single])
(register-list .
[(0 1)
@@ -113,6 +119,9 @@
(smart-operator .
[(4 0)
nil "Insert operators with surrounding spaces smartly" single])
+ (sml-mode .
+ [(6 1)
+ nil "Major mode for editing (Standard) ML" single])
(svg-clock .
[(0 4)
nil "Analog clock using Scalable Vector Graphics" single])
View
2  elpa/archives/marmalade/archive-contents
1 addition, 1 deletion not shown
View
26 elpa/midje-mode-0.1.1/README.md
@@ -0,0 +1,26 @@
+# Overview
+
+Midje-mode is an Emacs minor mode for
+[Midje](https://github.com/marick/Midje) - test framework for Clojure,
+which provides a migration path from clojure.test to a more flexible,
+readable, abstract, and gracious style of testing.
+
+See also wiki pages
+[about midje-mode](https://github.com/marick/Midje/wiki/Midje-mode)
+and [clojure-jump-to-file](https://github.com/marick/Midje/wiki/Clojure-jump-to-file).
+
+# Install
+
+Midje-mode can be installed through el-get: just add `midje-mode` to
+your `el-get-sources`.
+
+In addition, Midje-mode is on [marmalade-repo.org](http://marmalade-repo.org). Follow the
+instructions on marmalade-repo.org to use the maramalde repo, then
+install the midje-mode package.
+
+Finally, you can download files manually
+and place it somewhere on `load-path`, then add following lines to
+your .emacs file:
+
+ (require 'midje-mode)
+ (require 'clojure-jump-to-file)
View
79 elpa/midje-mode-0.1.1/clojure-jump-to-file.el
@@ -0,0 +1,79 @@
+(require 'clojure-mode)
+
+(defvar midje-root nil)
+(defvar midje-filename-stash '())
+(global-set-key "\^hj" 'midje-visit-source)
+
+(defun midje-root (here)
+ "Set the root directory that."
+ (interactive "DProject Root Directory: ")
+ ;; This wants to work in all buffers (or all shell buffers)?
+ (setq midje-root (expand-file-name here))
+ (setq midje-filename-stash '()))
+
+
+(defun midje-visit-source ()
+ "If the current line contains text like '../src/program.clj:34', visit
+that file in the other window and position point on that line."
+ (interactive)
+ (unless midje-root (call-interactively #'midje-root))
+ (let* ((start-boundary (save-excursion (beginning-of-line) (point)))
+ (regexp (concat "\\([ \t\n\r\"'([<{]\\|^\\)" ; non file chars or
+ ; effective
+ ; beginning of file
+ "\\(.+\\.clj\\):\\([0-9]+\\)" ; file.rb:NNN
+ "\\(\\+[0-9]\\)?"
+ ))
+ (matchp (save-excursion
+ (end-of-line)
+ ;; if two matches on line, the second is most likely
+ ;; to be useful, so search backward.
+ (re-search-backward regexp start-boundary t))))
+
+ (if matchp
+ (let ((file (midje-match-part 2))
+ (line (midje-match-part 3))
+ (increment (midje-match-part 4)))
+ (midje-goto file line increment))
+ (error "No Clojure location on line."))))
+
+
+
+(defun midje-reload-filename-stash (dir)
+ (setq midje-filename-stash
+ (split-string
+ (shell-command-to-string
+ (concat "find "
+ (shell-quote-argument dir)
+ " -name "
+ (shell-quote-argument "*.clj")
+ " -print "))))
+ nil)
+
+(defun midje-matching-file (file)
+ (message (concat "Looking for this file: " file))
+ (let* ((regexp (concat "/" file "$")))
+ (find-if (lambda (fullpath) (string-match regexp fullpath))
+ midje-filename-stash))
+)
+
+(defun midje-goto (file line increment)
+ (let ((relevant-file (or (midje-matching-file file)
+ (midje-reload-filename-stash midje-root)
+ (midje-matching-file file))))
+ (message (concat "relevant file is " relevant-file))
+ (message increment)
+ (if (not relevant-file)
+ (error (concat "No Clojure file matches " file))
+ (find-file-other-window relevant-file)
+ (goto-line (string-to-int line))
+ (if increment
+ (search-forward "=>" nil nil (string-to-int increment)))))
+)
+
+(defun midje-match-part (n)
+ (if (match-beginning n)
+ (buffer-substring (match-beginning n) (match-end n))
+ nil))
+
+(provide 'clojure-jump-to-file)
View
BIN  elpa/midje-mode-0.1.1/clojure-jump-to-file.elc
Binary file not shown
View
36 elpa/midje-mode-0.1.1/midje-mode-autoloads.el
@@ -0,0 +1,36 @@
+;;; midje-mode-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+
+
+;;;### (autoloads (midje-mode) "midje-mode" "midje-mode.el" (20642
+;;;;;; 48365))
+;;; Generated autoloads from midje-mode.el
+
+(autoload 'midje-mode "midje-mode" "\
+A minor mode for running Midje tests when in `slime-mode'.
+
+\\{midje-mode-map}
+
+\(fn &optional ARG)" t nil)
+
+(defun midje-mode-maybe-enable nil "\
+Enable midje-mode if the current buffer contains a \"midje.\" string." (let ((regexp "midje\\.")) (save-excursion (when (or (re-search-backward regexp nil t) (re-search-forward regexp nil t)) (midje-mode t)))))
+
+(add-hook 'clojure-mode-hook 'midje-mode-maybe-enable)
+
+;;;***
+
+;;;### (autoloads nil nil ("clojure-jump-to-file.el" "midje-mode-pkg.el"
+;;;;;; "midje-mode-praise.el") (20642 48365 356448))
+
+;;;***
+
+(provide 'midje-mode-autoloads)
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; coding: utf-8
+;; End:
+;;; midje-mode-autoloads.el ends here
View
3  elpa/midje-mode-0.1.1/midje-mode-pkg.el
@@ -0,0 +1,3 @@
+(define-package "midje-mode" "0.1.1"
+ "Minor mode for running Midje tests in emacs, see: https://github.com/dnaumov/midje-mode"
+ '((slime "1.0") (clojure-mode "1.0")))
View
BIN  elpa/midje-mode-0.1.1/midje-mode-pkg.elc
Binary file not shown
View
54 elpa/midje-mode-0.1.1/midje-mode-praise.el
@@ -0,0 +1,54 @@
+(defun midje-random-praise ()
+ (concat (nth (mod (random t) (length midje-praise-quotes))
+ midje-praise-quotes )
+ "\n"))
+
+(defvar midje-praise-quotes
+'(
+ "When someone asks you if you're a god, you say 'YES'! -- Zeddemore"
+ "The work itself praises the master. -- CPE Bach"
+ "Happiness comes when you believe that you have done something truly meaningful. -- Yan"
+ "I do believe in praising that which deserves to be praised. -- Dean Smith"
+ "Out of clutter find simplicity; from discord find harmony; in the middle of difficulty lies opportunity. -- Einstein"
+ "Satisfaction lies in the effort, not in the attainment, full effort is full victory. -- Gandhi"
+ "One of the symptoms of an approaching nervous breakdown is the belief that one's work is terribly important. -- Russell"
+ "The sum of wisdom is that time is never lost that is devoted to work. -- Emerson"
+ "Without work, all life goes rotten. -- Camus"
+ "Work joyfully and peacefully, knowing that right thoughts and right efforts will inevitably bring about right results. -- Allen"
+ "Work is either fun or drudgery. It depends on your attitude. I like fun. -- Barrett"
+ "There's a certain satisfaction in a little bit of pain. -- Madonna"
+ "One small test for a codebase, one giant leap for quality kind! -- @zspencer"
+ "Hey! You're green! Refactor then we get to go red again! -- @zspencer"
+ "Woohoo! -- @zspencer"
+ "Ding! You Have Gained Experience -- @zspencer"
+ "A journey of a thousand miles begins with a single step. -- @alanmstokes"
+ "If this isn't nice, I don't know what is. -- Vonnegut"
+ "Simplicity, carried to the extreme, becomes elegance. -- Jon Franklin"
+ "This is the future you were hoping for. -- @Vaguery"
+ "O frabjous day! Callooh! Callay! -- Lewis Carroll"
+ "Whoever wants to reach a distant goal must take small steps. -- fortune cookie"
+ "The next function taunts you still. Will you rise to the challenge? -- anonymous"
+ "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction. -- Schumacher"
+ "Excellence is not an act but a habit. -- Aristotle"
+ "Code you'd be proud to give your mom to show off on the fridge. -- Mike Cohn"
+ "A clean boundary between useful abstractions and the grubby code that touches the real world is always a good thing. -- Ron Jeffries"
+ "Of course the universe *is* out to get us, but it's not going to do it by passing a null to one of our methods. -- Ron Jeffries"
+ "Good code is its own best documentation. -- Steve McConnell"
+ "First they ignored you, then they laughed at you, then they fought you, now you've won. -- Not quite Gandhi"
+ "The reward of a thing well done is to have done it. -- Emerson"
+ "The highest reward for a man's toil is not what he gets for it but what he becomes by it. -- Ruskin"
+ "Before the reward there must be labor. You plant before you harvest. You sow in tears before you reap joy. -- Ransom"
+ "Intellectual 'work' is misnamed; it is a pleasure, a dissipation, and is its own highest reward. -- Twain"
+ "The biggest reward for a thing well done is to have done it. -- Voltaire"
+ "Effort only fully releases its reward after a person refuses to quit. -- Hill"
+ "The journey is the reward. -- traditional"
+ "For every disciplined effort, there is a multiple reward. -- Rohn"
+ "Happiness is not a reward / it is a consequence. -- Ingersoll"
+ "It takes time to succeed because success is merely the natural reward of taking time to do anything well. -- Ross"
+ "There is an inevitable reward for good deeds. -- Ming Fu Wu"
+ "Achievement is its own reward. -- David Lynch"
+ "Not in rewards, but in the strength to strive, the blessing lies. -- Towbridge"
+ "The right word may be effective, but no word was ever as effective as a rightly timed pause. -- Twain"
+))
+
+(provide 'midje-mode-praise)
View
BIN  elpa/midje-mode-0.1.1/midje-mode-praise.elc
Binary file not shown
View
315 elpa/midje-mode-0.1.1/midje-mode.el
@@ -0,0 +1,315 @@
+;;; midje-mode.el --- Minor mode for Midje tests
+
+(require 'clojure-mode)
+(require 'slime)
+(require 'newcomment)
+(require 'midje-mode-praise)
+
+(defvar midje-running-fact nil) ;; KLUDGE!
+
+(defvar midje-comments ";.;.")
+(defvar last-checked-midje-fact nil)
+(defvar midje-fact-regexp "^(facts?\\([[:space:]]\\|$\\)")
+(defvar midje-syntax-table nil)
+
+;; Callbacks
+(defun midje-insert-above-fact (result)
+ (if (bolp) (forward-char)) ; at first character of defun, beginning-of-defun moves back.
+ (beginning-of-defun)
+ (midje-provide-result-info result))
+
+(defun midje-insert-below-code-under-test (result)
+ (end-of-defun)
+ (next-line)
+ (midje-provide-result-info result))
+
+;; Util
+
+(defun midje-at-start-of-identifier? ()
+ (not (string= (string (char-syntax (char-before))) "w")))
+
+(defun midje-identifier ()
+ "Return text of nearest identifier."
+ (when (not midje-syntax-table)
+ (setq midje-syntax-table (make-syntax-table (syntax-table)))
+ (modify-syntax-entry ?- "w" midje-syntax-table)
+ (modify-syntax-entry ?? "w" midje-syntax-table)
+ (modify-syntax-entry ?! "w" midje-syntax-table))
+
+ (save-excursion
+ (with-syntax-table midje-syntax-table
+ (let ((beg (if (midje-at-start-of-identifier?)
+ (point)
+ (progn (backward-word) (point)))))
+ (forward-word)
+ (buffer-substring-no-properties beg (point))))))
+
+(defun midje-to-unfinished ()
+ (goto-char (point-min))
+ (search-forward-regexp "(\\(.*/\\)?unfinished"))
+
+(defun midje-within-unfinished? ()
+ (let ((target (point))
+ unfinished-beg
+ unfinished-end)
+ (save-excursion
+ (save-restriction
+ (midje-to-unfinished)
+ (beginning-of-defun)
+ (setq unfinished-beg (point))
+ (end-of-defun)
+ (setq unfinished-end (point))
+ (and (>= target unfinished-beg)
+ (<= target unfinished-end))))))
+
+(defun midje-tidy-unfinished ()
+ (midje-to-unfinished) (let ((fill-prefix "")) (fill-paragraph nil))
+ (midje-to-unfinished)
+ (beginning-of-defun)
+ (let ((beg (point)))
+ (end-of-defun)
+ (indent-region beg (point))))
+
+(defun midje-eval-unfinished ()
+ (midje-to-unfinished)
+ (end-of-defun)
+ (slime-eval-last-expression))
+
+(defun midje-add-identifier-to-unfinished-list (identifier)
+ (save-excursion
+ (save-restriction
+ (widen)
+ (midje-to-unfinished) (insert " ") (insert identifier)
+ (midje-tidy-unfinished)
+ (midje-eval-unfinished))))
+
+(defun midje-remove-identifier-from-unfinished-list ()
+ (save-excursion
+ (save-restriction
+ (widen)
+ (let ((identifier (midje-identifier)))
+ (with-syntax-table midje-syntax-table
+ (unless (midje-at-start-of-identifier?) (backward-word))
+ (kill-word nil)
+ (midje-tidy-unfinished)
+ identifier)))))
+
+(defun midje-add-defn-after-unfinished (identifier)
+ (widen)
+ (end-of-defun)
+ (newline-and-indent)
+ (insert "(defn ")
+ (insert identifier)
+ (insert " [])")
+ (newline-and-indent)
+ (newline-and-indent)
+ (insert "(fact \"\")")
+ (newline-and-indent)
+ (search-backward "[]")
+ (forward-char))
+
+(defun midje-provide-result-info (result)
+ (destructuring-bind (output value) result
+ (if (string= output "")
+ (midje-display-reward)
+ (midje-insert-failure-message output))))
+
+(defun midje-insert-failure-message (str &optional justify)
+ (let ((start-point (point))
+ (end-point (progn (insert str) (point))))
+ (midje-add-midje-comments start-point end-point)
+ (goto-char start-point)
+ (unless (string= ";" (char-to-string (char-after)))
+ (delete-char 1))))
+
+(defun midje-display-reward ()
+ (save-excursion
+ (save-restriction
+ (let ((start (point)))
+ (insert (midje-random-praise))
+ (narrow-to-region start (point))
+ (goto-char (point-min))
+ (fill-paragraph nil)
+ (midje-add-midje-comments (point-min) (point-max))))))
+
+(defun midje-add-midje-comments (start-point end-point)
+ (let ((comment-start midje-comments)
+ (comment-empty-lines t))
+ (comment-region start-point end-point)))
+
+(defun midje-on-fact? ()
+ (save-excursion
+ (save-restriction
+ (narrow-to-defun)
+ (goto-char (point-min))
+ (search-forward "fact" nil t))))
+
+(defun midje-doto-facts (fun)
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward midje-fact-regexp nil t)
+ (funcall fun))))
+
+
+(add-hook 'midje-mode-hook 'midje-colorize)
+(defun midje-colorize ()
+ (flet ((f (keywords face)
+ (cons (concat "\\<\\("
+ (mapconcat 'symbol-name keywords "\\|")
+ "\\)\\>")
+ face)))
+ (font-lock-add-keywords
+ nil
+ (list (f '(fact facts future-fact future-facts tabular provided)
+ 'font-lock-keyword-face)
+ (f '(just contains has has-suffix has-prefix
+ truthy falsey anything exactly roughly throws)
+ 'font-lock-type-face)
+ '("=>\\|=not=>" . font-lock-negation-char-face) ; arrows
+ '("\\<\\.+[a-zA-z]+\\.+\\>" . 'font-lock-type-face))))) ; metaconstants
+
+
+;; Interactive
+
+(defun midje-next-fact ()
+ (interactive)
+ (re-search-forward midje-fact-regexp))
+
+(defun midje-previous-fact ()
+ (interactive)
+ (re-search-backward midje-fact-regexp))
+
+(defun midje-clear-comments ()
+ "Midje uses comments to display test results. Delete
+all such comments."
+ (interactive)
+ (save-excursion
+ (goto-char (point-min))
+ (let ((kill-whole-line t))
+ (while (search-forward midje-comments nil t)
+ (beginning-of-line)
+ (kill-line)))))
+
+(defun midje-check-fact-near-point ()
+ "Used when `point' is on or just after a Midje fact.
+Check that fact and also save it for use of
+`midje-recheck-last-fact-checked'."
+ (interactive)
+ (midje-clear-comments)
+ (let ((string (save-excursion
+ (mark-defun)
+ (buffer-substring-no-properties (mark) (point)))))
+ (setq last-checked-midje-fact string)
+ (slime-eval-async `(swank:eval-and-grab-output ,string)
+ 'midje-insert-above-fact)))
+
+(defun midje-recheck-last-fact-checked ()
+ "Used when `point` is on or just after a def* form.
+Has the Clojure REPL compile that form, then rechecks
+the last fact checked (by `midje-check-fact-near-point')."
+
+ (interactive)
+ (midje-clear-comments)
+ (setq midje-running-fact t)
+ (slime-compile-defun)
+ ; Callback is slime-compilation-finished, then midje-after-compilation-check-fact
+ )
+
+;; This is a HACK. I want to add midje-after-compilation-check-fact to
+;; the slime-compilation-finished-hook, but I can't seem to override the
+;; :options declaration in the original slime.el defcustom.
+(unless (fboundp 'original-slime-compilation-finished)
+ (setf (symbol-function 'original-slime-compilation-finished)
+ (symbol-function 'slime-compilation-finished)))
+
+(defun slime-compilation-finished (result)
+ (original-slime-compilation-finished result)
+ (with-struct (slime-compilation-result. notes duration successp) result
+ (if successp (midje-after-compilation-check-fact))))
+
+(defun midje-after-compilation-check-fact ()
+ (if midje-running-fact
+ (slime-eval-async `(swank:eval-and-grab-output ,last-checked-midje-fact)
+ 'midje-insert-below-code-under-test))
+ (setq midje-running-fact nil))
+
+(defun midje-check-fact ()
+ "If on or near a Midje fact, check it with
+`midje-check-fact-near-point'. Otherwise, compile the
+nearby Clojure form and recheck the last fact checked
+(with `midje-recheck-last-fact-checked')."
+ (interactive)
+ (if (midje-on-fact?)
+ (midje-check-fact-near-point)
+ (midje-recheck-last-fact-checked)))
+
+(defun midje-hide-all-facts ()
+ (interactive)
+ (midje-doto-facts #'hs-hide-block))
+
+(defun midje-show-all-facts ()
+ (interactive)
+ (midje-doto-facts #'hs-show-block))
+
+
+(defun midje-focus-on-this-fact ()
+ (interactive)
+ (midje-hide-all-facts)
+ (hs-show-block))
+
+(defun midje-unfinished ()
+ (interactive)
+ (if (midje-within-unfinished?)
+ (midje-add-defn-after-unfinished (midje-remove-identifier-from-unfinished-list))
+ (midje-add-identifier-to-unfinished-list (midje-identifier))))
+
+(defvar midje-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "C-c ,") 'midje-check-fact)
+ (define-key map (kbd "C-c .") 'midje-check-fact)
+ (define-key map (kbd "C-c C-,") 'midje-check-fact-near-point)
+ (define-key map (kbd "C-c C-.") 'midje-recheck-last-fact-checked)
+ (define-key map (kbd "C-c k") 'midje-clear-comments)
+
+ (define-key map (kbd "C-c f") 'midje-focus-on-this-fact)
+ (define-key map (kbd "C-c h") 'midje-hide-all-facts)
+ (define-key map (kbd "C-c s") 'midje-show-all-facts)
+
+ (define-key map (kbd "C-c n") 'midje-next-fact)
+ (define-key map (kbd "C-c p") 'midje-previous-fact)
+
+ (define-key map (kbd "C-c u") 'midje-unfinished)
+
+ map)
+ "Keymap for Midje mode.")
+
+;;;###autoload
+(define-minor-mode midje-mode
+ "A minor mode for running Midje tests when in `slime-mode'.
+
+\\{midje-mode-map}"
+ nil " Midje" midje-mode-map
+ ;; This doesn't seem to work.
+ ;; (custom-add-option 'slime-compilation-finished-hook
+ ;; 'midje-post-compilation-action)
+ (hs-minor-mode 1))
+
+;;;###autoload
+(progn
+ (defun midje-mode-maybe-enable ()
+ "Enable midje-mode if the current buffer contains a \"midje.\" string."
+ (let ((regexp "midje\\."))
+ (save-excursion
+ (when (or (re-search-backward regexp nil t)
+ (re-search-forward regexp nil t))
+ (midje-mode t)))))
+ (add-hook 'clojure-mode-hook 'midje-mode-maybe-enable))
+
+(eval-after-load 'clojure-mode
+ '(define-clojure-indent
+ (fact 'defun)
+ (facts 'defun)
+ (against-background 'defun)
+ (provided 0)))
+
+(provide 'midje-mode)
View
BIN  elpa/midje-mode-0.1.1/midje-mode.elc
Binary file not shown
View
1  elpa/pax_global_header
@@ -0,0 +1 @@
+52 comment=6794f984dab285b08b3fd15d2ea37681562461db
View
39 init.el
@@ -41,6 +41,13 @@
(normal-top-level-add-subdirs-to-load-path)))
load-path)))
+;disable backup
+(setq backup-inhibited t)
+;disable auto save
+(setq auto-save-default nil)
+
+(setq ispell-program-name "hunspell")
+
(setq-default display-buffer-reuse-frames nil)
;;(require 'org-drill) wants org-learn
@@ -237,6 +244,7 @@
;(require 'flymake-ruby)
;(add-hook 'ruby-mode-hook 'flymake-ruby-load)
(add-to-list 'auto-mode-alist '("\\.rabl$" . ruby-mode))
+(add-to-list 'auto-mode-alist '("\\.hamlc$" . haml-mode))
(defun trim-string (string)
"Remove white spaces in beginning and ending of STRING.
@@ -299,12 +307,12 @@
;; better backup and autosave handling
-(setq
- backup-by-copying t ; don't clobber symlinks
- delete-old-versions t
- kept-new-versions 6
- kept-old-versions 2
- version-control t) ; use versioned backups
+;; (setq
+;; backup-by-copying t ; don't clobber symlinks
+;; delete-old-versions t
+;; kept-new-versions 6
+;; kept-old-versions 2
+;; version-control t) ; use versioned backups
(setq backup-directory-alist
@@ -433,9 +441,13 @@
(add-hook 'after-init-hook
#'(lambda ()
+
(when (locate-library "slime-js")
+ (require 'haml-coffee-mode)
(require 'setup-slime-js))))
+
+
(global-set-key [f5] 'slime-js-reload)
(add-hook 'js2-mode-hook
(lambda ()
@@ -446,13 +458,26 @@
(defun turn-on-tabs ()
(setq indent-tabs-mode t))
+(defun turn-off-tabs ()
+ (setq indent-tabs-mode nil))
+
+(add-hook 'haml-mode-hook
+ (lambda ()
+ (turn-off-tabs)))
+
(add-hook 'coffee-mode-hook
(lambda ()
- (turn-on-tabs)
(local-set-key (kbd "C-c C-d") 'slime-js-coffee-eval-current)
(local-set-key (kbd "C-c C-b") 'slime-js-coffee-eval-buffer)
(slime-js-minor-mode 1)))
+(add-hook 'haml-mode-hook
+ (lambda ()
+ (local-set-key (kbd "C-c C-d") 'slime-js-haml-coffee-eval-current)
+ (local-set-key (kbd "C-c C-b") 'slime-js-haml-coffee-eval-buffer)
+ (slime-js-minor-mode 1)))
+
+
;; ;; Close the compilation window if there was no error at all.
;; (setq compilation-exit-message-function
;; (lambda (status code msg)
View
1  site-lisp/.#coffee-mode.el
View
154 site-lisp/haml-coffee-mode.el
@@ -0,0 +1,154 @@
+;;; haml-coffee-mode.el --- Minor mode to compile HamlCoffee files in Emacs
+
+;; Copyright (C) 2012 Daniel Woelfel
+
+;; Version: 0.1.0
+;; Keywords: HamlCoffee minor mode
+;; Author: Daniel Woelfel <daniel@danielwoelfel.com>
+;; URL: http://github.com/dwwoelfel/haml-coffee-mode
+
+;; This file is not part of GNU Emacs.
+
+;; 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 this program; if not, write to the Free Software
+;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Commentary
+
+;; For commentary please see the README.md or
+;; http://github.com/dwwoelfel/haml-coffee-mode#readme
+
+;;; Installation
+
+;; In your shell:
+
+;; $ cd ~/.emacs.d/vendor
+;; $ git clone git://github.com/dwwoelfel/haml-coffee-mode.git
+
+;; In your emacs config:
+
+;; (add-to-list 'load-path "~/.emacs.d/vendor/haml-coffee-mode")
+;; TODO: This should be a hook
+;; (require 'haml-coffee-mode)
+
+;;; Thanks
+
+;; Major thanks to http://github.com/defunkt/coffee-mode
+;; This mode is a blantant rip-off of coffee-mode
+
+;;; Code:
+
+(require 'haml-mode)
+
+(defconst haml-coffee-mode-version "0.1.0"
+ "The version of this `haml-coffee-mode'.")
+
+(defgroup haml-coffee nil
+ "A HamlCoffee minor mode meant to supplement Haml-mode"
+ :group 'languages)
+
+(defcustom haml-coffee-js-mode 'js2-mode
+ "The mode to use when viewing compiled JavaScript."
+ :type 'string
+ :group 'haml-coffee)
+
+(defcustom haml-coffee-compiled-buffer-name "*haml-coffee-compiled*"
+ "The name of the scratch buffer used for compiled HamlCoffee."
+ :type 'string
+ :group 'haml-coffee)
+
+(defcustom haml-coffee-command "haml-coffee"
+ "The Haml-Coffee command used for evaluating code. Must be in your
+path."
+ :type 'string
+ :group 'haml-coffee)
+
+(defcustom haml-coffee-args-compile '("--disable-html-escaping")
+ "The command line args to pass to `haml-coffee-command' when compiling a file."
+ :type 'list
+ :group 'haml-coffee)
+
+(defvar haml-coffee-mode-hook nil
+ "A hook for you to run your own code when the mode is loaded.")
+
+;; TODO: Custom namespace
+;; (defcustom haml-coffee-namespace nil
+;; "If non-nil, will change template namespace"
+;; :type 'string
+;; :group 'haml-coffee)
+
+;; TODO: Custom template name
+;; (defcustom haml-coffee-root-path nil
+;; "If non-nil, template name will use remaining portion of path"
+;; :type 'string
+;; :group 'haml-coffee)
+
+;;
+;; Compat
+;;
+
+(unless (fboundp 'apply-partially)
+ (defun apply-partially (fun &rest args)
+ "Return a function that is a partial application of FUN to ARGS.
+ARGS is a list of the first N arguments to pass to FUN.
+The result is a new function which does the same as FUN, except that
+the first N arguments are fixed at the values with which this function
+was called."
+ (lexical-let ((fun fun) (args1 args))
+ (lambda (&rest args2) (apply fun (append args1 args2))))))
+
+;;
+;; Macros
+;;
+
+(defmacro haml-coffee-line-as-string ()
+ "Returns the current line as a string."
+ `(buffer-substring (point-at-bol) (point-at-eol)))
+
+;;
+;; Commands
+;;
+
+;; TODO: Custom template name
+(defun haml-coffee-template-name ()
+ "Determines the template name from the buffer name. Must be called when buffer to compile is selected!"
+ (interactive)
+ (replace-regexp-in-string
+ "[\s-]+" "_"
+ (replace-regexp-in-string
+ "\\(\.html\\)?.haml[c]?$" "" (buffer-name))))
+
+(defun haml-coffee-compile-buffer ()
+ "Compiles the current buffer and displays the JS in another buffer."
+ (interactive)
+ (save-excursion
+ (haml-coffee-compile-region (point-min) (point-max))))
+
+(defun haml-coffee-compile-region (start end)
+ "Compiles a region and displays the JS in another buffer."
+ (interactive "r")
+
+ (let ((buffer (get-buffer haml-coffee-compiled-buffer-name)))
+ (when buffer
+ (kill-buffer buffer)))
+
+ (apply (apply-partially 'call-process-region start end haml-coffee-command
+ nil
+ (get-buffer-create haml-coffee-compiled-buffer-name)
+ nil)
+ (append haml-coffee-args-compile (list "-t" (haml-coffee-template-name))))
+ (switch-to-buffer (get-buffer haml-coffee-compiled-buffer-name))
+ (funcall haml-coffee-js-mode)
+ (goto-char (point-min)))
+
+(provide 'haml-coffee-mode)
View
20 site-lisp/setup-slime-js.el
@@ -30,13 +30,14 @@
(require 'slime)
(require 'slime-js)
(require 'coffee-mode)
+(require 'haml-coffee-mode)
(setq slime-js-target-url "http://localhost:8090")
(setq slime-js-connect-url "http://localhost:8009")
(setq slime-js-starting-url "/")
(setq slime-js-swank-command "swank-js")
-(setq slime-js-swank-args '())
-(setq slime-js-browser-command "google-chrome")
+(setq slime-js-swank-args '("4008"))
+(setq slime-js-browser-command "chrome")
(setq slime-js-browser-jacked-in-p nil)
(add-hook 'js2-mode-hook (lambda () (slime-js-minor-mode 1)))
@@ -53,7 +54,7 @@
(slime-js-run-swank)
(sleep-for 1)
(setq slime-protocol-version 'ignore)
- (slime-connect "localhost" 4005))
+ (slime-connect "localhost" 4008))
(defun slime-js-jack-in-browser ()
"Start a swank-js server, connect to it, open a repl, open a browser, connect to that."
@@ -131,7 +132,18 @@
(coffee-compile-buffer)
(switch-to-buffer coffee-compiled-buffer-name) ;; defined in coffee-mode
(slime-js-eval-buffer)
- (kill-buffer coffee-compiled-buffer-name))
+ (kill-buffer coffee-compiled-buffer-name)
+ (slime-js-eval "SammyApp.refresh()") ;; make this a hook?
+ )
+
+(defun slime-js-haml-coffee-eval-buffer ()
+ (interactive)
+ (haml-coffee-compile-buffer)
+ (switch-to-buffer haml-coffee-compiled-buffer-name) ;; defined in haml-coffee-mode
+ (slime-js-eval-buffer)
+ (kill-buffer haml-coffee-compiled-buffer-name)
+ (slime-js-eval "SammyApp.refresh()") ;; make this a hook?
+ (message "Sent buffer to remote"))
;; Remove slime-minor-mode from mode line if diminish.el is installed
(when (boundp 'diminish)

No commit comments for this range

Something went wrong with that request. Please try again.