emacs: select current line with single command

Previously, we've covered Single Command to Delete Whole Line and How to Copy/Cut Current Line. But what if you want to select the current line with a single command? Very short, like this:

(transient-mark-mode 1)

(defun select-current-line ()
  "Select the current line"
  (end-of-line) ; move to end of line
  (set-mark (line-beginning-position)))

This is added to Emacs Lisp Examples, check it out for other useful exmaples.

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs