Emacs
Un article de MonWiki.
Sommaire |
[modifier]
Commandes utiles
[modifier]
Clavier
Commande | Description |
---|---|
C-q | Insérer un caractère spécial (ex: C-q C-j insère un retour chariot). |
C-x Esc Esc | edit last command in minibuffer. |
C-x z | repeat |
C-x C-t | transpose-lines |
M-g g | goto-line |
M-: | Evaluate a LISP expression and print the result (M-x eval-expression). |
M-^ | delete-indentation |
M-z | zap-to-char |
M-m | back-to-indentation |
C-u C-Space | pop-global-mark |
[modifier]
Fonctions interactives
- ielm Interactive Emacs Lisp mode.
- untabify Replace tabs by spaces.
- delete-trailing-whitespaces
- set-buffer-file-coding-system
- list-matching-lines
- delete-matching-lines
- align-regexp
- re-builder
[modifier]
.emacs
Voir le wiki Emacs pour une version plus récente.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; User Settings ;; load customizations (setq custom-file "~/.emacs-custom.el") (load-file custom-file) ;; Load modes (if (fboundp 'normal-top-level-add-subdirs-to-load-path) (let* ((my-lisp-dir "C:/cygwin/usr/local/share/emacs/site-lisp") (default-directory my-lisp-dir)) (setq load-path (cons my-lisp-dir load-path)) (normal-top-level-add-subdirs-to-load-path))) ;; Calendar (setq calendar-day-name-array ["Dimanche" "Lundi" "Mardi" "Mercredi" "Jeudi" "Vendredi" "Samedi"] calendar-month-name-array ["Janvier" "Février" "Mars" "Avril" "Mai" "Juin" "Juillet" "Août" "Septembre" "Octobre" "Novembre" "Décembre"]) ;; Key bindings (load-file ".emacs.d/key-bindings.el") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Languages ;; Lua (setq auto-mode-alist (cons '("\\.lua$" . lua-mode) auto-mode-alist)) (autoload 'lua-mode "lua-mode" "Lua editing mode." t) ;; Smalltalk (setq auto-mode-alist (cons '("\\.st$" . smalltalk-mode) auto-mode-alist)) (autoload 'smalltalk-mode "smalltalk-mode" "Smalltalk editing mode." t) ;; C (c-add-style "e8" (quote ( (indent-tabs-mode . nil) (c-basic-offset . 4) (c-comment-only-line-offset . 0) (c-hanging-braces-alist (substatement-open before after)) (c-offsets-alist (topmost-intro . 0) (topmost-intro-cont . 0) (substatement . +) (substatement-open . 0) (case-label . +) (access-label . -) (inclass . ++) (inline-open . 0)) ) ) ) ;; XML (load "rng-auto.el") (setq auto-mode-alist (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode) auto-mode-alist)) (unify-8859-on-decoding-mode) (setq magic-mode-alist (cons '("<\\?xml " . nxml-mode) magic-mode-alist)) (fset 'xml-mode 'nxml-mode) ;; XSLT transformation (defun xsl-transform-file () "Transform the XML in the given buffer" (interactive) (let ((executable '"xalan") (file (buffer-file-name (current-buffer))) (new-buffer (get-buffer-create (format "%s (=>XSLT)" (buffer-name))))) (save-excursion (set-buffer new-buffer) (erase-buffer)) (call-process executable nil new-buffer nil "-a" file) (display-buffer new-buffer t) (select-window (get-buffer-window new-buffer)) (set-auto-mode) (indent-region (point-min) (point-max)) (goto-char (point-min)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Libraries ;;;;;;;;;;;;; ;; Perforce ;(load-library "p4") ;;;;;;;;;;;;;; ;; Org Mode (add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) (define-key global-map "\C-cl" 'org-store-link) (define-key global-map "\C-ca" 'org-agenda) ;;;;;;;;;;;; ;; Others (require 'uniquify) (require 'redo) (require 'ido) (ido-mode t) (require 'generic) (require 'generic-x) (require 'fit-frame) (add-hook 'after-make-frame-functions 'fit-frame) ;(require 'cygwin-mount) ;(cygwin-mount-activate) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; CRJ (defun load-crj () (interactive) (find-file "~/crj.txt") (goto-char (point-min)) (mail-mode) (replace-regexp "[0-9][0-9]-[01][0-9]-[0-3][0-9]" (format-time-string "%y-%m-%d")) (goto-char (point-max))) (define-key mode-specific-map "rj" 'load-crj) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; My lisp functions (defun insert-date () (eval-expression (format-time-string "%y-%m-%d") (quote (4)))) (require 'zenburn) (color-theme-zenburn) ;; Load CEDET (load "common/cedet.el") ;; Enabling various SEMANTIC minor modes. See semantic/INSTALL for more ideas. ;; Select one of the following (semantic-load-enable-code-helpers) ;; (semantic-load-enable-guady-code-helpers) ;; (semantic-load-enable-excessive-code-helpers) ;; Enable this if you develop in semantic, or develop grammars ;; (semantic-load-enable-semantic-debugging-helpers) (require 'ecb-autoloads)
[modifier]
.emacs-customize.el
(custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(backup-by-copying t) '(backup-directory-alist (quote (("." . "~/Documents/Tmp/Emacs")))) '(c-default-style (quote ((c-mode . "e8") (c++-mode . "e8") (java-mode . "java") (awk-mode . "awk") (other . "gnu")))) '(calendar-week-start-day 1) '(column-number-mode t) '(display-time-24hr-format t) '(ecb-key-map (quote ("C-c ." (t "fh" ecb-history-filter) (t "fs" ecb-sources-filter) (t "fm" ecb-methods-filter) (t "fr" ecb-methods-filter-regexp) (t "ft" ecb-methods-filter-tagclass) (t "fc" ecb-methods-filter-current-type) (t "fp" ecb-methods-filter-protection) (t "fn" ecb-methods-filter-nofilter) (t "fl" ecb-methods-filter-delete-last) (t "ff" ecb-methods-filter-function) (t "p" ecb-nav-goto-previous) (t "n" ecb-nav-goto-next) (t "lc" ecb-change-layout) (t "lr" ecb-redraw-layout) (t "lw" ecb-toggle-ecb-windows) (t "lt" ecb-toggle-layout) (t "s" ecb-window-sync) (t "r" ecb-rebuild-methods-buffer) (t "a" ecb-toggle-auto-expand-tag-tree) (t "x" ecb-expand-methods-nodes) (t "h" ecb-show-help) (nil "C-!" ecb-goto-window-edit-last) (t "g1" ecb-goto-window-edit1) (t "g2" ecb-goto-window-edit2) (t "gc" ecb-goto-window-compilation) (nil "C-," ecb-goto-window-directories) (nil "C-;" ecb-goto-window-sources) (nil "C-:" ecb-goto-window-methods) (t "gh" ecb-goto-window-history) (t "ga" ecb-goto-window-analyse) (t "gb" ecb-goto-window-speedbar) (t "md" ecb-maximize-window-directories) (t "ms" ecb-maximize-window-sources) (t "mm" ecb-maximize-window-methods) (t "mh" ecb-maximize-window-history) (t "ma" ecb-maximize-window-analyse) (t "mb" ecb-maximize-window-speedbar) (t "e" eshell) (t "o" ecb-toggle-scroll-other-window-scrolls-compile) (t "\\" ecb-toggle-compile-window) (t "/" ecb-toggle-compile-window-height) (t "," ecb-cycle-maximized-ecb-buffers) (t "." ecb-cycle-through-compilation-buffers)))) '(ecb-layout-name "left8") '(ecb-options-version "2.32") '(ecb-windows-width 40) '(eshell-save-history-on-exit t) '(european-calendar-style t) '(explicit-shell-file-name "C:\\cygwin\\bin\\bash.exe") '(global-font-lock-mode t) '(grep-highlight-matches t) '(indent-tabs-mode nil) '(isearch-allow-scroll t) '(mark-diary-entries-in-calendar t) '(nxml-child-indent 4) '(nxml-outline-child-indent 4) '(nxml-section-element-name-regexp ".*") '(org-agenda-files (quote ("c:/Documents and Settings/sra/org/Mre.org" "c:/Documents and Settings/sra/org/Twd.org" "c:/Documents and Settings/sra/org/Whisky.org"))) '(org-link-abbrev-alist (quote (("Main" . "http://xx-server/~twiki/bin/view/Main/") ("XX" . "http://xx-server/~twiki/bin/view/XX/") ("Bug" . "http://xx-bugs.xx-xxxx.com/cgi-bin/bugzilla/show_bug.cgi?id=")))) '(org-log-done t) '(org-return-follows-link t) '(pc-selection-mode t nil (pc-select)) '(semanticdb-default-save-directory "~/.emacs.d/semanticdb") '(send-mail-function (quote smtpmail-send-it)) '(sentence-end "[\\.!?][ \\t]") '(sgml-basic-offset 4) '(show-paren-mode t) '(smtpmail-debug-info t) '(smtpmail-default-smtp-server "mail.xx-xxxxxxxxxxx.com") '(smtpmail-local-domain "xx-xxxxx.net") '(smtpmail-smtp-service "smtp") '(tool-bar-mode nil) '(transient-mark-mode t) '(uniquify-buffer-name-style (quote forward) nil (uniquify)) '(user-full-name "Sebastien Rocca-Serra") '(user-mail-address "xxx@xx-xxxxx.xxx") '(viper-ex-style-editing nil) '(viper-ex-style-motion nil) '(viper-vi-style-in-minibuffer nil) '(w32shell-cygwin-bin "C:\\cygwin\\bin") '(w32shell-shell (quote cygwin))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. )
[modifier]
key-bindings.el
;;;;;;;;;;;;;;;;;;;;;;;; ;; Useful key bindings ;; Zap up to char (require 'misc) (global-set-key "\M-z" 'zap-up-to-char) ;; ISearch modif (defun isearch-yank-word-at-point () "Put word at current point into search string." (interactive) (save-excursion (let ((word (current-word))) (if (null word) (message "No word at point.") (isearch-yank-string word))))) (define-key isearch-mode-map "\C-w" 'isearch-yank-word-at-point)