aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2007-12-05 06:59:24 +0000
committerGlenn Morris2007-12-05 06:59:24 +0000
commit700645db69fb28ad38fe3080e2ee45f4630b8759 (patch)
tree1d0a16a48f0dd91cff4d63b0e799b8db4732ad02
parenta342aca45cc34d5a6a7e70eff177425dcd23fbb9 (diff)
downloademacs-700645db69fb28ad38fe3080e2ee45f4630b8759.tar.gz
emacs-700645db69fb28ad38fe3080e2ee45f4630b8759.zip
Require individual files if needed when compiling, rather than
esh-maint. Collect any require statements. Move provide statement to end. Move any commentary to start. (pcomplete-stub): Define for compiler. (pcomplete-here): Autoload it.
-rw-r--r--lisp/eshell/em-alias.el74
1 files changed, 38 insertions, 36 deletions
diff --git a/lisp/eshell/em-alias.el b/lisp/eshell/em-alias.el
index 8ecc335523b..dd61dac0594 100644
--- a/lisp/eshell/em-alias.el
+++ b/lisp/eshell/em-alias.el
@@ -22,17 +22,6 @@
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA. 23;; Boston, MA 02110-1301, USA.
24 24
25(provide 'em-alias)
26
27(eval-when-compile (require 'esh-maint))
28(require 'eshell)
29
30(defgroup eshell-alias nil
31 "Command aliases allow for easy definition of alternate commands."
32 :tag "Command aliases"
33 ;; :link '(info-link "(eshell)Command aliases")
34 :group 'eshell-module)
35
36;;; Commentary: 25;;; Commentary:
37 26
38;; Command aliases greatly simplify the definition of new commands. 27;; Command aliases greatly simplify the definition of new commands.
@@ -62,19 +51,8 @@
62;; 51;;
63;; Aliases are written to disk immediately after being defined or 52;; Aliases are written to disk immediately after being defined or
64;; deleted. The filename in which they are kept is defined by the 53;; deleted. The filename in which they are kept is defined by the
65;; following variable: 54;; variable eshell-aliases-file.
66 55
67(defcustom eshell-aliases-file (concat eshell-directory-name "alias")
68 "*The file in which aliases are kept.
69Whenever an alias is defined by the user, using the `alias' command,
70it will be written to this file. Thus, alias definitions (and
71deletions) are always permanent. This approach was chosen for the
72sake of simplicity, since that's pretty much the only benefit to be
73gained by using this module."
74 :type 'file
75 :group 'eshell-alias)
76
77;;;
78;; The format of this file is quite basic. It specifies the alias 56;; The format of this file is quite basic. It specifies the alias
79;; definitions in almost exactly the same way that the user entered 57;; definitions in almost exactly the same way that the user entered
80;; them, minus any argument quoting (since interpolation is not done 58;; them, minus any argument quoting (since interpolation is not done
@@ -102,19 +80,12 @@ gained by using this module."
102;; mispelled command, once a given tolerance threshold has been 80;; mispelled command, once a given tolerance threshold has been
103;; reached. 81;; reached.
104 82
105(defcustom eshell-bad-command-tolerance 3 83;; Whenever the same bad command name is encountered
106 "*The number of failed commands to ignore before creating an alias." 84;; `eshell-bad-command-tolerance' times, the user will be prompted in
107 :type 'integer 85;; the minibuffer to provide an alias name. An alias definition will
108 ;; :link '(custom-manual "(eshell)Auto-correction of bad commands") 86;; then be created which will result in an equal call to the correct
109 :group 'eshell-alias) 87;; name. In this way, Eshell gradually learns about the commands that
110 88;; the user mistypes frequently, and will automatically correct them!
111;;;
112;; Whenever the same bad command name is encountered this many times,
113;; the user will be prompted in the minibuffer to provide an alias
114;; name. An alias definition will then be created which will result
115;; in an equal call to the correct name. In this way, Eshell
116;; gradually learns about the commands that the user mistypes
117;; frequently, and will automatically correct them!
118;; 89;;
119;; Note that a '$*' is automatically appended at the end of the alias 90;; Note that a '$*' is automatically appended at the end of the alias
120;; definition, so that entering it is unnecessary when specifying the 91;; definition, so that entering it is unnecessary when specifying the
@@ -122,6 +93,32 @@ gained by using this module."
122 93
123;;; Code: 94;;; Code:
124 95
96(eval-when-compile
97 (require 'esh-util))
98(require 'eshell)
99
100(defgroup eshell-alias nil
101 "Command aliases allow for easy definition of alternate commands."
102 :tag "Command aliases"
103 ;; :link '(info-link "(eshell)Command aliases")
104 :group 'eshell-module)
105
106(defcustom eshell-aliases-file (concat eshell-directory-name "alias")
107 "*The file in which aliases are kept.
108Whenever an alias is defined by the user, using the `alias' command,
109it will be written to this file. Thus, alias definitions (and
110deletions) are always permanent. This approach was chosen for the
111sake of simplicity, since that's pretty much the only benefit to be
112gained by using this module."
113 :type 'file
114 :group 'eshell-alias)
115
116(defcustom eshell-bad-command-tolerance 3
117 "*The number of failed commands to ignore before creating an alias."
118 :type 'integer
119 ;; :link '(custom-manual "(eshell)Auto-correction of bad commands")
120 :group 'eshell-alias)
121
125(defcustom eshell-alias-load-hook '(eshell-alias-initialize) 122(defcustom eshell-alias-load-hook '(eshell-alias-initialize)
126 "*A hook that gets run when `eshell-alias' is loaded." 123 "*A hook that gets run when `eshell-alias' is loaded."
127 :type 'hook 124 :type 'hook
@@ -180,6 +177,9 @@ command, which will automatically write them to the file named by
180 (eshell-write-aliases-list)) 177 (eshell-write-aliases-list))
181 nil) 178 nil)
182 179
180(defvar pcomplete-stub)
181(autoload 'pcomplete-here "pcomplete")
182
183(defun pcomplete/eshell-mode/alias () 183(defun pcomplete/eshell-mode/alias ()
184 "Completion function for Eshell's `alias' command." 184 "Completion function for Eshell's `alias' command."
185 (pcomplete-here (eshell-alias-completions pcomplete-stub))) 185 (pcomplete-here (eshell-alias-completions pcomplete-stub)))
@@ -274,5 +274,7 @@ These are all the command aliases which begin with NAME."
274 eshell-prevent-alias-expansion)))) 274 eshell-prevent-alias-expansion))))
275 (eshell-parse-command alias)))))))))) 275 (eshell-parse-command alias))))))))))
276 276
277(provide 'em-alias)
278
277;;; arch-tag: 8b018fc1-4e07-4ccc-aa73-c0a1ba361f82 279;;; arch-tag: 8b018fc1-4e07-4ccc-aa73-c0a1ba361f82
278;;; em-alias.el ends here 280;;; em-alias.el ends here