Ads by Google

Thursday, December 8, 2011

Monday, December 5, 2011

The History of Unix

Just stumbled on this fantastic IEEE article on the The Strange Birth and Long Life of Unix;  A fantastic read, worth the 15 minutes of time in knowing how Unix came about.

Unix: an emasculated version of Multics!

Thursday, December 1, 2011

Third Emacs pretest out

The third Emacs pretest is now out.  Binaries and tarballs can be found here.  The NEWS file will have the list of changes.

Moving buffers between windows

If you're new to emacs, it might be a good idea to read this post to know the difference between frames and windows before you can follow this post.

I had to do some fair amount of coding recently with lots of interlinked files.  With so many windows open and with my limited screen estate, I soon settled on a 3 window layout with the screen split horizontally and the top half split again into 2.  This way I could read code flowing off to the right on the bottom half while referring to the called functions in the other 2 windows on top.


But I soon found myself switching to those buffers to read a bit more on the definitions and losing my window layout.  A quick ask on gnu.emacs.help turned up this emacswiki page, the last elisp function that I reproduce below was perfect for my needs.

(defun rotate-windows ()
  "Rotate your windows"
  (interactive)
  (cond ((not (> (count-windows)1))
     (message "You can't rotate a single window!"))
    (t
     (setq i 1)
     (setq numWindows (count-windows))
     (while  (< i numWindows)
       (let* (
          (w1 (elt (window-list) i))
          (w2 (elt (window-list) (+ (% i numWindows) 1)))
         
          (b1 (window-buffer w1))
          (b2 (window-buffer w2))
         
          (s1 (window-start w1))
          (s2 (window-start w2))
          )
         (set-window-buffer w1  b2)
         (set-window-buffer w2 b1)
         (set-window-start w1 s2)
         (set-window-start w2 s1)
         (setq i (1+ i)))))))


There are a number of other options available too as mentioned by Sundar Vasan in his post. They give your more options and key bindings to use.

Monday, November 28, 2011

Gnus Tip: Customising the position of point when replying

If you have a need to top post or inline or below the mail depending on whom and where you're replying to, Gnus allows you to customise it by setting message-cite-reply-position whose doc string is reproduced below

message-cite-reply-position is a variable defined in `message.el'.
Its value is traditional
Documentation:
*Where the reply should be positioned.
If `traditional', reply inline.
If `above', reply above quoted text.
If `below', reply below quoted text.
Note: Many newsgroups frown upon nontraditional reply styles. You
probably want to set this variable only for specific groups,
e.g. using `gnus-posting-styles':

  (eval (set (make-local-variable 'message-cite-reply-above) 'above))

I've highlighted the warning just in case you missed it. :-)

Hat tip to Eric Abrahamsen's reply to a poster.  And in his post, you can see an example customisation of gnus-posting-styles to do group specific behaviour of reply.

Friday, November 4, 2011

VimOrganizer, an Org-mode clone in Vim

I seemed to have missed this announcement.  For vim users, apparently, there is a way of using vim with org-mode.  The good news is that you use vim, the bad news is that it does use Emacs at the backend to work on the files. :-)

The relevant links are
An intro to some of the stuff in the new version is here:
https://github.com/hsitz/VimOrganizer/blob/master/intro.txt
Git page is here:
https://github.com/hsitz/VimOrganizer

And the page on Vim's website is here:
http://www.vim.org/scripts/script.php?script_id=3342

Wednesday, November 2, 2011

Second Emacs Pretest Available

The second Emacs Pretest is now available for testing.  The windows build announcement can be found here.   The link on the right, next to the popular posts links you to the Windows binaries.

Tuesday, November 1, 2011

It's these little things....in Emacs

You know why I continue to use emacs?  It's those little things that DTRT.  So, here I am looking at some octave code and trying to look at a function definition in another file.

% Randomly select 100 data points to display
rand_indices = randperm(m);
sel = X(rand_indices(1:100), :);

displayData(sel);
^Point is here
fprintf('Program paused. Press enter to continue.\n');
pause;


Any other editor, I'd have to do one or the other; Go to File-->Open.... or switch to Explorer view and open the file by double clicking on it.

In Emacs, I just do M-x ffap at point and it simply prompts me with the completed file name and waits for me to hit RET.

Awesome.

Sunday, October 30, 2011

Searching the Internet from any buffer in Emacs

From the post here by Peter Munster, here's a method to search for any keyword that you're reading in the emacs buffer.

(defun pm/region-or-word (prompt)
  "Read a string from the minibuffer, prompting with PROMPT.
If `transient-mark-mode' is non-nil and the mark is active,
it defaults to the current region, else to the word at or before
point. This function returns a list (string) for use in `interactive'."
  (list (read-string prompt (or (and transient-mark-mode mark-active
                                     (buffer-substring-no-properties
                                      (region-beginning) (region-end)))
                            (current-word)))))
 
(defun pm/google (string)
  "Ask a WWW browser to google string.
Prompts for a string, defaulting to the active region or the current word at
or before point."
  (interactive (pm/region-or-word "Google: "))
  (browse-url (concat "http://google.com/search?num=100&q=" string)))

This will work if you have set

;;point to the appropriate browser
(setq browse-url-firefox-program "C:/Program Files/Mozilla Firefox/firefox.exe")

(setq browse-url-browser-function 'browse-url-firefox
          browse-url-new-window-flag nil
          browse-url-firefox-new-window-is-tab t)


Put this in your .emacs and when you see a word or highlight a region, issue a M-x pm/google (you can rename the function to a mnemonic, if you want to) and it will search for the word before point or region in google.  You probably would want to change the search engine if you want to some other search.

Friday, October 21, 2011

Direct links to mail messages in Gmail through Org-mode

Here's something I didn't know was possible.  It's possible for org-mode links to point to Gmail's individual emails.  This thread on the list outlines the different options and caveats to do it from various posters.

And do note this post on how to refer to individual mail messages in the most general case.