This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(map (cut * <> 2) `(1 2 3 4 5)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro def-add-hooks (lst body) | |
`(mapc #'(lambda (name) | |
(add-hook name #'(lambda () ,body))) | |
,lst)) | |
; 使い方 | |
; (def-add-hooks `(text-mode-hook markdown-mode-hook) | |
; (setq truncate-lines nil)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********************************************************************* | |
* Modified Version of "PHP FTP Client Class By TOMO" | |
* | |
* convert ereg* to preg* | |
* | |
* Author kobapan kobapan at gmail.com | |
********************************************************************/ | |
/********************************************************************* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq initial-scratch-message "") ; とりあえず initial message を消す | |
(add-hook 'kill-emacs-hook 'scratch-save) ; Emacs終了時に *scratch* を保存 | |
(add-hook 'window-setup-hook 'scratch-resume); 起動時に.scratchを読み込み | |
;; window-setup-hook が最後に呼ばれるっぽい | |
;; @see info 38.1.1 Summary: Sequence of Actions at Startup | |
(add-hook 'kill-buffer-hook; *scratch* バッファで kill-buffer したら内容を保存 | |
(lambda () (if (equal (buffer-name) "*scratch*") (scratch-save)))) | |
(add-hook 'after-save-hook ; *scratch*をファイル保存したら、*scratch*復帰 | |
(lambda () (unless (get-buffer "*scratch*") (scratch-resume)))) | |
(defvar scratch-file "~/.emacs.d/.scratch") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(delq nil (mapcar | |
(lambda (x) | |
(set-buffer x) | |
(unless (string= (file-name-nondirectory "README") (buffer-name)) ;exclude README | |
(or (buffer-file-name) list-buffers-directory))) | |
(buffer-list))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun kill-other-buffers () | |
"Kill all other buffers." | |
(interactive) | |
(let ((exclude '("*scratch*" "*Messages*"))) | |
(mapc (lambda (b) | |
(let ((buf (buffer-name b))) | |
(unless (member buf exclude) | |
(kill-buffer buf)))) | |
(delq (current-buffer) (buffer-list))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; in the current buffer, | |
(hl-line-mode) ; enable or disable highlight cursor line | |
(hl-line-mode t) ; enable highlight cursor line | |
(hl-line-mode nil) ; disable highlight cursor line | |
; globally, | |
(global-hl-line-mode) ; enables or disables highlight cursor line | |
(global-hl-line-mode t) ; enable highlight cursor line | |
(global-hl-line-mode nil) ; disable highlight cursor line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(mapcar* 'cons '(a b c) '(1 2 3 4)) | |
;=>((a . 1) (b . 2) (c . 3)) | |
(mapcar* 'cons '(a b c) '(1 2 3 4) '(5 6 7)) | |
;=>error | |
(mapcar* (lambda (a b c) | |
(+ a b c)) | |
'(1 2 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro between (var start end &optional $=) | |
`(cond ((null ,var) nil) | |
((numberp ,var) | |
(let (($$ (if ,$= '<= '<))) | |
(and (funcall $$ ,start ,var) (funcall $$ ,var ,end)))) | |
((stringp ,var) | |
(if ,$= | |
(or (and (string< ,start ,var) (string< ,var ,end)) (string= ,start ,var) (string= ,var ,end)) | |
(and (string< ,start ,var) (string< ,var ,end)))) | |
(t (error "comparing neither numberp nor stringp")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-hook 'kill-emacs-hook 'frame-size-save); Emacs終了時 | |
(add-hook 'window-setup-hook 'frame-size-resume); Emacs起動時 | |
(defun frame-size-save () | |
(set-buffer | |
(find-file-noselect (expand-file-name "~/.emacs.d/.framesize"))) | |
(erase-buffer) | |
(insert (concat | |
"(set-frame-width (selected-frame) " | |
(int-to-string (frame-width)) | |
") (set-frame-height (selected-frame) " |
OlderNewer