User:Timothee Flutre/Notebook/Postdoc/2012/07/25: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
(→‎About Emacs: add ex see content var)
(→‎About Emacs: add official tutorial)
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
|-
|-
|style="background-color: #EEE"|[[Image:owwnotebook_icon.png|128px]]<span style="font-size:22px;"> Project name</span>
|style="background-color: #EEE"|[[Image:owwnotebook_icon.png|128px]]<span style="font-size:22px;"> Project name</span>
|style="background-color: #F2F2F2" align="center"|<html><img src="/images/9/94/Report.png" border="0" /></html> [[{{#sub:{{FULLPAGENAME}}|0|-11}}|Main project page]]<br />{{#if:{{#lnpreventry:{{FULLPAGENAME}}}}|<html><img src="/images/c/c3/Resultset_previous.png" border="0" /></html>[[{{#lnpreventry:{{FULLPAGENAME}}}}{{!}}Previous entry]]<html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</html>}}{{#if:{{#lnnextentry:{{FULLPAGENAME}}}}|[[{{#lnnextentry:{{FULLPAGENAME}}}}{{!}}Next entry]]<html><img src="/images/5/5c/Resultset_next.png" border="0" /></html>}}
|style="background-color: #F2F2F2" align="center"|[[File:Report.png|frameless|link={{#sub:{{FULLPAGENAME}}|0|-11}}]][[{{#sub:{{FULLPAGENAME}}|0|-11}}|Main project page]]<br />{{#if:{{#lnpreventry:{{FULLPAGENAME}}}}|[[File:Resultset_previous.png|frameless|link={{#lnpreventry:{{FULLPAGENAME}}}}]][[{{#lnpreventry:{{FULLPAGENAME}}}}{{!}}Previous entry]]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}}{{#if:{{#lnnextentry:{{FULLPAGENAME}}}}|[[{{#lnnextentry:{{FULLPAGENAME}}}}{{!}}Next entry]][[File:Resultset_next.png|frameless|link={{#lnnextentry:{{FULLPAGENAME}}}}]]}}
|-
|-
| colspan="2"|
| colspan="2"|
Line 12: Line 12:
* '''Documentation''':
* '''Documentation''':
** official [https://www.gnu.org/software/emacs/manual/html_node/emacs/index.html manual] ([https://www.gnu.org/software/emacs/manual/html_node/eintr/index.html intro] to Emacs Lisp)
** official [https://www.gnu.org/software/emacs/manual/html_node/emacs/index.html manual] ([https://www.gnu.org/software/emacs/manual/html_node/eintr/index.html intro] to Emacs Lisp)
** official [https://www.gnu.org/software/emacs/tour/ tour], [http://www.tuteurs.ens.fr/unix/editeurs/emacs.html tutorial] (in French)
** official [https://www.gnu.org/software/emacs/tour/ tour]
** official tutorial: <code>C-h t</code>
** [http://www.tuteurs.ens.fr/unix/editeurs/emacs.html tutorial] (in French)
** [http://www.emacswiki.org/ wiki] (with many tips)
** [http://www.emacswiki.org/ wiki] (with many tips)
** [https://github.com/vikasrawal/orgpaper/blob/master/orgpapers.org org tutorial]
** [https://github.com/vikasrawal/orgpaper/blob/master/orgpapers.org org tutorial]

Latest revision as of 15:16, 4 November 2017

Project name Main project page
Previous entry      Next entry

About Emacs

  • Motivation: when analyzing data for any research project, it's essential to know well a good text editor. Indeed, it's very efficient to be able to program in several languages (eg. Python, C/C++, R), interact with the shell like in a terminal, manipulate data and plot exploratory analyzes in R, all this within the same editor! One such editor is Emacs, and is available on Linux, Mac OS and Windows. For Mac OS X users, I recommend this distribution.
  • Configuration: my own file ~/.emacs (versioned here):
  • Tips:
    • from the office computer (desktop), log interactively to a cluster node, launch emacs --daemon and keep the terminal open indefinitely; then access this session from any computer, e.g. a laptop, with emacsclient -t; and close it when needed via emacsclient -e "(kill-emacs)"
    • especially useful with PuTTY on Windows, launch emacs so that its window is the terminal itself, via emacs -nw
    • when updating org-mode, one may have to first comment all org-related lines in ~/.emacs, remove the dir ~/.emacs.d/elpa/org-*, re-open Emacs with option -Q, install the latest version of org-mode, close Emacs and re-open it without -Q, uncomment all org-related lines in ~/.emacs
  • Emacs Lisp: intro
    • see the content of a variable, C-h v, the enter the name of the variable, say load-path
    • go to the *scratch* buffer
    • write (+ 2 2)
    • put the cursor after the last parenthesis, and enter C-x C-e
    • one should see 4 in the mini-buffer
    • do the same with (concat "abc" "def")
    • here is an example of a function (interactive in this case)
(defun f (x y)
  "add"
  (interactive "nx=\nny=")
  (message "%i" (+ x y))
  )