spacemacs/core/core-command-line.el

47 lines
1.5 KiB
EmacsLisp
Raw Normal View History

;;; core-command-line.el --- Spacemacs Core File
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; process args
(defun spacemacs//parse-command-line (args)
"Process ARGS relevant to core-debug.el"
(let ((i 0) new-args)
(while (< i (length args))
(let ((arg (nth i args))
(next-arg-digit
(when (< (1+ i) (length args))
(string-to-number (nth (1+ i ) args)))))
(when (or (null next-arg-digit) (= 0 next-arg-digit))
(setq next-arg-digit nil))
(pcase arg
("--profile"
(setq spacemacs-debug-with-profile t)
(setq spacemacs-debugp t))
("--timed-requires"
(setq spacemacs-debug-with-timed-requires t)
(when next-arg-digit
(setq spacemacs-debug-timer-threshold next-arg-digit
i (1+ i)))
(setq spacemacs-debugp t))
("--adv-timers"
(setq spacemacs-debug-with-adv-timers t)
(when next-arg-digit
(setq spacemacs-debug-timer-threshold next-arg-digit
i (1+ 1)))
(setq spacemacs-debugp t))
(_ (push arg new-args))))
(setq i (1+ i)))
(nreverse new-args)))
(setq command-line-args (spacemacs//parse-command-line command-line-args))
(provide 'core-command-line)