by shigemk2

当面は技術的なことしか書かない

Emacs Lisp

string-to-int

string-to-intは26.1からなくなったぽい (string-to-int "555") -- error (string-to-number "555") -- 555 ** Some obsolete functions, variables, and faces have been removed: *** make-variable-frame-local. Variables cannot be frame-local any mor…

sort alist by key

alistをキーでソートする関数は自前では用意されていないので、独自定義する必要がありまして。 (defalias 'asoc-copy 'copy-sequence "Return a shallow copy of ALIST.") (defun asoc-sort-keys (alist comparator) "Return a copy of ALIST sorted by key…

string conversion

149 a a 95 in に 40 string 文字列 34 is は 27 at に 26 function 関数 26 to に 25 the その 20 an 〜 20 or または 19 be 〜する 15 as として 15 this この 13 see 見る 12 convert 変換する 11 and そして 11 character キャラクター 11 of の 10 for …

replace-regexp-in-string/replace-regexp/replace-string

戻り値をごにょごにょしたいときは、replace-regexp-in-stringを使うと良い (replace-regexp-in-string "test abc" "" "test abcdef") "def" (replace-regexp "test abc" "" "test abcdef") nil (replace-string "test abc" "" "test abcdef") nil 文字列 - …

mapcar

特に理由はないけど、Scalaでいうとこんなかんじのを scala> List(1,-2,3,4,5).map(x => Math.abs(x)) res0: List[Int] = List(1, 2, 3, 4, 5) Emacs Lispでやる。 (mapcar 'abs '(1 -2 3 4 -5)) d.hatena.ne.jp

how-many

how-many is an interactive compiled Lisp function in ‘replace.el’. (how-many REGEXP &optional RSTART REND INTERACTIVE) Print and return number of matches for REGEXP following point. When called from Lisp and INTERACTIVE is omitted or nil, …

split-string

split-string is a compiled Lisp function in ‘subr.el’. (split-string STRING &optional SEPARATORS OMIT-NULLS TRIM) Split STRING into substrings bounded by matches for SEPARATORS. The beginning and end of STRING, and each match for SEPARATOR…

buffer-substring

buffer-substring is a built-in function in ‘C source code’. (buffer-substring START END) Return the contents of part of the current buffer as a string. The two arguments START and END are character positions; they can be in either order. T…

search Emacs function

f1 f or describe-function

emacs-helm 2.7.1

疲れたな Release Version 2.7.1 · emacs-helm/helm · GitHub

emacs helm v2.3.4

どんな変更なのかちょっと良くわからない。 Release v2.3.4 · emacs-helm/helm · GitHub

emacs helm v2.3.3

所謂bugfixなのだけれど、関数名のリネームがなんだか良くわからない。 Release Version 2.3.3 · emacs-helm/helm · GitHub github.com

連想リスト emacs lisp

www.geocities.co.jp

Emacs Lispでデバッグしたい

edebugとかmessageとか Emacs Lisp デバッグ — ありえるえりあ

symbol-name

シンボル名を返す。 symbol-name is a built-in function in `C source code'. (symbol-name SYMBOL) Return SYMBOL's name, a string.

mapconcat

mapconcatは、sequenceの各要素にfunctionを適用する。 第二引数はリスト、ベクトル、ブールベクトル、あるいは、文字列。 (mapconcat 'symbol-name '(The cat in the hat) " ")

fullstacklisp

後で読むと思う。 leanpub.com

Emacs Lisp雑記

Emacs Lispをいろいろなところで使いたいっていう話。 jordiinglada.net

Emacs Lispの演算 リンク

1+がインクリメントなのは始めて知る。 GNU Emacs Lisp Reference Manual: Arithmetic Operations

Emacs 正規表現でインクリメント その2

Mac OSX query-replace-regexp [0-9]\{5\} \,(+ 1000 (string-to-numer \&))

s.el これから使う

github.com これから使うけど、キャメルとスネークを変換することも出来るらしい。

query-replaceをEmacs Lispの中で使う(その1)

Emacs: how do I replace-regexp with a lisp function in a defun? - Stack Overflow www.shigemk2.com query-replace-regexpの書き方がよくわからない。。。 (defun my-replace () (interactive) (query-replace "family" "families"))

Autoloadとは

(ページの文字コードはEUCだったと思う) GNU Emacs Lisp¥ê¥Õ¥¡¥ì¥ó¥¹¥Þ¥Ë¥å¥¢¥ë: Autoload 自動ロード(autoload)機能により、 関数やマクロを定義しているファイルをロードしていなくても、 関数やマクロをLispに登録できます というところ。

Emacs Lispの関数を書こう

そう、関数です。キーバインドとして使える関数を書きます。 例。今のバッファのメジャーモードをミニバッファに出力する関数。 (defun buffer-major-mode() "This is functoin that shows major-mode." (interactive) (message "%s" major-mode)) (global-s…

分散のelispプログラム

分散がなんなのかイマイチよく分からなかったので、Emacs Lispでなんか書いてみる。 gist.github.com 期待する結果は38.75(のはず)で、期待通りの結果が返ってきているので、これで良いと判断する。 しかし、もうちょっと一般化するべきではあるのだろう。

Emacs Lispの適当なデバッグ

要所要所に以下を入れると良い。 (message hogehoge) 無論、数字は文字列に変換しないといけない。 (message (number-to-string 1)) で、messageをprintのように使って、変数がどんな感じで定義されているのかを確認するといいと思う。

js2-modeちょっと書き換え その2

前回のアレから、 js2-modeちょっと書き換え - by shigemk2shigemk2.hatenablog.com このようなご指摘を頂いたので。 @shigemk2 関数 underscore-requireの定義は hookで呼ばれる関数の外に出した方が良いです. これだと Javascriptファイルを新規に開くたび…

js2-modeちょっと書き換え

ちょっと書き換えました。 js2-mode起動時のみに実行できる関数underscore-requireを定義しています。 gist.github.com いろいろ助力は受けております。 (when (memq major-mode '(twittering-edit-mode)) 〜) とか RT: Emacsで特定のmajor modeが発動してい…

はてなブログのブログカードを挿入するEmacs Lisp

ブログネタをEmacsでメモってるとやっぱりリンクの生成とか手入力するのは面倒なので、 Emacs Lispを書きました。 昨日の新規機能を受けまして。 「ブログカード」をOGPなどに対応しました。さまざまなWebページをコンパクトに整形して掲載できます - はてな…

go-modeでスペースタブにしてみる【追記あり】

(add-hook 'go-mode-hook (lambda () (setq-default) (setq space-width 4) (setq standard-indent 4) (setq indent-tabs-mode nil))) modeのhookでごまかした。 How to make Emacs use tabs instead of spaces? - Stack Overflow 追記 Go言語入門 vol.2 - g…