git.fiddlerwoaroof.com
Browse code

feat (emacs): add read-sexps-in-buffer

Ed L authored on 20/12/2020 07:10:44
Showing 1 changed files
... ...
@@ -23,6 +23,15 @@ from the selected region."
23 23
    (fwoar/doc-for-resource-type
24 24
     (buffer-substring min max))))
25 25
 
26
+(defun read-sexps-in-buffer (buffer)
27
+  (with-temp-buffer
28
+    (save-excursion
29
+      (insert "(")
30
+      (insert-buffer buffer)
31
+      (goto-char (point-max))
32
+      (insert "\n)"))
33
+    (read (current-buffer))))
34
+
26 35
 (defun read-sexps-in-file (fn)
27 36
   (with-temp-buffer
28 37
     (save-excursion
... ...
@@ -101,10 +110,10 @@ from the selected region."
101 110
 
102 111
 (defun set-exec-path-from-shell-PATH ()
103 112
   "Set up Emacs' `exec-path' and PATH environment variable to match
104
-that used by the user's shell.
113
+  that used by the user's shell.
105 114
 
106 115
   This is particularly useful under Mac OSX, where GUI apps are not
107
-started from a shell."
116
+  started from a shell."
108 117
   (interactive)
109 118
   (let ((path-from-shell
110 119
          (replace-regexp-in-string
... ...
@@ -180,6 +189,7 @@ started from a shell."
180 189
       (global-display-line-numbers-mode)
181 190
     (setq linum-format "%5d\u2502")
182 191
     (global-linum-mode))
192
+  (set-exec-path-from-shell-PATH)
183 193
   ;; NOTE: this must be here...
184 194
   (global-company-mode 1))
185 195