Skip to content

Instantly share code, notes, and snippets.

toolScripts.afterPowerOn = "FALSE"
toolScripts.afterResume = "FALSE"
toolScripts.beforePowerOff = "FALSE"
toolScripts.beforeSuspend = "FALSE"
@d5884
d5884 / w32-map-drive.el
Last active August 29, 2015 14:16
windows drive mapper for emacs on cygwin
;; windows drive mapper for emacs on cygwin
(add-to-list 'file-name-handler-alist
'("\\<[a-zA-Z]:" . w32-map-drive))
(defun w32-map-drive (operation &rest args)
(let ((fn (get operation 'w32-map-drive)))
(if fn
(apply fn args)
(w32-map-drive-run-real-handler operation args))))
;; mozc のステータス取得系
(defvar ini:mozc-status-alist nil
"`mozc-mode' の状態を表す alist.")
(defconst ini:mozc-status-default-mode
(if (memq system-type '(windows-nt cygwin)) 'direct 'hiragana)
"`mozc-mode' の初期変換モード.")
(defadvice mozc-mode (after ini:mozc-status-init activate)
;; helm のサスペンドステータス更新系
(with-eval-after-load "helm"
(defun ini:helm-set-suspend-update-flag (status)
(when (and status (not helm-suspend-update-flag))
(helm-kill-async-processes)
(setq helm-pattern ""))
(setq helm-suspend-update-flag status))
(defadvice mozc-mode (after ini:mozc-helm-suspender-init activate)
(when (helm-alive-p)
;;; locate-file-cache.el --- Support cache for locate-file.
;; Copyright (C) 2013 Daisuke Kobayashi
;; Author: Daisuke Kobayashi <d5884jp@gmail.com>
;; Keywords: extensions
;; 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 3 of the License, or
@d5884
d5884 / gist:3252900
Created August 4, 2012 00:10
function coding system
(defmacro in:set-function-coding-system (function decoding encoding)
"関数使用時のコーディングシステムを設定する.
関数 FUNCTION に対し、実行時に DECODING を `coding-system-for-read' に、
ENCODING を `coding-system-for-write' に設定する advice を作成、活性化する."
`(defadvice ,function (around
,(intern (format "in:ad-%s-coding-setup" function))
activate compile)
,(format "関数実行時のコーディングシステムを以下に置き換える.
`coding-system-for-read': %s
`coding-system-for-write': %s" (eval decoding) (eval encoding))
@d5884
d5884 / scratch-20120111.el
Created July 30, 2012 12:07
color changer
;; 明るさ変更
(labels ((rgb-to-ycrcb (r g b)
(mapcar (lambda (v)
(round v 1000))
(list (+ (* 299 r) (* 587 g) (* 114 b))
(+ (* 500 r) (* -418.69 g) (* -81.31 b))
(+ (* -168.74 r) (* -331.26 g) (* 500 b)))))
(ycrcb-to-rgb (y cr cb)
(let ((y (* y 1000)))
(mapcar (lambda (v)
@d5884
d5884 / google-maps.el
Created July 30, 2012 02:23
google maps localization
;; google-map / git clone http://git.naquadah.org/git/google-maps.git
(when (locate-library "google-maps")
(autoload 'google-maps "google-maps" nil t)
(eval-after-load "google-maps"
'(progn
(when (require 'popwin nil t)
(add-to-list 'popwin:special-display-config '("*Google Maps*")))
(defadvice google-maps-static-show (before ini:ad-google-maps-set-lang
(require 'inf-ruby)
;; from http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/20892
(define-key inferior-ruby-mode-map (kbd "TAB") 'inferior-ruby-complete-or-tab)
(defun inferior-ruby-completions (seed)
"Return a list of completions for the line of ruby code starting with SEED."
(let* ((proc (get-buffer-process ruby-buffer))
(comint-filt (process-filter proc))
(kept "") completions)
@d5884
d5884 / init.el
Created December 19, 2011 15:29
cl suppress warning
(require 'cl nil t)
(setq byte-compile-warnings '(not cl-functions))
;; to use cl-lib