Paolo Granada Lim

I am a programmer in Cebu, Philippines.

  • Ubuntu
  • Music
  • Running
  • Books
    • 0
      8 Nov 2011

      Emacs: org-mode creates new line when reaching a certain line width

      • Edit
      • Delete
      • Tags
      • Autopost

      Just discovered how to disable org-mode from going to the next line when reaching a certain line length.

      I just removed this line (.emacs.d/starter-kit-misc.el:75):

      (add-hook 'text-mode-hook 'turn-on-auto-fill)
      No more problems copying content from emacs to posterous.

      I use emacs when writing anything, including my blogs. Before this I used to delete each newline character when I copy text from emacs, so the lines would wrap properly. I know, pretty stupid.

      reference: http://stackoverflow.com/questions/1263009/longlines-mode-in-emacs

      Update:

      Even better, put this line instead in your config

      (global-visual-line-mode t)

      New lines will now be created when the line reaches the buffer's width

      reference: http://stackoverflow.com/questions/3281581/how-to-word-wrap-in-emacs

      • views
      • Tweet
    • 2
      8 Jul 2011

      Emacs for personal finance: How I use emacs to keep track of my expenses

      • Edit
      • Delete
      • Tags
      • Autopost

      I use emacs org-mode and calc to keep track of my expenses. I've been using it for 2 months now and so far it has been mindblowing. Keeping track of expenses has never been more.. er.. fun. Got that right! FUN.

      Here is my template:

      * Monthly Base Expenses
      * May
      * June
      * July

      Inside each of the headlines I usually have a table that kind of looks like this:

      | date | description | total |
      |------+-------------+-------|
      | 1    | cloud 9     |     6 |
      | 6    | tempura     |    10 |
      |      | sparkle     |     7 |
      | 7    | handuraw    |       |
      |      | beer        |       |
      |      | pizza       |       |
      |      | chili chips |   200 |
      |------+-------------+-------|
      |      | total spent |   223 |
      |    ^ |             |    ts |
      |------+-------------+-------|
      |      |  money left |   777 |
      |    ^ |             |    ml |
      #+TBLFM: $ts=vsum(@I..@II)::$ml=1000-@II+1

      Some weird things in the table:

      • The rows with "^" are marker rows. In these rows you define names for the fields above the row. So "ts" in the table is a marker for the value 223, which is the total spent money, then "ml" is the money left. These markers are used in the calculations in the table.
      • The last row "#+TBLFM: $ts=vsum(@I..@II)::$ml=1000-@II+1" is where all formulas in the table go. You can see that we made use of the markers here.

      The formulas:

      $ts=vsum(@I..@II)

      This is the computation for the total spent field:

      • $ts = where the total spent value will be stored.
      • vsum = is the sum function
      • @I and @II = refers to the first and second hline (the line rows |----+----+----|)

      So basically the formula says to add all values in the column of ts from the first hline (@I) to the second (@II).

      $ml=1000-@II+1

      • $ml = where the total money left value will be stored.
      • 1000 = total money for the month (my salary)
      • @II+1 = the field below the second hline (total spent amount)

      Here we subtract the total money spent from the total money for the month.

      How I update the table:

      Everytime I add a new expense, I just place the cursor on the formula row and hit C-c and the total spent and money left fields get updated automatically. Pretty awesome. :)

      Thoughts:

      • I keep a separate table for the monthly base expenses so I'll always be up-to-date of how much money I can spend freely every month. This is also the initial template that I copy and paste when a new month starts. 
      • I separated the months per headline instead of using just one table because that way, I can hide the other months while viewing a specific month instead of viewing a very large table. Later I will have to separate it by years (if I'm still going to be using this method a year from now :p)
      • I sync this file via dropbox, so that I can access it in any machine.

      Why this?

      • Handling text is just easier in emacs or vi or any editor that has shortcut keys.
      • Spreadsheets can get messy when data gets bigger, in org-mode I simply "fold" it.
      • This file is saved in plain text format, which means it can be opened by any plain text editor. Spreadsheet files can only be opened by spreadsheet software.
      • Currently the size of my file is 6kb. When I save a new empty spreadsheet in Libre Office, it's already 7kb.
      • I get to use emacs.

      For Vi users, there are also org-mode counterparts, like vimorganizer.

      • views
      • Tweet
    • 4
      25 Jan 2011

      How I setup my Emacs in Ubuntu

      • Edit
      • Delete
      • Tags
      • Autopost

      install emacs

      sudo apt-get install emacs23

      initialize config files
      Using a bare emacs install is not very exciting, so I add some custom configs. There's a lot in the web, people usually boast their emacs configs with each other. Currently I really like technomancy's config files which is in github. Maybe someday when I learn lisp I'll be able to make some configs of my own.

      Get technomancy's emacs config.
      git clone https://github.com/technomancy/emacs-starter-kit.git

      Turn it into the emacs config folder
      mv emacs-starter-kit .emacs.d

      I also install haml support since I code rails a lot.
      sudo apt-get install haml-elisp

      I also add a few custom bindings.

      Add this line to ~/emacs.d/init.el
      (add-hook 'before-save-hook 'delete-trailing-whitespace)
      This will delete all trailing whitespace when you save a file.

      give emacs a shortcut
      I use emacs a lot so I find it much better to give it an alias instead of typing "emacs -nw" all the time. I bind it to "e" since this character is always available.

      Add this line in ~/.bashrc.
      alias e='emacs -nw'

      Then reload your settings
      . ~/.bashrc

      And I'm set!

      • views
      • Tweet
    « Previous 1 2 Next »
    • Search

    • Tags

      • life
      • running
      • music
      • books
      • tutorials
      • ubuntu
      • programming
      • work
      • ideas
      • productivity
      • thoughts
      • fun
      • linux
      • places
      • travel
    • Archive

      • 2012 (15)
        • April (2)
        • March (9)
        • January (4)
      • 2011 (46)
        • November (3)
        • November (10)
        • October (4)
        • September (7)
        • August (5)
        • July (3)
        • June (1)
        • April (1)
        • March (3)
        • February (4)
        • January (5)
      • 2010 (36)
        • November (1)
        • October (1)
        • September (3)
        • August (2)
        • July (4)
        • June (5)
        • May (9)
        • April (3)
        • March (5)
        • February (1)
        • January (2)
      • 2009 (2)
        • December (2)
    • Obox Design
  • Paolo Granada Lim

    I currently work at:
    http://caresharing.ph

    My current side project
    http://uberder.com

    My side team
    http://codecampr.com

    My other links
    http://facebook.com/paologlim
    http://twitter.com/paologlim
    http://www.linkedin.com/in/paologlim

    Stuff I've been reading
    http://www.google.com/reader/shared/paologlim

    I also contribute to these blogs
    http://buhaystartup.com
    http://stuffwageesays.com
    http://runnroo.com

    49012 Views
  • Get Updates

    Subscribe via RSS