emacs-devel
[Top][All Lists]
Advanced

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

Re: patch for buff-menu.el enhancements


From: Mathias Dahl
Subject: Re: patch for buff-menu.el enhancements
Date: Tue, 10 Jul 2007 23:21:15 +0200

For those who use Windows Explorer, you will recognize this
click-column-header sorting; you probably use it many times a day. IMO, it
is one of the most useful features of Windows Explorer. I think we should do
the same thing for Dired.

Speaking of sorting in Dired, I really like this simple hack, which I
use many times per day:

;;; dired-sort-map.el --- in Dired: press s then s, x, t or n to sort
by Size, eXtension, Time or Name

;; Copyright (C) 2002 by Free Software Foundation, Inc.

;; Author: Patrick Anderson
;; Version: 1

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:

;;; inspired by Francis J. Wright's dired-sort-menu.el

;install:
;this file in your load path

;add
; (require 'dired-sort-map)
;to your .emacs file

(defvar dired-sort-map (make-sparse-keymap))

(add-hook 'dired-mode-hook '(lambda () (define-key dired-mode-map "s"
dired-sort-map)))
(add-hook 'dired-mode-hook '(lambda () (define-key dired-sort-map "s"
'(lambda () "sort by Size" (interactive) (dired-sort-other (concat
dired-listing-switches "S"))))))
(add-hook 'dired-mode-hook '(lambda () (define-key dired-sort-map "x"
'(lambda () "sort by eXtension" (interactive) (dired-sort-other
(concat dired-listing-switches "X"))))))
(add-hook 'dired-mode-hook '(lambda () (define-key dired-sort-map "t"
'(lambda () "sort by Time" (interactive) (dired-sort-other (concat
dired-listing-switches "t"))))))
(add-hook 'dired-mode-hook '(lambda () (define-key dired-sort-map "n"
'(lambda () "sort by Name" (interactive) (dired-sort-other (concat
dired-listing-switches ""))))))

(provide 'dired-sort-map)

;;; dired-sort-map.el ends here

/Mathias




reply via email to

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