Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Help me improve my Ultimate N00b SLIME/Emacs Cheat Sheet
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Maciej Katafiasz  
View profile  
 More options Feb 16 2008, 5:06 pm
Newsgroups: comp.lang.lisp
From: Maciej Katafiasz <mathr...@gmail.com>
Date: Sat, 16 Feb 2008 22:06:05 +0000 (UTC)
Local: Sat, Feb 16 2008 5:06 pm
Subject: Re: Help me improve my Ultimate N00b SLIME/Emacs Cheat Sheet
Den Thu, 14 Feb 2008 09:10:39 -0800 skrev Peter Christensen:

> So, if you've
> ever looked over the shoulder of a new Emacs user and cringed at the way
> they do things, here's your chance to make the world a better place!

I have to pimp CUA-mode.el here. It comes in the standard distribution of
GNU Emacs 22, and features awesome CUA clipboard support together with
better versions of pc-selection-mode and delete-region-mode, as well as
an absolutely superior visual rectangle mark mode. CUA-mode should be
especially valuable for newbies, as it lets you use the clipboard model
familiar from Windows/MacOS/GNOME/KDE (although I don't consider myself
a newbie and I still prefer it over the stock Emacs clipboard/region
handling). A couple of remarks:

1) I do NOT use the C-{x,c,v} bindings. They're stupid and inconvenient,
and aren't even CUA keys, despite the widespread misconception.

2) I do use, however, the actual CUA clipboard keys, that is C-<insert>,
S-<insert>, S-<delete>, for a variety of reasons, like the fact I can use
the same keys in just about every other GUI programme (and a couple of
non-GUI ones), and that it's the most convenient bindings set, much less
straining than any of the alternatives.

3) A must-try is CUA-mode's visual rectangle mark support. It's
absolutely rocktastic, and has truckloads of goodies. Read the docs!

4) For best results, inform CUA-mode about additional movement commands
you want to be treated the same as the standard ones (ie. mark with Shift,
deactivate mark otherwise). For instance:

(put 'c-backward-into-nomenclature 'CUA 'move)
(put 'c-forward-into-nomenclature 'CUA 'move)

5) Default keybindings of paredit conflict with those of CUA-mode, you
need to put some code in your .emacs to agree them. For me the list
is somewhat longer, as I have other commands I don't want paredit to
remap, in particular, I have sexp navigation bound to C-A-cursors. I
have commented out keys that aren't directly used by CUA:

========================BEGIN SNIPPET===============================

(defun check-region-parens ()
  "Check if parentheses in the region are balanced. Signals a
scan-error if not."
  (interactive)
  (save-restriction
    (save-excursion
    (let ((deactivate-mark nil))
      (condition-case c
          (progn
            (narrow-to-region (region-beginning) (region-end))
            (goto-char (point-min))
            (while (/= 0 (- (point)
                            (forward-list))))
            t)
        (scan-error (signal 'scan-error '("Region parentheses not balanced"))))))))

(defun paredit-backward-maybe-delete-region ()
  (interactive)
  (if mark-active
      (progn
        (check-region-parens)
        (cua-delete-region))
    (paredit-backward-delete)))

(defun paredit-forward-maybe-delete-region ()
  (interactive)
  (if mark-active
      (progn
        (check-region-parens)
        (cua-delete-region))
    (paredit-forward-delete)))

;; Change the path to where you have paredit.el
(load-file "~/elisp/paredit.el")
;; Unbind some of the keys paredit binds by default that conflict with CUA
(eval-after-load "~/elisp/paredit.el"
  '(let ((map paredit-mode-map))
     (mapcar (lambda (key)
               (define-key map (read-kbd-macro key) nil))
             (list
              ;; Choose which of standard paredit keys you don't want to bind
;;              "C-M-p"
;;              "C-M-n"
;;              "M-<up>"
;;              "M-<down>"
              "C-<right>"
              "C-<left>"
;;              "C-M-<left>"
;;              "C-M-<right>"))
     ;; Make <backspace> and <delete> delete region in paredit-mode too.
     ;; You can only delete balanced regions, however.
     (define-key map (read-kbd-macro "<delete>") 'paredit-forward-maybe-delete-region)
     (define-key map (read-kbd-macro "DEL") 'paredit-backward-maybe-delete-region)))

==========================END SNIPPET================================

I'd also recommend windmove.el, a package that allows directional
window switching instead of C-x o. It's a must-have for any kind of
efficient window navigation in Emacs.

Cheers,
Maciej


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.