all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Critique these snippets from my .emacs file
@ 2010-01-17 21:21 Sean McAfee
  0 siblings, 0 replies; only message in thread
From: Sean McAfee @ 2010-01-17 21:21 UTC (permalink / raw)
  To: help-gnu-emacs

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."
    (beginning-of-line)
    ad-do-it
    (indent-according-to-mode))

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)
    (delete-other-windows))

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-17 21:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-17 21:21 Critique these snippets from my .emacs file Sean McAfee

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.