unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Sean McAfee <eefacm@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Critique these snippets from my .emacs file
Date: Sun, 17 Jan 2010 13:21:41 -0800	[thread overview]
Message-ID: <m2hbqk5swq.fsf@sean-mcafees-macbook-pro.local.i-did-not-set--mail-host-address--so-tickle-me> (raw)

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.


                 reply	other threads:[~2010-01-17 21:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2hbqk5swq.fsf@sean-mcafees-macbook-pro.local.i-did-not-set--mail-host-address--so-tickle-me \
    --to=eefacm@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).