-
Notifications
You must be signed in to change notification settings - Fork 31
emacs-jp/emacs-jp.github.com#22 の内容をまとめ #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
66 changes: 66 additions & 0 deletions
osx_backslash.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| --- | ||
| layout: page | ||
| title: "Macでの\\(バックスラッシュ)入力について" | ||
| description: "" | ||
| --- | ||
| {% include JB/setup %} | ||
|
|
||
| Mac OS X と日本語設定の環境では、`delete` の左側のキーで `\` (バックスラッシュ) ではなく `\` (円記号) が入力されます。 | ||
|
|
||
| 通常は `alt option` と書かれたキー (以下 `option`)と `\` を同時に押すことで `\` を入力することができますが、Emacs の初期設定では `option` は `Meta` キーの代用として設定されています。 | ||
|
|
||
| `\` が入力できないとコーディングに支障が出るので、何らかの手段で `\` を入力できるようにする必要があります。 | ||
|
|
||
| ターミナルで使用する場合 | ||
| ------------------------ | ||
|
|
||
| ターミナル(Terminal.app) や [iTerm2](http://www.iterm2.com/#/section/home) で Emacs を起動する場合 (`emacs -nw`) は、通常そのままで `\` (バックスラッシュ) を入力することができます。 | ||
|
|
||
| Metaキーの割り当てを変える | ||
| -------------------------- | ||
|
|
||
| `Meta` を `⌘(Command)` キーに割り当て、`option` を Mac 本来の挙動に割り当てることで `option + \` で `\` を入力することができます。 | ||
|
|
||
| ```cl | ||
| ;; command key as meta key | ||
| (setq ns-command-modifier 'meta) | ||
| ;; option + yen(jis keyboard) => backslash | ||
| (setq ns-alternate-modifier 'option) | ||
| ``` | ||
|
|
||
| IMEパッチを使用している場合 | ||
| --------------------------- | ||
|
|
||
| [http://sakito.jp/emacs/emacs24.html#ime](http://sakito.jp/emacs/emacs24.html#ime) などを参考に IME パッチを当ててビルドした場合は、`.emacs` に次の一行を加えることで `\` を入力できるようになります。 | ||
|
|
||
| ```cl | ||
| (mac-translate-from-yen-to-backslash) | ||
| ``` | ||
|
|
||
| global-set-keyで文字を挿入する | ||
| ------------------------------ | ||
|
|
||
| `.emacs` に以下の設定を追加することで、 `option + \` で `\` を入力できるようになります。 | ||
|
|
||
| ```cl | ||
| (global-set-key (kbd "M-\") (lambda () (interactive) (insert "\\"))) | ||
| ``` | ||
|
|
||
| また、次のように設定することで単独で `\` 、 `option` と同時に押すことで `\` を入力できるようにできます。 | ||
|
|
||
| ```cl | ||
| (global-set-key (kbd "\") (lambda () (interactive) (insert "\\"))) | ||
| (global-set-key (kbd "M-\") (lambda () (interactive) (insert "\"))) | ||
| ``` | ||
|
|
||
| KeyRemap4MacBookでキーボードをリマップする | ||
| ------------------------------------------ | ||
|
|
||
| [KeyRemap4MacBook](http://pqrs.org/macosx/keyremap4macbook/index.html.ja) は Mac 用のキーボードマップ割り当てツールで、非常に柔軟にカスタマイズすることができます。 | ||
|
|
||
| ただし影響範囲が大きく Emacs カスタマイズの範疇からも逸脱するため、この記事では詳細に解説しません。 | ||
|
|
||
| この記事について | ||
| ---------------- | ||
|
|
||
| この記事は [Macでの\\(バックスラッシュ)入力について · Issue #22 · emacs-jp/emacs-jp.github.com](https://github.com/emacs-jp/emacs-jp.github.com/issues/22) に寄せられた質問と回答をまとめたものです。 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.