aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/eshell
diff options
context:
space:
mode:
authorBastien2017-07-03 09:06:29 +0200
committerBastien2017-07-03 09:06:29 +0200
commit5ca1888fe670aee7febd4d42665d7372ab2ffebc (patch)
tree1f7f8d8a7580e556fc83cf3a6aaeec567b33a090 /lisp/eshell
parent20e006ffee41062f1b551a92c24d9edc53cd0f56 (diff)
parent1b4f0a92ff3505ef9a465b9b391756e3a73a6443 (diff)
downloademacs-5ca1888fe670aee7febd4d42665d7372ab2ffebc.tar.gz
emacs-5ca1888fe670aee7febd4d42665d7372ab2ffebc.zip
Merge branch 'master' into scratch/org-mode-merge
Diffstat (limited to 'lisp/eshell')
-rw-r--r--lisp/eshell/esh-cmd.el32
1 files changed, 13 insertions, 19 deletions
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index 86e7b83c281..24342208771 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -1148,6 +1148,8 @@ be finished later after the completion of an asynchronous subprocess."
1148 1148
1149;; command invocation 1149;; command invocation
1150 1150
1151(declare-function help-fns-function-description-header "help-fns")
1152
1151(defun eshell/which (command &rest names) 1153(defun eshell/which (command &rest names)
1152 "Identify the COMMAND, and where it is located." 1154 "Identify the COMMAND, and where it is located."
1153 (dolist (name (cons command names)) 1155 (dolist (name (cons command names))
@@ -1164,25 +1166,17 @@ be finished later after the completion of an asynchronous subprocess."
1164 (concat name " is an alias, defined as \"" 1166 (concat name " is an alias, defined as \""
1165 (cadr alias) "\""))) 1167 (cadr alias) "\"")))
1166 (unless program 1168 (unless program
1167 (setq program (eshell-search-path name)) 1169 (setq program
1168 (let* ((esym (eshell-find-alias-function name)) 1170 (let* ((esym (eshell-find-alias-function name))
1169 (sym (or esym (intern-soft name)))) 1171 (sym (or esym (intern-soft name))))
1170 (if (and (or esym (and sym (fboundp sym))) 1172 (if (and (or esym (and sym (fboundp sym)))
1171 (or eshell-prefer-lisp-functions (not direct))) 1173 (or eshell-prefer-lisp-functions (not direct)))
1172 (let ((desc (let ((inhibit-redisplay t)) 1174 (or (with-output-to-string
1173 (save-window-excursion 1175 (require 'help-fns)
1174 (prog1 1176 (princ (format "%s is " sym))
1175 (describe-function sym) 1177 (help-fns-function-description-header sym))
1176 (message nil)))))) 1178 name)
1177 (setq desc (if desc (substring desc 0 1179 (eshell-search-path name)))))
1178 (1- (or (string-match "\n" desc)
1179 (length desc))))
1180 ;; This should not happen.
1181 (format "%s is defined, \
1182but no documentation was found" name)))
1183 (if (buffer-live-p (get-buffer "*Help*"))
1184 (kill-buffer "*Help*"))
1185 (setq program (or desc name))))))
1186 (if (not program) 1180 (if (not program)
1187 (eshell-error (format "which: no %s in (%s)\n" 1181 (eshell-error (format "which: no %s in (%s)\n"
1188 name (getenv "PATH"))) 1182 name (getenv "PATH")))