summaryrefslogtreecommitdiff
path: root/lisp/eshell
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2012-07-11 19:13:41 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2012-07-11 19:13:41 -0400
commita464a6c73acf27b0d633d428919a36bc16a9d442 (patch)
treebcba70ce0242bfd5987356c750ba4eb6b58820b1 /lisp/eshell
parentc214e35e489145bd3a8ab7a353671f947368a7ae (diff)
downloademacs-a464a6c73acf27b0d633d428919a36bc16a9d442.tar.gz
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.
Diffstat (limited to 'lisp/eshell')
-rw-r--r--lisp/eshell/em-banner.el8
-rw-r--r--lisp/eshell/em-cmpl.el8
-rw-r--r--lisp/eshell/em-hist.el9
-rw-r--r--lisp/eshell/em-ls.el6
-rw-r--r--lisp/eshell/em-script.el1
-rw-r--r--lisp/eshell/esh-cmd.el12
-rw-r--r--lisp/eshell/esh-ext.el9
-rw-r--r--lisp/eshell/esh-io.el4
-rw-r--r--lisp/eshell/esh-opt.el15
-rw-r--r--lisp/eshell/esh-var.el2
-rw-r--r--lisp/eshell/eshell.el12
11 files changed, 43 insertions, 43 deletions
diff --git a/lisp/eshell/em-banner.el b/lisp/eshell/em-banner.el
index 82cb638a791..8fdad66f3f0 100644
--- a/lisp/eshell/em-banner.el
+++ b/lisp/eshell/em-banner.el
@@ -39,7 +39,7 @@
;;; Code:
(eval-when-compile
- (require 'cl)
+ (require 'cl-lib)
(require 'esh-mode)
(require 'eshell))
@@ -77,10 +77,10 @@ This can be any sexp, and should end with at least two newlines."
;; `insert', because `insert' doesn't know how to interact with the
;; I/O code used by Eshell
(unless eshell-non-interactive-p
- (assert eshell-mode)
- (assert eshell-banner-message)
+ (cl-assert eshell-mode)
+ (cl-assert eshell-banner-message)
(let ((msg (eval eshell-banner-message)))
- (assert msg)
+ (cl-assert msg)
(eshell-interactive-print msg))))
(provide 'em-banner)
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index 25a70104c02..a67861e83a9 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -70,7 +70,7 @@
;;; Code:
(eval-when-compile
- (require 'cl)
+ (require 'cl-lib)
(require 'eshell))
(require 'esh-util)
@@ -358,7 +358,7 @@ to writing a completion function."
(nconc posns (list pos)))
(setq pos (1+ pos))))
(setq posns (cdr posns))
- (assert (= (length args) (length posns)))
+ (cl-assert (= (length args) (length posns)))
(let ((a args)
(i 0)
l final)
@@ -370,7 +370,7 @@ to writing a completion function."
(and l
(setq args (nthcdr (1+ l) args)
posns (nthcdr (1+ l) posns))))
- (assert (= (length args) (length posns)))
+ (cl-assert (= (length args) (length posns)))
(when (and args (eq (char-syntax (char-before end)) ? )
(not (eq (char-before (1- end)) ?\\)))
(nconc args (list ""))
@@ -383,7 +383,7 @@ to writing a completion function."
(let ((result
(eshell-do-eval
(list 'eshell-commands arg) t)))
- (assert (eq (car result) 'quote))
+ (cl-assert (eq (car result) 'quote))
(cadr result))
arg)))
(if (numberp val)
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index 62d0bd65e9d..64a7ad94c53 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -54,8 +54,7 @@
;;; Code:
-(eval-when-compile
- (require 'cl))
+(eval-when-compile (require 'cl-lib))
(require 'ring)
(require 'esh-opt)
@@ -560,8 +559,8 @@ See also `eshell-read-history'."
(forward-char))
(setq posb (cdr posb)
pose (cdr pose))
- (assert (= (length posb) (length args)))
- (assert (<= (length posb) (length pose))))
+ (cl-assert (= (length posb) (length args)))
+ (cl-assert (<= (length posb) (length pose))))
(setq hist (buffer-substring-no-properties begin end))
(let ((b posb) (e pose))
(while b
@@ -571,7 +570,7 @@ See also `eshell-read-history'."
(setq b (cdr b)
e (cdr e))))
(setq textargs (cdr textargs))
- (assert (= (length textargs) (length args)))
+ (cl-assert (= (length textargs) (length args)))
(list textargs posb pose))))
(defun eshell-expand-history-references (beg end)
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 5553207b626..142a5f964ab 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -27,7 +27,7 @@
;;; Code:
(eval-when-compile
- (require 'cl)
+ (require 'cl-lib)
(require 'eshell))
(require 'esh-util)
(require 'esh-opt)
@@ -463,7 +463,7 @@ name should be displayed as, etc. Think of it as cooking a FILEINFO."
(progn
(setcdr fileinfo attr)
(setcar fileinfo (eshell-ls-decorated-name fileinfo)))
- (assert (eq listing-style 'long-listing))
+ (cl-assert (eq listing-style 'long-listing))
(setcar fileinfo
(concat (eshell-ls-decorated-name fileinfo) " -> "
(eshell-ls-decorated-name
@@ -698,7 +698,7 @@ Each member of FILES is either a string or a cons cell of the form
(let* ((col-vals
(if (eq listing-style 'by-columns)
(eshell-ls-find-column-lengths display-files)
- (assert (eq listing-style 'by-lines))
+ (cl-assert (eq listing-style 'by-lines))
(eshell-ls-find-column-widths display-files)))
(col-widths (car col-vals))
(display-files (cdr col-vals))
diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el
index 3b203b4856c..f219a4b6f12 100644
--- a/lisp/eshell/em-script.el
+++ b/lisp/eshell/em-script.el
@@ -24,6 +24,7 @@
;;; Code:
(require 'eshell)
+(require 'esh-opt)
;;;###autoload
(progn
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index 872d1cdd53e..515a23f81d7 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -108,7 +108,7 @@
(require 'esh-ext)
(eval-when-compile
- (require 'cl)
+ (require 'cl-lib)
(require 'pcomplete))
@@ -604,7 +604,7 @@ For an external command, it means an exit code of 0."
(list
(if (<= (length pieces) 1)
(car pieces)
- (assert (not eshell-in-pipeline-p))
+ (cl-assert (not eshell-in-pipeline-p))
`(eshell-execute-pipeline (quote ,pieces))))))
(setq bp (cdr bp))))
;; `results' might be empty; this happens in the case of
@@ -615,7 +615,7 @@ For an external command, it means an exit code of 0."
results (cdr results)
sep-terms (nreverse sep-terms))
(while results
- (assert (car sep-terms))
+ (cl-assert (car sep-terms))
(setq final (eshell-structure-basic-command
'if (string= (car sep-terms) "&&") "if"
`(eshell-protect ,(car results))
@@ -1026,7 +1026,7 @@ be finished later after the completion of an asynchronous subprocess."
;; `eshell-copy-tree' is needed here so that the test argument
;; doesn't get modified and thus always yield the same result.
(when (car eshell-command-body)
- (assert (not synchronous-p))
+ (cl-assert (not synchronous-p))
(eshell-do-eval (car eshell-command-body))
(setcar eshell-command-body nil)
(setcar eshell-test-body nil))
@@ -1046,7 +1046,7 @@ be finished later after the completion of an asynchronous subprocess."
;; doesn't get modified and thus always yield the same result.
(if (car eshell-command-body)
(progn
- (assert (not synchronous-p))
+ (cl-assert (not synchronous-p))
(eshell-do-eval (car eshell-command-body)))
(unless (car eshell-test-body)
(setcar eshell-test-body (eshell-copy-tree (car args))))
@@ -1201,7 +1201,7 @@ COMMAND may result in an alias being executed, or a plain command."
(setq eshell-last-arguments args
eshell-last-command-name (eshell-stringify command))
(run-hook-with-args 'eshell-prepare-command-hook)
- (assert (stringp eshell-last-command-name))
+ (cl-assert (stringp eshell-last-command-name))
(if eshell-last-command-name
(or (run-hook-with-args-until-success
'eshell-named-command-hook eshell-last-command-name
diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el
index a411d3df06e..603da6f2e30 100644
--- a/lisp/eshell/esh-ext.el
+++ b/lisp/eshell/esh-ext.el
@@ -34,9 +34,10 @@
(provide 'esh-ext)
(eval-when-compile
- (require 'cl)
+ (require 'cl-lib)
(require 'esh-cmd))
(require 'esh-util)
+(require 'esh-opt)
(defgroup eshell-ext nil
"External commands are invoked when operating system executables are
@@ -206,10 +207,10 @@ causing the user to wonder if anything's really going on..."
(defun eshell-external-command (command args)
"Insert output from an external COMMAND, using ARGS."
(setq args (eshell-stringify-list (eshell-flatten-list args)))
-; (if (file-remote-p default-directory)
-; (eshell-remote-command command args))
+ ;; (if (file-remote-p default-directory)
+ ;; (eshell-remote-command command args))
(let ((interp (eshell-find-interpreter command)))
- (assert interp)
+ (cl-assert interp)
(if (functionp (car interp))
(apply (car interp) (append (cdr interp) args))
(eshell-gather-process-output
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
index c8230e0baad..9f3cfe0f6d0 100644
--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -59,7 +59,7 @@
(provide 'esh-io)
(eval-when-compile
- (require 'cl)
+ (require 'cl-lib)
(require 'eshell))
(defgroup eshell-io nil
@@ -298,7 +298,7 @@ completed successfully. RESULT is the quoted value of the last
command. If nil, then the meta variables for keeping track of the
last execution result should not be changed."
(let ((idx 0))
- (assert (or (not result) (eq (car result) 'quote)))
+ (cl-assert (or (not result) (eq (car result) 'quote)))
(setq eshell-last-command-status exit-code
eshell-last-command-result (cadr result))
(while (< idx eshell-number-of-handles)
diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el
index edb115b7f4f..fed2d8f1c62 100644
--- a/lisp/eshell/esh-opt.el
+++ b/lisp/eshell/esh-opt.el
@@ -106,7 +106,9 @@ interned variable `args' (created using a `let' form)."
(and (listp opt) (nth 3 opt)))
(cadr options)))
'(usage-msg last-value ext-command args))
- (eshell-do-opt ,name ,options (quote ,body-forms)))))
+ ;; FIXME: `options' ends up hiding some variable names under `quote',
+ ;; which is incompatible with lexical scoping!!
+ (eshell-do-opt ,name ,options (lambda () ,@body-forms)))))
;;; Internal Functions:
@@ -117,7 +119,7 @@ interned variable `args' (created using a `let' form)."
;; Documented part of the interface; see eshell-eval-using-options.
(defvar args)
-(defun eshell-do-opt (name options body-forms)
+(defun eshell-do-opt (name options body-fun)
"Helper function for `eshell-eval-using-options'.
This code doesn't really need to be macro expanded everywhere."
(setq args temp-args)
@@ -133,8 +135,7 @@ This code doesn't really need to be macro expanded everywhere."
(throw 'eshell-usage
(eshell-show-usage name options)))
(setq args (eshell-process-args name args options)
- last-value (eval (append (list 'progn)
- body-forms)))
+ last-value (funcall body-fun))
nil))
(error "%s" usage-msg))))
(throw 'eshell-external
@@ -218,10 +219,8 @@ switch is unrecognized."
found)
(while opts
(if (and (listp (car opts))
- (nth kind (car opts))
- (if (= kind 0)
- (eq switch (nth kind (car opts)))
- (string= switch (nth kind (car opts)))))
+ (nth kind (car opts))
+ (equal switch (nth kind (car opts))))
(progn
(eshell-set-option name ai (car opts) options)
(setq found t opts nil))
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index 28984c2747d..6a0e159e82e 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -110,8 +110,8 @@
(eval-when-compile
(require 'pcomplete)
(require 'esh-util)
- (require 'esh-opt)
(require 'esh-mode))
+(require 'esh-opt)
(require 'env)
(require 'ring)
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index 0a200deee46..a1717756696 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -222,7 +222,7 @@
;; things up.
(eval-when-compile
- (require 'cl)
+ (require 'cl-lib)
(require 'esh-util))
(require 'esh-util)
(require 'esh-mode)
@@ -298,7 +298,7 @@ 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)."
(interactive "P")
- (assert eshell-buffer-name)
+ (cl-assert eshell-buffer-name)
(let ((buf (cond ((numberp arg)
(get-buffer-create (format "%s<%d>"
eshell-buffer-name
@@ -312,7 +312,7 @@ buffer selected (or created)."
;; window that that command was invoked from. To achieve this,
;; it's necessary to add `eshell-buffer-name' to the variable
;; `same-window-buffer-names', which is done when Eshell is loaded
- (assert (and buf (buffer-live-p buf)))
+ (cl-assert (and buf (buffer-live-p buf)))
(pop-to-buffer buf)
(unless (eq major-mode 'eshell-mode)
(eshell-mode))
@@ -380,11 +380,11 @@ With prefix ARG, insert output into the current buffer at point."
(when intr
(if (eshell-interactive-process)
(eshell-wait-for-process (eshell-interactive-process)))
- (assert (not (eshell-interactive-process)))
+ (cl-assert (not (eshell-interactive-process)))
(goto-char (point-max))
(while (and (bolp) (not (bobp)))
(delete-char -1)))
- (assert (and buf (buffer-live-p buf)))
+ (cl-assert (and buf (buffer-live-p buf)))
(unless arg
(let ((len (if (not intr) 2
(count-lines (point-min) (point-max)))))
@@ -424,7 +424,7 @@ corresponding to a successful execution."
(list 'eshell-commands
(list 'eshell-command-to-value
(eshell-parse-command command))) t)))
- (assert (eq (car result) 'quote))
+ (cl-assert (eq (car result) 'quote))
(if (and status-var (symbolp status-var))
(set status-var eshell-last-command-status))
(cadr result))))))