info:emacs:start

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
info:emacs:start [2018/07/18 08:58] – ↷ Page déplacée et renommée de info:xemacs à info:emacs:start radeffinfo:emacs:start [2026/08/26 14:19] (Version actuelle) radeff
Ligne 1: Ligne 1:
-todo+====== Emacs ====== 
 +{{tag>emacs editor LaTeX}} 
 + 
 +{{ :info:emacs.jpg?200|}}C'est Kaspar (comprennent ceux qui le connaissent) qui m'a initié, en 1998, à cet éditeur irremplaçable, lorsque d'autres éditeurs graphiques ne suffisent plus et en évitant le rupestre [[:info:vim|vi]] 
 +===== Install ===== 
 +    flatpak install flathub org.gnu.emacs 
 + 
 +ensuite, ajouter un fichier exécutable dans votre path du genre 
 +    flatpak run org.gnu.emacs 
 + 
 +vos config personnelles seront sous  
 +    ~/.emacs.d/init.el 
 + 
 +<note tip>il est possible de symlinker cela sur un serveur afin de partager les config entre plusieurs machines</note> 
 +===== Doc ===== 
 + 
 +https://linuxfr.org/users/bersace/journaux/une-configuration-gnu-emacs-communautaire-qui-vaut-le-detour-doom-emacs 
 +==== EmacsWiki ==== 
 +{{:info:emacswiki.png?200|}} 
 + 
 + 
 +The EmacsWiki is dedicated to documenting and discussing EmacsAndXEmacs and EmacsLisp. See the MissionStatement for more information. 
 + 
 +  * https://www.emacswiki.org/emacs/SiteMap 
 +  * [[http://rigaux.org/emacs-tut2.html|Tutorial pour Emacs, pour le programmeur]] 
 +  * [[http://www.linux-france.org/article/appli/emacs/manuel/|Manuel]] 
 + 
 +===== LaTeX ===== 
 + 
 +==== auctex ==== 
 + AUCTeX is an extensible package for writing and formatting TeX files in GNU Emacs and XEmacs. It supports many different TeX macro packages, including AMS-TeX, LaTeX, Texinfo, ConTeXt, and docTeX (dtx files).  
 + 
 +https://www.gnu.org/software/auctex/ 
 +==== TeX-Mode ==== 
 + Emacs provides special major modes for editing files written in TeX and its related formats. TeX is a powerful text formatter written by Donald Knuth; like GNU Emacs, it is free software. LaTeX is a simplified input format for TeX, implemented using TeX macros. DocTeX is a special file format in which the LaTeX sources are written, combining sources with documentation. SliTeX is an obsolete special form of LaTeX. 
 + 
 +https://www.gnu.org/software/emacs/manual/html_node/emacs/TeX-Mode.html 
 + 
 +  * Emacs as the Ultimate LaTeX Editor https://piotrkazmierczak.com/2010/emacs-as-the-ultimate-latex-editor/ 
 +  * https://www.emacswiki.org/emacs/LaTeX 
 +===== Astuces ===== 
 +Utile pour recharger un programme édité ailleurs (si on bosse avec plusieurs éditeurs simultanément sur un même fichier: 
 + 
 +M-x revert-buffer (if you want you can bind it to a key), or use a more practice trick: use C-x C-v RET. 
 + 
 +===== Emacs Command Summary ===== 
 + 
 +<code> 
 +SOURCE: http://www.cs.rutgers.edu/LCSR-Computing/some-docs/emacs-chart.html 
 + 
 +Emacs command summary, Thu Jul 25. 
 + 
 +C-SP     set-mark-command C-q      quoted-insert 
 +C-a      beginning-of-line C-r      isearch-backward 
 +C-b      backward-char C-s      isearch-forward 
 +C-c      exit-recursive-edit C-t      transpose-chars 
 +C-d      delete-char C-u      universal-argument 
 +C-e      end-of-line C-v      scroll-up 
 +C-f      forward-char C-w      kill-region 
 +C-h      help-command C-x      Control-X-prefix 
 +TAB      indent-for-tab-command C-y      yank 
 +LFD      newline-and-indent C-z      suspend-emacs 
 +C-k      kill-line ESC      ESC-prefix 
 +C-l      recenter C-]      abort-recursive-edit 
 +RET      newline C-_      undo 
 +C-n      next-line SPC .. ~        self-insert-command 
 +C-o      open-line DEL      delete-backward-char 
 +C-p      previous-line 
 + 
 +C-h v    describe-variable C-h d    describe-function 
 +C-h w    where-is C-h k    describe-key 
 +C-h t    help-with-tutorial C-h c    describe-key-briefly 
 +C-h s    describe-syntax C-h b    describe-bindings 
 +C-h n    view-emacs-news C-h a    command-apropos 
 +C-h C-n  view-emacs-news C-h C-d  describe-distribution 
 +C-h m    describe-mode C-h C-c  describe-copying 
 +C-h l    view-lossage C-h ?    help-for-help 
 +C-h i    info C-h C-h  help-for-help 
 +C-h f    describe-function 
 + 
 +C-x C-a  add-mode-abbrev C-x 5    split-window-horizontally 
 +C-x C-b  list-buffers C-x ;    set-comment-column 
 +C-x C-c  save-buffers-kill-emacs C-x <    scroll-left 
 +C-x C-d  list-directory C-x =    what-cursor-position 
 +C-x C-e  eval-last-sexp C-x >    scroll-right 
 +C-x C-f  find-file C-x [    backward-page 
 +C-x C-h  inverse-add-mode-abbrev C-x ]    forward-page 
 +C-x TAB  indent-rigidly C-x ^    enlarge-window 
 +C-x C-l  downcase-region C-x `    next-error 
 +C-x C-n  set-goal-column C-x a    append-to-buffer 
 +C-x C-o  delete-blank-lines C-x b    switch-to-buffer 
 +C-x C-p  mark-page C-x d    dired 
 +C-x C-q  toggle-read-only C-x e    call-last-kbd-macro 
 +C-x C-r  find-file-read-only C-x f    set-fill-column 
 +C-x C-s  save-buffer C-x g    insert-register 
 +C-x C-t  transpose-lines C-x h    mark-whole-buffer 
 +C-x C-u  upcase-region C-x i    insert-file 
 +C-x C-v  find-alternate-file C-x j    register-to-dot 
 +C-x C-w  write-file C-x k    kill-buffer 
 +C-x C-x  exchange-dot-and-mark C-x l    count-lines-page 
 +C-x C-z  suspend-emacs C-x m    mail 
 +C-x ESC  repeat-complex-command C-x n    narrow-to-region 
 +C-x $    set-selective-display C-x o    other-window 
 +C-x (    start-kbd-macro C-x p    narrow-to-page 
 +C-x )    end-kbd-macro C-x q    kbd-macro-query 
 +C-x +    add-global-abbrev C-x r    copy-rectangle-to-register 
 +C-x -    inverse-add-global-abbrev C-x s    save-some-buffers 
 +C-x .    set-fill-prefix C-x u    advertised-undo 
 +C-x /    dot-to-register C-x w    widen 
 +C-x 0    delete-window C-x x    copy-to-register 
 +C-x 1    delete-other-windows C-x {    shrink-window-horizontally 
 +C-x 2    split-window-vertically C-x }    enlarge-window-horizontally 
 +C-x 4    ctl-x-4-prefix C-x DEL  backward-kill-sentence 
 + 
 +ESC C-SP mark-sexp ESC =    count-lines-region 
 +ESC C-a  beginning-of-defun ESC >    end-of-buffer 
 +ESC C-b  backward-sexp ESC @    mark-word 
 +ESC C-c  exit-recursive-edit ESC O    ?? 
 +ESC C-d  down-list ESC [    backward-paragraph 
 +ESC C-e  end-of-defun ESC \    delete-horizontal-space 
 +ESC C-f  forward-sexp ESC ]    forward-paragraph 
 +ESC C-h  mark-defun ESC ^    delete-indentation 
 +ESC LFD  indent-new-comment-line ESC a    backward-sentence 
 +ESC C-k  kill-sexp ESC b    backward-word 
 +ESC C-n  forward-list ESC c    capitalize-word 
 +ESC C-o  split-line ESC d    kill-word 
 +ESC C-p  backward-list ESC e    forward-sentence 
 +ESC C-s  isearch-forward-regexp ESC f    forward-word 
 +ESC C-t  transpose-sexps ESC g    fill-region 
 +ESC C-u  backward-up-list ESC h    mark-paragraph 
 +ESC C-v  scroll-other-window ESC i    tab-to-tab-stop 
 +ESC C-w  append-next-kill ESC j    indent-new-comment-line 
 +ESC ESC  ?? ESC k    kill-sentence 
 +ESC C-\  indent-region ESC l    downcase-word 
 +ESC SPC  just-one-space ESC m    back-to-indentation 
 +ESC !    shell-command ESC q    fill-paragraph 
 +ESC $    spell-word ESC r    move-to-window-line 
 +ESC %    query-replace ESC t    transpose-words 
 +ESC '    abbrev-prefix-mark ESC u    upcase-word 
 +ESC (    insert-parentheses ESC v    scroll-down 
 +ESC )    move-past-close-and-reindent ESC w    copy-region-as-kill 
 +ESC ,    tags-loop-continue ESC x    execute-extended-command 
 +ESC -    negative-argument ESC y    yank-pop 
 +ESC .    find-tag ESC z    zap-to-char 
 +ESC 0 .. ESC 9  digit-argument ESC |    shell-command-on-region 
 +ESC ;    indent-for-comment ESC ~    not-modified 
 +ESC <    beginning-of-buffer ESC DEL  backward-kill-word 
 + 
 +C-x 4 C-f       find-file-other-window C-x 4 d  dired-other-window 
 +C-x 4 .  find-tag-other-window C-x 4 f  find-file-other-window 
 +C-x 4 b  pop-to-buffer C-x 4 m  mail-other-window 
 +</code> 
 + 
 +===== Case Change ===== 
 + 
 +<code> 
 + 
 +uppercase word                      M-u 
 +lowercase word                      M-l 
 +capitalize word                     M-c 
 +uppercase region                    C-x C-u 
 +lowercase region                    C-x C-l 
 +capitalize region             M-x capitalize-region 
 +</code> 
 + 
 +===== indentation ===== 
 +<code> 
 +C-x TAB 
 +    Shift block of lines rigidly right or left (indent-rigidly).  
 + 
 +TAB 
 +    Indent current line "appropriately" in a mode-dependent fashion.  
 +LFD 
 +    Perform RET followed by TAB (newline-and-indent).  
 +M-^ 
 +    Merge two lines (delete-indentation). This would cancel out the effect of LFD.  
 +C-M-o 
 +    Split line at point; text on the line after point becomes a new line indented to the same column that it now starts in (split-line).  
 +M-m 
 +    Move (forward or back) to the first nonblank character on the current line (back-to-indentation).  
 +C-M-\ 
 +    Indent several lines to same column (indent-region).  
 + 
 +M-i 
 +    Indent from point to the next prespecified tab stop column (tab-to-tab-stop).  
 +M-x indent-relative 
 +    Indent from point to under an indentation point in the previous line. 
 +</code> 
 + 
 +====== Astuces / Tips ====== 
 +===== Theme ===== 
 + 
 +plus simple que ce qui suit, ajouter dans votre config ces lignes: 
 +<code emacs> 
 +;; Activer le support des thèmes 
 +(setq custom-enabled-themes nil) 
 + 
 +;; Charger un thème sombre (choisissez-en un seul) 
 +;; Option A : Modus Vivendi (Contraste élevé, très lisible) 
 +(load-theme 'modus-vivendi t) 
 + 
 +;; Option B : Doom One (Style sombre populaire, plus doux) 
 +;; (load-theme 'doom-one t) ;; Nécessite parfois de télécharger le paquet doom-themes via MELPA 
 +</code> 
 +pour changer de thème, p. ex. pour avoir un fond sombre 
 +   ALT-X customize-themes 
 + 
 +{{:info:emacs_theme.jpg?600|}}    
 +===== Replacing with RegExp within (x)emacs ===== 
 + 
 + 
 +<code> 
 +query-replace-regexp 
 +<a href=\(.*\)> 
 +<a class="ns" href=\1> 
 + 
 +<a href="http://www.a">a</a> 
 +
 +
 +<\(/?\)font> 
 + 
 +<font>\(.*\)<\/font> 
 +\1 
 + 
 +<font.*>\(.*\)<\/font> 
 +<span class="ns">\1</span> 
 + 
 +<font class="\(.*\)">\(.*\)<\/font> 
 +<span class="\1">\2</span> 
 + 
 +<font size=\(.*\)>\(.*\)<\/font> 
 +<span class="\1">\2</span> 
 +</code> 
 + 
 +===== pour changer les noms de variables php ===== 
 +<code> 
 +/* put here your variable list 
 + 
 +var1 
 +variabl2 
 +etc... 
 + 
 +note: you can get it with a command like 
 +ex. your form has lines like 
 + 
 +<input type="text" name="titre" size="60"> 
 +<input type="checkbox" name="image" value="1"> 
 + 
 +cat yourForm.php | sed 's|^.*name="||g' | sed 's|".*$||g' 
 + 
 +will return 
 +titre 
 +image 
 + 
 +*/ 
 +/*copy-paste 
 +var1 
 +variabl2 
 +etc... 
 +*/ 
 +in emacs, do a: 
 +CTRL-ALT-SHIFT-% (query-replace-regexp) 
 +^\(.*\)$ 
 +[ENTER] 
 +$\1=$_POST['\1']; 
 +[ENTER] 
 +then try somes, if ok just make ! to change everything 
 + 
 +the result 
 +$var1=$_POST['var1']; 
 +$variabl2=$_POST['variabl2']; 
 + 
 +of course you can do the same with other replacement 
 +</code> 
 + 
 +===== Replacing emails with firstname   emails ===== 
 +eg you have 
 + 
 +<code> 
 +John.Doe@soviet.org 
 +Mary.Smith@bolchoi.net 
 +</code> 
 + 
 +and want 
 + 
 +<code> 
 +John John.Doe@soviet.org 
 +Mary Mary.Smith@bolchoi.net 
 +</code> 
 + 
 +this is the way: 
 + 
 +CTRL-SHIFT-ALT-% 
 + 
 +<code> 
 +^\([A-Z][a-z]*\)\.\([A-Z][a-z]*\)@\(.*\)$ 
 +\1   \1.\2@\3 
 +</code> 
 + 
 +===== how to introduce a new line with regexp (x)emacs ===== 
 +<code> 
 +example: 
 +transform 
 +a,b,c 
 +into  
 +
 +
 +
 + 
 +use regular expression replacement: 
 +alt-ctrl-shift-% 
 +type the string you want to replace, eg. , 
 +RET 
 +alt-J 
 +RET 
 +
 +and it's done! 
 + 
 +THE OTHER WAY (REPLACE LINES WITH STHING) 
 +alt-ctrl-shift-% 
 +type the string you want to replace, eg. , 
 +alt-J 
 +RET 
 +THEN THE REPLACEMENT, eg , 
 +RET 
 +
 + 
 +
 +
 +
 +WILL become 
 +a,b,c 
 +</code> 
 + 
 + 
 + 
 +===== how to print special characters ===== 
 +<code> 
 +-> scratch, C-q + caract. (eg tab) 
 +esc ^[ 
 +return ^M 
 +linefeed ^J 
 +</code> 
 + 
 +===== HTML-Helper-Mode, php syntax highlighting etc. ===== 
 +http://radeff.red/info/emacs/html_helper_mode.htm 
 + 
 +for ubuntu: 
 +<code> 
 +sudo apt-get install php-mode php-elisp html-helper-mode css-mode 
 +</code> 
 + 
 +===== PHP & emacs ===== 
 +pour cakephp & ses fichus fichiers "views" *.ctp: 
 + 
 + 
 +radeff@radeff-desktop:~$ gedit .xemacs/init.el  
 + 
 + (add-to-list 'auto-mode-alist '("\\.ctp$" . php-mode)) 
 + 
 +et relancer xemacs 
 + 
 +===== How can I get XEmacs to work with UTF-8 files? ===== 
 + 
 + 
 +    * Set up XEmacs so that it autodetects UTF-8 encoded files. 
 +    * In the case of starting a new file in a non-UTF-8 locale, set the file coding system to UTF-8 using C-x RET f. 
 +    * If running XEmacs in non-graphical mode in a UTF-8 xterm, set the terminal coding system to UTF-8 using C-x RET t. 
 + 
 +If you want XEmacs to load UTF-8 files correctly, add the following lines to your ~/.xemacs/init.el: 
 + 
 +(require 'un-define) 
 +(set-coding-priority-list '(utf-8)) 
 +(set-coding-category-system 'utf-8 'utf-8) 
 + 
 +**ci-dessus pas terrible, il faut mieux utiliser la solution suivante:** 
 + 
 +source: http://www.maruko.ca/i18n/ 
 + 
 +If you want XEmacs to load UTF-8 files correctly, add the following lines to your ~/.xemacs/init.el: 
 + 
 +<code> 
 +(require 'un-define) 
 +(set-coding-priority-list '(utf-8)) 
 +(set-coding-category-system 'utf-8 'utf-8) 
 +</code> 
 + 
 +===== last complex command ===== 
 +<code> 
 +C-x esc esc 
 +before commands: esc p 
 +</code> 
 + 
 +===== Repeating Query-Replaces ===== 
 +<code> 
 +ESC < followed by C-x ESC ESC 
 +</code> 
 + 
 +===== Top/End of file ===== 
 +<code> 
 +esc < 
 +esc > 
 +</code> 
 + 
 +===== FTP / SFTP / Tramp ===== 
 +Source: http://www.benjaminbaudouin.com/xemacs-edit-over-ssh (dead link) 
 + 
 +Grâce au package TRAMP (Transparent Remote Access, Multiple Protocols), il est possible d’éditer des fichiers distants via SSH par exemple. 
 + 
 +Installation (Debian) : 
 + 
 +apt-get install tramp 
 + 
 +Utilisation : 
 + 
 +    * Avec xemacs : 
 + 
 +      xemacs /[ssh/user@host]/chemin/fichier 
 + 
 +    * Avec emacs : 
 + 
 +      emacs /ssh:user@host:/chemin/fichier 
 + 
 +Remarque : 
 + 
 +Ajoutez (setq tramp-default-method “ssh”) 
 +dans votre ~/.xemacs/custom.el pour de pas avoir à préciser la méthode ssh 
 + 
 +  * https://www.emacswiki.org/emacs/TrampMode 
 +  * https://nsaunders.wordpress.com/2007/02/05/emacs-tramp-ubuntu/ 
 + 
 +===== Shortcuts ===== 
 + 
  
  • info/emacs/start.1531897088.txt.gz
  • Dernière modification : 2018/07/18 08:58
  • de radeff