;ELC   
;;; Compiled by pot@pot.cnuce.cnr.it on Tue Mar 18 15:47:20 2003
;;; from file /home/pot/gnu/emacs-pretest.new/lisp/ls-lisp.el
;;; in Emacs version 21.3
;;; with bytecomp version 2.85.4.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`ls-lisp.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(custom-declare-group 'ls-lisp nil "Emulate the ls program completely in Emacs Lisp." :version "21.1" :group 'dired)
#@325 *Platform to emulate: GNU (default), MacOS, MS-Windows, UNIX.
Corresponding value is one of the atoms: nil, MacOS, MS-Windows, UNIX.
Sets default values for: `ls-lisp-ignore-case', `ls-lisp-dirs-first',
`ls-lisp-verbosity'.  Need not match actual platform.  Changing this
option will have no effect until you restart Emacs.
(custom-declare-variable 'ls-lisp-emulation '(cond ((eq system-type 'macos) 'MacOS) ((memq system-type '(hpux dgux usg-unix-v unisoft-unix rtu irix berkeley-unix)) 'UNIX)) '(#$ . -734) :type '(choice (const :tag "GNU" nil) (const MacOS) (const MS-Windows) (const UNIX)) :group 'ls-lisp)
#@60 *Non-nil causes ls-lisp alphabetic sorting to ignore case.
(custom-declare-variable 'ls-lisp-ignore-case '(or (memq ls-lisp-emulation '(MS-Windows MacOS)) (and (boundp 'ls-lisp-dired-ignore-case) ls-lisp-dired-ignore-case)) '(#$ . -1351) :type 'boolean :group 'ls-lisp)
#@134 *Non-nil causes ls-lisp to sort directories first in any ordering.
(Or last if it is reversed.)  Follows Microsoft Windows Explorer.
(custom-declare-variable 'ls-lisp-dirs-first '(eq ls-lisp-emulation 'MS-Windows) '(#$ . -1628) :type 'boolean :group 'ls-lisp)
#@578 *A list of optional file attributes that ls-lisp should display.
It should contain none or more of the symbols: links, uid, gid.
Nil (or an empty list) means display none of them.

Concepts come from UNIX: `links' means count of names associated with
the file; `uid' means user (owner) identifier; `gid' means group
identifier.

If emulation is MacOS then default is nil;
if emulation is MS-Windows then default is `(links)' if platform is
Windows NT/2K, nil otherwise;
if emulation is UNIX then default is `(links uid)';
if emulation is GNU then default is `(links uid gid)'.
(custom-declare-variable 'ls-lisp-verbosity '(cond ((eq ls-lisp-emulation 'MacOS) nil) ((eq ls-lisp-emulation 'MS-Windows) (if (and (fboundp 'w32-using-nt) (w32-using-nt)) '(links))) ((eq ls-lisp-emulation 'UNIX) '(links uid)) (t '(links uid gid))) '(#$ . -1895) :type '(set (const :tag "Show Link Count" links) (const :tag "Show User" uid) (const :tag "Show Group" gid)) :group 'ls-lisp)
#@247 *Non-nil causes ls-lisp to revert back to using `insert-directory-program'.
This is useful on platforms where ls-lisp is dumped into Emacs, such as
Microsoft Windows, but you would still like to use a program to list
the contents of a directory.
(custom-declare-variable 'ls-lisp-use-insert-directory-program 'nil '(#$ . -2868) :type 'boolean :group 'ls-lisp)
#@139 *Non-nil means ls-lisp treats file patterns as shell wildcards.
Otherwise they are treated as Emacs regexps (for backward compatibility).
(custom-declare-variable 'ls-lisp-support-shell-wildcards 't '(#$ . -3235) :type 'boolean :group 'ls-lisp)
(byte-code "\300\301!\204 \302\303KM\210\300\207" [featurep ls-lisp original-insert-directory insert-directory] 2)
#@114 This stub may be redefined to parse FILE-NAME as a symlink.
It should return nil or the link target as a string.
(defalias 'ls-lisp-parse-symlink #[(file-name) "\300\207" [nil] 1 (#$ . 3603)])
#@1151 Insert directory listing for FILE, formatted according to SWITCHES.
Leaves point after the inserted text.
SWITCHES may be a string of options, or a list of strings.
Optional third arg WILDCARD means treat FILE as shell wildcard.
Optional fourth arg FULL-DIRECTORY-P means file is a directory and
switches do not contain `d', so that a full listing is expected.

This version of the function comes from `ls-lisp.el'.
If the value of `ls-lisp-use-insert-directory-program' is non-nil then
it works exactly like the version from `files.el' and runs a directory
listing program whose name is in the variable
`insert-directory-program'; if also WILDCARD is non-nil then it runs
the shell specified by `shell-file-name'.  If the value of
`ls-lisp-use-insert-directory-program' is nil then it runs a Lisp
emulation.

The Lisp emulation does not run any external programs or shells.  It
supports ordinary shell wildcards if `ls-lisp-support-shell-wildcards'
is non-nil; otherwise, it interprets wildcards as regular expressions
to match file names.  It does not support all `ls' switches -- those
that work are: A a c i r S s t u U X g G B C R and F partly.
(defalias 'insert-directory #[(file switches &optional wildcard full-directory-p) "\203 \306	\n\f$\207\307\310	!\311\"\211\203  \311	\n\f%\202U \312\313\314\n\315\"\"\203D \2039 \316\317	!!\202< \317	!\320	!\202L \321\n>\203L \322\323	\n\324\n!\f%)\207" [ls-lisp-use-insert-directory-program file switches wildcard full-directory-p handler original-insert-directory find-file-name-handler expand-file-name insert-directory delete 45 append nil wildcard-to-regexp file-name-nondirectory file-name-directory 66 "[^~]\\'" ls-lisp-insert-directory ls-lisp-time-index ls-lisp-support-shell-wildcards] 7 (#$ . 3804)])
#@521 Insert directory listing for FILE, formatted according to SWITCHES.
Leaves point after the inserted text.  This is an internal function
optionally called by the `ls-lisp.el' version of `insert-directory'.
It is called recursively if the -R switch is used.
SWITCHES is a *list* of characters.  TIME-INDEX is the time index into
file-attributes according to SWITCHES.  WILDCARD is nil or an *Emacs
regexp*.  FULL-DIRECTORY-P means file is a directory and SWITCHES does
not contain `d', so that a full listing is expected.
(defalias 'ls-lisp-insert-directory #[(file switches time-index wildcard full-directory-p) "\203 \306\307	\"\203 	\211GSH\310=\203 	\311	GSO\312\n\204& \203Z\313	!\211\314\f\315\n\312$.\316 /\3110\3151\3152\3153\3154\3155\3156\3157\3178>\203a \320\321.\".\202o \3228>\204o \320\323.\".\324.8\".\3258>\203\206 \326.!\210\202`.\242B1.22\203\363 2@32A23@43A7\3277857\203\221 50\3305ZW\204\317 \3310!\204\317 \3315!\203\324 0\202\330 \3320!\\\2110\203\221 \33347589/&c\210\202\221 \2121@b\2101A\204\334c\210\335\336\3370\340\245!\"c\210)\3418>\205W.\205W.@3.A.3\211:A@)\312=\203\306\3423@\"\204\3433@\f\"3\3443\345\261\210\346389\n%\210\202.\f\207	\211GSH\310=\203i	\311\347O\350	!\211;\203\206\333	;\327;889\316 &c\202\221\351\352	\"\210\353 \210\354\355!)\207" [ls-lisp-support-shell-wildcards file wildcard full-directory-p dir default-directory string-match "[[?*]" 47 0 t file-name-as-directory directory-files-and-attributes nil current-time 65 ls-lisp-delete-matching "^\\.\\.?$" 97 "^\\." ls-lisp-handle-switches 67 ls-lisp-column-format 7 134217727 floatp float ls-lisp-format "(No match)\n" format "total %.0f\n" fceiling 1024.0 82 "\\`\\.\\.?\\'" expand-file-name "\n" ":\n" ls-lisp-insert-directory -1 file-attributes message "%s: doesn't exist or is inaccessible" ding sit-for 2 file-alist now sum total-line files elt short file-size fil attr switches time-index x fattr] 8 (#$ . 5587)])
#@183 Insert the file names (only) in FILE-ALIST into the current buffer.
Format in columns, sorted vertically, following GNU ls -C.
Responds to the window width as ls should but may not!
(defalias 'ls-lisp-column-format #[(file-alist) "\306\211\211\211\307\211\306\211\203> 	T\211@@)\211BAG\211V\203 \202 *\237\310\\\311\312\"\313 \245	\245	\n_V\203_ \nT\307\306\211\nW\205\234 \211	W\203\210 \311\f8\"c\210\n\\\211\202p `\314\306x\210`|\210\315c\210T\211\202f .\207" [colwid nfiles collen ncols fmt files nil 0 2 format "%%-%ds" window-width " 	" 10 len file file-alist x j i] 7 (#$ . 7616)])
#@65 Delete all elements matching REGEXP from LIST, return new list.
(defalias 'ls-lisp-delete-matching #[(regexp list) "\304	\203 \305\n	\211@@)\"\204 	@B	A\211\204 )\207" [result list regexp x nil string-match] 4 (#$ . 8278)])
#@182 Return t if string S1 is less than string S2 in lexicographic order.
Case is significant if `ls-lisp-ignore-case' is nil.
Unibyte strings are converted to multibyte for comparison.
(defalias 'ls-lisp-string-lessp #[(s1 s2) "\304\305\306	\305\306\n&\211\247\205 \305W)\207" [s1 s2 ls-lisp-ignore-case u compare-strings 0 nil] 9 (#$ . 8518)])
(put 'ls-lisp-string-lessp 'byte-optimizer 'byte-compile-inline-expand)
#@119 Return new FILE-ALIST sorted according to SWITCHES.
SWITCHES is a list of characters.  Default sorting is alphabetic.
(defalias 'ls-lisp-handle-switches #[(file-alist switches) "\306>\204 \307\310\311\217\210\312>\203 \313\314	\"\n\203V \315\211\211	\203E 	@\211\211A@)\316=\203: \fB\202> B	A\211\204$ \306>\203Q \f\244\202T \f\244+\306>?\317>?=\n=\203g 	\237\207	\207" [switches file-alist ls-lisp-dirs-first files dirs el 85 err (byte-code "\303\304\305	!\306\n>\203 \307\202' \310\n!\211\203 \311\202' \312\n>\203& \313\202' \314\")\303\207" [index file-alist switches nil sort copy-sequence 83 #[(x y) "\302A8\302	A8W\207" [y x 7] 3] ls-lisp-time-index #[(x y) "\303	A8\nA8\"\207" [index y x ls-lisp-time-lessp] 4] 88 #[(x y) "\306@!\306	@!\307\310\311\n\310\311\f&\211\247\205 \310W+\207" [x y s2 s1 ls-lisp-ignore-case u ls-lisp-extension compare-strings 0 nil] 9] #[(x y) "@	@\306\307\310\n\307\310\f&\211\247\205 \307W+\207" [x y s2 s1 ls-lisp-ignore-case u compare-strings 0 nil] 9]] 4) ((error (byte-code "\301\302\303!\"\210\304 \210\305\306!\207" [err message "Unsorted (ls-lisp sorting error) - %s" error-message-string ding sit-for 2] 4))) 70 mapcar ls-lisp-classify nil t 114 x] 4 (#$ . 8943)])
#@439 Append a character to each file name indicating the file type.
Also, for regular files that are executable, append `*'.
The file type indicators are `/' for directories, `@' for symbolic
links, `|' for FIFOs, `=' for sockets, and nothing for regular files.
[But FIFOs and sockets are not recognised.]
FILEDATA has the form (filename . `file-attributes').  Its `cadr' is t
for directory, string (name linked to) for symbolic link, or nil.
(defalias 'ls-lisp-classify #[(filedata) "\211A@)@\211\204 \304\n!\211\203) \n\305=\203! \306\202\" \307PAB\202< \310\311\3128\"\203; \n\313PAB\202< *\207" [filedata x file-name dir ls-lisp-parse-symlink t "/" "@" string-match "x" 9 "*"] 5 (#$ . 10208)])
#@127 Return extension of FILENAME (ignoring any version extension)
FOLLOWED by null and full filename, SOLELY for full alpha sort.
(defalias 'ls-lisp-extension #[(filename) "G\303	SH\304U\203 \305\202` 	S\211\306Y\203# 	H\304U\203 	\306W\203- \307\202` 	TH\310U\204> 	T\303O\202` 		S\211\306Y\203Q 	H\304U\203@ 	\306W\203[ \307\202` 	T\nO*\305Q\207" [filename i end nil 46 " " 0 "  " 126] 3 (#$ . 10920)])
#@52 Return t if time TIME0 is earlier than time TIME1.
(defalias 'ls-lisp-time-lessp #[(time0 time1) "@	@\211\nW\206 \nU\205 \211A@)	\211A@)W*\207" [time0 time1 hi1 hi0 x] 3 (#$ . 11342)])
#@186 Format one line of long ls output for file FILE-NAME.
FILE-ATTR and FILE-SIZE give the file's attributes and size.
SWITCHES, TIME-INDEX and NOW give the full switch list and time data.
(defalias 'ls-lisp-format #[(file-name file-attr file-size switches time-index now) "@\3068\211\204 \307!\211\203 	\310\311I\210\312\f>\205$ \313\314\3158\"\316\f>\2052 \313\317\320\321\245!\"	\322'>\205@ \313\323A@\"\324'>\205a \3258\211\326 U\203[ \313\327\330 \"\202` \313\331\")\332\f>?\205\235 \333\f>\204u \334'>\205\235 (\335>\203\200 \336\202\235 \3378\330!\211)\203\227 \313\327)\"\202\234 \313\331\"*\313\340!\203\250 \341\202\251 \342\"\343\344*+#\343\n;\205\275 \345\nP\346\260*\207" [file-attr drwxrwxrwx file-type file-name switches file-size 8 ls-lisp-parse-symlink 0 108 105 format " %6d" 10 115 " %4.0f" fceiling 1024.0 links " %3d" uid 2 user-uid " %-8s" user-login-name " %-8d" 71 103 gid (macos windows-nt ms-dos) " root" 3 floatp " %8.0f" " %8d" " " ls-lisp-format-time " -> " "\n" ls-lisp-verbosity system-type group time-index now] 14 (#$ . 11543)])
#@107 Return time index into file-attributes according to ls SWITCHES list.
Return nil if no time switch found.
(defalias 'ls-lisp-time-index #[(switches) "\301>\203 \302\207\303>\203 \304\207\305>\205 \306\207" [switches 99 6 116 5 117 4] 2 (#$ . 12644)])
#@248 Format time for file with attributes FILE-ATTR according to TIME-INDEX.
Use the same method as ls to decide whether to show time-of-day or year,
depending on distance between file date and NOW.
All ls time options, namely c, t and u, are handled.
(defalias 'ls-lisp-format-time #[(file-attr time-index now) "\206 \306	8\211@@Z\307\f\310\"\nA@A@Z\\\311\312\\[\313\312\\\314\315\316\217-\207" [time-index file-attr time now diff16 diff 5 ash 16 15552000 0 3600 nil (byte-code "\305	X\203% 	\nX\203% \306\307\"SX\203% \306\n\307\"TX\203% \310\202& \311\f\"\207" [past-cutoff diff future-cutoff diff16 time format-time-string ash -16 "%b %e %H:%M" "%b %e  %Y"] 5) ((error "Unk  0  0000")) past-cutoff future-cutoff] 4 (#$ . 12908)])
(provide 'ls-lisp)
