Emacs

shell-command-to-string 実行時の $TERM

dumb の場合と ""(空文字列) の場合がある? 起動直後は空文字列みたい。なので tmux は↓みたいな感じに。 if which tmux 2>&1 >/dev/null; then #if not inside a tmux session, and if no session is started, start a new session test -z "$TMUX" && tes…

Symbol's function definition is void: sps

;; recompile every `.el' file that already has a `.elc' file. (byte-recompile-directory "/path/to/ensime/elisp" 0 t) then restart Emacs.https://github.com/aemoncannon/ensime/issues/162

Firefox.app で Ctrl+AE を Command+Left/Right に remap しているとページ遷移してウザい

Control+AE がもともと Firefox.app 内で BOL・EOL として動作するらしかったので、Control+AE の remap だけ not フィルタに FIREFOX を追加すればよさそうだった。しかし、Control+E が EOL として動作しない場合があったので、最終的に以下のようなものを…

古い howm-mode と emacs 24 で inhibit-first-line-modes-regexps が無いといわれるので

(defvaralias 'inhibit-first-line-modes-regexps 'inhibit-local-variables-regexps) を追加して暫定対処。 ちゃんとしたパッチがあるのであとでやる http://howm.sourceforge.jp/index-j.html

Mac OS X で Java の file.encoding が SJIS になってて困る

Mac で UTF-8 で Scala のコードを書いてて、日本語を書いちゃうと、 java.nio.charset.UnmappableCharacterException が発生したりします。utf 8 - Printing Unicode from Scala interpreter - Stack Overflowにあるように、JAVA_OPTS="-Dfile.encoding=UTF…

org-export-as-html したときに強調要素前後の半角空白が気になって仕方がない

org-export-as-html するときに、 a *bcd* /efg/ =hij= が a <b>bcd</b> <i>efg</i> <code>hij</code> のように出力されるが、前後の半角スペースもそのまま出力されてしまうのでなんかかっこ悪い。 気になる。困った。org-export-html-final-hook という変数に、 エクスポートの最終段…

key-chord 設定例とちょっとした便利関数

?? で設定されているキーバインドの一覧をミニバッファに印刷する。すでに key-chord-describe という関数はあるのだけれど、それだと key-chord が気を利かせて登録してくれる、二通りの組み合わせのバインディング(ab を設定すると ba も勝手に設定される)…

Mac OS X Lion + Cocoa Emacs 24 でフォントの設定

参考 http://sakito.jp/emacs/emacs23.html#id17 例 ;; font (create-fontset-from-ascii-font "Ricty-14:weight=normal:slant=normal" nil "ricty") (set-fontset-font "fontset-ricty" 'unicode (font-spec :family "Ricty" :size 14) nil 'append) (add-t…

gtags の便利設定と関数一覧を出す関数の自前定義(gtags-parse-file)

gtags.el Version: 2.6 でのみ確認、他ではほぼ確実に動かない。以下のような感じに gtags-goto-tag を修正して、 ((char-equal flag-char ?r) (setq prefix "(R)")) ((char-equal flag-char ?f) (setq prefix "(F)")) (t (setq prefix "(D)"))) 以下のよう…

emacs で phpmd の結果を使う

みたいなのを使って、M-x compile で myphpmd test.php text unusedcode,naming とすると使いやすい。 (defun phpmd () (interactive) (let ((source-code (file-name-nondirectory (buffer-file-name))) (report-format "text") (ruleset "unusedcode")) (c…

ディレクトリと探したいものとかを与えると grep-find してくれる関数(要 ack)

;; grep-find (defvar dgrep-find-default-cmd "ack --nocolor --nogroup --type=%s %s \"%s\" \"%s\"") (defvar dgrep-find-default-type "elisp") (defvar dgrep-find-default-ctx 3) (defvar dgrep-find-default-subject "") (defun dgrep-find (dir subj…

howm の todo とかを growl で通知(手動登録)@Windows

elisp growl-notifyが必要 (require 'parse-time) (defvar howm-notify-before-min 5) (defvar howm-notify-title "予定の通知") (defun howm-growl-notify () (interactive) (let* ((line (thing-at-point 'line)) (time (parse-time-string line)) (sec (f…

Emacs と growlnotify@windows

elisp (defvar growl-program "growlnotify") (defvar growl-notify-icon (concat data-directory "images/icons/hicolor/128x128/apps/emacs.png")) (defvar growl-notify-application-name "Emacs") (defun growl-notify (title message) (interactive) (c…

anything-imenu-at-point

(defun anything-imenu-at-point () (interactive) (anything 'anything-c-source-imenu (current-word) nil nil nil "*anything imenu*") )

calfw-calendar に howm と diary の内容どっちも表示

僕はプライベートの予定は google-emacs で google カレンダーと diary を同期して管理していて、仕事の予定は howm で管理している。calfw-howm と calfw-calendar がそれぞれ用意されているので、それぞれを calfw-calendar に表示することはできるけれど…

cfw:open-howm-calendar して今日の howm に日付だけ挿入できればいいや

(defun my-cfw-open-schedule-buffer () (interactive) (let ((date (cfw:cursor-to-nearest-date))) (howm-find-today) (goto-char (point-max)) (insert (format "[%04d-%02d-%02d]@ " (calendar-extract-year date) (calendar-extract-month date) (calen…

calendar の曜日とか月とかの表示を変える

;; 月 (setq calendar-month-name-array (vconcat (mapcar (lambda (n) (concat n "月")) (mapcar 'number-to-string [1 2 3 4 5 6 7 8 9 10 11 12])))) ;; 曜日 (setq calendar-day-name-array (vconcat (mapcar (lambda (n) (concat (char-to-string n) "…

mozrepl でリロード、タブ操作、Google・ALC 検索

参考 Firefox と Emacs の会話 | Amrta Firefox で閲覧中の画面を Emacs からスムーススクロールする elisp - memo (autoload 'moz-minor-mode "moz" "Mozilla Minor and Inferior Mozilla Modes" t) (moz-minor-mode t) (defun moz-close-tab-or-window () …

いまさら flyspell を動かした

参考 よしいずの雑記帳 Windows XPにおけるispell for Win32のセットアップ作業のメモ 【Proton.jp】 ispellの設定と利用法 本文 ispell 入れなきゃいけないのかと思ったら aspell でいいのね。cygwin にくっついてきていたので emacs の設定だけで動いた。 …

emacs-google の calendar をローカルの Timezone を使うようにしたのと Windows 対応

https://github.com/yewton/emacs-google-calendar にあげました。…元の作者さんに連絡したほうがよいのだろうなぁ

Google カレンダー連携して howm メニューに表示

Meadow/Emacs memo: メモを書こうに、homw menu に diary を表示する方法がある。Google calendar と diary の連携は[emacs][google][calendar]Emacs の calendar と Google カレンダーを連携させるをすれば出来るので、この両方をやれば目的を達成できるこ…

windows で magit を使いはじめるまで

参考 magit - メモ用なWiki - livedoor Wiki(ウィキ) 本文 落としてくる Downloads · magit/magit make とか持って無いし要はバイトコンパイルするだけのようなので、下のようなのをでっちあげる ;; M-x eval-buffer (setq load-path (cons (expand-file-n…

カーソル下の数字っぽいものをインクリメント・デクリメントする

参考あるいはパクリ元 カーソルの位置にある数字列をインクリメントする emacs lisp 改修 - 質のないDiary H 本文 vim の Ctrl+a, Ctrl+x に相当するらしい機能。参考元にプラスでデクリメントをつけ、ついでに samrt-rep の設定例を。 (defun operate-strin…

calendar で日付選択して貼り付ける関数作った

デフォルトで howm 形式のフォーマットで出力する。 (calendar-exit)して(insert)しているので、ウインドウ構成によっては思ったところに貼り付けられないかもしれない。前にいた window をとれたらいいんだけど。 (eval-after-load "calendar" '(progn (def…

Emacs の calendar と Google カレンダーを連携させる

はじめに Google カレンダーを Emacs で見る方法があるというので探してみたが、そのままでは Windows 上で動かなかった。 動くようにする方法を書く。(追記アリ) 参考 まぁるいしっぽ:emacsのカレンダーでgoogle calendarを読み込む googlecalendar - emacs…

ウインドウ最大化トグルコマンド

http://www.bookshelf.jp/2ch/software/1005469775.html#808 ;; フレームサイズをトグルで切り替え (setq my-frame-max-flag nil) (defun my-toggle-frame-size () (interactive) (if my-frame-max-flag (progn (w32-send-sys-command 61728);; 最大化を元に…

コミットログに自動でブランチ名を入れる2

http://d.hatena.ne.jp/yuto_sasaki/20120127/1327650259 を改良 ;; http://hogepiyo.cmo/svn/hoge/branches/hogepiyo/dottokom ;; dsvn defadvice ;; Emacs/Lisp/Drill - Emacsグループ <http://emacs.g.hatena.ne.jp/k1LoW/200810> (defadvice svn-commit (around svn-commit-around activate) (goto-</http://emacs.g.hatena.ne.jp/k1low/200810>…

コミットログに自動でブランチ名を入れる

参考 dsvnでcommitログに変更ファイルを自動入力する - Emacs/Lisp/Drill - Emacsグループ (defadvice svn-commit (around svn-commit-around activate) (goto-char (point-min)) (if (re-search-forward "\\(branches\\|tags\\)/[^/]+" nil t) (kill-new (m…

ディレクトリと探したいもの与えると grep-find してくれる関数

;; dgrep-find (defun dgrep-find (dir subject &optional cmd) (interactive "DDiretory: \nsSubject: ") (let ( (cmd (or cmd "find %s -type f ! -wholename '*/.svn/*' ! -wholename '*/tplc/*' -name '*.php' | xargs grep -3 -nH '%s'")) ) (when (tra…

dsvn.el でリモートコミット

tramp LC_ALL に C を設定している箇所全て、ja_JP.UTF-8 を設定するように修正する。 dsvn http://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/emacs/dsvn.el ローカルの tmp ファイルにコミットメッセージを出力するのではなく、リモ…