[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Critique these snippets from my .emacs file

From: Sean McAfee
Subject: Critique these snippets from my .emacs file
Date: Sun, 17 Jan 2010 13:21:41 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (darwin)

I was hoping that some of the local experts might like to offer some
critiques of some bits of my .emacs file that I suspect might be
accomplishable in better or more standard ways.

  (global-set-key [(control m)] 'newline-and-indent)

I've had this first bit just about since I started with Emacs.  It's
hard to believe that anyone at all would use C-j for this, as the
Emacs manual seems to suggest.  It's only in text-mode that it
occasionally gives me unwanted indentation.

  (defadvice open-line (around vi-style-open-line activate)
    "Make open-line behave more like vi."

This snippet is also of pretty ancient vintage.  It used to be its own
function, but I recently recast it as advice.  It also occasionally
gives me unwanted indentation, typically in text-mode.

  (global-set-key [(control x) (control o)] 'other-window-delete-rest)

  (defun other-window-delete-rest (arg)
    "Goes to the next window with other-window, then makes that window
  the only visible window.  With a prefix argument, kills the current
  buffer first."
    (interactive "P")
    (if arg (kill-buffer nil))
    (other-window 1)

This one has been so useful it's hard to believe it's not built into
Emacs somewhere.  I only recently discovered C-x 4 0, which does part
of the job that this command does, but I think this arrangement is
better overall.

  (defvar recenter-fraction 0.33
    "The recenter-proportionally advice will recenter the screen by
  putting the current line this far down the window.")

  (defadvice recenter (before recenter-proportionally activate)
    (or (ad-get-arg 0)
        (ad-set-arg 0 (truncate (* recenter-fraction (window-body-height))))))

Pretty self-explanatory.  It generally seems to be more convenient for
me to see about twice as much below the current line as above.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]