Skip to content

Instantly share code, notes, and snippets.

View hchbaw's full-sized avatar

Takeshi Banse hchbaw

View GitHub Profile
(defun* my-funcall-and-eval-last-sexp (before &optional (eval-last-sexp 'eval-last-sexp))
"Call 0 arg procedure BEFORE then call interactive command EVAL-LAST-SEXP."
(save-excursion
(funcall before)
(call-interactively eval-last-sexp)))
(defmacro define-my-eval-sexp* (eval-last-sexp inner-sexp inner-list)
(declare (indent 1))
`(progn
(defun ,inner-sexp ()
(interactive)
(defun get-scores ()
(let ((h (make-hash-table :test 'eql)))
(mapatoms (lambda (sym)
(let ((s (symbol-name sym)))
(unless (equal s "")
(if (gethash (aref s 0) h)
(incf (gethash (aref s 0) h))
(puthash (aref s 0) 1 h))))))
(let (xs)
(maphash (lambda (k v)
;;; http://www.emacswiki.org/emacs/anything-complete.el
(defun* alcs-transformer-prepend-spacer+-0
(candidates source &optional (prepend (lambda (cand column)
(concat (make-string column ? )
cand))))
(let ((column (with-current-buffer anything-current-buffer
(save-excursion
(backward-char (string-width anything-complete-target))
(let ((col (alcs-current-physical-column)))
(if (< col 0)
(progn
(defun tst ()
(macrolet ((with-window-testing-buffer (lines &rest body)
(let ((gb (gensym)))
`(let ((,gb (get-buffer-create "testing")))
(switch-to-buffer ,gb)
(erase-buffer)
(dotimes (_ ,lines)
(insert "a\n"))
(unwind-protect
@hchbaw
hchbaw / t.diff
Created September 18, 2009 23:14
diff --git a/vimpulse-text-object-system.el b/vimpulse-text-object-system.el
index d62225b..21e5445 100644
--- a/vimpulse-text-object-system.el
+++ b/vimpulse-text-object-system.el
@@ -135,6 +135,12 @@ (defun vimpulse-get-vWord-bounds (pos)
(re-search-backward "[\n\r[:space:]]")
(cons (1+ (point)) result))))
+ (defun vimpulse-get-sexp-bounds (pos)
+ (save-excursion
;;; swank_fuzzy.clj --- fuzzy symbol completion, Clojure implementation.
;; Original CL implementation authors (from swank-fuzzy.lisp) below,
;; Authors: Brian Downing <[email protected]>
;; Tobias C. Rittweiler <[email protected]>
;; and others
;; This progam is based on the swank-fuzzy.lisp.
;; Thanks the CL implementation authors for that useful software.
int main(int argc, char** argv) {
return 0;
}
(require 'cl)
(defun* azs-make-source
(arg &optional name (skipp #'(lambda (s)
(equal
anything-zsh-screen-zle-line-source-name
(anything-attr 'name s)))))
(let* ((arg (concat (replace-regexp-in-string "[[:space:]]+$" "" arg) " "))
(name (or name (concat arg "(zsh screen)")))
(anything-source-name name))
(with-current-buffer (anything-candidate-buffer 'global)
From 97ec3532c97606270b97ced7ca102fb27457f06b Mon Sep 17 00:00:00 2001
From: Takeshi Banse <[email protected]>
Date: Thu, 2 Jul 2009 21:18:49 +0900
Subject: [PATCH Emacs/swank-clojure] Add apropos-list-for-emacs
Signed-off-by: Takeshi Banse <[email protected]>
---
Hi all,
I Takeshi Banse live in Japan, have been teaching myself Clojure and in the
;;;; Documentation
(defn- briefly-describe-symbol-for-emacs [var]
(let [lines (fn [s] (seq (.split s (System/getProperty "line.separator"))))
[_ symbol-name arglists d1 d2 & __] (lines (describe-to-string var))
macro? (= d1 "Macro")]
(list :designator symbol-name
(cond
macro? :macro
(:arglists ^var) :function