Skip to content

Instantly share code, notes, and snippets.

// 短く
javascript:location=decodeURI(location)
;;; undo-tree.el --- Treat undo history as a tree
;; 2010/2/15 追記.
;; undo-tree-visualizer-quit のバグを修正しました.
;; 参考) http://d.hatena.ne.jp/kitokitoki/20100211/p1
;; オリジナルからの変更点
;; 1. q で *undo-tree* があったウィンドウも削除し,呼び出しもとのウィンドウ・バッファにポイントを移動
;; 2. 上下分割から左右分割に変更
(defun my-delete-bol-space (from to)
(interactive "r")
(save-restriction
(narrow-to-region from to)
(goto-char (point-min))
(while (not (eobp))
(delete-horizontal-space)
(next-line)
(beginning-of-line))))
;;http://blog.livedoor.jp/naoya_t/archives/51350496.html
;;switch-to-buffer-other-window しないのが僕ごのみ
(defun gauche-info-index (topic)
(interactive
(list (read-string
(concat "Gauche help topic : ")
(current-word))))
(get-buffer-create "*info*")
(info "/usr/share/info/gauche-refe.info.gz")
(Info-index topic))
;; http://at-aka.blogspot.com/2008/12/emacs-uniq.html
(defun my-uniq (st en)
(interactive "r")
(call-process-region st en "uniq" t t))
;;(cute-cursor t) ;開始
;;(cute-cursor nil) ;終了
(require 'cl)
(lexical-let ((interval 0.05)
(colors '("red" "green" "blue" "yellow" "purple" "magenta" "cyan"))
(cursor-nth 0)
(timer nil))
(defun cute-cursor (flag)
(remove-if 'oddp '(1 2 3 4 5 6))
;;=>(2 4 6)
(defun complement (fn)
(lexical-let ((fn fn))
(lambda (&rest args) (not (apply fn args)))))
(remove-if (complement 'oddp) '(1 2 3 4 5 6))
;;=>(1 3 5)
(defun sqlf (start end)
"リージョンのSQLを整形する"
(interactive "r")
(let ((case-fold-search t))
(let* ((s (buffer-substring-no-properties start end))
(s (replace-regexp-in-string "\\(select \\)" "\n\\1\n " s))
(s (replace-regexp-in-string "\\(update \\)" "\n\\1\n " s))
(s (replace-regexp-in-string "\\(insert into \\)\\(fuga\\)\\(fuga\\)" "\n\\2\n " s))
(s (replace-regexp-in-string "\\(delete from \\)" "\n\\1\n " s))
(s (replace-regexp-in-string "\\(create table \\)" "\n\\1\n " s))
(defun aws-cut-search-ring (n lst)
(if (or (>= 0 n) (null lst)) nil
(cons (car lst)
(aws-cut-search-ring (- n 1) (cdr lst)))))
(setq anything-c-source-recentf
'((name . "Recentf")
(init . (lambda ()
(require 'recentf)
(or recentf-mode (recentf-mode 1))
;; Big value empowers anything/recentf
(when (and (numberp recentf-max-saved-items)
(<= recentf-max-saved-items 20))
(setq recentf-max-saved-items 500))))
(candidates . recentf-list)