Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit df01782bed9dcb050345f9bac3c551fecfcdac3d @candera committed Mar 27, 2011
Showing with 18,818 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +74 −0 ac-slime.el
  3. +65 −0 candera/journal.el
  4. +467 −0 csharp-mode-0.7.0.el
  5. +435 −0 edit-server.el
  6. +308 −0 highlight-symbol.el
  7. +763 −0 init.el
  8. +699 −0 javascript.el
  9. +11,927 −0 js2.el
  10. +1,469 −0 markdown-mode.el
  11. +2,516 −0 paredit.el
  12. +93 −0 refactor.el
@@ -0,0 +1,2 @@
+*.elc
+*~
@@ -0,0 +1,74 @@
+;;----------------------------------------------------------------------------
+;; An auto-complete source using slime completions
+;;
+;; Author: Steve Purcell <steve at sanityinc dot com>
+;;
+;; Usage:
+;; (require 'ac-slime)
+;; (add-hook 'slime-mode-hook 'set-up-slime-ac)
+;; (add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
+;;----------------------------------------------------------------------------
+
+(eval-when-compile (require 'cl))
+
+(defun ac-source-slime-fuzzy-candidates ()
+ "Return a possibly-empty list of fuzzy completions for the symbol at point."
+ (if (slime-connected-p)
+ (let ((slime-fuzzy-completion-limit 50))
+ (mapcar 'car (car (slime-fuzzy-completions ac-prefix))))))
+
+(defun ac-source-slime-simple-candidates ()
+ "Return a possibly-empty list of completions for the symbol at point."
+ (if (slime-connected-p)
+ (car (slime-simple-completions ac-prefix))))
+
+(defvar ac-slime-current-doc nil "Holds slime docstring for current symbol")
+(defun ac-slime-documentation (symbol-name)
+ (let ((symbol-name (substring-no-properties symbol-name)))
+ (slime-eval `(swank:documentation-symbol ,symbol-name))))
+
+(defun ac-slime-init ()
+ (setq ac-slime-current-doc nil))
+
+(defface ac-slime-menu-face
+ '((t (:inherit 'ac-candidate-face)))
+ "Face for slime candidate menu."
+ :group 'auto-complete)
+
+(defface ac-slime-selection-face
+ '((t (:inherit 'ac-selection-face)))
+ "Face for the slime selected candidate."
+ :group 'auto-complete)
+
+(defvar ac-source-slime-fuzzy
+ '((init . ac-slime-init)
+ (candidates . ac-source-slime-fuzzy-candidates)
+ (candidate-face . ac-slime-menu-face)
+ (selection-face . ac-slime-selection-face)
+ (prefix . slime-symbol-start-pos)
+ (symbol . "l")
+ (document . ac-slime-documentation))
+ "Source for fuzzy slime completion")
+
+(defvar ac-source-slime-simple
+ '((init . ac-slime-init)
+ (candidates . ac-source-slime-simple-candidates)
+ (candidate-face . ac-slime-menu-face)
+ (selection-face . ac-slime-selection-face)
+ (prefix . slime-symbol-start-pos)
+ (symbol . "l")
+ (document . ac-slime-documentation))
+ "Source for slime completion")
+
+
+(defun set-up-slime-ac (&optional fuzzy)
+ "Add an optionally-fuzzy slime completion source to the
+front of `ac-sources' for the current buffer."
+ (interactive)
+ (setq ac-sources (add-to-list 'ac-sources
+ (if fuzzy
+ 'ac-source-slime-fuzzy
+ 'ac-source-slime-simple))))
+
+
+(provide 'ac-slime)
@@ -0,0 +1,65 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; This section sets up automatic journal file creation
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defvar *journal-roots* '()) ; new entries must end with slash
+
+(defun find-yesterday-log-file (&optional days-ago)
+ "Open a file that has the default settings for yesterday's entry"
+ (interactive "p")
+ (let*
+ ((n-days-ago (if (null days-ago) 1 days-ago))
+ (logfile-date (time-n-days-ago n-days-ago))
+ (logfile-directory (available-logfile-directory *journal-roots*))
+ (new-logfile-directory (format-time-string (concat logfile-directory "%Y/%m-%b") logfile-date))
+ (new-logfile-filename
+ (format-time-string
+ (concat new-logfile-directory "/%Y%m%d.txt") logfile-date)))
+ (progn
+ (make-directory new-logfile-directory 't)
+ (find-file new-logfile-filename)
+ (unless (file-exists-p new-logfile-filename)
+ (insert (concat (format-time-string "%A, %B " logfile-date)
+ (day-of-month-ordinal (string-to-number (format-time-string "%e" logfile-date)))
+ (format-time-string ", %Y." logfile-date)))
+ (newline)
+ (newline)
+ (newline)
+ (previous-line))
+ ;; (flyspell-mode 1)
+ (message (concat "Opened " new-logfile-filename)))))
+
+;; (defun days-ago (n)
+;; "Returns a value similar to current-time, but for n days ago"
+;; (interactive)
+;; (let ((now (float-time)))
+;; (
+
+(defun time-n-days-ago (n)
+ "Returns a value similar to get-float-time, but for n days ago"
+ (interactive)
+ (seconds-to-time (- (float-time) (* 24 3600 n))))
+
+(defun available-logfile-directory (journal-roots)
+ "Returns the first available directory from the list journal-roots"
+ (interactive)
+ (if journal-roots
+ (if (or (file-directory-p (car journal-roots))
+ (tramp-handle-file-directory-p (car journal-roots)))
+ (car journal-roots)
+ (available-logfile-directory (cdr journal-roots)))
+ nil))
+
+(defun day-of-month-ordinal (n)
+ "Returns ordinal for range 1-31 (1st, 2nd, 3rd, etc.)"
+ ()
+ (if (= n 1) "1st"
+ (if (= n 2) "2nd"
+ (if (= n 3) "3rd"
+ (if (= n 21) "21st"
+ (if (= n 22) "22nd"
+ (if (= n 23) "23rd"
+ (if (= n 31) "31st"
+ (if (and (> n 0) (< n 31)) (concat (number-to-string n) "th") nil)))))))))
+
Oops, something went wrong.

0 comments on commit df01782

Please sign in to comment.