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
;; Anythingのプロンプトがある状態でほかのウィンドウに移動したらanything-keyboard-quitする | |
(defvar my-last-selected-buffer nil | |
"The buffer that was selected before the current window change.") | |
(defun my-window-selection-change (frame) | |
"Handle anything-keyboard-quit when switching from minibuffer." | |
(let ((current-buffer (buffer-name (window-buffer (selected-window))))) | |
(when (and my-last-selected-buffer | |
(stringp (buffer-name my-last-selected-buffer)) |
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
;;; ------------------------------------------------------------ | |
;;; 大きいファイルを早く開きたい | |
;; 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 |
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
;;; ------------------------------------------------------------ | |
;;; やっぱりキル時にリージョンを残したい……。 | |
;; 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))) |
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
;;; ------------------------------------------------------------ | |
;;; 起動時には最後に作業していたファイルを開く | |
;; 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")) |
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
;;; ------------------------------------------------------------ | |
;;; 自分好みのカーソル移動 (2) | |
;; gist-description: Emacs(Elisp): forward/backward-wordだと、移動距離が微妙に大きい。単語境界も微妙だった。ので、カーソル移動をちょっとカスタマイズ。 | |
;; gist-id: 467f4302c002049bfb95511bd21cdbe7 | |
;; gist-name: skip-chars-(forward|backward)-dwim.el | |
;; gist-private: nil | |
(defun my-skip-chars (forward) | |
"Skip characters based on the direction FORWARD." | |
(let ((start (point)) |
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
;; 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 |
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
;;; ------------------------------------------------------------ | |
;;; 次/前の空行 | |
;; 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 "^") |
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
;;; ------------------------------------------------------------ | |
;;; インデント整形 | |
;; gist-description: Emacs(Elisp): indent.elにそのままの機能があったので、そちらに置き換え。 | |
;; gist-id: f941e7f365872920c7f8 | |
;; gist-name: my-indext-region.el | |
;; gist-private: nil | |
(global-set-key (kbd "s-}") 'indent-rigidly-right-to-tab-stop) | |
(global-set-key (kbd "s-]") 'indent-rigidly-right-to-tab-stop) | |
(global-set-key (kbd "s-{") 'indent-rigidly-left-to-tab-stop) |
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
;; move-current-tab-to-top | |
;; gist-description: Emacs(Elisp): move current tab (buffer) to top at tabbar-mode. tabbarで選択中のタブ(バッファ)を左端に移動します。 | |
;; gist-id: 54dab2fc5f2e278833f5 | |
;; gist-name: move-current-tab-to-top.el | |
;; gist-private: nil | |
(defun move-current-tab-to-top () | |
"Move current tab to top." | |
(interactive) | |
(let* ((bufset (tabbar-current-tabset t)) |
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
;;; 行/選択範囲の複製 (cmd+d) | |
;; gist-description: Emacs(Elisp): duplicate region or line. if same command repeated, then duplicate sate strings. 選択範囲がある場合は選択範囲を、選択範囲がない場合は、行を複製します。繰り返した場合、同じ文字列を複製し続けます。 | |
;; gist-id: 297fe973cde66b384fa1 | |
;; gist-name: duplicate-region-or-line.el | |
;; gist-private: nil | |
(defvar previous-duplicate-region-or-line nil) | |
(defvar previous-duplicate-region-or-line-was-line nil) | |
(defun duplicate-region-or-line () |
NewerOlder