Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8c2d5a0

Browse filesBrowse files
committed
Merge pull request #5 from ardumont/0.0.6
0.0.6
2 parents 577473f + 3e49faa commit 8c2d5a0
Copy full SHA for 8c2d5a0

File tree

3 files changed

+62
-24
lines changed
Filter options

3 files changed

+62
-24
lines changed

‎README.org

Copy file name to clipboardExpand all lines: README.org
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@
33

44
A major mode to try and improve the purescript repl experience within emacs.
55

6+
* TOC :TOC:
7+
- [[#description][Description]]
8+
- [[#what][What]]
9+
- [[#how][How]]
10+
- [[#why][Why]]
11+
- [[#when][When]]
12+
- [[#who][Who]]
13+
- [[#install][Install]]
14+
- [[#git][Git]]
15+
- [[#package-repositories][Package repositories]]
16+
- [[#el-get][el-get]]
17+
- [[#start-and-setup][Start and setup]]
18+
- [[#start][Start]]
19+
- [[#setup][Setup]]
20+
- [[#use][Use]]
21+
- [[#runtime-dependencies][Runtime dependencies]]
22+
- [[#contributions][Contributions]]
23+
- [[#pr][PR]]
24+
- [[#issues][Issues]]
25+
- [[#miscellaneous][Miscellaneous]]
26+
627
* Description
728
** What
829

‎psci.el

Copy file name to clipboardExpand all lines: psci.el
+30-22Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
;; Author: Antoine R. Dumont <eniotna.t AT gmail.com>
66
;; Maintainer: Antoine R. Dumont <eniotna.t AT gmail.com>
7-
;; Version: 0.0.5
7+
;; Version: 0.0.6
88
;; Package-Requires: ((purescript-mode "13.10") (dash "2.9.0") (s "1.9.0") (f "0.17.1") (deferred "0.3.2"))
99
;; Keywords: purescript psci repl major mode
1010
;; URL: https://github.com/ardumont/emacs-psci
@@ -77,11 +77,16 @@
7777

7878
;; private functions
7979

80+
(defun psci/log (msg)
81+
"Log MSG for psci."
82+
(message (format "psci - %s" msg)))
83+
8084
(defun psci/--project-root! ()
81-
"Determine the project's root folder."
82-
(->> psci/project-module-file
83-
(locate-dominating-file default-directory)
84-
expand-file-name))
85+
"Determine the project's root folder.
86+
Beware, can return nil if no .psci file is found."
87+
(-when-let (project-root (->> psci/project-module-file
88+
(locate-dominating-file default-directory)))
89+
(expand-file-name project-root)))
8590

8691
(defun psci/--process-name (buffer-name)
8792
"Compute the buffer's process name based on BUFFER-NAME."
@@ -133,31 +138,34 @@ Assumes the location of the modules is the project root folder."
133138
"Compute the current file's module name."
134139
(save-excursion
135140
(goto-char (point-min))
136-
(let ((regexp "^module \\\([a-zA-Z0-9\\\.]+\\\) "))
141+
(let ((regexp "^module\\s-+\\\([a-zA-Z0-9\\\.]+\\\)\\b"))
137142
(search-forward-regexp regexp)
138143
(match-string 1))))
139144

140145
;; public functions
141146

142147
;;;###autoload
143148
(defun psci ()
144-
"Run an inferior instance of `psci' inside Emacs."
149+
"Run an inferior instance of `psci' inside Emacs.
150+
Relies on .psci file for determining the project's root folder."
145151
(interactive)
146-
(let* ((psci-program psci/file-path)
147-
(buffer (comint-check-proc psci/buffer-name)))
148-
;; pop to the "*psci*" buffer if the process is dead, the
149-
;; buffer is missing or it's got the wrong mode.
150-
(pop-to-buffer-same-window
151-
(if (or buffer (not (derived-mode-p 'psci-mode))
152-
(comint-check-proc (current-buffer)))
153-
(get-buffer-create (or buffer (psci/--process-name psci/buffer-name)))
154-
(current-buffer)))
155-
;; create the comint process if there is no buffer.
156-
(unless buffer
157-
(setq default-directory (psci/--project-root!))
158-
(apply 'make-comint-in-buffer psci/buffer-name buffer
159-
psci-program psci/arguments)
160-
(psci-mode))))
152+
(-if-let (project-root-folder (psci/--project-root!))
153+
(let* ((psci-program psci/file-path)
154+
(buffer (comint-check-proc psci/buffer-name)))
155+
;; pop to the "*psci*" buffer if the process is dead, the
156+
;; buffer is missing or it's got the wrong mode.
157+
(pop-to-buffer-same-window
158+
(if (or buffer (not (derived-mode-p 'psci-mode))
159+
(comint-check-proc (current-buffer)))
160+
(get-buffer-create (or buffer (psci/--process-name psci/buffer-name)))
161+
(current-buffer)))
162+
;; create the comint process if there is no buffer.
163+
(unless buffer
164+
(setq default-directory (psci/--project-root!))
165+
(apply 'make-comint-in-buffer psci/buffer-name buffer
166+
psci-program psci/arguments)
167+
(psci-mode)))
168+
(psci/log "No .psci file so we cannot determine the root project folder. Please, add one.")))
161169

162170
(defvar psci-mode-map
163171
(let ((map (nconc (make-sparse-keymap) comint-mode-map)))

‎todo.org

Copy file name to clipboardExpand all lines: todo.org
+11-2Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
#+title: backlog
22
#+author: ardumont
33

4-
* TODO 0.0.6 [0%]
5-
- [ ] Update version
4+
* 0.0.7 [%]
5+
- [ ] Add :b binding
6+
- [ ] Add `:s import` binding
7+
- [ ] Add `:s loaded` binding
68
- [ ] Make psci's default completion work
9+
* DONE 0.0.6 [100%]
10+
CLOSED: [2015-01-14 Wed 09:03]
11+
- [X] Prepare backlog
12+
- [X] Update version
13+
- [X] Add TOC to the README.org (Cheers to org-toc!)
14+
- [X] `M-x psci` errors if there is no .psci file. - CLOSE #3
15+
- [X] Need better regex for `psci/--compute-module-name!` - CLOSE #4
716
* DONE 0.0.5 [100%]
817
CLOSED: [2014-10-30 Thu 18:17]
918
- [X] Prepare backlog

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.