GNU Emacs 32.0.50 (9008bf64c3) のマニュアルを PLaMo 翻訳で機械翻訳したものです。誤訳を含むことがあります。原文: https://www.gnu.org/software/emacs/manual/html_node/emacs/Windows-Startup.html ・ emacs-doc.conao3.com

I.1 MS-WindowsでEmacsを起動する方法

MS-WindowsでEmacsを起動する方法はいくつかあります:

  1. From the desktop shortcut icon: either double-click the left mouse button on the icon, or click once, then press RET. The desktop shortcut should specify as its “Target” (in the “Properties” of the shortcut) the full absolute file name of runemacs.exe, not of emacs.exe. This is because runemacs.exe hides the console window that would have been created if the target of the shortcut were emacs.exe (which is a console program, as far as Windows is concerned). If you use this method, Emacs starts in the directory specified by the shortcut. To control where that is, right-click on the shortcut, select “Properties”, and in the “Shortcut” tab modify the “Start in” field to your liking.
  2. From a task-bar shortcut icon, by clicking once the left mouse button. Windows versions since Vista allow you to create such shortcuts by pinning the icon of a running program that appears in the task bar. You can do that with Emacs, but afterwards you will have to change the properties of the pinned shortcut to run runemacs.exe, not of emacs.exe. You can also pin Emacs to the task bar by clicking the right mouse button on its icon in the Start menu, then selecting ‘Pin to taskbar’. Once again, be sure to specify runemacs.exe as the program to run. You can control where Emacs starts by setting the “Start in” field of the shortcut’s Properties.
  3. コマンドプロンプトのウィンドウで、プロンプトに emacs RET と入力します。この操作を行ったコマンドプロンプトのウィンドウは、Emacsが終了するまで他のコマンドを実行できなくなります。この場合、EmacsはWindowsシェルのカレントディレクトリで起動します。
  4. コマンドプロンプトのウィンドウで、プロンプトに runemacs RET と入力します。操作を行ったコマンドプロンプトのウィンドウは、すぐに他のコマンドを実行できるようになります。この場合、Emacs は Windows シェルのカレントディレクトリで起動します。
  5. WindowsのRunダイアログ(通常はStartボタンをクリックしてアクセスします)で、runemacs RETと入力すると、ユーザーのHOMEディレクトリに相当するWindows上のディレクトリの親ディレクトリでEmacsが起動します。詳細はMS-WindowsにおけるHOMEおよび起動ディレクトリを参照してください。
  6. 他のプログラムからEmacsを起動したり、実行中のEmacsプロセスを再利用して他のプログラムが必要とする編集ジョブを処理したりできる emacsclient.exe または emacsclientw.exe を使用します。Emacsをサーバーとして使用する を参照してください。emacsclient.exe と emacsclientw.exe の違いは、前者がコンソールプログラムであるのに対し、後者はWindows GUIプログラムである点です。どちらのプログラムも、Emacsが編集ジョブの完了を通知するまで待機し、その後終了して起動元のプログラムに制御を戻します。どちらを使用するかは、編集サービスを必要とするプログラムの要件によって異なります。そのプログラム自体がコンソール(テキストモード)プログラムである場合は、emacsclient.exe を使用してください。これにより、そのプログラムのメッセージやプロンプトが、起動元のプログラムと同じコマンドウィンドウに表示されます。対照的に、起動元のプログラムがGUIプログラムである場合は、emacsclientw.exe を使用するのが適切です。emacsclient.exe をGUIプログラムから起動すると、コマンドウィンドウがポップアップ表示されるためです。emacsclientw.exe が有用な代表的な場面は、Windowsエクスプローラーでファイルを右クリックし、ポップアップメニューから「プログラムから開く」を選択する場合です。emacsclient を起動した際にEmacsが実行されていない(またはサーバーとして動作していない)可能性がある場合は、--alternate-editor= または -a オプションを使用してください。これにより、常にエディタが利用可能になります。emacsclient 経由で起動した場合、Emacsは emacsclient を起動したプログラムのカレントディレクトリで起動します。

なお、MS-Windowsの制約により、Emacsでは同一セッション内でGUIフレームとテキストモードフレームを共存させることはできません。また、Windowsの各プログラムは一度に1つのコンソールしか持てないため、複数のコマンドプロンプトウィンドウでテキストモードフレームを開くこともできません。こうした理由から、-cオプションを指定してemacsclientを実行し、かつEmacsサーバーがテキストモードセッションで動作している場合、Emacsは常に起動したのと同じコマンドプロンプトウィンドウ内に新しいテキストモードフレームを作成します。GUIフレームが作成されるのは、サーバーがGUIセッションで動作している場合のみです。同様に、-tオプションを指定してemacsclientを実行した場合、サーバーがGUIセッションで動作していればEmacsはGUIフレームを、コマンドプロンプトウィンドウのテキストモードセッションで動作していればテキストモードフレームを作成します。emacsclient オプションを参照してください。