From: Mark Wooding Date: Fri, 13 Sep 2019 16:05:13 +0000 (+0100) Subject: el/dot-emacs.el: Factor out the command-line option scanning. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/61aab3720fad74e4166c9541df43a46a25b0567f?ds=sidebyside el/dot-emacs.el: Factor out the command-line option scanning. --- diff --git a/el/dot-emacs.el b/el/dot-emacs.el index d2c9275..70d3b7a 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -24,19 +24,23 @@ ;;;-------------------------------------------------------------------------- ;;; Check command-line. +(defun mdw-check-command-line-switch (switch) + (let ((probe nil) (next command-line-args) (found nil)) + (while next + (cond ((string= (car next) switch) + (setq found t) + (if probe (rplacd probe (cdr next)) + (setq command-line-args (cdr next)))) + (t + (setq probe next))) + (setq next (cdr next))) + found)) + (defvar mdw-fast-startup nil "Whether .emacs should optimize for rapid startup. This may be at the expense of cool features.") -(let ((probe nil) (next command-line-args)) - (while next - (cond ((string= (car next) "--mdw-fast-startup") - (setq mdw-fast-startup t) - (if probe - (rplacd probe (cdr next)) - (setq command-line-args (cdr next)))) - (t - (setq probe next))) - (setq next (cdr next)))) +(setq mdw-fast-startup + (mdw-check-command-line-switch "--mdw-fast-startup")) ;;;-------------------------------------------------------------------------- ;;; Some general utilities.