Ads by Google

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.

Thursday, October 20, 2011

Sunday, October 16, 2011

Emacs Column Editing Cua Mode

Not sure whether it's been seen before but here goes.


Generating PNG images of math equations in LaTeX

This is an interesting thread  on comp.text.tex, which discusses various options of generating PNG images of your LaTeX math equations.  Useful when you want to embed in a webpage or Word documents (at least compared to the built-in option).

Tuesday, October 4, 2011

Emacs Poll on the DEL key

This might look a bit weird for some OS users but if you want to influence Emacs key chord behaviour implementation for the DEL key, now is the time to get involved.  I quote partially from the post by Dr. Richard Stallman

In Emacs 24, now in pretest, a change is being considered for ASCII DEL (on most keyboards, the Backspace key) and the Delete function key.  The change affects the case of an active region that was not dragged with the mouse.  The change is that these commands would delete the region, rather than just one character as now.

Read the post and thread in full (search for poll) and drop your feedback to the asked questions to the mail id listed in the post.  And spread the word.