Git Product home page Git Product logo

sg-emacs-init's Introduction

Introduction

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.

Your settings

Installation

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/

Structure

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.

Loading packages

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.

Visual appearance

Themes

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.

Fonts

I use two fonts, one variable width and one fixed width for code:

  1. Noto Sans
  2. 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.

Whiteroom for distraction free writing

Just press F9 to see it

Workgroups2 and desktop

For having multiple window setups (e.g. Org with agenda, Python IDE, R IDE) and restoring the buffers automatically.

Custom key bindings

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)

Org-mode

Defaults

Agenda directories, etc Right now it is

~/ORG

To change these, edit the orgsettings.el file

Export to LaTeX

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

Google Calendar synchronization

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:

  1. Go to Google Developers Console
  2. Create a project (with any name)
  3. Click on the project
  4. Click on APIs & Auth then Credentials
  5. Click on Create New Client ID with Application type Installed application, Installed application type Other
  6. Click on Create Client ID
  7. Record the Client ID and Client secret for setup.
  8. Under the same APIs & Auth menu section, select APIs
  9. 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.
  10. Go to Google setting page and click the gear-shaped settings icon in the upper right, then select “Settings” from the drop down list.
  11. Select the “Calendars” tab, which will display a list of your calendars.
  12. 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.
  13. 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.

describe literature management with RefTeX

LaTeX

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

  1. Open Okular and go to…
  2. Settings -> Configure Okular -> Editor
  3. Set Editor to “Emacs client”
  4. Command should automatically set to:
emacsclient -a emacs --no-wait +%l %f

Miscellaneous

  • You can seamlessly work remotely with TRAMP e.g. like this
     C-x d /ssh:[email protected]:/home/yname
        

sg-emacs-init's People

Contributors

nanumyan avatar

Stargazers

Yoko Spirig avatar

Watchers

 avatar Yoko Spirig avatar

sg-emacs-init's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.