What’s New in Emacs 24.4

Mickey Petersen has written up an excellent round-up of the latest features
of the Emacs 24.4 release.

Read the whole article at http://www.masteringemacs.org/articles/2013/12/29/whats-new-in-emacs-24-4/.

He had also written a similar article for Emacs 24.3 (current stable version),
which can be found here.

New Settings that I am using

I have already setup the load-prefer-newer, cycle-spacing, and ns-use-srgb-colorspace options.

The new electric-pair-mode options also look interesting, and I have set these
up (I was using skeleton-pair for the auto-pairing function till now).

The new M-s . (isearch-forward-symbol-at-point) is going to be very useful. It
essentially replicates what C-s C-w does, but having a single key-stroke is a
little easier. A closely related command M-s h . (highlight-symbol-at-point)
also looks to be useful. This is especially handy with the
hi-lock-auto-select-face option.

C-x SPC (rectangle-mark-mode) finally allows replacing CUA for me.

Eshell now has even better support for visual commands; i.e., commands
which expect a terminal. See the options eshell-visual-commands,
eshell-visual-subcommands and eshell-visual-options for details.

New Interesting Modes

The new Web Browser for Emacs (eww) is great! I have already
uninstalledw3m and using eww solely right now.

The dired-hide-details-mode is also nice. It has already replaced
dired-details for me.

superword-mode looks to be useful (especially for programming Ruby, where
underscores are usually used to separate words in an identifier).

The new file notification system would be very useful, except that it does
not (yet) work in OSX (bummer).

Other Default Settings of Interest

desktop-auto-save-timeout is going to be a life-saver. The related option for
desktop-restore-frames finally does what I want.

The new electric-pair settings electric-pair-preserve-balance,
electric-pair-delete-adjacent-pairs and
electric-pair-open-newline-between-pairs do exactly what is expected.

Ruby-mode has some interesting updates, especially for indentation.

Emacs function to add new path elements to the $PATH environment variable

A very simple eLisp function to add new path elements to the PATH environment variable. Very useful for adding new comint executables from within .emacs/init.el files.

(defun my-add-path (path-element)
 "Add the specified path element to the Emacs PATH"
  (interactive "DEnter directory to be added to path: ")
  (if (file-directory-p path-element)
    (setenv "PATH"
       (concat (expand-file-name path-element)
               path-separator (getenv "PATH")))))

Quickly diff the changes made in the current buffer with its file

Update (23rd Jan 2010): Separated the key-assignment and  function definition.

A simple function to quickly do a diff of the current buffer contents with its underlying file. Very useful if the file has been changed outside (e.g., a log file).

;; Diff the current buffer with the file contents
(defun my-diff-current-buffer-with-disk ()
 "Compare the current buffer with it's disk file."
 (diff-buffer-with-file (current-buffer)))
(global-set-key (kbd "C-c w") 'my-diff-current-buffer-with-disk)

Google Search from within Emacs

A quick and dirty eLisp function for searching on the internet from within Emacs. The default is to search using Google, but you can add to the *internet-search-urls* variable to setup additional search URLs.

By default, the search term is appended at end of the URL – however, you can also encode the specific search term insertion point in the URL by marking the position using the “%s” marker.

;;; The custom search URLs
(defvar *internet-search-urls*
 (quote ("http://www.google.com/search?ie=utf-8&oe=utf-8&q=%s"

;;; Search a query on the Internet using the selected URL.
(defun search-in-internet (arg)
 "Searches the internet using the ARGth custom URL for the marked text.

If a region is not selected, prompts for the string to search on.

The prefix number ARG indicates the Search URL to use. By default the search URL at position 1 will be used."
 (interactive "p")

 ;; Some sanity check.
 (if (> arg (length *internet-search-urls*))
      (error "There is no search URL defined at position %s" arg))

  (let ((query                          ; Set the search query first.
    (if (region-active-p)
      (buffer-substring (region-beginning) (region-end))
    (read-from-minibuffer "Search for: ")))

  ;; Now get the Base URL to use for the search
  (baseurl (nth (1- arg) *internet-search-urls*)))

  ;; Add the query parameter
  (let ((url
    (if (string-match "%s" baseurl)
      ;; If the base URL has a %s embedded, then replace it
         (replace-match query t t baseurl)
    ;; Else just append the query string at end of the URL
      (concat baseurl query))))
   (message "Searching for %s at %s" query url)
   ;; Now browse the URL
   (browse-url url))))


Get every new post delivered to your Inbox.

Join 67 other followers