Skip to content

Instantly share code, notes, and snippets.

View jidaikobo-shibata's full-sized avatar

jidaikobo-shibata jidaikobo-shibata

View GitHub Profile
@jidaikobo-shibata
jidaikobo-shibata / move(region)-to-next(previous)-blank-line.el
Last active July 7, 2016 05:29 — forked from jewel12/gist:2873112
Emacs(Elisp): forward/backward-paragraphだとparagraph判定がおそらくシンタックステーブル依存になり、字義通りの「次の空行」にならないので、別途用意。
;;; ------------------------------------------------------------
;;; 次/前の空行
;; gist-description: Emacs(Elisp): forward/backward-paragraphだとparagraph判定がおそらくシンタックステーブル依存になり、字義通りの「次の空行」にならないので、別途用意。
;; gist-id: ad27b19dd3779ccc1ff2
;; gist-name: move(region)-to-next(previous)-blank-line.el
;; gist-private: nil
(defun move-to-previous-blank-line ()
"Go to previous empty lines."
(interactive "^")
@jidaikobo-shibata
jidaikobo-shibata / defadvice-indent-for-tab-command.el
Last active July 11, 2016 13:34
Emacs(Elisp): To integrate indent style, delete existing whitespaces before indent-for-tab-command. indent-for-tab-commandの前に存在する行頭ホワイトスペースを削除することでインデントスタイルを統一する
;; defadvice-indent-for-tab-command
;; gist-description: Emacs(Elisp): To integrate indent style, delete existing whitespaces before indent-for-tab-command. indent-for-tab-commandの前に存在する行頭ホワイトスペースを削除することでインデントスタイルを統一する
;; gist-id: 604173d11ff376036635fd4811df6abb
;; gist-name: defadvice-indent-for-tab-command.el
;; gist-private: nil
(defadvice indent-for-tab-command (around advise-indent-for-tab-command activate)
"To integrate indent style, delete existing whitespaces before indentation."
(let (beg
end
@jidaikobo-shibata
jidaikobo-shibata / move-to-next(previous)-word-break.el
Last active October 12, 2020 07:10
Emacs(Elisp): forward/backward-wordだと、移動距離が微妙に大きい。単語境界も微妙だった。ので、ちょっと変質的にカーソル移動をカスタマイズ。
;;; ------------------------------------------------------------
;;; 次/前のwordbreakへ
;; gist-description: Emacs(Elisp): forward/backward-wordだと、移動距離が微妙に大きいので、単語境界でひっかかるように。
;; gist-id: 467f4302c002049bfb95511bd21cdbe7
;; gist-name: move-to-next(previous)-word-break.el
;; gist-private: nil
;; thx http://d.hatena.ne.jp/h1mesuke/20070803/p1
(defun move-to-next-word-break (&optional arg)
"Move point forward ARG word breaks (backward if ARG is negative)."
@jidaikobo-shibata
jidaikobo-shibata / preserve-last-buffers-and-point.el
Last active July 22, 2016 13:37
Emacs(Elisp): Preserve last buffers and its each point to reopen. 終了時のバッファとポイントを記憶して、起動時に同じ状態で開くelispです。
;;; ------------------------------------------------------------
;;; 起動時には最後に作業していたファイルを開く
;; gist-description: Emacs(Elisp): Preserve last buffers and its each point to reopen. 終了時のバッファとポイントを記憶して、起動時に同じ状態で開くelispです。
;; gist-id: 35b4d739a149f70e86298f71e5b1f9e7
;; gist-name: preserve-last-buffers-and-point.el
;; gist-private: nil
(defvar my-hist-dir (expand-file-name "~/.emacs.d/histories/"))
(defvar my-hist-last-files (concat my-hist-dir "last-files"))
@jidaikobo-shibata
jidaikobo-shibata / preserve-region-when-kill.el
Created June 7, 2017 09:02
Emacs(Elisp): Preserve region when kill. 他のエディタだと選択範囲を作った後コピーしても選択範囲が解除されないが、Emacsは解除されちゃう。1年以上使っていてもどうしてもこれには慣れることができなかったので、選択範囲をキープするように変更。
;;; ------------------------------------------------------------
;;; やっぱりキル時にリージョンを残したい……。
;; gist-description: Emacs(Elisp): Preserve region when kill. 他のエディタだと選択範囲を作った後コピーしても選択範囲が解除されないが、Emacsは解除されちゃう。1年以上使っていてもどうしてもこれには慣れることができなかったので、選択範囲をキープするように変更。
;; gist-id:
;; gist-name: preserve-region-when-kill.el
;; gist-private: nil
(defun f--around--cua-copy-region (cua-copy-region arg)
"Keep Region at kill. CUA-COPY-REGION, ARG."
(let ((beg (region-beginning))
(end (region-end)))
@jidaikobo-shibata
jidaikobo-shibata / open-large-file-quickly.el
Last active August 2, 2020 07:32
Emacs(Elisp): Open large file quickly. 大きいファイルを早く開きたい
;;; ------------------------------------------------------------
;;; 大きいファイルを早く開きたい
;; gist-description: Emacs(Elisp): Open large file quickly. 大きいファイルを早く開きたい
;; gist-id: 96e00bd843c838f45ab8183e286150ec
;; gist-name: open-large-file-quickly.el
;; gist-private: nil
(defun open-large-file-quickly()
"To read large file."
(interactive)
(progn