Skip to content

Instantly share code, notes, and snippets.

@sluchin
sluchin / .zshrc
Last active September 29, 2022 02:24
# .zshrc
[[ -f $HOME/.zshenv ]] && source $HOME/.zshenv
stty stop undef
bindkey -e
# autoload
autoload -Uz run-help
autoload -Uz zmv
(defvar syslog-overlay-list nil)
(defun syslog-highlight ()
" Highlight syslog."
(interactive)
(save-excursion
(goto-char (point-min))
(let (bop eop string lst ol)
(while (not (eobp))
(move-beginning-of-line nil)
;; 日本語で検索するための設定
(when (locate-library "skk-isearch")
(autoload 'skk-isearch-mode-setup "skk-isearch"
"Hook function called when skk isearch begin." t)
(autoload 'skk-isearch-mode-cleanup "skk-isearch"
"Hook function called when skk isearch is done." t)
(add-hook 'isearch-mode-hook 'skk-isearch-mode-setup)
(add-hook 'isearch-mode-end-hook 'skk-isearch-mode-cleanup)
(eval-after-load "skk-isearch"
;; (install-elisp-from-emacswiki "anything-match-plugin.el")
;; (install-elisp-from-emacswiki "anything-config.el")
(when (and (locate-library "anything")
(locate-library "anything-config"))
(autoload 'anything "anything"
"Main function to execute anything sources." t)
(when (boundp 'anything-for-document-sources)
(setq anything-for-document-sources
'(anything-c-source-man-pages
anything-c-source-info-cl
;; ロード履歴の表示
(defun print-load ()
"Print load-history."
(interactive)
(let ((all 0))
(dolist (lst load-history)
(let* ((file (car lst))
(bytes (nth 7 (file-attributes file))))
(message "%-8s %s" bytes file)
(setq all (+ all bytes))))
(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)
@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")
;;; タグ検索
;; 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: "
;; 標準タグ検索 (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")
;; 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)