[comp.emacs] nice addition to dired

erik@mpx2.UUCP (Erik Murrey) (01/07/89)

Here is a "one-liner" that I added to dired that saves a few dozen
keystrokes, called "dired-exit" that quits a dired session and removes
the buffer.  This is *great* when you are recursing down directories
with dired, and need to pop back without leaving a mess of dired buffers
behind...  I bind it to my "q" key:

Just add this to your .emacs file, (or just add the key definition to
your dired hook, if you already have one...)

;;; dired-exit hook stuff... 1/6/89 erik@mpx2.UUCP
(setq dired-mode-hook 'set-my-dired-keys-hook)

(defun set-my-dired-keys-hook ()
  "My favorite dired vars."
  (local-set-key "q" 'dired-exit)))

;;; command to quit a dired session...
(defun dired-exit ()
  "Quit editing this directory."
  (interactive)
  (kill-buffer (current-buffer)))


...Erik
-- 
Erik Murrey                            /|   //  /~~~~/  |  /
MPX Data Systems, Inc.                / | / /  /____/   |/
erik@mpx2.UUCP                       /  /  /  /        /|  Data Systems, Inc. 
{spl1,vu-vlsi,bpa}!mpx1!erik        /     /  /       /  |====================

MAP@LCS.MIT.EDU (01/08/89)

I thought your added dired command was a nice idea.  Here's a slightly
improved version that doesn't lose pending deletions if there are any.

;;; dired-exit hook stuff... 1/6/89 erik@mpx2.UUCP
;; 7-Jan-89  MAP@LCS.MIT.Edu do pending deletions before punting
(setq dired-mode-hook 'set-my-dired-keys-hook)

(defun set-my-dired-keys-hook ()
  "My favorite dired vars."
  (local-set-key "q" 'dired-delete-and-exit))

;;; command to quit a dired session...
(defun dired-delete-and-exit ()
  "Quit editing this directory."
  (interactive)
  (dired-do-deletions)
  (kill-buffer (current-buffer)))

jr@bbn.com (John Robinson) (01/09/89)

> I thought your added dired command was a nice idea.  Here's a slightly
> improved version that doesn't lose pending deletions if there are any.

The original article to which this responded was in gnu.emacs.  Here
'tis:

--------
From: erik@mpx2.UUCP (Erik Murrey)
Subject: nice addition to dired
Date: 6 Jan 89 21:02:38 GMT
Organization: MPX Data Systems, Inc. ,  Wayne, PA

Here is a "one-liner" that I added to dired that saves a few dozen
keystrokes, called "dired-exit" that quits a dired session and removes
the buffer.  This is *great* when you are recursing down directories
with dired, and need to pop back without leaving a mess of dired buffers
behind...  I bind it to my "q" key:

Just add this to your .emacs file, (or just add the key definition to
your dired hook, if you already have one...)

;;; dired-exit hook stuff... 1/6/89 erik@mpx2.UUCP
(setq dired-mode-hook 'set-my-dired-keys-hook)

(defun set-my-dired-keys-hook ()
  "My favorite dired vars."
  (local-set-key "q" 'dired-exit)))

;;; command to quit a dired session...
(defun dired-exit ()
  "Quit editing this directory."
  (interactive)
  (kill-buffer (current-buffer)))


...Erik
-- 
Erik Murrey                            /|   //  /~~~~/  |  /
MPX Data Systems, Inc.                / | / /  /____/   |/
erik@mpx2.UUCP                       /  /  /  /        /|  Data Systems, Inc. 
{spl1,vu-vlsi,bpa}!mpx1!erik        /     /  /       /  |====================
/jr
jr@bbn.com or bbn!jr