# HG changeset patch # User John Wiegley # Date 988093939 0 # Node ID f4b209194d8c16d7b0f3e48de718eaa8a55aa448 # Parent 565e55bc8630fd1bf253041ad9055d9060b2b95d (eshell-find-alias-function): Return t in the case where the function was defined in a file, but not part of an eshell module. diff -r 565e55bc8630 -r f4b209194d8c lisp/eshell/esh-cmd.el --- a/lisp/eshell/esh-cmd.el Tue Apr 24 06:31:46 2001 +0000 +++ b/lisp/eshell/esh-cmd.el Tue Apr 24 06:32:19 2001 +0000 @@ -1284,20 +1284,21 @@ (defun eshell-find-alias-function (name) "Check whether a function called `eshell/NAME' exists." (let* ((sym (intern-soft (concat "eshell/" name))) - (file (symbol-file sym)) - module-sym) + (file (symbol-file sym))) + ;; If the function exists, but is defined in an eshell module + ;; that's not currently enabled, don't report it as found (if (and file (string-match "\\(em\\|esh\\)-\\(.*\\)\\(\\.el\\)?\\'" file)) - (setq file (concat "eshell-" (match-string 2 file)))) - (setq module-sym - (and sym file (fboundp 'symbol-file) + (let ((module-sym (intern (file-name-sans-extension - (file-name-nondirectory file))))) - (and sym (functionp sym) - (or (not module-sym) - (eshell-using-module module-sym) - (memq module-sym (eshell-subgroups 'eshell))) - sym))) + (file-name-nondirectory + (concat "eshell-" (match-string 2 file))))))) + (if (and (eshell-using-module module-sym) + (memq module-sym (eshell-subgroups 'eshell))) + sym)) + ;; Otherwise, if it's bound, return it. + (if (functionp sym) + sym)))) (defun eshell-plain-command (command args) "Insert output from a plain COMMAND, using ARGS.