Open Emacs, type Alt+x help
, hit ENTER, then t
(Emacs notation for the same would be M-x help RET t
) to start the built-in tutorial.
…
To install the latest Emacs, version 24.4, follow this tutorial: http://ubuntuhandbook.org/index.php/2014/10/emacs-24-4-released-install-in-ubuntu-14-04/
There are two main methods for Emacs customization.
One is by writing Emacs Lisp code in $HOME/.emacs
file and the other is using Customize, a built in graphical functionality.
Choosing Customize may seem the easy way as it is more conventional, but in the long run the manual approach is preferable for the following reasons:
- not all variables can be customized through Customize
- no way to define and use own functions with Customize
- any solution for any question is posted as Emacs Lisp code by the community, that you copy, paste into your
.emacs
file - ready Emacs Lisp solutions for virtually any purpose
Emacs is extensible through packages. Many are a part of the Emacs distribution, but an ample of them is offered by the community and can be installed separately.
In a nutshell, installing a package is putting in a place where Emacs sees it.
By default it is $HOME/.emacs.d/
directory.
Because of flexibility of Emacs, .emacs
file tends to grow in time and at some point becomes very messy.
A good practice to organize it is splitting it into multiple file.
I will have all my customization in $HOME/.emacs.d/sg_init/
directory.
loadpackages.el
- file has the list of needed packages and installs them if they are not installed
visuals.el
- has the customization of how emacs looks, i.e. color themes, nicer mode line, fonts.
keybindings.el
- try to guess
misc.el
- small global tweaks like making the mini buffer smarter, adding functionality to Dired (the file manager), automatic line wrapping, etc.
<mode>settings.el
- a set of files customizing a certain <mode>, like Org, LaTeX, Python, etc.
The best way to install a package is from within Emacs through a package repository. There are three main repositories. The default GNU repository (ELPA), MELPA and Marmalade.
To keep this setup easily reproducible, if you install packages at some point, add them into the list in loadpackages.el
.
This way the next time you setup an Emacs , it will be installed automatically.
There are some themes installed, notably Sublime color themes. You can preview them by
M-x load-theme RET TAB
Then choose from the list.
To make the choice permanent, change the corresponding setting in the visuals.el
.
I use two fonts, one variable width and one fixed width for code:
- Noto Sans
- Droid Sans Mono
Get them here: http://www.google.com/fonts/
To install these system wise, extract the downloaded ZIP archives into
/usr/share/fonts
and then run
sudo fc-cache -f
To install it locally (say, if you don’t have sudo access), put the fonts in
~/.fonts
and then do
fc-cache -f
Note, that you may need to create that folder first.
Just press F9
to see it
For having multiple window setups (e.g. Org with agenda, Python IDE, R IDE) and restoring the buffers automatically.
C-<scroll>
- change font style
S-<scroll>
- change font size
F9
- writeroom
F11
- toggle fullscreen (Emacs 24.4)
M-q
- toggle line wrapping
C-x <arrows>
- move between Emacs windows (splits of the Emacs window)
- …
- …
Agenda directories, etc Right now it is
~/ORG
To change these, edit the orgsettings.el
file
The SG styles for manuscripts and Beamer presentations are set up.
It is set up to run the necessary LaTeX, BibTeX sequence with the help of rubber
.
You can install it with
sudo apt-get install rubber
Otherwise, you can customize it to use latexmk
, that you probably have shipped with the \TeX distribution
You can synchronize you Google Calendar with the Org mode. For that, follow the following steps and fill the relevant information in
~/.emacs.d/sg_init/gcal-credentials.el
When you have it, use the org-gcal-fetch
to fetch from Google Calendars and org-gcal-post-at-point
to post the active Org entry to Google calendar.
Taken from https://github.com/myuhe/org-gcal.el:
- Go to Google Developers Console
- Create a project (with any name)
- Click on the project
- Click on APIs & Auth then Credentials
- Click on Create New Client ID with Application type Installed application, Installed application type Other
- Click on Create Client ID
- Record the Client ID and Client secret for setup.
- Under the same APIs & Auth menu section, select APIs
- Scroll down to Calendar API. Click the Status button to enable calendar API access to the app you created in steps 5 & 6. Go to Google setting page to check the calendar ID.
- Go to Google setting page and click the gear-shaped settings icon in the upper right, then select “Settings” from the drop down list.
- Select the “Calendars” tab, which will display a list of your calendars.
- Select the calendar you would like to synchronize with. This will take you to the “Calendar Details” page for that calendar. Near the end is a section titled “Calendar Address”. Following the XML, ICAL, and HTML tags, you will see your Calendar ID.
- Copy the Calendar ID for use in the settings below, where you will use it as the first element in the org-gcal-file-alist for associating calendars with specific org files. You can associate different calendars with different org files, so repeat this for each calendar you want to use.
Thanks to SyncTeX, the LaTeX source in your Emacs and the PDF output in Okular are synchronized.
- If you want to see how what you are working on looks like on pdf, just
View
(C-c C-c v RET
) while on the coresponding line of code. - To go to the source from PDF,
Shift + <left click>
on the place you want to investigate. If you write one line per sentence, clickiing on body text will bring you to the beginning of the corresponding sentence.
For the above to work, you need to setup Okular as follows
- Open Okular and go to…
- Settings -> Configure Okular -> Editor
- Set Editor to “Emacs client”
- Command should automatically set to:
emacsclient -a emacs --no-wait +%l %f
- You can seamlessly work remotely with TRAMP e.g. like this
C-x d /ssh:[email protected]:/home/yname