2001-07-15 19:53:53 +00:00
|
|
|
;;; eshell.el --- the Emacs command shell
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2013-01-01 09:11:05 +00:00
|
|
|
;; Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;; Author: John Wiegley <johnw@gnu.org>
|
2001-06-19 20:36:16 +00:00
|
|
|
;; Version: 2.4.2
|
2000-06-23 05:24:10 +00:00
|
|
|
;; Keywords: processes
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 03:36:21 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2000-06-23 05:24:10 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:36:21 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 03:36:21 +00:00
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;;;_* What does Eshell offer you?
|
|
|
|
;;
|
|
|
|
;; Despite the sheer fact that running an Emacs shell can be fun, here
|
|
|
|
;; are a few of the unique features offered by Eshell:
|
|
|
|
;;
|
|
|
|
;; @ Integration with the Emacs Lisp programming environment
|
|
|
|
;;
|
|
|
|
;; @ A high degree of configurability
|
|
|
|
;;
|
|
|
|
;; @ The ability to have the same shell on every system Emacs has been
|
|
|
|
;; ported to. Since Eshell imposes no external requirements, and
|
|
|
|
;; relies upon only the Lisp functions exposed by Emacs, it is quite
|
|
|
|
;; operating system independent. Several of the common UNIX
|
|
|
|
;; commands, such as ls, mv, rm, ln, etc., have been implemented in
|
|
|
|
;; Lisp in order to provide a more consistent work environment.
|
|
|
|
;;
|
|
|
|
;; For those who might be using an older version of Eshell, version
|
|
|
|
;; 2.1 represents an entirely new, module-based architecture. It
|
|
|
|
;; supports most of the features offered by modern shells. Here is a
|
|
|
|
;; brief list of some of its more visible features:
|
|
|
|
;;
|
|
|
|
;; @ Command argument completion (tcsh, zsh)
|
|
|
|
;; @ Input history management (bash)
|
|
|
|
;; @ Intelligent output scrolling
|
2003-05-10 13:58:56 +00:00
|
|
|
;; @ Pseudo-devices (such as "/dev/clip" for copying to the clipboard)
|
2000-06-23 05:24:10 +00:00
|
|
|
;; @ Extended globbing (zsh)
|
|
|
|
;; @ Argument and globbing predication (zsh)
|
|
|
|
;; @ I/O redirection to buffers, files, symbols, processes, etc.
|
|
|
|
;; @ Many niceties otherwise seen only in 4DOS
|
|
|
|
;; @ Alias functions, both Lisp and Eshell-syntax
|
|
|
|
;; @ Piping, sequenced commands, background jobs, etc...
|
|
|
|
;;
|
|
|
|
;;;_* How to begin
|
|
|
|
;;
|
2007-11-24 21:15:08 +00:00
|
|
|
;; To start using Eshell, simply type `M-x eshell'.
|
2000-06-23 05:24:10 +00:00
|
|
|
;;
|
|
|
|
;;;_* Philosophy
|
|
|
|
;;
|
|
|
|
;; A shell is a layer which metaphorically surrounds the kernel, or
|
|
|
|
;; heart of an operating system. This kernel can be seen as an engine
|
|
|
|
;; of pure functionality, waiting to serve, while the user programs
|
|
|
|
;; take advantage of that functionality to accomplish their purpose.
|
|
|
|
;;
|
|
|
|
;; The shell's role is to make that functionality accessible to the
|
|
|
|
;; user in an unformed state. Very roughly, it associates kernel
|
|
|
|
;; functionality with textual commands, allowing the user to interact
|
|
|
|
;; with the operating system via linguistic constructs. Process
|
|
|
|
;; invocation is perhaps the most significant form this takes, using
|
|
|
|
;; the kernel's `fork' and `exec' functions.
|
|
|
|
;;
|
|
|
|
;; Other programs also interact with the functionality of the kernel,
|
|
|
|
;; but these user applications typically offer a specific range of
|
|
|
|
;; functionality, and thus are not classed as "shells" proper.
|
|
|
|
;; (What they lose in quiddity, they gain in rigidity).
|
|
|
|
;;
|
|
|
|
;; Emacs is also a user application, but it does make the
|
|
|
|
;; functionality of the kernel accessible through an interpreted
|
|
|
|
;; language -- namely, Lisp. For that reason, there is little
|
|
|
|
;; preventing Emacs from serving the same role as a modern shell. It
|
|
|
|
;; too can manipulate the kernel in an unpredetermined way to cause
|
|
|
|
;; system changes. All it's missing is the shell-ish linguistic
|
|
|
|
;; model.
|
|
|
|
;;
|
|
|
|
;; Enter Eshell. Eshell translates "shell-like" syntax into Lisp
|
|
|
|
;; in order to exercise the kernel in the same manner as typical
|
|
|
|
;; system shells. There is a fundamental difference here, however,
|
|
|
|
;; although it may seem subtle at first...
|
|
|
|
;;
|
|
|
|
;; Shells like csh and Bourne shell were written several decades ago,
|
|
|
|
;; in different times, under more restrictive circumstances. This
|
|
|
|
;; confined perspective shows itself in the paradigm used by nearly
|
|
|
|
;; all command-line shells since. They are linear in conception, byte
|
|
|
|
;; stream-based, sequential, and confined to movement within a single
|
|
|
|
;; host machine.
|
|
|
|
;;
|
|
|
|
;; Emacs, on the other hand, is more than just a limited translator
|
|
|
|
;; that can invoke subprocesses and redirect file handles. It also
|
|
|
|
;; manages character buffers, windowing frames, network connections,
|
|
|
|
;; registers, bookmarks, processes, etc. In other words, it's a very
|
|
|
|
;; multi-dimensional environment, within which eshell emulates a highly
|
|
|
|
;; linear methodology.
|
|
|
|
;;
|
|
|
|
;; Taking a moment, let's look at how this could affect the future of
|
|
|
|
;; a shell allowed to develop in such a wider field of play:
|
|
|
|
;;
|
|
|
|
;; @ There is no reason why directory movement should be linear, and
|
|
|
|
;; confined to a single file-system. Emacs, through w3 and ange-ftp,
|
|
|
|
;; has access to the entire Web. Why not allow a user to cd to
|
|
|
|
;; multiple directories simultaneously, for example? It might make
|
|
|
|
;; some tasks easier, such as diff'ing files separated by very long
|
|
|
|
;; pathnames.
|
|
|
|
;;
|
|
|
|
;; @ Data sources are available from anywhere Emacs can derive
|
|
|
|
;; information from: not just from files or the output of other
|
|
|
|
;; processes.
|
|
|
|
;;
|
|
|
|
;; @ Multiple shell invocations all share the same environment -- even
|
|
|
|
;; the same process list! It would be possible to have "process
|
|
|
|
;; views", so that one buffer is watching standard output, another
|
|
|
|
;; standard error, and another the result of standard output grep'd
|
|
|
|
;; through a regular expression...
|
|
|
|
;;
|
|
|
|
;; @ It is not necessary to "leave" the shell, losing all input and
|
|
|
|
;; output history, environment variables, directory stack, etc.
|
|
|
|
;; Emacs could save the contents of your eshell environment, and
|
|
|
|
;; restore all of it (or at least as much as possible) each time you
|
|
|
|
;; restart. This could occur automatically, without requiring
|
|
|
|
;; complex initialization scripts.
|
|
|
|
;;
|
|
|
|
;; @ Typos occur all of the time; many of them are repeats of common
|
|
|
|
;; errors, such as 'dri' for `dir'. Since executing non-existent
|
|
|
|
;; programs is rarely the intention of the user, eshell could prompt
|
|
|
|
;; for the replacement string, and then record that in a database of
|
|
|
|
;; known misspellings. (Note: The typo at the beginning of this
|
|
|
|
;; paragraph wasn't discovered until two months after I wrote the
|
|
|
|
;; text; it was not intentional).
|
|
|
|
;;
|
2012-02-28 08:17:21 +00:00
|
|
|
;; @ Emacs's register and bookmarking facilities can be used for
|
2000-06-23 05:24:10 +00:00
|
|
|
;; remembering where you've been, and what you've seen -- to varying
|
|
|
|
;; levels of persistence. They could perhaps even be tied to
|
|
|
|
;; specific "moments" during eshell execution, which would include
|
|
|
|
;; the environment at that time, as well as other variables.
|
2012-02-28 08:17:21 +00:00
|
|
|
;; Although this would require functionality orthogonal to Emacs's
|
2000-06-23 05:24:10 +00:00
|
|
|
;; own bookmarking facilities, the interface used could be made to
|
|
|
|
;; operate very similarly.
|
|
|
|
;;
|
|
|
|
;; This presents a brief idea of what the fuller dimensionality of an
|
|
|
|
;; Emacs shell could offer. It's not just the language of a shell
|
|
|
|
;; that determines how it's used, but also the Weltanschauung
|
|
|
|
;; underlying its design -- and which is felt behind even the smallest
|
|
|
|
;; feature. I would hope the freedom provided by using Emacs as a
|
|
|
|
;; parent environment will invite rich ideas from others. It
|
|
|
|
;; certainly feels as though all I've done so far is to tie down the
|
|
|
|
;; horse, so to speak, so that he will run at a man's pace.
|
|
|
|
;;
|
|
|
|
;;;_* Influences
|
|
|
|
;;
|
|
|
|
;; The author of Eshell has been a long-time user of the following
|
|
|
|
;; shells, all of which contributed to Eshell's design:
|
|
|
|
;;
|
|
|
|
;; @ rc
|
|
|
|
;; @ bash
|
|
|
|
;; @ zsh
|
|
|
|
;; @ sh
|
|
|
|
;; @ 4nt
|
|
|
|
;; @ csh
|
|
|
|
|
2001-06-19 20:25:18 +00:00
|
|
|
;;;_* Speeding up load time
|
|
|
|
;;
|
|
|
|
;; If you find that Eshell loads too slowly, there is something you
|
|
|
|
;; can do to speed it up.
|
|
|
|
;;
|
|
|
|
;; Create a file, named /tmp/elc, containing this filelist:
|
|
|
|
;;
|
|
|
|
;; esh-util.elc
|
|
|
|
;; eshell.elc
|
|
|
|
;; esh-module.elc
|
|
|
|
;; esh-var.elc
|
|
|
|
;; esh-proc.elc
|
|
|
|
;; esh-arg.elc
|
|
|
|
;; esh-io.elc
|
|
|
|
;; esh-ext.elc
|
|
|
|
;; esh-cmd.elc
|
|
|
|
;; esh-mode.elc
|
|
|
|
;; esh-opt.elc
|
|
|
|
;; em-alias.elc
|
|
|
|
;; em-banner.elc
|
|
|
|
;; em-basic.elc
|
|
|
|
;; em-cmpl.elc
|
|
|
|
;; em-dirs.elc
|
|
|
|
;; em-pred.elc
|
|
|
|
;; em-glob.elc
|
|
|
|
;; em-hist.elc
|
|
|
|
;; em-ls.elc
|
|
|
|
;; em-prompt.elc
|
|
|
|
;; em-rebind.elc
|
|
|
|
;; em-script.elc
|
|
|
|
;; em-smart.elc
|
|
|
|
;; em-term.elc
|
|
|
|
;; em-unix.elc
|
|
|
|
;; em-xtra.elc
|
|
|
|
;;
|
|
|
|
;; The order is very important. Remove from the filelist any features
|
|
|
|
;; you don't use. These all begin with "em-". If you don't use
|
|
|
|
;; Eshell's key rebinding module, you can remove "em-rebind.elc" from
|
|
|
|
;; the filelist. The modules you are currently using are listed in
|
|
|
|
;; `eshell-modules-list'.
|
|
|
|
;;
|
|
|
|
;; Now, concatenating all of the above mentioned .elc files, in that
|
|
|
|
;; order, to another file. Here is how to do this on UNIX:
|
|
|
|
;;
|
|
|
|
;; cat `cat /tmp/elc` > tmp.elc ; mv tmp.elc eshell.elc
|
|
|
|
;;
|
|
|
|
;; Now your eshell.elc file contains all of the .elc files that make
|
|
|
|
;; up Eshell, in the right load order. When you next load Eshell, it
|
|
|
|
;; will only have to read in this one file, which will greatly speed
|
|
|
|
;; things up.
|
|
|
|
|
2007-12-05 07:07:39 +00:00
|
|
|
(eval-when-compile
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(require 'cl-lib)
|
2007-12-05 07:07:39 +00:00
|
|
|
(require 'esh-util))
|
2007-11-24 21:15:08 +00:00
|
|
|
(require 'esh-util)
|
2007-12-05 07:07:39 +00:00
|
|
|
(require 'esh-mode)
|
2007-11-24 21:15:08 +00:00
|
|
|
|
|
|
|
(defgroup eshell nil
|
2012-04-22 13:58:00 +00:00
|
|
|
"Command shell implemented entirely in Emacs Lisp.
|
2010-02-21 21:05:13 +00:00
|
|
|
It invokes no external processes beyond those requested by the
|
|
|
|
user, and is intended to be a functional replacement for command
|
|
|
|
shells such as bash, zsh, rc, 4dos."
|
2007-11-24 21:15:08 +00:00
|
|
|
:link '(info-link "(eshell)Top")
|
|
|
|
:version "21.1"
|
|
|
|
:group 'applications)
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;;;_* User Options
|
|
|
|
;;
|
|
|
|
;; The following user options modify the behavior of Eshell overall.
|
2007-12-05 07:07:39 +00:00
|
|
|
(defvar eshell-buffer-name)
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2012-08-10 16:46:07 +00:00
|
|
|
(defun eshell-add-to-window-buffer-names ()
|
2000-06-23 05:24:10 +00:00
|
|
|
"Add `eshell-buffer-name' to `same-window-buffer-names'."
|
Use declare forms, where possible, to mark obsolete functions.
* lisp/allout.el (allout-passphrase-hint-string): Likewise.
(allout-init): Use a declare form to mark obsolete.
* lisp/calendar/calendar.el (calendar-version):
* lisp/calendar/icalendar.el (icalendar-extract-ical-from-buffer)
(icalendar-convert-diary-to-ical):
* lisp/cus-edit.el (custom-mode):
* lisp/ansi-color.el (ansi-color-unfontify-region):
* lisp/international/latin1-disp.el (latin1-char-displayable-p):
* lisp/progmodes/cwarn.el (turn-on-cwarn-mode):
* lisp/progmodes/which-func.el (which-func-update-1): Use
define-obsolete-function-alias.
* lisp/bookmark.el (bookmark-jump-noselect): Use a declare form to mark
this function obsolete.
* lisp/calendar/cal-x.el (calendar-two-frame-setup)
(calendar-only-one-frame-setup, calendar-one-frame-setup):
* lisp/calendar/calendar.el (american-calendar, european-calendar)
(calendar-for-loop):
* lisp/comint.el (comint-dynamic-simple-complete)
(comint-dynamic-complete-as-filename, comint-unquote-filename):
* lisp/desktop.el (desktop-load-default):
* lisp/dired-x.el (dired-omit-here-always)
(dired-hack-local-variables, dired-default-directory):
* lisp/emacs-lisp/derived.el (derived-mode-class):
* lisp/emacs-lisp/timer.el (timer-set-time-with-usecs):
* lisp/emacs-lock.el (toggle-emacs-lock):
* lisp/epa.el (epa-display-verify-result):
* lisp/epg.el (epg-sign-keys, epg-start-sign-keys)
(epg-passphrase-callback-function):
* lisp/eshell/esh-util.el (eshell-for):
* lisp/eshell/eshell.el (eshell-remove-from-window-buffer-names)
(eshell-add-to-window-buffer-names):
* lisp/files.el (locate-file-completion):
* lisp/imenu.el (imenu-example--create-c-index)
(imenu-example--create-lisp-index)
(imenu-example--lisp-extract-index-name)
(imenu-example--name-and-position):
* lisp/international/mule-cmds.el (princ-list):
* lisp/international/mule-diag.el (decode-codepage-char):
* lisp/international/mule-util.el (detect-coding-with-priority):
* lisp/iswitchb.el (iswitchb-read-buffer):
* lisp/mail/mailalias.el (mail-complete):
* lisp/mail/sendmail.el (mail-sent-via):
* lisp/mouse.el (mouse-popup-menubar-stuff, mouse-popup-menubar)
(mouse-major-mode-menu):
* lisp/password-cache.el (password-read-and-add):
* lisp/pcomplete.el (pcomplete-parse-comint-arguments):
* lisp/progmodes/sh-script.el (sh-maybe-here-document):
* lisp/replace.el (query-replace-regexp-eval):
* lisp/savehist.el (savehist-load):
* lisp/simple.el (choose-completion-delete-max-match):
* lisp/term.el (term-dynamic-simple-complete):
* lisp/vc/ediff-init.el (ediff-check-version):
* lisp/vc/ediff-wind.el (ediff-choose-window-setup-function-automatically):
* lisp/vc/vc.el (vc-diff-switches-list):
* lisp/view.el (view-return-to-alist-update): Likewise.
* lisp/iswitchb.el (iswitchb-read-buffer): Move code of
iswitchb-define-mode-map here, and delete that obsolete function.
* lisp/subr.el (eval-next-after-load, makehash, insert-string)
(assoc-ignore-representation, assoc-ignore-case): Use declare to
mark obsolete.
(mode-line-inverse-video): Variable deleted.
* lisp/emacs-lisp/byte-run.el (make-obsolete): Doc fix; emphasize that
this applies to functions.
* lisp/erc/erc.el (erc-send-command): Use define-obsolete-function-alias.
* lisp/international/mule-util.el (string-to-sequence): Remove.
* lisp/net/newst-backend.el (newsticker-cache-filename):
* lisp/net/newst-treeview.el (newsticker-groups-filename): Fix
incorrect obsolescence declaration.
* lisp/net/snmp-mode.el (snmp-font-lock-keywords-3): Don't use obsolete
font-lock-reference-face.
* lisp/url/url-parse.el (url-recreate-url-attributes):
* lisp/url/url-util.el (url-generate-unique-filename): Use declare to mark
obsolete.
* src/xdisp.c (mode_line_inverse_video): Delete obsolete variable.
2012-09-25 04:13:02 +00:00
|
|
|
(declare (obsolete nil "24.3"))
|
2000-06-23 05:24:10 +00:00
|
|
|
(add-to-list 'same-window-buffer-names eshell-buffer-name))
|
|
|
|
|
2012-08-10 16:46:07 +00:00
|
|
|
(defun eshell-remove-from-window-buffer-names ()
|
2000-06-23 05:24:10 +00:00
|
|
|
"Remove `eshell-buffer-name' from `same-window-buffer-names'."
|
Use declare forms, where possible, to mark obsolete functions.
* lisp/allout.el (allout-passphrase-hint-string): Likewise.
(allout-init): Use a declare form to mark obsolete.
* lisp/calendar/calendar.el (calendar-version):
* lisp/calendar/icalendar.el (icalendar-extract-ical-from-buffer)
(icalendar-convert-diary-to-ical):
* lisp/cus-edit.el (custom-mode):
* lisp/ansi-color.el (ansi-color-unfontify-region):
* lisp/international/latin1-disp.el (latin1-char-displayable-p):
* lisp/progmodes/cwarn.el (turn-on-cwarn-mode):
* lisp/progmodes/which-func.el (which-func-update-1): Use
define-obsolete-function-alias.
* lisp/bookmark.el (bookmark-jump-noselect): Use a declare form to mark
this function obsolete.
* lisp/calendar/cal-x.el (calendar-two-frame-setup)
(calendar-only-one-frame-setup, calendar-one-frame-setup):
* lisp/calendar/calendar.el (american-calendar, european-calendar)
(calendar-for-loop):
* lisp/comint.el (comint-dynamic-simple-complete)
(comint-dynamic-complete-as-filename, comint-unquote-filename):
* lisp/desktop.el (desktop-load-default):
* lisp/dired-x.el (dired-omit-here-always)
(dired-hack-local-variables, dired-default-directory):
* lisp/emacs-lisp/derived.el (derived-mode-class):
* lisp/emacs-lisp/timer.el (timer-set-time-with-usecs):
* lisp/emacs-lock.el (toggle-emacs-lock):
* lisp/epa.el (epa-display-verify-result):
* lisp/epg.el (epg-sign-keys, epg-start-sign-keys)
(epg-passphrase-callback-function):
* lisp/eshell/esh-util.el (eshell-for):
* lisp/eshell/eshell.el (eshell-remove-from-window-buffer-names)
(eshell-add-to-window-buffer-names):
* lisp/files.el (locate-file-completion):
* lisp/imenu.el (imenu-example--create-c-index)
(imenu-example--create-lisp-index)
(imenu-example--lisp-extract-index-name)
(imenu-example--name-and-position):
* lisp/international/mule-cmds.el (princ-list):
* lisp/international/mule-diag.el (decode-codepage-char):
* lisp/international/mule-util.el (detect-coding-with-priority):
* lisp/iswitchb.el (iswitchb-read-buffer):
* lisp/mail/mailalias.el (mail-complete):
* lisp/mail/sendmail.el (mail-sent-via):
* lisp/mouse.el (mouse-popup-menubar-stuff, mouse-popup-menubar)
(mouse-major-mode-menu):
* lisp/password-cache.el (password-read-and-add):
* lisp/pcomplete.el (pcomplete-parse-comint-arguments):
* lisp/progmodes/sh-script.el (sh-maybe-here-document):
* lisp/replace.el (query-replace-regexp-eval):
* lisp/savehist.el (savehist-load):
* lisp/simple.el (choose-completion-delete-max-match):
* lisp/term.el (term-dynamic-simple-complete):
* lisp/vc/ediff-init.el (ediff-check-version):
* lisp/vc/ediff-wind.el (ediff-choose-window-setup-function-automatically):
* lisp/vc/vc.el (vc-diff-switches-list):
* lisp/view.el (view-return-to-alist-update): Likewise.
* lisp/iswitchb.el (iswitchb-read-buffer): Move code of
iswitchb-define-mode-map here, and delete that obsolete function.
* lisp/subr.el (eval-next-after-load, makehash, insert-string)
(assoc-ignore-representation, assoc-ignore-case): Use declare to
mark obsolete.
(mode-line-inverse-video): Variable deleted.
* lisp/emacs-lisp/byte-run.el (make-obsolete): Doc fix; emphasize that
this applies to functions.
* lisp/erc/erc.el (erc-send-command): Use define-obsolete-function-alias.
* lisp/international/mule-util.el (string-to-sequence): Remove.
* lisp/net/newst-backend.el (newsticker-cache-filename):
* lisp/net/newst-treeview.el (newsticker-groups-filename): Fix
incorrect obsolescence declaration.
* lisp/net/snmp-mode.el (snmp-font-lock-keywords-3): Don't use obsolete
font-lock-reference-face.
* lisp/url/url-parse.el (url-recreate-url-attributes):
* lisp/url/url-util.el (url-generate-unique-filename): Use declare to mark
obsolete.
* src/xdisp.c (mode_line_inverse_video): Delete obsolete variable.
2012-09-25 04:13:02 +00:00
|
|
|
(declare (obsolete nil "24.3"))
|
2000-06-23 05:24:10 +00:00
|
|
|
(setq same-window-buffer-names
|
|
|
|
(delete eshell-buffer-name same-window-buffer-names)))
|
|
|
|
|
|
|
|
(defcustom eshell-load-hook nil
|
2007-11-24 21:15:08 +00:00
|
|
|
"A hook run once Eshell has been loaded."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'hook
|
|
|
|
:group 'eshell)
|
|
|
|
|
2012-08-10 16:46:07 +00:00
|
|
|
(defcustom eshell-unload-hook '(eshell-unload-all-modules)
|
2007-11-24 21:15:08 +00:00
|
|
|
"A hook run when Eshell is unloaded from memory."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'hook
|
|
|
|
:group 'eshell)
|
|
|
|
|
|
|
|
(defcustom eshell-buffer-name "*eshell*"
|
2007-11-24 21:15:08 +00:00
|
|
|
"The basename used for Eshell buffers."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'string
|
|
|
|
:group 'eshell)
|
|
|
|
|
2010-12-16 02:26:39 +00:00
|
|
|
(defcustom eshell-directory-name
|
|
|
|
(locate-user-emacs-file "eshell/" ".eshell/")
|
2007-11-24 21:15:08 +00:00
|
|
|
"The directory where Eshell control files should be kept."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'directory
|
|
|
|
:group 'eshell)
|
|
|
|
|
|
|
|
;;;_* Running Eshell
|
|
|
|
;;
|
|
|
|
;; There are only three commands used to invoke Eshell. The first two
|
|
|
|
;; are intended for interactive use, while the third is meant for
|
|
|
|
;; programmers. They are:
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun eshell (&optional arg)
|
|
|
|
"Create an interactive Eshell buffer.
|
|
|
|
The buffer used for Eshell sessions is determined by the value of
|
|
|
|
`eshell-buffer-name'. If there is already an Eshell session active in
|
|
|
|
that buffer, Emacs will simply switch to it. Otherwise, a new session
|
2002-07-26 20:40:53 +00:00
|
|
|
will begin. A numeric prefix arg (as in `C-u 42 M-x eshell RET')
|
|
|
|
switches to the session with that number, creating it if necessary. A
|
|
|
|
nonnumeric prefix arg means to create a new session. Returns the
|
|
|
|
buffer selected (or created)."
|
2000-06-23 05:24:10 +00:00
|
|
|
(interactive "P")
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(cl-assert eshell-buffer-name)
|
2002-07-26 20:40:53 +00:00
|
|
|
(let ((buf (cond ((numberp arg)
|
|
|
|
(get-buffer-create (format "%s<%d>"
|
|
|
|
eshell-buffer-name
|
|
|
|
arg)))
|
|
|
|
(arg
|
|
|
|
(generate-new-buffer eshell-buffer-name))
|
|
|
|
(t
|
|
|
|
(get-buffer-create eshell-buffer-name)))))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(cl-assert (and buf (buffer-live-p buf)))
|
2012-08-10 16:46:07 +00:00
|
|
|
(pop-to-buffer-same-window buf)
|
2007-11-24 21:15:08 +00:00
|
|
|
(unless (eq major-mode 'eshell-mode)
|
|
|
|
(eshell-mode))
|
2000-06-23 05:24:10 +00:00
|
|
|
buf))
|
|
|
|
|
|
|
|
(defun eshell-return-exits-minibuffer ()
|
|
|
|
(define-key eshell-mode-map [(control ?g)] 'abort-recursive-edit)
|
|
|
|
(define-key eshell-mode-map [return] 'exit-minibuffer)
|
|
|
|
(define-key eshell-mode-map [(control ?m)] 'exit-minibuffer)
|
|
|
|
(define-key eshell-mode-map [(control ?j)] 'exit-minibuffer)
|
|
|
|
(define-key eshell-mode-map [(meta return)] 'exit-minibuffer)
|
|
|
|
(define-key eshell-mode-map [(meta control ?m)] 'exit-minibuffer))
|
|
|
|
|
2001-04-24 01:37:31 +00:00
|
|
|
(defvar eshell-non-interactive-p nil
|
|
|
|
"A variable which is non-nil when Eshell is not running interactively.
|
|
|
|
Modules should use this variable so that they don't clutter
|
|
|
|
non-interactive sessions, such as when using `eshell-command'.")
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun eshell-command (&optional command arg)
|
|
|
|
"Execute the Eshell command string COMMAND.
|
|
|
|
With prefix ARG, insert output into the current buffer at point."
|
|
|
|
(interactive)
|
|
|
|
(require 'esh-cmd)
|
2001-04-24 01:37:31 +00:00
|
|
|
(unless arg
|
|
|
|
(setq arg current-prefix-arg))
|
2011-10-08 06:08:00 +00:00
|
|
|
(let ((eshell-non-interactive-p t))
|
|
|
|
;; Enable `eshell-mode' only in this minibuffer.
|
|
|
|
(minibuffer-with-setup-hook #'(lambda ()
|
|
|
|
(eshell-mode)
|
|
|
|
(eshell-return-exits-minibuffer))
|
2011-10-11 05:41:39 +00:00
|
|
|
(unless command
|
|
|
|
(setq command (read-from-minibuffer "Emacs shell command: "))
|
|
|
|
(eshell-add-input-to-history command))))
|
2000-06-23 05:24:10 +00:00
|
|
|
(unless command
|
|
|
|
(error "No command specified!"))
|
|
|
|
;; redirection into the current buffer is achieved by adding an
|
|
|
|
;; output redirection to the end of the command, of the form
|
|
|
|
;; 'COMMAND >>> #<buffer BUFFER>'. This will not interfere with
|
|
|
|
;; other redirections, since multiple redirections merely cause the
|
|
|
|
;; output to be copied to multiple target locations
|
|
|
|
(if arg
|
|
|
|
(setq command
|
|
|
|
(concat command
|
|
|
|
(format " >>> #<buffer %s>"
|
|
|
|
(buffer-name (current-buffer))))))
|
|
|
|
(save-excursion
|
|
|
|
(let ((buf (set-buffer (generate-new-buffer " *eshell cmd*")))
|
|
|
|
(eshell-non-interactive-p t))
|
|
|
|
(eshell-mode)
|
|
|
|
(let* ((proc (eshell-eval-command
|
|
|
|
(list 'eshell-commands
|
|
|
|
(eshell-parse-command command))))
|
|
|
|
intr
|
|
|
|
(bufname (if (and proc (listp proc))
|
|
|
|
"*EShell Async Command Output*"
|
|
|
|
(setq intr t)
|
|
|
|
"*EShell Command Output*")))
|
|
|
|
(if (buffer-live-p (get-buffer bufname))
|
|
|
|
(kill-buffer bufname))
|
|
|
|
(rename-buffer bufname)
|
|
|
|
;; things get a little coarse here, since the desire is to
|
|
|
|
;; make the output as attractive as possible, with no
|
|
|
|
;; extraneous newlines
|
|
|
|
(when intr
|
|
|
|
(if (eshell-interactive-process)
|
|
|
|
(eshell-wait-for-process (eshell-interactive-process)))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(cl-assert (not (eshell-interactive-process)))
|
2000-06-23 05:24:10 +00:00
|
|
|
(goto-char (point-max))
|
|
|
|
(while (and (bolp) (not (bobp)))
|
Replace Lisp calls to delete-backward-char by delete-char.
* bs.el, expand.el, ido.el, image-dired.el, lpr.el, pcomplete.el,
skeleton.el, term.el, time.el, wid-edit.el, woman.el,
calc/calc-graph.el, calc/calc-help.el, calc/calc-incom.el,
calc/calc.el, emacs-cl-extra.el, emacs-cl-loaddefs.el,
emulation/cua-rect.el, emulation/viper-ex.el, eshell/esh-test.el,
eshell/eshell.el, gnus/gnus-uu.el, gnus/nndoc.el, gnus/nnrss.el,
gnus/rfc2047.el, gnus/utf7.el, international/utf-7.el,
language/ethio-util.el, mh-e/mh-alias.el, mh-e/mh-search.el,
net/imap.el, net/rcirc.el, obsolete/complete.el, play/decipher.el,
progmodes/ada-mode.el, progmodes/cc-awk.el, progmodes/dcl-mode.el,
progmodes/ps-mode.el, progmodes/verilog-mode.el,
progmodes/vhdl-mode.el, textmodes/bibtex.el, textmodes/fill.el,
textmodes/reftex-auc.el, textmodes/rst.el, textmodes/sgml-mode.el,
textmodes/table.el, textmodes/texinfmt.el: Replace Lisp calls to
delete-backward-char by calls to delete-char.
2010-05-25 02:11:08 +00:00
|
|
|
(delete-char -1)))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(cl-assert (and buf (buffer-live-p buf)))
|
2000-06-23 05:24:10 +00:00
|
|
|
(unless arg
|
|
|
|
(let ((len (if (not intr) 2
|
|
|
|
(count-lines (point-min) (point-max)))))
|
|
|
|
(cond
|
|
|
|
((= len 0)
|
|
|
|
(message "(There was no command output)")
|
|
|
|
(kill-buffer buf))
|
|
|
|
((= len 1)
|
2001-04-09 23:34:16 +00:00
|
|
|
(message "%s" (buffer-string))
|
2000-06-23 05:24:10 +00:00
|
|
|
(kill-buffer buf))
|
|
|
|
(t
|
|
|
|
(save-selected-window
|
|
|
|
(select-window (display-buffer buf))
|
|
|
|
(goto-char (point-min))
|
|
|
|
;; cause the output buffer to take up as little screen
|
|
|
|
;; real-estate as possible, if temp buffer resizing is
|
|
|
|
;; enabled
|
|
|
|
(and intr temp-buffer-resize-mode
|
|
|
|
(resize-temp-buffer-window)))))))))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun eshell-command-result (command &optional status-var)
|
|
|
|
"Execute the given Eshell COMMAND, and return the result.
|
|
|
|
The result might be any Lisp object.
|
|
|
|
If STATUS-VAR is a symbol, it will be set to the exit status of the
|
|
|
|
command. This is the only way to determine whether the value returned
|
|
|
|
corresponding to a successful execution."
|
|
|
|
;; a null command produces a null, successful result
|
|
|
|
(if (not command)
|
|
|
|
(ignore
|
|
|
|
(if (and status-var (symbolp status-var))
|
|
|
|
(set status-var 0)))
|
|
|
|
(with-temp-buffer
|
|
|
|
(let ((eshell-non-interactive-p t))
|
|
|
|
(eshell-mode)
|
|
|
|
(let ((result (eshell-do-eval
|
|
|
|
(list 'eshell-commands
|
|
|
|
(list 'eshell-command-to-value
|
|
|
|
(eshell-parse-command command))) t)))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(cl-assert (eq (car result) 'quote))
|
2000-06-23 05:24:10 +00:00
|
|
|
(if (and status-var (symbolp status-var))
|
|
|
|
(set status-var eshell-last-command-status))
|
|
|
|
(cadr result))))))
|
|
|
|
|
|
|
|
;;;_* Reporting bugs
|
|
|
|
;;
|
2007-11-25 01:05:00 +00:00
|
|
|
;; If you do encounter a bug, on any system, please report
|
2000-06-23 05:24:10 +00:00
|
|
|
;; it -- in addition to any particular oddities in your configuration
|
|
|
|
;; -- so that the problem may be corrected for the benefit of others.
|
|
|
|
|
|
|
|
;;;###autoload
|
2007-11-27 04:12:21 +00:00
|
|
|
(define-obsolete-function-alias 'eshell-report-bug 'report-emacs-bug "23.1")
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(defun eshell-unload-all-modules ()
|
|
|
|
"Unload all modules that were loaded by Eshell, if possible.
|
|
|
|
If the user has require'd in any of the modules, or customized a
|
|
|
|
variable with a :require tag (such as `eshell-prefer-to-shell'), it
|
|
|
|
will be impossible to unload Eshell completely without restarting
|
|
|
|
Emacs."
|
|
|
|
;; if the user set `eshell-prefer-to-shell' to t, but never loaded
|
|
|
|
;; Eshell, then `eshell-subgroups' will be unbound
|
|
|
|
(when (fboundp 'eshell-subgroups)
|
Make eshell-for obsolete (replaced by dolist)
* eshell/esh-util.el (eshell-for): Make it obsolete.
* eshell/em-alias.el (eshell/alias, eshell-alias-completions):
* eshell/em-dirs.el (eshell-save-some-last-dir):
* eshell/em-hist.el (eshell-save-some-history, eshell-hist-parse-modifier):
* eshell/em-ls.el (eshell-ls-dir, eshell-ls-files, eshell-ls-entries):
* eshell/em-unix.el (eshell/cat, eshell/du, eshell/su):
* eshell/esh-cmd.el (eshell-invoke-directly, eshell-do-eval, eshell/which):
* eshell/esh-ext.el (eshell-find-interpreter):
* eshell/esh-mode.el (eshell-mode):
* eshell/esh-module.el (eshell-unload-extension-modules):
* eshell/esh-proc.el (eshell-process-interact):
* eshell/esh-test.el (eshell-test):
* eshell/esh-util.el (eshell-flatten-list, eshell-winnow-list):
* eshell/esh-var.el (eshell/env, eshell-environment-variables)
(eshell-variables-list):
* eshell/eshell.el (eshell-unload-all-modules):
Replace eshell-for with dolist.
2011-03-05 03:53:41 +00:00
|
|
|
(dolist (module (eshell-subgroups 'eshell))
|
2000-06-23 05:24:10 +00:00
|
|
|
;; this really only unloads as many modules as possible,
|
|
|
|
;; since other `require' references (such as by customizing
|
|
|
|
;; `eshell-prefer-to-shell' to a non-nil value) might make it
|
|
|
|
;; impossible to unload Eshell completely
|
|
|
|
(if (featurep module)
|
|
|
|
(ignore-errors
|
|
|
|
(message "Unloading %s..." (symbol-name module))
|
|
|
|
(unload-feature module)
|
|
|
|
(message "Unloading %s...done" (symbol-name module)))))
|
|
|
|
(message "Unloading eshell...done")))
|
|
|
|
|
|
|
|
(run-hooks 'eshell-load-hook)
|
|
|
|
|
2007-11-24 21:15:08 +00:00
|
|
|
(provide 'eshell)
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;;; eshell.el ends here
|