]> code.delx.au - gnu-emacs/blobdiff - lisp/eshell/em-alias.el
Detect remote uid and gid in tramp-gvfs.el
[gnu-emacs] / lisp / eshell / em-alias.el
index 44a4cef110601820cf1a9677e317223d79c196ed..513863d6f10bd0ed8ca58a1f49b1b094aebc89be 100644 (file)
@@ -1,7 +1,6 @@
-;;; em-alias.el --- creation and management of command aliases
+;;; em-alias.el --- creation and management of command aliases  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;;   2008, 2009, 2010, 2011, 2012  Free Software Foundation, Inc.
+;; Copyright (C) 1999-2016 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -75,7 +74,7 @@
 ;; session, it is likely that they are experiencing a spelling
 ;; difficulty associated with a certain command.  To combat this,
 ;; Eshell will offer to automatically define an alias for that
-;; mispelled command, once a given tolerance threshold has been
+;; misspelled command, once a given tolerance threshold has been
 ;; reached.
 
 ;; Whenever the same bad command name is encountered
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'esh-util))
 (require 'eshell)
 
 ;;;###autoload
-(eshell-defgroup eshell-alias nil
+(progn
+(defgroup eshell-alias nil
   "Command aliases allow for easy definition of alternate commands."
   :tag "Command aliases"
   ;; :link '(info-link "(eshell)Command aliases")
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 (defcustom eshell-aliases-file (expand-file-name "alias" eshell-directory-name)
-  "*The file in which aliases are kept.
+  "The file in which aliases are kept.
 Whenever an alias is defined by the user, using the `alias' command,
 it will be written to this file.  Thus, alias definitions (and
 deletions) are always permanent.  This approach was chosen for the
@@ -113,13 +111,14 @@ gained by using this module."
   :group 'eshell-alias)
 
 (defcustom eshell-bad-command-tolerance 3
-  "*The number of failed commands to ignore before creating an alias."
+  "The number of failed commands to ignore before creating an alias."
   :type 'integer
   ;; :link '(custom-manual "(eshell)Auto-correction of bad commands")
   :group 'eshell-alias)
 
-(defcustom eshell-alias-load-hook '(eshell-alias-initialize)
-  "*A hook that gets run when `eshell-alias' is loaded."
+(defcustom eshell-alias-load-hook nil
+  "A hook that gets run when `eshell-alias' is loaded."
+  :version "24.1"                      ; removed eshell-alias-initialize
   :type 'hook
   :group 'eshell-alias)
 
@@ -132,10 +131,10 @@ Each element of this alias is a list of the form:
 Where NAME is the textual name of the alias, and DEFINITION is the
 command string to replace that command with.
 
-Note: this list should not be modified in your '.emacs' file.  Rather,
-any desired alias definitions should be declared using the `alias'
-command, which will automatically write them to the file named by
-`eshell-aliases-file'.")
+Note: this list should not be modified in your init file.
+Rather, any desired alias definitions should be declared using
+the `alias' command, which will automatically write them to the
+file named by `eshell-aliases-file'.")
 
 (put 'eshell-command-aliases-list 'risky-local-variable t)
 
@@ -157,7 +156,7 @@ command, which will automatically write them to the file named by
 (defun eshell/alias (&optional alias &rest definition)
   "Define an ALIAS in the user's alias list using DEFINITION."
   (if (not alias)
-      (eshell-for alias eshell-command-aliases-list
+      (dolist (alias eshell-command-aliases-list)
        (eshell-print (apply 'format "alias %s %s\n" alias)))
     (if (not definition)
        (setq eshell-command-aliases-list
@@ -222,24 +221,17 @@ command, which will automatically write them to the file named by
     (let ((alias (eshell-lookup-alias command)))
       (if alias
          (throw 'eshell-replace-command
-                (list
-                 'let
-                 (list
-                  (list 'eshell-command-name
-                        (list 'quote eshell-last-command-name))
-                  (list 'eshell-command-arguments
-                        (list 'quote eshell-last-arguments))
-                  (list 'eshell-prevent-alias-expansion
-                        (list 'quote
-                              (cons command
-                                    eshell-prevent-alias-expansion))))
-                 (eshell-parse-command (nth 1 alias))))))))
+                `(let ((eshell-command-name ',eshell-last-command-name)
+                        (eshell-command-arguments ',eshell-last-arguments)
+                        (eshell-prevent-alias-expansion
+                         ',(cons command eshell-prevent-alias-expansion)))
+                    ,(eshell-parse-command (nth 1 alias))))))))
 
 (defun eshell-alias-completions (name)
   "Find all possible completions for NAME.
 These are all the command aliases which begin with NAME."
   (let (completions)
-    (eshell-for alias eshell-command-aliases-list
+    (dolist (alias eshell-command-aliases-list)
       (if (string-match (concat "^" name) (car alias))
          (setq completions (cons (car alias) completions))))
     completions))
@@ -279,5 +271,4 @@ These are all the command aliases which begin with NAME."
 ;; generated-autoload-file: "esh-groups.el"
 ;; End:
 
-;; arch-tag: 8b018fc1-4e07-4ccc-aa73-c0a1ba361f82
 ;;; em-alias.el ends here