Skip to content

Instantly share code, notes, and snippets.

@mikedll

mikedll/parse.el

Last active Feb 24, 2019
Embed
What would you like to do?
Parse lines of a file.
(defun get-lines()
(let* ((mine-file (concat settings-dir "/common/emacs/mike/mine.txt"))
(cur-line nil)
(files-to-load (list))
(my-configs-buf (find-file-noselect mine-file)))
(with-current-buffer my-configs-buf
(goto-char (point-min))
(while (not (eq (point) (point-max)))
(setq cur-line (thing-at-point 'line t))
(cond ((string-match "^#" cur-line)
(setq cur-line nil))
((string-match "\n" cur-line)
(setq cur-line (replace-match "" t nil cur-line)))
(t (setq cur-line nil)))
(if (not (null cur-line))
(setq files-to-load (cons cur-line files-to-load)))
(forward-line)))
;; reverse, since we cons-ed the list when building it.
(reverse files-to-load)))
(dolist (file (get-lines))
(message file))
# Will be loaded in this order.
mikedll-emacs-defaults.el
osx.el
windows.el
linux.el
mikedll-emacs-extensions.el
mikedll-editing-settings.el
load-languages.el
load-tools.el
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment