Mercurial > hg > xemacs-beta
comparison lisp/efs/dired-oas.el @ 98:0d2f883870bc r20-1b1
Import from CVS: tag r20-1b1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:13:56 +0200 |
parents | 8fc7fe29b841 |
children | 7e54bd776075 9f59509498e1 |
comparison
equal
deleted
inserted
replaced
97:498bf5da1c90 | 98:0d2f883870bc |
---|---|
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2 ;; | |
3 ;; File: dired-oas.el | |
4 ;; Dired Version: $Revision: 1.1 $ | |
5 ;; RCS: | |
6 ;; Description: dired odds and sods. Dired functions not usually needed. | |
7 ;; This file is not a reference to the Organization of | |
8 ;; American States. | |
9 ;; | |
10 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
11 | |
12 ;;; Don't require or provide anything, as this file is just an archive. | |
13 | |
14 (defun dired-sort-on-size () | |
15 "Sorts a dired listing on file size. | |
16 If your ls cannot sort on size, this is useful as `dired-after-readin-hook': | |
17 \(setq dired-after-readin-hook 'dired-sort-on-size\)" | |
18 (require 'sort) | |
19 (goto-char (point-min)) | |
20 (dired-goto-next-file) ; skip `total' line | |
21 (beginning-of-line) | |
22 (sort-subr t 'forward-line 'end-of-line 'dired-get-file-size)) | |
23 | |
24 (defun dired-directories-of (files) | |
25 ;; Return unique list of parent directories of FILES. | |
26 (let (dirs dir file) | |
27 (while files | |
28 (setq file (car files) | |
29 files (cdr files) | |
30 dir (file-name-directory file)) | |
31 (or (member dir dirs) | |
32 (setq dirs (cons dir dirs)))) | |
33 dirs)) | |
34 | |
35 (defun dired-parse-ls-show () | |
36 (interactive) | |
37 (let (inode s mode size uid gid nlink time name sym) | |
38 (if (dired-parse-ls) | |
39 (message "%s" (list inode s mode nlink uid gid size time name sym)) | |
40 (message "Not on a file line.")))) | |
41 | |
42 (defun dired-files-same-directory (file-list &optional absolute) | |
43 "If all files in LIST are in the same directory return it, otherwise nil. | |
44 Returned name has no trailing slash. \"Same\" means file-name-directory of | |
45 the files are string=. File names in LIST must all be absolute or all be | |
46 relative. Implicitly, relative file names are in default-directory. If | |
47 optional ABS is non-nil, the returned name will be absolute, otherwise the | |
48 returned name will be absolute or relative as per the files in LIST." | |
49 (let ((dir (file-name-directory (car file-list)))) | |
50 (if (memq nil (mapcar (function | |
51 (lambda (file) | |
52 (string= dir (file-name-directory file)))) | |
53 file-list)) | |
54 nil | |
55 (directory-file-name | |
56 (if (or (not absolute) (and dir (file-name-absolute-p dir))) | |
57 (or dir "") | |
58 (concat default-directory dir)))))) |