Misc refactoring
This commit is contained in:
parent
7769b6f4c7
commit
bc40d6f059
@ -102,6 +102,8 @@ Sets environment variables by starting a shell.
|
|||||||
Emacs' built in ~shell-command-to-string~ function has the downside that it forks a new shell process every time it is executed. This means that any shell startup cost is incurred when this function is called.
|
Emacs' built in ~shell-command-to-string~ function has the downside that it forks a new shell process every time it is executed. This means that any shell startup cost is incurred when this function is called.
|
||||||
|
|
||||||
The following implementation uses eshell's ~eshell-search-path~ to find the binary (which is the only reason ~shell-comand-to-string~ is typically used anyway), but it avoids incurring any shell-startup cost.
|
The following implementation uses eshell's ~eshell-search-path~ to find the binary (which is the only reason ~shell-comand-to-string~ is typically used anyway), but it avoids incurring any shell-startup cost.
|
||||||
|
|
||||||
|
This was originally inspired by [[https://github.com/bbatsov/projectile/issues/1044][this issue]].
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
;; We use `eshell-search-path' for this hack
|
;; We use `eshell-search-path' for this hack
|
||||||
(require 'eshell)
|
(require 'eshell)
|
||||||
@ -172,6 +174,7 @@ This makes it so that we always try to call-process instead of shell-command-to-
|
|||||||
(when imalison:secure (imalison:use-https-and-tls))
|
(when imalison:secure (imalison:use-https-and-tls))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** ELPA Archive Setup
|
** ELPA Archive Setup
|
||||||
|
The org archive does not support https, so we set http as the protocol explicitly.
|
||||||
#+BEGIN_SRC emacs-lisp -n -r
|
#+BEGIN_SRC emacs-lisp -n -r
|
||||||
(require 'package)
|
(require 'package)
|
||||||
|
|
||||||
@ -179,11 +182,11 @@ This makes it so that we always try to call-process instead of shell-command-to-
|
|||||||
(unless protocol (setq protocol (if imalison:secure "https" "http")))
|
(unless protocol (setq protocol (if imalison:secure "https" "http")))
|
||||||
(format "%s://%s" protocol uri))
|
(format "%s://%s" protocol uri))
|
||||||
|
|
||||||
|
(defvar imalison:melpa-uri nil)
|
||||||
(defvar imalison:package-archive-triples
|
(defvar imalison:package-archive-triples
|
||||||
'(("elpa" "tromey.com/elpa/" "http")
|
`(("elpa" "tromey.com/elpa/" "http")
|
||||||
;; ("marmalade" "marmalade-repo.org/packages/") (ref:marmalade)
|
("org" "orgmode.org/elpa/" "http")
|
||||||
("org" "orgmode.org/elpa/" "http") (ref:org setup)
|
("melpa" ,(or imalison:melpa-uri "melpa.org/packages/") nil)
|
||||||
("melpa" "melpa.org/packages/" nil)
|
|
||||||
("melpa-stable" "stable.melpa.org/packages/" nil)))
|
("melpa-stable" "stable.melpa.org/packages/" nil)))
|
||||||
|
|
||||||
(defun imalison:add-package-archive (archive-name archive-uri)
|
(defun imalison:add-package-archive (archive-name archive-uri)
|
||||||
@ -195,8 +198,6 @@ This makes it so that we always try to call-process instead of shell-command-to-
|
|||||||
(imalison:add-package-archive
|
(imalison:add-package-archive
|
||||||
archive-name (imalison:build-archive-uri archive-uri protocol))))
|
archive-name (imalison:build-archive-uri archive-uri protocol))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
[[(org setup)][The org archive]] does not support https, so we set http as the protocol explicitly.
|
|
||||||
I've decided to stop using [[(marmalade)][Marmalade]] completely
|
|
||||||
** Bootstrap Package Loading
|
** Bootstrap Package Loading
|
||||||
Its a shame that everyone has to have some version of this function in
|
Its a shame that everyone has to have some version of this function in
|
||||||
their init.el. I use use-package's own mechanism for ensuring packages
|
their init.el. I use use-package's own mechanism for ensuring packages
|
||||||
@ -283,9 +284,7 @@ but provide support for writing custom elisp.
|
|||||||
*** gh
|
*** gh
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package gh
|
(use-package gh
|
||||||
:ensure nil
|
:demand t)
|
||||||
:defer t
|
|
||||||
:load-path "~/Projects/gh.el")
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
*** shut-up
|
*** shut-up
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
Loading…
Reference in New Issue
Block a user