Mercurial > emacs
comparison lisp/eshell/em-pred.el @ 88155:d7ddb3e565de
sync with trunk
author | Henrik Enberg <henrik.enberg@telia.com> |
---|---|
date | Mon, 16 Jan 2006 00:03:54 +0000 |
parents | 8cce22874db4 |
children |
comparison
equal
deleted
inserted
replaced
88154:8ce476d3ba36 | 88155:d7ddb3e565de |
---|---|
1 ;;; em-pred.el --- argument predicates and modifiers (ala zsh) | 1 ;;; em-pred.el --- argument predicates and modifiers (ala zsh) |
2 | 2 |
3 ;; Copyright (C) 1999, 2000 Free Software Foundation | 3 ;; Copyright (C) 1999, 2000, 2002, 2003, 2004, |
4 ;; 2005 Free Software Foundation, Inc. | |
4 | 5 |
5 ;; Author: John Wiegley <johnw@gnu.org> | 6 ;; Author: John Wiegley <johnw@gnu.org> |
6 | 7 |
7 ;; This file is part of GNU Emacs. | 8 ;; This file is part of GNU Emacs. |
8 | 9 |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 ;; GNU General Public License for more details. | 18 ;; GNU General Public License for more details. |
18 | 19 |
19 ;; You should have received a copy of the GNU General Public License | 20 ;; You should have received a copy of the GNU General Public License |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 ;; Boston, MA 02111-1307, USA. | 23 ;; Boston, MA 02110-1301, USA. |
23 | 24 |
24 (provide 'em-pred) | 25 (provide 'em-pred) |
25 | 26 |
26 (eval-when-compile (require 'esh-maint)) | 27 (eval-when-compile (require 'esh-maint)) |
27 | 28 |
111 :group 'eshell-pred) | 112 :group 'eshell-pred) |
112 | 113 |
113 (put 'eshell-predicate-alist 'risky-local-variable t) | 114 (put 'eshell-predicate-alist 'risky-local-variable t) |
114 | 115 |
115 (defcustom eshell-modifier-alist | 116 (defcustom eshell-modifier-alist |
116 '((?e . '(lambda (lst) | 117 '((?E . '(lambda (lst) |
117 (mapcar | 118 (mapcar |
118 (function | 119 (function |
119 (lambda (str) | 120 (lambda (str) |
120 (eshell-stringify | 121 (eshell-stringify |
121 (car (eshell-parse-argument str))))) lst))) | 122 (car (eshell-parse-argument str))))) lst))) |
184 u(UID|'user') owned by UID/user | 185 u(UID|'user') owned by UID/user |
185 g(GID|'group') owned by GID/group | 186 g(GID|'group') owned by GID/group |
186 | 187 |
187 FILE ATTRIBUTES: | 188 FILE ATTRIBUTES: |
188 l[+-]N +/-/= N links | 189 l[+-]N +/-/= N links |
189 a[Mwhm][+-](N|'FILE') access time +/-/= N mnths/weeks/days/mins | 190 a[Mwhms][+-](N|'FILE') access time +/-/= N mnths/weeks/hours/mins/secs |
190 if FILE specified, use as comparison basis; | 191 (days if unspecified) if FILE specified, |
191 so a+'file.c' shows files accessed before | 192 use as comparison basis; so a+'file.c' |
192 file.c was last accessed | 193 shows files accessed before file.c was |
193 m[Mwhm][+-](N|'FILE') modification time... | 194 last accessed |
194 c[Mwhm][+-](N|'FILE') change time... | 195 m[Mwhms][+-](N|'FILE') modification time... |
196 c[Mwhms][+-](N|'FILE') change time... | |
195 L[kmp][+-]N file size +/-/= N Kb/Mb/blocks | 197 L[kmp][+-]N file size +/-/= N Kb/Mb/blocks |
196 | 198 |
197 EXAMPLES: | 199 EXAMPLES: |
198 *(^@) all non-dot files which are not symlinks | 200 *(^@) all non-dot files which are not symlinks |
199 .#*(^@) all files which are not symbolic links | 201 .#*(^@) all files which are not symbolic links |
205 | 207 |
206 (defvar eshell-modifier-help-string | 208 (defvar eshell-modifier-help-string |
207 "Eshell modifier quick reference: | 209 "Eshell modifier quick reference: |
208 | 210 |
209 FOR SINGLE ARGUMENTS, or each argument of a list of strings: | 211 FOR SINGLE ARGUMENTS, or each argument of a list of strings: |
210 e evaluate again | 212 E evaluate again |
211 L lowercase | 213 L lowercase |
212 U uppercase | 214 U uppercase |
213 C capitalize | 215 C capitalize |
214 h dirname | 216 h dirname |
215 t basename | 217 t basename |
407 | 409 |
408 (defun eshell-pred-file-time (mod-char mod-type attr-index) | 410 (defun eshell-pred-file-time (mod-char mod-type attr-index) |
409 "Return a predicate to test whether a file matches a certain time." | 411 "Return a predicate to test whether a file matches a certain time." |
410 (let* ((quantum 86400) | 412 (let* ((quantum 86400) |
411 qual amount when open close end) | 413 qual amount when open close end) |
412 (when (memq (char-after) '(?M ?w ?h ?m)) | 414 (when (memq (char-after) '(?M ?w ?h ?m ?s)) |
413 (setq quantum (char-after)) | 415 (setq quantum (char-after)) |
414 (cond | 416 (cond |
415 ((eq quantum ?M) | 417 ((eq quantum ?M) |
416 (setq quantum (* 60 60 24 30))) | 418 (setq quantum (* 60 60 24 30))) |
417 ((eq quantum ?w) | 419 ((eq quantum ?w) |
598 (mapcar | 600 (mapcar |
599 (function | 601 (function |
600 (lambda (str) | 602 (lambda (str) |
601 (split-string str ,sep))) lst)))) | 603 (split-string str ,sep))) lst)))) |
602 | 604 |
605 ;;; arch-tag: 8b5ce022-17f3-4c40-93c7-5faafaa63f31 | |
603 ;;; em-pred.el ends here | 606 ;;; em-pred.el ends here |