Skip to content

Instantly share code, notes, and snippets.

View yosisa's full-sized avatar

Yoshihisa Tanaka yosisa

View GitHub Profile
(defun e2wm-frame-size-save ()
(interactive)
(let ((file "~/.emacs.d/framesize.el")
(width (int-to-string (frame-parameter nil 'width)))
(height (int-to-string (frame-parameter nil 'height)))
(top (int-to-string (frame-parameter nil 'top)))
(left (int-to-string (frame-parameter nil 'left)))
buf beg line init-line)
(if (get-file-buffer (expand-file-name file))
(setq buf (get-file-buffer (expand-file-name file)))
class Foo(object):
_d = {}
def __init__(self, *names):
for name in names:
self.add_property(name, name)
def add_property(self, name, value):
self._d[name] = value
def getter(self, value):
class Foo:
def __init__(self, *names):
for name in names:
def getter(name):
def _getter(self):
return "[[ {0} ]]".format(name)
return _getter
setattr(Foo, name, property(fget=getter(name)))
foo = Foo("foo", "bar", "baz")
class Foo(object):
def __init__(self, *names):
self._d = {}
for name in names:
self.add_property(name, name)
def add_property(self, name, default):
self._d[name] = default
if not hasattr(Foo, name):
setattr(Foo, name, self._add_property(name))
import new
class myclassmethod(object):
def __init__(self, func):
self.func = func
self._first = True
def __get__(self, instance, klass):
if self._first:
@yosisa
yosisa / K2Emacs.ks.js.diff
Created July 13, 2011 12:31
Mac OSXでもK2Emacsでバイナリを指定できるように
diff --git keysnail/plugins/K2Emacs.ks.js keysnail/plugins/K2Emacs.ks.js
index 122d32a..31dd6bc 100644
--- keysnail/plugins/K2Emacs.ks.js
+++ keysnail/plugins/K2Emacs.ks.js
@@ -284,7 +284,7 @@ var ucjs_ExternalEditor = {
var editorFile;
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
- if ("Darwin" == xulRuntime.OS)
+ if ("Darwin" == xulRuntime.OS && editorPath.match('\.app$'))
@yosisa
yosisa / cmigemo.rb
Created July 30, 2011 23:19
formula for cmigemo
require 'formula'
class Cmigemo < Formula
url 'http://cmigemo.googlecode.com/files/cmigemo-default-src-20110227.zip'
homepage 'http://www.kaoriya.net/software/cmigemo'
sha1 '25e279c56d3a8f1e82cbfb3526d1b38742d1d66c'
depends_on 'nkf'
def patches
@yosisa
yosisa / apel.rb
Created July 30, 2011 23:21
formula for emacs apel
require 'formula'
class Apel < Formula
url 'http://kanji.zinbun.kyoto-u.ac.jp/~tomo/lemi/dist/apel/apel-10.8.tar.gz'
homepage 'http://kanji.zinbun.kyoto-u.ac.jp/~tomo/elisp/APEL/'
md5 '20b82300094b4377e1fb74d83ebbd972'
depends_on 'emacs'
def install
@yosisa
yosisa / flim.rb
Created July 30, 2011 23:22
formula for emacs flim
require 'formula'
class Flim < Formula
url 'http://www.kanji.zinbun.kyoto-u.ac.jp/~tomo/comp/emacsen/lisp/flim/flim-1.14/flim-1.14.9.tar.gz'
homepage 'http://kanji.zinbun.kyoto-u.ac.jp/~tomo/elisp/FLIM/'
md5 '3dca42e2a1af4b089bb3f177bcf9321b'
depends_on 'emacs'
depends_on 'apel'
@yosisa
yosisa / semi.rb
Created July 30, 2011 23:23
formula for emacs semi
require 'formula'
class Semi < Formula
url 'http://kanji.zinbun.kyoto-u.ac.jp/~tomo/lemi/dist/semi/semi-1.14-for-flim-1.14/semi-1.14.6.tar.gz'
homepage 'http://www.kanji.zinbun.kyoto-u.ac.jp/~tomo/elisp/SEMI/'
md5 '22d735fa218c8c6268cd2c9395cd837b'
depends_on 'emacs'
depends_on 'apel'
depends_on 'flim'