[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 2fda57c 3/4: Simplify eshell arg processing with (p
From: |
Noam Postavsky |
Subject: |
[Emacs-diffs] master 2fda57c 3/4: Simplify eshell arg processing with (pop (nthcdr ...)) |
Date: |
Tue, 15 May 2018 20:12:22 -0400 (EDT) |
branch: master
commit 2fda57c6fb29262261911819ec8f5e4cccb3abbb
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Simplify eshell arg processing with (pop (nthcdr ...))
* lisp/eshell/esh-opt.el (eshell--set-option)
(eshell--process-args): Use (pop (nthcdr ...)) instead of writing it
out by hand.
---
lisp/eshell/esh-opt.el | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el
index 80eb153..d7a4494 100644
--- a/lisp/eshell/esh-opt.el
+++ b/lisp/eshell/esh-opt.el
@@ -200,11 +200,7 @@ will be modified."
(if (eq (nth 2 opt) t)
(if (> ai (length eshell--args))
(error "%s: missing option argument" name)
- (prog1 (nth ai eshell--args)
- (if (> ai 0)
- (setcdr (nthcdr (1- ai) eshell--args)
- (nthcdr (1+ ai) eshell--args))
- (setq eshell--args (cdr eshell--args)))))
+ (pop (nthcdr ai eshell--args)))
(or (nth 2 opt) t)))))
(defun eshell--process-option (name switch kind ai options opt-vals)
@@ -264,10 +260,7 @@ switch is unrecognized."
;; dash or switch argument found, parse
(let* ((dash (match-string 1 arg))
(switch (match-string 2 arg)))
- (if (= ai 0)
- (setq eshell--args (cdr eshell--args))
- (setcdr (nthcdr (1- ai) eshell--args)
- (nthcdr (1+ ai) eshell--args)))
+ (pop (nthcdr ai eshell--args))
(if dash
(if (> (length switch) 0)
(eshell--process-option name switch 1 ai options opt-vals)