Skip to content

Commit

Permalink
preliminary support for temporary interactive Emacsen
Browse files Browse the repository at this point in the history
Fun toy for loading package into another Emacs to play around with.

Signed-off-by: Psionik K <[email protected]>
  • Loading branch information
psionic-k committed Dec 27, 2023
1 parent 05dfe17 commit 0d99064
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion lisp/erk.el
Original file line number Diff line number Diff line change
Expand Up @@ -986,5 +986,51 @@ With prefix argument, PREVIEW the buffer."
(interactive)
(let ((current-prefix-arg '(4))) (call-interactively #'erk-export-readme)))

;; TODO initialize for tests or batch
;;;###autoload
(defun erk-temp-emacsen ()
"Create a temporary Emacsen."
;; TODO enable multiple Emacsen and multiple base configs
(interactive)
(let* ((init-dir (make-temp-file "emacsen-" t))
(buffer-name (format " *%s*" (file-name-nondirectory
(directory-file-name init-dir))))
(out-buffer (get-buffer-create buffer-name))
(emacsen (executable-find "emacs")) ; TODO customize for more Emacsen
(package-path (erk--project-root)) ; TODO prefer package over project
;; TODO set up $HOME to avoid stupid trash files that `no-littering'
;; would normally catch
;; TODO support no package
(package-feature (erk--package-root-feature))
(init-form `(progn
(load-theme 'modus-vivendi t) ; TODO customize
;; TODO customize
;; TODO use early init
(setopt load-prefer-newer t
inhibit-startup-message t
package-enable-at-startup nil
use-short-answers t
use-dialog-box nil
pixel-scroll-precision-mode 1
;; Recursive minibuffer too useful when introspecting
enable-recursive-minibuffers t
default-frame-alist
'((tool-bar-lines . 0)
(menu-bar-lines . 0)
(internal-border-width . 0)
(undecorated . nil)
(background-color . "#000000") ; said to reduce startup flicker on theme
(ns-appearance . dark) ; darwin
(ns-transparent-titlebar . t) ; darwin
(vertical-scroll-bars . nil)
(horizontal-scroll-bars . nil)))
(setq load-path ',load-path)
(push ,package-path load-path)
(require ',package-feature))))
(start-process buffer-name out-buffer emacsen
"-Q"
"--init-dir" init-dir
"--eval" (format "%S" init-form))))

(provide 'erk)
;;; erk.el ends here
;;; erk.el ends here.

0 comments on commit 0d99064

Please sign in to comment.