Skip to content

Instantly share code, notes, and snippets.

@sluchin
sluchin / .emacs.el
Created March 9, 2013 17:09
configure ddskk
;;; 日本語入力 (ddskk)
;; sudo apt-get install ddskk
;; 辞書は以下からダウンロードする
;; http://openlab.ring.gr.jp/skk/wiki/wiki.cgi?page=SKK%BC%AD%BD%F1#p7
;; http://kddoing.ddo.jp/user/skk/SKK-JISYO.KAO.unannotated
;; http://omaemona.sourceforge.net/packages/Canna/SKK-JISYO.2ch
;; q 「かなモード」,「カナモード」間をトグルする.
;; l 「かなモード」または「カナモード」から「アスキーモード」へ.
;; L 「かなモード」または「カナモード」から「全英モード」へ.
;; 辞書をマージする
;;; GNU Global
;; wget http://tamacom.com/global/global-6.2.8.tar.gz
(when (and (executable-find "global")
(locate-library "gtags"))
(autoload 'gtags-mode "gtags" "Gtags facility for Emacs." t)
(add-hook 'gtags-select-mode-hook
(lambda () ; 強調表示
(when (fboundp 'hl-line-mode) (hl-line-mode t))))
(let ((hook (lambda ()
(when (fboundp 'gtags-mode) (gtags-mode t))
@sluchin
sluchin / .emacs.el
Last active December 15, 2015 17:49
;;; GNU Global
;; wget http://tamacom.com/global/global-6.2.8.tar.gz
(when (and (executable-find "global")
(locate-library "gtags"))
(autoload 'gtags-mode "gtags" "Gtags facility for Emacs." t)
(add-hook 'gtags-select-mode-hook
(lambda ()
(when (fboundp 'hl-line-mode) ; 強調表示
(hl-line-mode 1))))
(let ((hook (lambda ()
@sluchin
sluchin / .emacs.el
Last active December 15, 2015 21:19
require 時間計測
;;; require 時間を計測する
(defvar benchmark-alist nil)
(defadvice require
(around require-benchmark
(feature &optional filename noerror)
activate compile)
(let* ((before (time-to-seconds (current-time)))
(result ad-do-it)
(after (time-to-seconds (current-time)))
(time (* (- after before) 1000)))
;;; Psgml モード
;; C-c C-p DTD の Parse
;; C-c C-o 文章の Parse
;; C-c C-e element の挿入
;; C-c / 終了タグを挿入
(when (eval-and-compile
(and (require 'nxml-mode nil t)
(require 'psgml nil t)))
(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)
(autoload 'xml-mode "psgml" "Major mode to edit XML files." t)
;; C-q をプリフィックスキー化
(define-key global-map (kbd "C-q") (make-sparse-keymap))
;; 制御文字の挿入(デフォルト: C-q)
(define-key global-map (kbd "C-q C-q") 'quoted-insert)
;; 標準タグ検索 (etags)
;; M-. 検索, M-* 戻る
(defun exec-tags-command (exec &rest options)
"Execute etags or ctags command."
(if (and (executable-find "find")
(executable-find exec))
(let ((lst '(("l" "[l]isp" "\\(el\\|cl\\)")
("c" "[c],c++" "\\(h\\|c\\|hh\\|cc\\|cpp\\)")
("j" "[j]ava" "java")
("js" "[js]cript" "js")
;;; タグ検索
;; GNU Global
;; wget http://tamacom.com/global/global-6.2.8.tar.gz
;; タグファイル作成するコマンド (gtags -v)
(defun make-gtags ()
"Make GTAGS file."
(interactive)
(if (and (executable-find "global") (executable-find "gtags"))
(let* ((default default-directory)
(dir (read-string "Directory: "
@sluchin
sluchin / .emacs.el
Last active December 16, 2015 02:09
;;; VLC プレイリストのための XML パーサー
;; (install-elisp-from-emacswiki "xml-parse.el")
;; CSV 形式で一時バッファに出力する
(defun vlc-xml2csv-tempbuffer (tmpbuf &rest tags)
"Output temporary buffer from xml to csv."
(when (eval-and-compile (require 'xml-parse nil t))
(goto-char (point-min))
(with-output-to-temp-buffer tmpbuf
(dolist (tracklst (read-xml))
(when (string= (xml-tag-name tracklst) "trackList")
(defadvice boundp (around boundp-message (symbol) activate compile)
(if (eval ad-do-it) t
(message "boundp nil: %s" (ad-get-arg 0)) nil))
(defadvice fboundp (around fboundp-message (symbol) activate compile)
(if (eval ad-do-it) t
(message "fboundp nil: %s" (ad-get-arg 0)) nil))
(ad-disable-advice 'boundp 'around 'boundp-message)
(ad-activate 'boundp)