29876
|
1 ;;; em-xtra --- extra alias functions
|
|
2
|
|
3 ;; Copyright (C) 1999, 2000 Free Sofware Foundation
|
|
4
|
|
5 ;; This file is part of GNU Emacs.
|
|
6
|
|
7 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
8 ;; it under the terms of the GNU General Public License as published by
|
|
9 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
10 ;; any later version.
|
|
11
|
|
12 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 ;; GNU General Public License for more details.
|
|
16
|
|
17 ;; You should have received a copy of the GNU General Public License
|
|
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 ;; Boston, MA 02111-1307, USA.
|
|
21
|
|
22 (provide 'em-xtra)
|
|
23
|
|
24 (eval-when-compile (require 'esh-maint))
|
|
25
|
|
26 (defgroup eshell-xtra nil
|
|
27 "This module defines some extra alias functions which are entirely
|
|
28 optional. They can be viewed as samples for how to write Eshell alias
|
|
29 functions, or as aliases which make some of Emacs' behavior more
|
|
30 naturally accessible within Emacs."
|
|
31 :tag "Extra alias functions"
|
|
32 :group 'eshell-module)
|
|
33
|
|
34 ;;; Commentary:
|
|
35
|
|
36 (require 'compile)
|
|
37
|
|
38 ;;; Functions:
|
|
39
|
|
40 (defun eshell/expr (&rest args)
|
|
41 "Implementation of expr, using the calc package."
|
|
42 (if (not (fboundp 'calc-eval))
|
|
43 (throw 'eshell-replace-command
|
|
44 (eshell-parse-command "*expr" args))
|
|
45 ;; to fool the byte-compiler...
|
|
46 (let ((func 'calc-eval))
|
|
47 (funcall func (eshell-flatten-and-stringify args)))))
|
|
48
|
|
49 (defun eshell/substitute (&rest args)
|
|
50 "Easy front-end to `intersection', for comparing lists of strings."
|
|
51 (apply 'substitute (car args) (cadr args) :test 'equal
|
|
52 (cddr args)))
|
|
53
|
|
54 (defun eshell/count (&rest args)
|
|
55 "Easy front-end to `intersection', for comparing lists of strings."
|
|
56 (apply 'count (car args) (cadr args) :test 'equal
|
|
57 (cddr args)))
|
|
58
|
|
59 (defun eshell/mismatch (&rest args)
|
|
60 "Easy front-end to `intersection', for comparing lists of strings."
|
|
61 (apply 'mismatch (car args) (cadr args) :test 'equal
|
|
62 (cddr args)))
|
|
63
|
|
64 (defun eshell/union (&rest args)
|
|
65 "Easy front-end to `intersection', for comparing lists of strings."
|
|
66 (apply 'union (car args) (cadr args) :test 'equal
|
|
67 (cddr args)))
|
|
68
|
|
69 (defun eshell/intersection (&rest args)
|
|
70 "Easy front-end to `intersection', for comparing lists of strings."
|
|
71 (apply 'intersection (car args) (cadr args) :test 'equal
|
|
72 (cddr args)))
|
|
73
|
|
74 (defun eshell/set-difference (&rest args)
|
|
75 "Easy front-end to `intersection', for comparing lists of strings."
|
|
76 (apply 'set-difference (car args) (cadr args) :test 'equal
|
|
77 (cddr args)))
|
|
78
|
|
79 (defun eshell/set-exclusive-or (&rest args)
|
|
80 "Easy front-end to `intersection', for comparing lists of strings."
|
|
81 (apply 'set-exclusive-or (car args) (cadr args) :test 'equal
|
|
82 (cddr args)))
|
|
83
|
|
84 (defalias 'eshell/ff 'find-name-dired)
|
|
85 (defalias 'eshell/gf 'find-grep-dired)
|
|
86
|
|
87 (defun pcomplete/bcc32 ()
|
|
88 "Completion function for Borland's C++ compiler."
|
|
89 (let ((cur (pcomplete-arg 0)))
|
|
90 (cond
|
|
91 ((string-match "\\`-w\\([^;]+;\\)*\\([^;]*\\)\\'" cur)
|
|
92 (pcomplete-here
|
|
93 '("ali" "amb" "amp" "asc" "asm" "aus" "bbf" "bei" "big" "ccc"
|
|
94 "cln" "cod" "com" "cpt" "csu" "def" "dig" "dpu" "dsz" "dup"
|
|
95 "eas" "eff" "ext" "hch" "hid" "ias" "ibc" "ifr" "ill" "nil"
|
|
96 "lin" "lvc" "mcs" "mes" "mpc" "mpd" "msg" "nak" "ncf" "nci"
|
|
97 "ncl" "nfd" "ngu" "nin" "nma" "nmu" "nod" "nop" "npp" "nsf"
|
|
98 "nst" "ntd" "nto" "nvf" "obi" "obs" "ofp" "osh" "ovf" "par"
|
|
99 "pch" "pck" "pia" "pin" "pow" "prc" "pre" "pro" "rch" "ret"
|
|
100 "rng" "rpt" "rvl" "sig" "spa" "stl" "stu" "stv" "sus" "tai"
|
|
101 "tes" "thr" "ucp" "use" "voi" "zdi") (match-string 2 cur)))
|
|
102 ((string-match "\\`-[LIn]\\([^;]+;\\)*\\([^;]*\\)\\'" cur)
|
|
103 (pcomplete-here (pcomplete-dirs) (match-string 2 cur)))
|
|
104 ((string-match "\\`-[Ee]\\(.*\\)\\'" cur)
|
|
105 (pcomplete-here (pcomplete-dirs-or-entries "\\.[Ee][Xx][Ee]\\'")
|
|
106 (match-string 1 cur)))
|
|
107 ((string-match "\\`-o\\(.*\\)\\'" cur)
|
|
108 (pcomplete-here (pcomplete-dirs-or-entries "\\.[Oo][Bb][Jj]\\'")
|
|
109 (match-string 1 cur)))
|
|
110 (t
|
|
111 (pcomplete-opt "3456ABCDEHIKLMNOPRSTUVXabcdefgijklnoptuvwxyz"))))
|
|
112 (while (pcomplete-here
|
|
113 (pcomplete-dirs-or-entries "\\.[iCc]\\([Pp][Pp]\\)?\\'"))))
|
|
114
|
|
115 (defalias 'pcomplete/bcc 'pcomplete/bcc32)
|
|
116
|
|
117 ;;; Code:
|
|
118
|
|
119 ;;; em-xtra.el ends here
|