This is an old revision of the document!
File
⇒ New Frame
), multiple buffers
Install the emacs
package, if it is not already available
$ 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
At LSCE, use the .\admin
account
winget
to install emacs
for Windows (optional winget details, for people who want to learn more):cmd
, PowerShell
or Terminal
with elevated (i.e. administrator) permissions:winget install --id GNU.Emacs
winget
does not work, download the most recent Windows installer from a gnu ftp mirrorwindows/emacs-XX/
folder (e.g. windows/emacs-29/
)emacs-XX.YY-installer.exe
file (e.g. emacs-29.1_2-installer.exe
) and execute itStart
⇒Emacs-XX
menu that you can use to start emacs
emacs
settings, but it is highly recommended to start with a nice existing emacs configuration file (if available)emacs
can automatically transfer files from your computer and remote servers, if configured properlymylogin_server
(e.g. jyp_ssh1
) is OKmylogin server
will not work/plinkx:mylogin_server:/path/to/file
diffutils-2.8.7-1.exe
as of August 2023) from https://gnuwin32.sourceforge.net/packages/diffutils.htm.emacs
configuration file (and restart emacs). Otherwise emacs will not be able to find the diffutils
binaries it needs for comparing text files(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
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 accountC-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 ]