Endless Parentheses

Ramblings on productivity and technical subjects.

profile for Malabarba on Stack Exchange

Useful New Features in 24.4

New in 24.4 post series

Following yesterday's list of the Sweetest New Features in 24.4, today I go through the ones that strike me as most useful, either to me or to the Emacs environment itself. This is the part where I had to cut the most. Emacs 24.4 exhibits a downpour of usability improvements, and it almost feels unjust to not list them all. Nonetheless, I've narrowed them down to 8.

The commands eval-expression (M-:), eval-last-sexp (C-x C-e), and eval-print-last-sexp (C-j in Lisp Interaction mode) can take a zero prefix argument. This disables truncation of lists in the output, equivalent to setting (eval-expression-)print-length and (eval-expression-)print-level to nil. Additionally, it causes integers to be printed in other formats (octal, hexadecimal, and character).

Fantastic! The default behaviour of truncating lists proves frustrating every so often. My solution had been to set print-length to nil, but that's also not ideal as you don't always want to see everything either.

Being able to quickly toggle between the two is just perfect.

electric-indent-mode is now enabled by default.

New buffer-local electric-indent-local-mode.

I personally have fallen in love with Aggressive Auto-indentation, but this is a smart and convenient default. Also, see Bozhidar's Emacs Redux post on this feature.

New hooks focus-in-hook, focus-out-hook. These are normal hooks run when an Emacs frame gains or loses input focus.

There are already two questions on Emacs.StackExchange which are solved by these hooks! And I expect they'll pull their weight for a long time still.

Uniquify is enabled by default

This doesn't really affect me, as smart-mode-line has its own way of uniquifying names, but it's a huge improvement over the old numbering system.

letf is now just an alias for cl-letf.

I shouldn't have to tell you why this is a big deal.

New Dired minor mode dired-hide-details-mode

This used to be a very popular third party extension for dired. It's always nice to see good ideas getting promoted to built-in.

More packages look for ~/.emacs.d/<foo> additionally to ~/.<foo>.

I won't list each of the affected files here, suffice to say that they add up to 17 and include some very popular packages, such as places and ido. You could always do this yourself by configuring a score of different variables, but it's nice to see Emacs taking initiative against home clutter.

New macro define-alternatives can be used to define generic commands.

I had to write up some code to see what this was about and it certainly piqued my interest. define-alternatives is a command which defines a function with several possible implementations. The user is then asked to choose the implementation he prefers upon invoking the command for the first time.

For instance, say I'm writing up a major-mode for the Julia language. I want to offer a compilation command, but I don't known whether the user will prefer synchronous or asynchronous compilation. So I use define alternatives.

(define-alternatives julia-mode-compile
  ;; These keywords are used on the defcustom
  ;; for `julia-mode-compile-alternatives'.
  :group julia-mode
  :version "1.0")

(setq julia-mode-compile-alternatives
      '(("Compile synchronously" . 
         julia-mode-compile-synchronously)
        ("Compile asynchronously" . 
         julia-mode-compile-asynchronously)))

The first time the user invokes M-x julia-mode-compile, they will be asked to choose an implementation.

Tags: emacs-24.4, emacs,

comments powered by Disqus