This is an old revision of the document!
File
⇒ New Frame
), multiple buffersemacs
is already installed on the Linux computer or servers you are using, e.g with the which
command. There is a good chance that emacs
is already available on shared servers!$ which \emacs /usr/bin/emacs
emacs
is not available:emacs
package the following way$ sudo apt install emacs [sudo] password for your_login: Reading package lists... Done Building dependency tree Reading state information... Done emacs is already the newest version (1:26.3+1-1ubuntu2). 0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
Install Aquamacs
On a computer configured at LSCE, use your .\admin
account
winget
to install emacs
for Windows (optional winget details, for people who want to learn more):cmd
, PowerShell
or Terminal
winget install --id GNU.Emacs
winget
does not work, download the most recent Windows installer from a gnu ftp mirroremacs-XX/
folder (e.g. emacs-29/
as of February 2024)emacs-XX.YY-installer.exe
file (e.g. emacs-29.2_1-installer.exe
as of February 2024) and execute itStart
⇒Emacs-XX
menu that you can use to start emacs
C:\\Program Files\\Emacs\\emacs-XX.YY\\bin
addpm.exe
program to (re-)run the program that will create the shortcuts (official page)emacs
settings, but it is highly recommended to start with a nice existing emacs configuration file (if available)emacs
can automatically transfer files between your local computer and remote servers, if configured properlymylogin_server
(e.g. me_ssh1
) is OKmylogin server
will not work/plinkx:mylogin_server:/path/to/file
diffutils-2.8.7-1.exe
as of February 2024) from https://gnuwin32.sourceforge.net/packages/diffutils.htm and execute the installerC:\Program Files (x86)\GnuWin32\
.emacs
configuration file, it should already have a section telling emacs where to find the diffutils
binaries it needs for comparing text files(when (eq window-system 'w32) (setq exec-path (append exec-path '("C:\\Program Files (x86)\\GnuWin32\\bin"))) )
diffutils
2.8.7-1
Win32 binaries are dated May 2004, but work perfectly fine!emacs some_text_file &
emacs &
Start
⇒ E
⇒ Emacs-XX.Y
⇒ Emacs
C-g
(CTRL
+g
) to abort or interrupt something in emacs
e.g. When you are searching forward with C-s
, type C-g
to exit the search
All the common functions of emacs are available from the pull-down menus at the top, but the real power comes from knowing (a few of) the keyboard shortcuts!
C-x C-c
means CTRL-x
followed by CTRL-c
, and will exit emacsFile
⇒Quit
, just faster C-s
means CTRL-s
, and will Search forwardIncremental Search
in the Reference Card for more information on searching!C-g
means CTRL-G
and will abort the current emacs command/action (e.g. exit a forward search started with C-s
)C-z
will iconify the emacs window!C-x u
(CTRL-x
followed by u
) or Edit
⇒Undo
for undoing the previous action!M-f
means Alt-f
(or Esc
followed by f
if the keyboard has no Alt
key), and will Move forward a wordC-A
and C-E
to go to the beginning and end of a lineHelp
⇒Emacs Tutorial
Help
⇒Emacs Tutorial (choose language)…
(
and )
) when copy/pasting settings you find on the web, and remember that comments start with a ;
characterOptions
menu appear at the end of the configuration file
Configuration file name: .emacs
emacs knows (of course) where its .emacs
configuration file is located! You can open the configuration file just by typing C-x C-f ~/.emacs
and you can then check how your Home folder (~/
) has been expanded
Related emacs (configuration) files and folders (e.g. .emacs.d/
folder) are located in the same place as the main configuration file
~/.emacs
: i.e. .emacs
(dot-emacs) file in the current user's Home directoryc:\Users\your_login\AppData\Roaming\.emacs
c:/Users/your_login/AppData/Roaming/.emacs
(or just ~/.emacs
)emacs_jyp_yyyy-mm-dd.txt
file to the appropriate configuration directory (for your system).emacs
emacs
or another editor) and search Microsoft to (un)comment MS Windows specific sections of the configuration fileemacs
to take this configuration file into accountemacs
displays the following error message, just create the server
directory (c:/Users/your_login/AppData/Roaming/.emacs.d/server
) by hand and restart emacs
Warning (initialization): An error occurred while loading ‘c:/Users/your_login/AppData/Roaming/.emacs’: File is missing: Opening output file, No such file or directory, c:/Users/your_login/AppData/Roaming/.emacs.d/server/server
C-x C-g
: go to a specific lineShift Left_Arrow
and Shift Right_Arrow
: go to the beginning/end of a lineC-a
and C-e
, and the Home
and End
keyboard keysShift Up_Arrow
and Shift Down_Arrow
: go to the beginning/end of the bufferF1
: Undo (lots of undos!!)F2
: Search and ReplaceQuery Replace
in the Reference Card to determine what you can do when a match is foundF3
: fill-paragraph (i.e. automatically re-indent text or comments)F4
: indent the selected region (if indenting makes sense for the current buffer mode)F5
: comment out the selected region (comment style depends on the current buffer mode)M-;
can be used for commenting and un-commentingF12
: Repeat complex command (e.g. restart a previous query-replace operation)M-;
: comment out selected linescomment character
for the current buffer mode, e.g. #
for a Python scriptC-x C-f
), emacs will automatically use the tramp
mode to:scp
) to your computer when you open it, so that you can edit the file locallyscp
) back to its original remote location when you save it (C-x C-s
)/ssh:mylogin@server:/path/file
/ssh:mylogin@ssh1.lsce.ipsl.fr:/home/users/mylogin/my_script.py
/plinkx:mylogin_server:/path/file
on MS Windows, with an existing mylogin_server
session defined in PuTTY
/ssh:user_A@gateway|ssh:user_B@target_server:/path/file
/ssh:mylogin@ssh1.lsce.ipsl.fr|ssh:user_B@target_server:/path/file
/plinkx:mylogin_server|ssh:user_B@target_server:/path/file
on MS Windows, with an existing mylogin_server
session defined in PuTTY
'(recentf-mode t)
mode, you can easily access recent files in File
⇒Open Recent
without having to type the full access path again!
The tramp
mode is quite complex and relies on connections to one or more remote computers using external programs and protocols. You may have to experiment a bit till you find the correct syntax and inline method to work with a particular remote server. Make sure you have read the prerequisite section!
Buffer
⇒ *Messages*
C-g
M-x doctor
). See also Fun and Games in EmacsI am the psychotherapist. Please, describe your problems. Each time you are finished talking, type RET twice. My climate model does not work Why do you say your climate model does not work? I get wrong results Is it because of your plans that you say you get wrong results?
Using winget upgrade
for updating emacs on Windows unfortunately does not work yet (August 2023). The easiest way to update Emacs is:
Start
menu: Start
⇒ E
⇒ Emacs-version
(e.g. Emacs 28.2
)Help
menu ⇒ About Emacs
winget show
in a PowerShell to determine (all) the available versionsPS C:> winget show --id GNU.Emacs --versions Found GNU Emacs [GNU.Emacs] Version ------- 29.1 28.2 [...]
Start
⇒ E
⇒ Emacs-version
⇒ Uninstall
[ PMIP3 Wiki Home ] - [ Help! ] - [ Wiki syntax ]