This file contains hidden or 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
| ;; 色々やり方があるけど、これはcdのコマンド履歴を残すやり方 | |
| (defun eshell-cd-default-directory () | |
| "Eshell 'cd' with current buffer's default-directory." | |
| (interactive) | |
| (let ((dir default-directory)) | |
| (eshell) | |
| (eshell-reset) | |
| (insert (concat "cd " (shell-quote-wildcard-pattern dir))) | |
| (eshell-send-input))) |
This file contains hidden or 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
| ;; #Emacs でコーディングしてて、コメント内に TODO とか色々書き残したりするけど | |
| ;; 後でまとめてそれらを抜き出したりしたい時に役立つelisp | |
| ;; | |
| ;; Emacs はコメントを認識してるから、それを使って言語非依存になってる! | |
| (defun comment-traversal (beg end func) | |
| (save-excursion | |
| (let (spt ept) | |
| (goto-char beg) | |
| (while (and (< (point) end) |
This file contains hidden or 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
| ;; 一応、以下のようにすると固定ウィンドウに表示する事は出来るよ | |
| ;; これだと *info* バッファを開く場合に右に出るようになる | |
| ;; 完璧なサイドウィンドウって訳じゃないけど…お試しあれ | |
| (add-to-list 'display-buffer-alist | |
| '("\\`\\*info\\*\\'" . | |
| (display-buffer-in-side-window | |
| (side . right) | |
| (window-width . 40)))) |
This file contains hidden or 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
| ;; 出力結果は文字列だけど、3の後ろに小数点が無いのと最後の4桁は未収束の為除いたものが正しい値 | |
| (defmath mpiarccot (x) | |
| (let ((base (expt 10 (+ 1000 4))) | |
| (a x) | |
| (b 1) | |
| pos | |
| (sum 0)) | |
| (while (> (setq pos (idiv base (* a b))) 1) | |
| (setq sum (+ sum (if (/= (logand 2 b) 0) (- pos) pos)) |
This file contains hidden or 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
| # 出力結果は3の後ろに小数点が無いのと最後の4桁は未収束の為除いたものが正しい値 | |
| import time | |
| def mpiarccot(x): | |
| base = 10 ** (10000 + 4) | |
| a = x | |
| b = 1 | |
| pos = base // (a * b) | |
| s = 0 |
This file contains hidden or 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
| ;; 出力結果は3の後ろに小数点が無いのと最後の4桁は未収束の為除いたものが正しい値 | |
| (defpackage #:pi | |
| (:use #:cl)) | |
| (in-package #:pi) | |
| (declaim (optimize (speed 3) (debug 0) (safety 0))) | |
| (defun mpiarccot (x) | |
| (loop with base = (expt 10 (+ 10000 4)) |
This file contains hidden or 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
| ;;; -*- lexical-binding: t; -*- | |
| ;; なぜfor文は禁止なのか?関数型記述のススメ | |
| ;; https://qiita.com/ukiuni@github/items/abad07524856c65a20ea | |
| ;; | |
| ;; Emacs Lisp 遅延評価版 (25.1 以上) | |
| ;; ※ Emacs にバグがある為 100 をあまり大きい値にすると Emacs ごと落ちます… | |
| (require 'cl-lib) | |
| (require 'stream) ;; (package-install 'stream) |
This file contains hidden or 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
| ;;; -*- lexical-binding: t; -*- | |
| (defvar rand-next 1) | |
| (defsubst myrand () | |
| "C 言語版や Common Lisp 版等と計算結果を合わせたい為に 32 bit の整形合同法を実装してます…" | |
| (setq rand-next (logand (+ (logand (* rand-next 1103515245) #x7fffffff) 12345) #x7fffffff)) | |
| (logand (ash rand-next -16) #x7fff)) | |
| (defsubst float-rand () |
This file contains hidden or 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
| ;;; -*- lexical-binding: t; -*- | |
| ;; load-path に書かれたディレクトリにコピーした後 (require 'popframe) するか、 | |
| ;; (load-file "/path/to/popframe.el") してください。 | |
| ;; | |
| ;; (setq frame-resize-pixelwise t) | |
| ;; ↑この設定をしておくことを推奨します。 | |
| ;; してない場合は、画像サイズぴったりにフレームがリサイズされません。 | |
| (require 'subr-x) |
This file contains hidden or 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
| ;;; -*- lexical-binding: t; -*- | |
| (defun image-tooltip-at-point () | |
| "ポイントやマウスカーソルの下の画像ファイルをツールチップ内に表示します。 | |
| 使い方: | |
| (define-key c-mode-map \"\\C-co\" 'image-tooltip-at-point) | |
| (define-key c-mode-map [mouse-1] 'image-tooltip-at-point) | |
| ./very-sorry.png |
OlderNewer