emacs-slackでShift+Enter, Ctrl+Enterをメッセージ内改行にする
keyboard macroの最中はhelmを使わない
個人的にC-s
での検索に通常のisearch-forward
ではなく,
helm-swoop
を利用している.
しかしこうすると, keyboard macroを入力している間にhelmが走り、これがどうやら後ほどkeyboard macroを再生するときに問題があるようだ.
keyboard macroを記録中かどうかはdefining-kbd-macro
という変数を見ればわかるようだ. また, keyboard macroの実行中はexecuting-kdb-macro
を見ればわかる.
defining-kbd-macro
がt
のときはisearch-forward
を利用するようにする.
;; (global-set-key (kbd "C-s") 'helm-swoop) (defun my-search-forward () "Customized search function to use helm-swoop except for in defining keyboard macro." (interactive) (if (or defining-kbd-macro executing-kbd-macro) (isearch-forward) (helm-swoop))) (global-set-key (kbd "C-s") 'my-search-forward)
同様のkeyboard macroが有効かに応じて挙動を切り替える設定は他の色々なものに利用できるはず.
emacs 26で入ったdisplay-line-numbersを利用する
emacsで左側に行数を表示するlinum-modeは重いことで有名だった。 軽くするためにはいろいろと設定しなくてはいけなかった.
しかし, emacs26でついに行数表示のネイティブ実装であるdiplay-line-numbers-modeが実装された.
(if (version<= "26.0.50" emacs-version) (global-display-line-numbers-mode))
個人的にはemacs -nw
で起動したときに行数表示の色が見にくかったので以下のようにしている
(if (version<= "26.0.50" emacs-version) (progn (global-display-line-numbers-mode) (defun display-line-numbers-color-on-after-init (frame) "Hook function executed after FRAME is generated." (unless (display-graphic-p frame) (set-face-background 'line-number (plist-get base16-solarized-dark-colors :base01)))) (add-hook 'after-make-frame-functions (lambda (frame) (display-line-numbers-color-on-after-init frame))) ))
web-modeでeslintをflycheck経由で使う
flycheck-add-mode
で設定する
(flycheck-add-mode 'javascript-eslint 'web-mode)
eslintの設定で, eslint-plugin-htmlが必要なので、その設定を忘れないようにする.
module.exports = { ... "plugins": [ "html", ], ... }
helmを立ち上げたときにhelm-source-ls-gitを強制的に更新させる
helm-ls-gitはgitで管理されているファイルをhelmの候補に加えてくれるとても便利なパッケージ.
これをhelm-miniなどを立ち上げたときにも使うようにしたいのだが、helm-source-ls-git
をhelm-mini-default-sources
に加えるだけでは不十分だった。自分でhelm-source-ls-git
を更新してあげる必要がある.
(setq helm-mini-default-sources '(... helm-source-ls-git ...)) (defun my-helm-mini () (interactive) (require 'helm-x-files) (unless helm-source-buffers-list (setq helm-source-buffers-list (helm-make-source "Buffers" 'helm-source-buffers))) (setq helm-source-ls-git (helm-ls-git-build-ls-git-source)) ; important! (helm :sources helm-mini-default-sources :buffer "*helm mini*" :default "" :ff-transformer-show-only-basename nil :truncate-lines helm-buffers-truncate-lines))
typescriptでthree.jsのexamplesにあるTrackballControlsなどを使う
imports-loader
とexports-loader
というパッケージを利用すると良いらしい。
npm install --save imports-loader exports-loader
TrackballControls
を使うには下のようにする.
const THREE = require('three'); THREE.TrackballControls = require('imports-loader?THREE=three!exports-loader?THREE.TrackballControls!../node_modules\/three\/examples\/js\/controls\/TrackballControls');