gnu: All snippets report errors using exceptions, else return #t.
[jackhill/guix/guix.git] / gnu / packages / text-editors.scm
CommitLineData
a2c1dcea
JMSG
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016 José Miguel Sánchez García <jmi2k@openmailbox.org>
5613ea79 3;;; Copyright © 2016 Carlo Zancanaro <carlo@zancanaro.id.au>
7904f18a 4;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
0bf11648 5;;; Copyright © 2017 Feng Shu <tumashu@163.com>
1a5a8afe 6;;; Copyright © 2017 ng0 <ng0@infotropique.org>
bcd757fd 7;;; Copyright © 2014 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.org>
2c7f6ce1 8;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
a2c1dcea
JMSG
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages text-editors)
26 #:use-module (guix packages)
27 #:use-module (guix download)
5613ea79 28 #:use-module (guix git-download)
a2c1dcea
JMSG
29 #:use-module (guix utils)
30 #:use-module (guix build-system gnu)
4f038621 31 #:use-module (guix build-system glib-or-gtk)
a2c1dcea
JMSG
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (gnu packages)
3312fda0 34 #:use-module (gnu packages assembly)
5613ea79
CZ
35 #:use-module (gnu packages boost)
36 #:use-module (gnu packages documentation)
37 #:use-module (gnu packages gcc)
0bf11648
FS
38 #:use-module (gnu packages glib)
39 #:use-module (gnu packages gtk)
bcd757fd 40 #:use-module (gnu packages libbsd)
a2c1dcea
JMSG
41 #:use-module (gnu packages lua)
42 #:use-module (gnu packages ncurses)
0bf11648 43 #:use-module (gnu packages pkg-config)
852ba10a 44 #:use-module (gnu packages regex)
5613ea79 45 #:use-module (gnu packages ruby)
264ccbb3 46 #:use-module (gnu packages terminals)
5613ea79 47 #:use-module (gnu packages xml))
a2c1dcea
JMSG
48
49(define-public vis
50 (package
51 (name "vis")
852ba10a 52 (version "0.4")
a2c1dcea
JMSG
53 (source (origin
54 (method url-fetch)
55 (uri (string-append "https://github.com/martanne/"
56 name "/archive/v" version ".tar.gz"))
57 (file-name (string-append name "-" version ".tar.gz"))
58 (sha256
852ba10a
TGR
59 (base32
60 "1iclfsc9vn40fqfiz56vrw6dmr4x8q9gvav0b53kkpc6zcfa86zi"))))
a2c1dcea
JMSG
61 (build-system gnu-build-system)
62 (arguments
852ba10a
TGR
63 `(#:test-target "test"
64 #:tests? #f ; no releases; snapshots are missing tests
a2c1dcea
JMSG
65 #:phases
66 (modify-phases %standard-phases
67 (add-after 'install 'wrap-binary
68 (lambda* (#:key inputs outputs #:allow-other-keys)
69 (let* ((out (assoc-ref outputs "out"))
70 (lpeg (assoc-ref inputs "lua-lpeg"))
71 (lua-version ,(version-major+minor (package-version lua)))
72 (LUA_PATH (string-append lpeg "/share/lua/"
73 lua-version "/?.lua"))
74 (LUA_CPATH (string-append lpeg "/lib/lua/"
75 lua-version "/?.so")))
76 (wrap-program (string-append out "/bin/vis")
77 `("LUA_PATH" ":" prefix (,LUA_PATH))
78 `("LUA_CPATH" ":" prefix (,LUA_CPATH)))
79 #t))))))
80 (native-search-paths
81 (list (search-path-specification
82 (variable "VIS_PATH")
83 (files '("share/vis")))))
84 (inputs `(("lua", lua)
85 ("ncurses", ncurses)
86 ("libtermkey", libtermkey)
852ba10a
TGR
87 ("lua-lpeg", lua-lpeg)
88 ("tre" ,tre)))
a2c1dcea
JMSG
89 (synopsis "Vim-like text editor")
90 (description
91 "Vis aims to be a modern, legacy free, simple yet efficient vim-like text
92editor. It extends vim's modal editing with built-in support for multiple
93cursors/selections and combines it with sam's structural regular expression
94based command language.")
95 (home-page "https://github.com/martanne/vis")
96 (license (list license:isc ; Main distribution.
97 license:public-domain ; map.[ch]
98 license:expat)))) ; lexers and libutf.[ch]
5613ea79
CZ
99
100(define-public kakoune
101 (let ((commit "125c8b7e80995732e0d8c87b82040025748f1b4f")
102 (revision "1"))
103 (package
104 (name "kakoune")
105 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
106 (source
107 (origin
108 (file-name (string-append "kakoune-" version "-checkout"))
109 (method git-fetch)
110 (uri (git-reference
111 (url "https://github.com/mawww/kakoune.git")
112 (commit commit)))
113 (sha256
114 (base32
c7f7a5ba 115 "19qs99l8r9p1vi5pxxx9an22fvi7xx40qw3jh2cnh2mbacawvdyb"))))
5613ea79
CZ
116 (build-system gnu-build-system)
117 (arguments
c7f7a5ba 118 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
5613ea79
CZ
119 #:phases
120 (modify-phases %standard-phases
121 (add-after 'unpack 'patch-source
122 (lambda _
123 ;; kakoune uses confstr with _CS_PATH to find out where to find
124 ;; a posix shell, but this doesn't work in the build
125 ;; environment. This substitution just replaces that result
126 ;; with the "sh" path.
127 (substitute* "src/shell_manager.cc"
128 (("if \\(m_shell.empty\\(\\)\\)" line)
129 (string-append "m_shell = \"" (which "sh")
130 "\";\n " line)))
5613ea79
CZ
131 #t))
132 (delete 'configure)
133 ;; kakoune requires us to be in the src/ directory to build
134 (add-before 'build 'chdir
135 (lambda _ (chdir "src") #t))
136 (add-before 'check 'fix-test-permissions
137 (lambda _
138 ;; Out git downloader doesn't give us write permissions, but
139 ;; without them the tests fail.
140 (zero? (system* "chmod" "-R" "u+w" "../test")))))))
c7f7a5ba 141 (native-inputs `(("asciidoc" ,asciidoc)
5613ea79 142 ("ruby" ,ruby)))
c7f7a5ba 143 (inputs `(("ncurses" ,ncurses)
5613ea79
CZ
144 ("boost" ,boost)))
145 (synopsis "Vim-inspired code editor")
146 (description
147 "Kakoune is a code editor heavily inspired by Vim, as such most of its
148commands are similar to Vi's ones, and it shares Vi's \"keystrokes as a text
149editing language\" model. Kakoune has a strong focus on interactivity, most
150commands provide immediate and incremental results, while still being
151competitive (as in keystroke count) with Vim.")
152 (home-page "http://kakoune.org/")
153 (license license:unlicense))))
f255a6db
EB
154
155(define-public joe
156 (package
157 (name "joe")
158 (version "4.4")
159 (source
160 (origin
161 (method url-fetch)
162 (uri (string-append "https://sourceforge.net/projects/joe-editor/"
163 "files/JOE sources/joe-" version "/"
164 "joe-" version ".tar.gz"))
165 (sha256
166 (base32
167 "0y898r1xlrv75m00y598rvwwsricabplyh80wawsqafapcl4hw55"))))
168 (build-system gnu-build-system)
169 (inputs `(("ncurses" ,ncurses)))
170 (home-page "http://joe-editor.sourceforge.net/")
171 (synopsis "Console screen editor")
172 (description
7904f18a
EB
173 "JOE is a powerful console screen editor with a \"mode-less\" user
174interface similar to many user-friendly editors. JOE has some of the key
175bindings and many of the powerful features of GNU Emacs.")
f255a6db 176 (license license:gpl3+)))
0bf11648
FS
177
178(define-public leafpad
179 (package
180 (name "leafpad")
181 (version "0.8.18.1")
182 (source (origin
183 (method url-fetch)
b7fd77ef 184 (uri (string-append "mirror://savannah/"
0bf11648
FS
185 "leafpad/leafpad-" version ".tar.gz"))
186 (sha256
187 (base32
188 "0b0az2wvqgvam7w0ns1j8xp2llslm1rx6h7zcsy06a7j0yp257cm"))))
4f038621 189 (build-system glib-or-gtk-build-system)
0bf11648
FS
190 (native-inputs
191 `(("intltool" ,intltool)
192 ("pkg-config" ,pkg-config)))
193 (inputs
194 `(("gtk+" ,gtk+-2)))
dde5831c 195 (home-page "http://tarot.freeshell.org/leafpad/")
0bf11648
FS
196 (synopsis "GTK+ based text editor")
197 (description "Leafpad is a GTK+ text editor that emphasizes simplicity. As
198development focuses on keeping weight down to a minimum, only the most essential
199features are implemented in the editor. Leafpad is simple to use, is easily
200compiled, requires few libraries, and starts up quickly. ")
201 (license license:gpl2+)))
3312fda0 202
203(define-public e3
204 (package
205 (name "e3")
206 (version "2.82")
207 (source (origin
208 (method url-fetch)
209 (uri (string-append "https://sites.google.com/site/e3editor/Home/"
210 "e3-" version ".tgz"))
211 (sha256
212 (base32
213 "0919kadkas020maqq37852isnzp053q2fnws2zh3mz81d1jiviak"))
214 (modules '((guix build utils)))
215
216 ;; Remove pre-built binaries.
6cbee49d
MW
217 (snippet '(begin
218 (delete-file-recursively "bin")
219 #t))))
3312fda0 220 (build-system gnu-build-system)
221 (arguments
222 `(#:tests? #f
223 #:make-flags (list (string-append "PREFIX="
224 (assoc-ref %outputs "out")))
225 #:phases (modify-phases %standard-phases
226 (delete 'configure))))
227 (native-inputs
228 `(("nasm" ,nasm)))
229 (home-page "https://sites.google.com/site/e3editor/")
230 (synopsis "Tiny text editor written in assembly")
231 (description
232 "e3 is a micro text editor with an executable code size between 3800 and
23335000 bytes. Except for ``syntax highlighting'', the e3 binary supports all
234of the basic functions one expects plus built in arithmetic calculations.
235UTF-8 coding of unicode characters is supported as well. e3 can use
236Wordstar-, EMACS-, Pico, Nedit or vi-like key bindings. e3 can be used on
23716, 32, and 64-bit CPUs.")
238 (supported-systems '("x86_64-linux" "i686-linux"))
239 (license license:gpl2+)))
bcd757fd
LC
240
241(define-public mg
242 (package
243 (name "mg")
b11481a5 244 (version "20171014")
bcd757fd
LC
245 (source (origin
246 (method url-fetch)
bcd1544d 247 (uri (string-append "https://homepage.boetes.org/software/mg/mg-"
bcd757fd
LC
248 version ".tar.gz"))
249 (sha256
250 (base32
b11481a5 251 "0hakfikzsml7z0hja8m8mcahrmfy2piy81bq9nccsjplyfc9clai"))
bcd757fd 252 (modules '((guix build utils)))
6cbee49d
MW
253 (snippet '(begin
254 (substitute* "GNUmakefile"
255 (("/usr/bin/") ""))
256 #t))))
bcd757fd
LC
257 (build-system gnu-build-system)
258 (native-inputs
259 `(("pkg-config" ,pkg-config)))
260 (inputs
261 `(("libbsd" ,libbsd)
262 ("ncurses" ,ncurses)))
263 (arguments
264 ;; No test suite available.
265 '(#:tests? #f
266 #:make-flags (list (string-append "prefix=" %output)
267 "CURSES_LIBS=-lncurses"
268 "CC=gcc")
269 #:phases (modify-phases %standard-phases
270 (delete 'configure)
217ce570 271 (add-before 'build 'correct-location-of-difftool
272 (lambda _
273 (substitute* "buffer.c"
274 (("/usr/bin/diff")
275 (which "diff")))
276 #t))
bcd757fd
LC
277 (add-before 'install 'patch-tutorial-location
278 (lambda* (#:key outputs #:allow-other-keys)
279 (substitute* "mg.1"
280 (("/usr") (assoc-ref outputs "out")))
281 #t))
282 (add-after 'install 'install-tutorial
283 (lambda* (#:key outputs #:allow-other-keys)
284 (let* ((out (assoc-ref outputs "out"))
285 (doc (string-append out "/share/doc/mg")))
286 (install-file "tutorial" doc)
287 #t))))))
c3d82885 288 (home-page "https://homepage.boetes.org/software/mg/")
bcd757fd
LC
289 (synopsis "Microscopic GNU Emacs clone")
290 (description
291 "Mg (mg) is a GNU Emacs style editor, with which it is \"broadly\"
292compatible. This is a portable version of the mg maintained by the OpenBSD
293team.")
294 (license license:public-domain)))