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
(defun eval-print-region () | |
(interactive) | |
(let ((f (lambda (s e) | |
(print (eval (read (replace-regexp-in-string "," "" (buffer-substring s e)))) (current-buffer))))) | |
(if (region-active-p) | |
;; リージョン全体 | |
(funcall f (region-beginning) (region-end)) | |
;; カーソルのある行全体 | |
(progn (end-of-line) | |
(funcall f (point-at-bol) (point-at-eol)))))) |
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
#!/usr/bin/env bash | |
# exif.sh | |
# usage | |
usage_exit() { | |
if [[ $1 ]]; then echo "error $1"; fi | |
echo "--- | |
Usage: |
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
(defun set-env-from-shell () | |
"シェル の PATH と alias を、emacs に引き継ぐ" | |
(let* ((trim (lambda (string &optional needle) | |
(let* ((n (if needle needle "[ \t\n\r]+")) | |
(s (if (string-match (concat "\\`" n) string) | |
(replace-match "" t t string) | |
string))) | |
(if (string-match (concat n "+\\'") s) | |
(replace-match "" t t s) | |
s)))) |
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
(use rfc.http) ; http-get http-compose-query | |
(use rfc.uri) ; uri-parse uri-compose | |
(define (uri-get uri :key (query #f)) | |
(if query (set! uri (string-append uri (if (car query) (http-compose-query "" query) | |
#"&~(http-compose-query #f (cdr query))")))) | |
(receive (code status body) | |
(receive (scheme user-info hostname port path query frament) | |
(uri-parse uri) | |
(http-get hostname (uri-compose :path path :query query))) |
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
;;; Depentancy: | |
;; | |
;; e2ps | |
;; ps2pdf | |
;; sudo apt install e2ps; sudo apt install ghostscript ; | |
;;; Usage: | |
;; | |
;; M-x e2ps-ps2pdf | |
;; 保存ディレクトリを選ぶ |
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
;; @original [日付に対する加算 | 逆引きScheme](http://tips.cddddr.org/scheme/index.cgi?%e6%97%a5%e4%bb%98%e3%81%ab%e5%af%be%e3%81%99%e3%82%8b%e5%8a%a0%e7%ae%97) | |
(use srfi-19) | |
;; 日付 date の seconds 秒後の日付を返す。閏秒は考えない。 | |
(define (date-mod-second date seconds) | |
(time-utc->date | |
(add-duration (date->time-utc date) | |
(make-time time-duration 0 seconds)))) |
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 call-sxiv () | |
(interactive) | |
(let ((image-files;画像ファイル名のリスト | |
(delq nil;この辺はemacs26辺りで filterマクロに置き換えか? | |
(mapcar | |
(lambda (f) | |
(when (string-match | |
"\.\\(jpe?g\\|png\\|gif\\|bmp\\)$" | |
f ) | |
f )) |
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
;;; sudo.el --- | |
;; Author: kobapan <kobapan@gmail.com> | |
;; Keywords: emacs,lisp | |
;; This program is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation, either version 3 of the License, or | |
;; (at your option) any later version. |
NewerOlder