User Tools

Site Tools


other:emacs_doc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
other:emacs_doc [2023/12/06 16:55]
jypeter [Windows installation] Improved
other:emacs_doc [2024/07/30 15:03] (current)
jypeter [Windows installation] Updated some dates
Line 33: Line 33:
 ==== Linux installation ==== ==== Linux installation ====
  
-Install the ''​emacs'' ​packageif it is not already available+  * Check **if ''​emacs'' ​is already installed** on the Linux computer or servers you are usinge.g with the ''​[[other:​newppl:​starting#​which_program_am_i_using|which]]''​ command. There is a good chance that ''​emacs'' ​is already available ​on shared servers! 
 +    * <​code>​$ which \emacs 
 +/​usr/​bin/​emacs</​code>​
  
-<​code>​$ sudo apt install emacs+  * **If ''​emacs''​ is not available**:​ 
 +    * On shared server: ask your local system administrators 
 +    *  On your Linux desktop/​laptop:​ install the ''​emacs''​ package the following way 
 +      * <​code>​$ sudo apt install emacs
 [sudo] password for your_login: [sudo] password for your_login:
 Reading package lists... Done Reading package lists... Done
Line 50: Line 55:
  
 ==== Windows installation ==== ==== Windows installation ====
- 
  
  
Line 57: Line 61:
 <note warning>​When installing emacs, you will need an account that can get **//​elevated//​ (i.e. //​administrator//​) permissions** <note warning>​When installing emacs, you will need an account that can get **//​elevated//​ (i.e. //​administrator//​) permissions**
  
-\\ At LSCE, use the ''​[[https://​wiki.lsce.ipsl.fr/​pmip3/​doku.php/​other:​win10config#​the_available_accounts|.\admin]]''​ account</​note>​+\\ On a computer configured at LSCE, use your ''​[[https://​wiki.lsce.ipsl.fr/​pmip3/​doku.php/​other:​win10config#​the_available_accounts|.\admin]]''​ account</​note>​
  
   * Use ''​winget''​ to install ''​emacs''​ for Windows (optional [[other:​win10apps#​installing_applications_with_winget|winget]] details, for people who want to learn more):   * Use ''​winget''​ to install ''​emacs''​ for Windows (optional [[other:​win10apps#​installing_applications_with_winget|winget]] details, for people who want to learn more):
-    * Just type the folllowing, in a windows ''​cmd'',​ ''​PowerShell''​ or ''​Terminal''​ **with //​elevated//​ (i.e. //​administrator//​) permissions**:\\ ''​%%winget install --id GNU.Emacs%%''​ +    * Just type the folllowing, in a windows ''​cmd'',​ ''​PowerShell''​ or ''​Terminal''​ 
-  * IF the automated installation with ''​winget''​ does not work, download the most recent Windows installer from a gnu ftp mirror +      ​''​%%winget install --id GNU.Emacs%%''​ 
-    * Go to [[https://​ftpmirror.gnu.org/​emacs/​|gnu emacs ftp mirror]] +      ​if your Windows terminal does not have //​elevated//​ (i.e. //​administrator//​) permissions, a pop-up window will open and ask for confirmation 
-    * Go to the most recent ''​windows/emacs-XX/''​ folder (e.g. ''​windows/emacs-29/''​) +  * IF the automated installation with ''​winget''​ does not work, download the most recent Windows installer from a gnu //ftp// mirror 
-    * Download the most recent ''​emacs-XX.YY-installer.exe''​ file (e.g. ''​emacs-29.1_2-installer.exe''​) and execute it+    * Go to [[https://​ftpmirror.gnu.org/​emacs/windows/|gnu emacs for windows ​ftp mirror]] 
 +    * Go to the most recent ''​emacs-XX/''​ folder (e.g. ''​emacs-29/'' ​as of August 2024
 +    * Download the most recent ''​emacs-XX.YY-installer.exe''​ file (e.g. ''​emacs-29.4-installer.exe'' ​as of August 2024) and execute it
  
   * If everything went well, you should have a new ''​Start''​=>''​Emacs-XX''​ menu that you can use to start ''​emacs''​   * If everything went well, you should have a new ''​Start''​=>''​Emacs-XX''​ menu that you can use to start ''​emacs''​
-    * If that'​s ​not the cas FIXME+    * If the menu shortcuts have **not** been installed:​ 
 +      * Go to the emacs binaries directory: ''​C:​\Program Files\Emacs\emacs-XX.YY\bin''​ 
 +      * Click on the ''​addpm.exe''​ program to (re-)run the program that will create ​the shortcuts ([[https://​www.gnu.org/​software/​emacs/​manual/​html_node/​efaq-w32/​Installing-binaries.html|official page]])
  
   * You can work with the default ''​emacs''​ settings, but it is highly recommended to start with a nice existing emacs configuration file (if available)   * You can work with the default ''​emacs''​ settings, but it is highly recommended to start with a nice existing emacs configuration file (if available)
     * [[other:​emacs_doc#​example_configuration_file|Example configuration file]]     * [[other:​emacs_doc#​example_configuration_file|Example configuration file]]
 +
 +  * Note: Emacs is installed in the ''​C:​\Program Files\Emacs\emacs-XX.YY\bin''​ directory
  
 === Recommended EXTRA binaries for Windows === === Recommended EXTRA binaries for Windows ===
  
-  * **If** you need to **work with remote files**, ''​emacs''​ can automatically transfer files from your computer and remote servers, if configured properly\\ <wrap hi>​**Extremely** useful</​wrap>​+  * **If** you need to **work with remote files**, ''​emacs''​ can automatically transfer files between ​your local computer and remote servers, if configured properly\\ <wrap hi>​**Extremely** useful</​wrap>​
     * [[https://​wiki.lsce.ipsl.fr/​pmip3/​doku.php/​other:​putty_conf|Install PuTTY]], and configure a PuTTY //profile// for the desired //host **and** user// combination,​ so that emacs can use the [[https://​the.earth.li/​~sgtatham/​putty/​0.78/​htmldoc/​Chapter7.html#​plink|PuTTY plink]] command to connect to remote servers (and transfer files)     * [[https://​wiki.lsce.ipsl.fr/​pmip3/​doku.php/​other:​putty_conf|Install PuTTY]], and configure a PuTTY //profile// for the desired //host **and** user// combination,​ so that emacs can use the [[https://​the.earth.li/​~sgtatham/​putty/​0.78/​htmldoc/​Chapter7.html#​plink|PuTTY plink]] command to connect to remote servers (and transfer files)
-      * Do not use //space// characters in the predefined PuTTY profile name! +      ​* **Do not use //space// characters in the predefined PuTTY profile name**
-        * ''​mylogin_server''​ (e.g. ''​jyp_ssh1''​) is OK+        * ''​mylogin_server''​ (e.g. ''​me_ssh1''​) is OK
         * but ''​mylogin server''​ will **not** work         * but ''​mylogin server''​ will **not** work
     * Use the [[https://​www.gnu.org/​software/​tramp/#​Inline-methods|plinkx]] //method// when opening a remote file with emacs: ''/​plinkx:​mylogin_server:/​path/​to/​file''​     * Use the [[https://​www.gnu.org/​software/​tramp/#​Inline-methods|plinkx]] //method// when opening a remote file with emacs: ''/​plinkx:​mylogin_server:/​path/​to/​file''​
-      * Use **exactly** the same profile name as an existing PuTTY profile!+      * Use **exactly the same profile name** as an existing PuTTY profile!
       * More details in FIXME       * More details in FIXME
  
   * **If** you need to use the **emacs //ediff// mode to compare text files**\\ <wrap hi>Very useful</​wrap>​   * **If** you need to use the **emacs //ediff// mode to compare text files**\\ <wrap hi>Very useful</​wrap>​
     * Install the Windows version of [[https://​www.gnu.org/​software/​diffutils/​diffutils.html|Gnu diffutils]]     * Install the Windows version of [[https://​www.gnu.org/​software/​diffutils/​diffutils.html|Gnu diffutils]]
-      * Download ​and execute ​the //Complete package, except sources ​installer// (''​diffutils-2.8.7-1.exe''​ as of August ​2023) from [[https://​gnuwin32.sourceforge.net/​packages/​diffutils.htm|]] +      * Download the //Complete package, except sources// ​''​Setup''​ installer ​(''​diffutils-2.8.7-1.exe''​ as of August ​2024) from [[https://​gnuwin32.sourceforge.net/​packages/​diffutils.htm|]] ​and execute the installer 
-      Be sure to uncomment ​the following line in your ''​.emacs''​ configuration file (and restart ​emacs). Otherwise emacs will not be able to find the ''​diffutils''​ binaries it needs for comparing text files +        This will install ​the required binaries and reources ​in ''​C:​\Program Files (x86)\GnuWin32\''​ 
-        * ''(setq exec-path (append exec-path '​("​C:​\\Program Files (x86)\\GnuWin32\\bin"​)))''​ +      * If you use the recommended ​''​.emacs''​ configuration file, it should already include the following section telling ''​emacs''​ where to find the ''​diffutils''​ binaries it needs for comparing text files 
-    * FIXME Find a recent //compiled for Windows// version of ''​diffutils''​\\ As of July 2023...+        * <​code>​(when (eq window-system ​'w32) 
 +  ​(setq exec-path (append exec-path '​("​C:​\\Program Files (x86)\\GnuWin32\\bin"​))) 
 +  )</​code>​ 
 +    * FIXME Check if there is a recent //compiled for Windows// version of ''​diffutils''​\\ As of August 2024...
       * [[https://​savannah.gnu.org/​news/?​id=10368|diffutils-3.10]] is available (released in May 2023)       * [[https://​savannah.gnu.org/​news/?​id=10368|diffutils-3.10]] is available (released in May 2023)
       * The ''​2.8.7-1''​ Win32 binaries are dated //May 2004//, but **work perfectly fine**!       * The ''​2.8.7-1''​ Win32 binaries are dated //May 2004//, but **work perfectly fine**!
Line 112: Line 125:
 ==== Windows launch ==== ==== Windows launch ====
  
-  * ''​Start''​ => ''​E''​ => ''​Emacs''​+  * ''​Start''​ => ''​E''​ => ''​Emacs-XX.Y''​ => ''​Emacs''​
  
 ==== Mac launch ==== ==== Mac launch ====
Line 167: Line 180:
 ===== emacs configuration file ===== ===== emacs configuration file =====
  
-  * The **configuration file** is officially known as the //​[[https://​www.gnu.org/​software/​emacs/​manual/​html_node/​emacs/​Init-File.html|Emacs Initialization File]]//+  * The **configuration file** is officially known as the //​[[https://​www.gnu.org/​software/​emacs/​manual/​html_node/​emacs/​Init-File.html|Emacs Initialization File]]// ​(or just //init file//)
  
   * The configuration file (and most of the emacs //​Packages//​) is written in **//Emacs Lisp//**   * The configuration file (and most of the emacs //​Packages//​) is written in **//Emacs Lisp//**
     * You can perfectly survive without knowing anything about lisp! Just **don'​t forget opening and closing parentheses** (''​(''​ and ''​)''​) when copy/​pasting settings you find on the web, and remember that comments start with a '';''​ character     * You can perfectly survive without knowing anything about lisp! Just **don'​t forget opening and closing parentheses** (''​(''​ and ''​)''​) when copy/​pasting settings you find on the web, and remember that comments start with a '';''​ character
     * The settings changed with the ''​Options''​ menu appear at the end of the configuration file     * The settings changed with the ''​Options''​ menu appear at the end of the configuration file
 +      * Setting are defined in the ''​custom-set-XXXX''​ variables, if you don't forget to select ''​Options''​=>''​Save Options''​
  
   * The easiest way to take changes into account is to restart emacs   * The easiest way to take changes into account is to restart emacs
Line 192: Line 206:
 ==== Example configuration file ==== ==== Example configuration file ====
  
-  * Recommended {{ :other:emacs_jyp_2023-09-12.txt |emacs configuration file}}+  * Recommended {{ :other:emacs_jyp_2024-05-07.txt |emacs configuration file}}
     * Download this ''​emacs_jyp_yyyy-mm-dd.txt''​ file to the [[other:​emacs_doc#​location_of_the_configuration_file|appropriate configuration directory (for your system)]]     * Download this ''​emacs_jyp_yyyy-mm-dd.txt''​ file to the [[other:​emacs_doc#​location_of_the_configuration_file|appropriate configuration directory (for your system)]]
-    * Rename ​the file to ''​.emacs''​ +    * Copy the ''​emacs_jyp_yyyy-mm-dd.txt'' ​file to ''​.emacs''​ 
-    * Edit the file (with ''​emacs''​ or another editor) ​and search ​//Microsoft// to (un)comment ​MS Windows specific ​sections of the configuration file +    * You can possibly edit the ''​.emacs'' ​file (with ''​emacs''​ or another editor) ​to make some changes, but it should theoretically work //as is// 
-    * (re)start ''​emacs''​ to take this configuration ​file into account+      * MS Windows specific ​section should automatically be executed only on Windows computer, and you don't have to comment them out by hand. You can find them by looking for the following strings: ''​Microsoft'',​ ''​MS'',​ ''​w32''​ 
 +    * (re)start ''​emacs''​ to take changes made to the ''​.emacs'' ​file into account 
 +      * On MS Windows: if ''​emacs''​ displays the following error message, just create the ''​server''​ directory (''​c:/​Users/​your_login/​AppData/​Roaming/​.emacs.d/​server''​) by hand and restart ''​emacs''​\\ <​code>​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</​code>​ 
 +    * You may want to **change the default font** defined in the recommended configuration file, depending on the fonts available on the computer/​server where ''​emacs''​ is running, the size of your screen, etc... 
 +      * The recommended configuration file will probably use the ''​Consolas''​ or ''​Cascadia Code''​ fonts, with size ''​12'',​ available on Windows. 
 +      * Changing the default font: 
 +        * ''​Options''​=>''​Set Default Font...''​ 
 +        * Select a font and size 
 +          * Linux: ''​DejaVu Sans Mono'',​ size 12 
 +          * Windows: ''​Consolas''​+''​Normal''​ size ''​12''​ or ''​Cascadia Code''​+''​Regular''​ size ''​10''​ 
 +            * Note: the ''​Cascadia Code''​ font is only available after installing [[other:​win10apps#​windows_terminal|Windows Terminal]] 
 +          * Mac: FIXME 
 +        * ''​Options''​=>''​Save Options''​
  
-  * Keyboard shortcuts defined by the example configuration file+  ​* **Keyboard shortcuts** defined by the example configuration file
     * ''​C-x C-g'':​ go to a specific line     * ''​C-x C-g'':​ go to a specific line
     * ''​Shift Left_Arrow''​ and ''​Shift Right_Arrow'':​ go to the beginning/​end of a line\\ Same behavior as ''​C-a''​ and ''​C-e'',​ and the ''​Home''​ and ''​End''​ keyboard keys     * ''​Shift Left_Arrow''​ and ''​Shift Right_Arrow'':​ go to the beginning/​end of a line\\ Same behavior as ''​C-a''​ and ''​C-e'',​ and the ''​Home''​ and ''​End''​ keyboard keys
     * ''​Shift Up_Arrow''​ and ''​Shift Down_Arrow'':​ go to the beginning/​end of the buffer     * ''​Shift Up_Arrow''​ and ''​Shift Down_Arrow'':​ go to the beginning/​end of the buffer
     * //​Function//​ keys     * //​Function//​ keys
-      * ''​F1'':​ Undo (lots of undos!!) +      * ''​F1'': ​**Undo** (lots of undos!!) 
-      * ''​F2'':​ Search and Replace+      * ''​F2'': ​**Search and Replace**
         * Look for ''​Query Replace''​ in the [[https://​www.gnu.org/​software/​emacs/​refcards/​pdf/​refcard.pdf|Reference Card]] to determine what you can do when a match is found         * Look for ''​Query Replace''​ in the [[https://​www.gnu.org/​software/​emacs/​refcards/​pdf/​refcard.pdf|Reference Card]] to determine what you can do when a match is found
         * ...or read [[https://​www.gnu.org/​software/​emacs/​manual/​html_node/​emacs/​Query-Replace.html|Query Replace]] page         * ...or read [[https://​www.gnu.org/​software/​emacs/​manual/​html_node/​emacs/​Query-Replace.html|Query Replace]] page
       * ''​F3'':​ fill-paragraph (i.e. automatically re-indent text or comments)       * ''​F3'':​ fill-paragraph (i.e. automatically re-indent text or comments)
       * ''​F4'':​ indent the selected region (if indenting makes sense for the current buffer mode)       * ''​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)+      * ''​F5'': ​**comment out the selected region** (comment style depends on the current buffer mode)
         * ''​M-;''​ can be used for commenting **and un-commenting**         * ''​M-;''​ can be used for commenting **and un-commenting**
       * ''​F12'':​ Repeat complex command (e.g. restart a previous query-replace operation)       * ''​F12'':​ Repeat complex command (e.g. restart a previous query-replace operation)
Line 281: Line 309:
 ==== Windows ==== ==== Windows ====
  
-Using ''​winget upgrade''​ for updating emacs on Windows unfortunately [[https://​github.com/​microsoft/​winget-pkgs/​issues/​88443#​issuecomment-1688257680|does not work yet (August ​2023)]]. The easiest way to update Emacs is:+Using ''​winget upgrade''​ for updating emacs on Windows unfortunately [[https://​github.com/​microsoft/​winget-pkgs/​issues/​88443#​issuecomment-1688257680|does not work yet (August ​2024)]]. The easiest way to update Emacs is:
  
-  * Check the version of the installed Emacs +  * Check the version of the **installed** Emacs 
-    * In the ''​Start''​ menu: ''​Start''​ => ''​E''​ => ''​Emacs-**version**''​ (e.g. ''​Emacs ​28.2''​)+    * In the ''​Start''​ menu: ''​Start''​ => ''​E''​ => ''​Emacs-**version**''​ (e.g. ''​Emacs ​29.3''​)
     * In a running Emacs: ''​Help''​ menu => ''​About Emacs''​     * In a running Emacs: ''​Help''​ menu => ''​About Emacs''​
   * Use ''​winget show''​ in a PowerShell to determine (all) the available versions   * Use ''​winget show''​ in a PowerShell to determine (all) the available versions
Line 291: Line 319:
 Version Version
 ------- -------
-29.1 +29.4 
-28.2+29.3 
 +29.2
 [...]</​code>​ [...]</​code>​
-  * If you want/need to update Emacs (after making ​sure it is not running) +  * If you want/need to update Emacs 
-    * Uninstall it with: ''​Start''​ => ''​E''​ => ''​Emacs-**version**''​ => ''​Uninstall''​\\ Your emacs configuration file and other files you have installed will **not** be removed!+    * Make sure Emacs it is not running 
 +    * Uninstall it with: ''​Start''​ => ''​E''​ => ''​Emacs-**version**''​ => ''​Uninstall''​ 
 +      * Your emacs configuration file and other files you have installed will **not** be removed! 
 +      * This will remove the ''​C:​\Program Files\Emacs''​ directory and its content 
 +      * Slight //bug//: this will **not** remove the shortcuts from the ''​Start''​ menu 
 +        * e.g. If you uninstalled emacs 29.3 and installed emacs 29.4, you will end up with the following ''​Start''​ Menu:{{ :​other:​emacs_in_start_menu.jpg?​direct&​200 |}} 
 +        * Just go to the ''​C:​\Users\your_login\AppData\Roaming\Microsoft\Windows\Start Menu\Programs''​ directory and remove the **old** menu/​directory (e.g. ''​Emacs-29.3''​)
     * Perform a new [[other:​emacs_doc#​windows_installation|Emacs for Windows installation]]     * Perform a new [[other:​emacs_doc#​windows_installation|Emacs for Windows installation]]
  
other/emacs_doc.1701881748.txt.gz · Last modified: 2023/12/06 16:55 by jypeter