emacs.scm 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013-2017, 2019, 2021-2022 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
  4. ;;; Copyright © 2014 Taylan Ulrich Bayirli/Kammer <taylanbayirli@gmail.com>
  5. ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Mark H Weaver <mhw@netris.org>
  6. ;;; Copyright © 2014, 2015, 2016, 2017 Alex Kost <alezost@gmail.com>
  7. ;;; Copyright © 2016, 2018 Arun Isaac <arunisaac@systemreboot.net>
  8. ;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
  9. ;;; Copyright © 2016 David Thompson <dthompson2@worcester.edu>
  10. ;;; Copyright © 2016 Nikita <nikita@n0.is>
  11. ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
  12. ;;; Copyright © 2017, 2019, 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  13. ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
  14. ;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
  15. ;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
  16. ;;; Copyright © 2018, 2023 Efraim Flashner <efraim@flashner.co.il>
  17. ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
  18. ;;; Copyright © 2018, 2019, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
  19. ;;; Copyright © 2019 Jesse John Gildersleve <jessejohngildersleve@zohomail.eu>
  20. ;;; Copyright © 2019 Valentin Ignatev <valentignatev@gmail.com>
  21. ;;; Copyright © 2019, 2021 Liliana Marie Prikler <liliana.prikler@gmail.com>
  22. ;;; Copyright © 2019 Amin Bandali <bandali@gnu.org>
  23. ;;; Copyright © 2020 Jack Hill <jackhill@jackhill.us>
  24. ;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
  25. ;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
  26. ;;; Copyright © 2023 Declan Tsien <declantsien@riseup.net>
  27. ;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
  28. ;;;
  29. ;;; This file is part of GNU Guix.
  30. ;;;
  31. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  32. ;;; under the terms of the GNU General Public License as published by
  33. ;;; the Free Software Foundation; either version 3 of the License, or (at
  34. ;;; your option) any later version.
  35. ;;;
  36. ;;; GNU Guix is distributed in the hope that it will be useful, but
  37. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  38. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  39. ;;; GNU General Public License for more details.
  40. ;;;
  41. ;;; You should have received a copy of the GNU General Public License
  42. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  43. (define-module (gnu packages emacs)
  44. #:use-module ((guix licenses) #:prefix license:)
  45. #:use-module (guix packages)
  46. #:use-module (guix gexp)
  47. #:use-module (guix download)
  48. #:use-module (guix git-download)
  49. #:use-module (guix build-system)
  50. #:use-module (guix build-system gnu)
  51. #:use-module (guix build-system glib-or-gtk)
  52. #:use-module (gnu packages)
  53. #:use-module (gnu packages acl)
  54. #:use-module (gnu packages autotools)
  55. #:use-module (gnu packages base)
  56. #:use-module (gnu packages compression)
  57. #:use-module (gnu packages fontutils)
  58. #:use-module (gnu packages freedesktop)
  59. #:use-module (gnu packages fribidi)
  60. #:use-module (gnu packages gcc)
  61. #:use-module (gnu packages gd)
  62. #:use-module (gnu packages gettext)
  63. #:use-module (gnu packages ghostscript)
  64. #:use-module (gnu packages glib)
  65. #:use-module (gnu packages gnome) ; for librsvg
  66. #:use-module (gnu packages gtk)
  67. #:use-module (gnu packages guile)
  68. #:use-module (gnu packages image)
  69. #:use-module (gnu packages lesstif) ; motif
  70. #:use-module (gnu packages linux) ; alsa-lib, gpm
  71. #:use-module (gnu packages mail) ; for mailutils
  72. #:use-module (gnu packages multiprecision)
  73. #:use-module (gnu packages ncurses)
  74. #:use-module (gnu packages pdf)
  75. #:use-module (gnu packages pkg-config)
  76. #:use-module (gnu packages selinux)
  77. #:use-module (gnu packages sqlite)
  78. #:use-module (gnu packages texinfo)
  79. #:use-module (gnu packages tls)
  80. #:use-module (gnu packages tree-sitter)
  81. #:use-module (gnu packages web) ; for jansson
  82. #:use-module (gnu packages webkit)
  83. #:use-module (gnu packages xml)
  84. #:use-module (gnu packages xorg)
  85. #:use-module (guix utils)
  86. #:use-module (ice-9 match)
  87. #:use-module (srfi srfi-1))
  88. (define (%emacs-modules build-system)
  89. (let ((which (build-system-name build-system)))
  90. `((guix build ,(symbol-append which '-build-system))
  91. (guix build utils)
  92. (srfi srfi-1)
  93. (ice-9 ftw))))
  94. (define-public emacs
  95. (package
  96. (name "emacs")
  97. (version "28.2")
  98. (source (origin
  99. (method url-fetch)
  100. (uri (string-append "mirror://gnu/emacs/emacs-"
  101. version ".tar.xz"))
  102. (sha256
  103. (base32
  104. "12144dcaihv2ymfm7g2vnvdl4h71hqnsz1mljzf34cpg6ci1h8gf"))
  105. (patches (search-patches "emacs-exec-path.patch"
  106. "emacs-fix-scheme-indent-function.patch"
  107. "emacs-source-date-epoch.patch"))
  108. (modules '((guix build utils)))
  109. (snippet
  110. '(with-directory-excursion "lisp"
  111. ;; Delete the bundled byte-compiled elisp files and generated
  112. ;; autoloads.
  113. (for-each delete-file
  114. (append (find-files "." "\\.elc$")
  115. (find-files "." "loaddefs\\.el$")
  116. (find-files "eshell" "^esh-groups\\.el$")))
  117. ;; Make sure Tramp looks for binaries in the right places on
  118. ;; remote Guix System machines, where 'getconf PATH' returns
  119. ;; something bogus.
  120. (substitute* "net/tramp.el"
  121. ;; Patch the line after "(defcustom tramp-remote-path".
  122. (("\\(tramp-default-remote-path")
  123. (format #f "(tramp-default-remote-path ~s ~s ~s ~s "
  124. "~/.guix-profile/bin" "~/.guix-profile/sbin"
  125. "/run/current-system/profile/bin"
  126. "/run/current-system/profile/sbin")))
  127. ;; Make sure Man looks for C header files in the right
  128. ;; places.
  129. (substitute* "man.el"
  130. (("\"/usr/local/include\"" line)
  131. (string-join
  132. (list line
  133. "\"~/.guix-profile/include\""
  134. "\"/var/guix/profiles/system/profile/include\"")
  135. " ")))))))
  136. (build-system glib-or-gtk-build-system)
  137. (arguments
  138. (list
  139. #:tests? #f ; no check target
  140. #:modules (%emacs-modules build-system)
  141. #:configure-flags #~(list "--with-modules"
  142. "--with-cairo"
  143. "--with-native-compilation"
  144. "--disable-build-details")
  145. #:make-flags #~(list "NATIVE_FULL_AOT=1")
  146. #:phases
  147. #~(modify-phases %standard-phases
  148. (add-after 'set-paths 'set-libgccjit-path
  149. (lambda* (#:key inputs #:allow-other-keys)
  150. (define (first-subdirectory/absolute directory)
  151. (let ((files (scandir
  152. directory
  153. (lambda (file)
  154. (and (not (member file '("." "..")))
  155. (file-is-directory? (string-append
  156. directory "/"
  157. file)))))))
  158. (and (not (null? files))
  159. (string-append directory "/" (car files)))))
  160. (let* ((libgccjit-libdir
  161. (first-subdirectory/absolute ;; version
  162. (first-subdirectory/absolute ;; host type
  163. (search-input-directory inputs "lib/gcc")))))
  164. (setenv "LIBRARY_PATH"
  165. (string-append (getenv "LIBRARY_PATH")
  166. ":" libgccjit-libdir)))))
  167. (add-after 'unpack 'enable-elogind
  168. (lambda _
  169. (substitute* "configure.ac"
  170. (("libsystemd") "libelogind"))
  171. (when (file-exists? "configure")
  172. (delete-file "configure"))))
  173. (add-after 'unpack 'patch-program-file-names
  174. (lambda* (#:key inputs #:allow-other-keys)
  175. (substitute* '("src/callproc.c"
  176. "lisp/term.el"
  177. "lisp/htmlfontify.el"
  178. "lisp/textmodes/artist.el"
  179. "lisp/progmodes/sh-script.el")
  180. (("\"/bin/sh\"")
  181. (format #f "~s" (search-input-file inputs "/bin/sh"))))
  182. (substitute* "lisp/doc-view.el"
  183. (("\"(gs|dvipdf|ps2pdf|pdftotext)\"" all what)
  184. (let ((replacement (false-if-exception
  185. (search-input-file
  186. inputs
  187. (string-append "/bin/" what)))))
  188. (if replacement
  189. (string-append "\"" replacement "\"")
  190. all))))
  191. ;; match ".gvfs-fuse-daemon-real" and ".gvfsd-fuse-real"
  192. ;; respectively when looking for GVFS processes.
  193. (substitute* "lisp/net/tramp-gvfs.el"
  194. (("\\(tramp-compat-process-running-p \"(.*)\"\\)" all process)
  195. (format #f "(or ~a (tramp-compat-process-running-p ~s))"
  196. all (string-append "." process "-real"))))))
  197. (add-after 'unpack 'patch-compilation-driver
  198. (lambda _
  199. (substitute* "lisp/emacs-lisp/comp.el"
  200. (("\\(defcustom native-comp-driver-options nil")
  201. (format
  202. #f "(defcustom native-comp-driver-options '(~@{~s~^ ~})"
  203. (string-append
  204. "-B" #$(this-package-input "binutils") "/bin/")
  205. (string-append
  206. "-B" #$(this-package-input "glibc") "/lib/")
  207. (string-append
  208. "-B" #$(this-package-input "libgccjit") "/lib/")
  209. (string-append
  210. "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
  211. (add-before 'configure 'fix-/bin/pwd
  212. (lambda _
  213. ;; Use `pwd', not `/bin/pwd'.
  214. (substitute* (find-files "." "^Makefile\\.in$")
  215. (("/bin/pwd")
  216. "pwd"))))
  217. (add-after 'install 'install-site-start
  218. ;; Use 'guix-emacs' in "site-start.el", which is used autoload the
  219. ;; Elisp packages found in EMACSLOADPATH.
  220. (lambda* (#:key inputs outputs #:allow-other-keys)
  221. (let* ((out (assoc-ref outputs "out"))
  222. (lisp-dir (string-append out "/share/emacs/site-lisp"))
  223. (emacs (string-append out "/bin/emacs")))
  224. ;; This is duplicated from emacs-utils to prevent coupling.
  225. (define* (emacs-byte-compile-directory dir)
  226. (let ((expr `(progn
  227. (setq byte-compile-debug t)
  228. (byte-recompile-directory
  229. (file-name-as-directory ,dir) 0 1))))
  230. (invoke emacs "--quick" "--batch"
  231. (format #f "--eval=~s" expr))))
  232. (copy-file #$(local-file
  233. (search-auxiliary-file "emacs/guix-emacs.el"))
  234. (string-append lisp-dir "/guix-emacs.el"))
  235. (with-output-to-file (string-append lisp-dir "/site-start.el")
  236. (lambda ()
  237. (display
  238. (string-append
  239. "(when (require 'guix-emacs nil t)\n"
  240. " (guix-emacs-autoload-packages)\n"
  241. " (advice-add 'package-load-all-descriptors"
  242. " :after #'guix-emacs-load-package-descriptors))"))))
  243. ;; Remove the extraneous subdirs.el file, as it causes Emacs to
  244. ;; add recursively all the the sub-directories of a profile's
  245. ;; share/emacs/site-lisp union when added to EMACSLOADPATH,
  246. ;; which leads to conflicts.
  247. (delete-file (string-append lisp-dir "/subdirs.el"))
  248. ;; Byte compile the site-start files.
  249. (emacs-byte-compile-directory lisp-dir))))
  250. (add-after 'glib-or-gtk-wrap 'restore-emacs-pdmp
  251. ;; restore the dump file that Emacs installs somewhere in
  252. ;; libexec/ to its original state
  253. (lambda* (#:key outputs target #:allow-other-keys)
  254. (let* ((libexec (string-append (assoc-ref outputs "out")
  255. "/libexec"))
  256. ;; each of these ought to only match a single file,
  257. ;; but even if not (find-files) sorts by string<,
  258. ;; so the Nth element in one maps to the Nth element of
  259. ;; the other
  260. (pdmp (find-files libexec "\\.pdmp$"))
  261. (pdmp-real (find-files libexec "\\.pdmp-real$")))
  262. (for-each rename-file pdmp-real pdmp))))
  263. (add-after 'glib-or-gtk-wrap 'strip-double-wrap
  264. (lambda* (#:key outputs #:allow-other-keys)
  265. ;; Directly copy emacs-X.Y to emacs, so that it is not wrapped
  266. ;; twice. This also fixes a minor issue, where WMs would not be
  267. ;; able to track emacs back to emacs.desktop.
  268. (with-directory-excursion (assoc-ref outputs "out")
  269. (copy-file
  270. (car (find-files "bin" "^emacs-([0-9]+\\.)+[0-9]+$"))
  271. "bin/emacs"))))
  272. (add-after 'strip-double-wrap 'wrap-emacs-paths
  273. (lambda* (#:key inputs outputs #:allow-other-keys)
  274. (let* ((out (assoc-ref outputs "out"))
  275. (lisp-dirs (find-files (string-append out "/share/emacs")
  276. "^lisp$"
  277. #:directories? #t)))
  278. (for-each
  279. (lambda (prog)
  280. (wrap-program prog
  281. ;; emacs-next and variants rely on uname being in PATH for
  282. ;; Tramp. Tramp paths can't be hardcoded, because they
  283. ;; need to be portable.
  284. `("PATH" suffix
  285. ,(map dirname
  286. (list (search-input-file inputs "/bin/gzip")
  287. ;; for coreutils
  288. (search-input-file inputs "/bin/yes"))))
  289. `("EMACSLOADPATH" suffix ,lisp-dirs)))
  290. (find-files (string-append out "/bin")
  291. ;; Matches versioned and unversioned emacs binaries.
  292. ;; We don't patch emacsclient, because it takes its
  293. ;; environment variables from emacs.
  294. ;; Likewise, we don't need to patch helper binaries
  295. ;; like etags, ctags or ebrowse.
  296. "^emacs(-[0-9]+(\\.[0-9]+)*)?$"))))))))
  297. (inputs
  298. (list gnutls
  299. ncurses
  300. ;; To "unshadow" ld-wrapper in native builds
  301. (make-ld-wrapper "ld-wrapper" #:binutils binutils)
  302. ;; For native compilation
  303. binutils
  304. glibc
  305. libgccjit
  306. ;; Required for "core" functionality, such as dired and compression.
  307. coreutils
  308. gzip
  309. ;; Avoid Emacs's limited movemail substitute that retrieves POP3
  310. ;; email only via insecure channels.
  311. ;; This is not needed for (modern) IMAP.
  312. mailutils
  313. gpm
  314. libx11
  315. gtk+
  316. cairo
  317. pango
  318. harfbuzz
  319. libxft
  320. libtiff
  321. giflib
  322. lcms
  323. libjpeg-turbo
  324. libselinux
  325. acl
  326. jansson
  327. gmp
  328. ghostscript
  329. poppler
  330. elogind
  331. ;; When looking for libpng `configure' links with `-lpng -lz', so we
  332. ;; must also provide zlib as an input.
  333. libpng
  334. zlib
  335. (librsvg-for-system)
  336. libxpm
  337. libxml2
  338. libice
  339. libsm
  340. alsa-lib
  341. dbus
  342. ;; multilingualization support
  343. libotf
  344. m17n-lib))
  345. (native-inputs
  346. (list autoconf pkg-config texinfo))
  347. (native-search-paths
  348. (list (search-path-specification
  349. (variable "EMACSLOADPATH")
  350. (files '("share/emacs/site-lisp")))
  351. (search-path-specification
  352. (variable "EMACSNATIVELOADPATH")
  353. (files '("lib/emacs/native-site-lisp")))
  354. (search-path-specification
  355. (variable "INFOPATH")
  356. (files '("share/info")))
  357. ;; tree-sitter support is not yet available in emacs 28, but this
  358. ;; search path won't harm and also will be beneficial for
  359. ;; emacs-next and other emacs-* packages, which have tree-sitter
  360. ;; support enabled. Please, remove this comment, when emacs
  361. ;; package is updated to 29.
  362. (search-path-specification
  363. (variable "TREE_SITTER_GRAMMAR_PATH")
  364. (files '("lib/tree-sitter")))))
  365. (home-page "https://www.gnu.org/software/emacs/")
  366. (synopsis "The extensible, customizable, self-documenting text editor")
  367. (description
  368. "GNU Emacs is an extensible and highly customizable text editor. It is
  369. based on an Emacs Lisp interpreter with extensions for text editing. Emacs
  370. has been extended in essentially all areas of computing, giving rise to a
  371. vast array of packages supporting, e.g., email, IRC and XMPP messaging,
  372. spreadsheets, remote server editing, and much more. Emacs includes extensive
  373. documentation on all aspects of the system, from basic editing to writing
  374. large Lisp programs. It has full Unicode support for nearly all human
  375. languages.")
  376. (license license:gpl3+)))
  377. (define-public emacs-next
  378. (package
  379. (inherit emacs)
  380. (name "emacs-next")
  381. (version "29.0.91")
  382. (source
  383. (origin
  384. (inherit (package-source emacs))
  385. (method git-fetch)
  386. (uri (git-reference
  387. (url "https://git.savannah.gnu.org/git/emacs.git/")
  388. (commit (string-append "emacs-" version))))
  389. (file-name (git-file-name name version))
  390. ;; emacs-source-date-epoch.patch is no longer necessary
  391. (patches (search-patches "emacs-exec-path.patch"
  392. "emacs-fix-scheme-indent-function.patch"
  393. "emacs-native-comp-driver-options.patch"))
  394. (sha256
  395. (base32
  396. "09jm1q5pvd1dc0xq5rhn66v1j235zlr72kwv5i27xigvi9nfqkv1"))))
  397. (inputs
  398. (modify-inputs (package-inputs emacs)
  399. (prepend sqlite)))
  400. (native-inputs
  401. (modify-inputs (package-native-inputs emacs)
  402. (prepend autoconf)))))
  403. (define-public emacs-next-tree-sitter
  404. (package
  405. (inherit emacs-next)
  406. (name "emacs-next-tree-sitter")
  407. (inputs
  408. (modify-inputs (package-inputs emacs-next)
  409. (prepend sqlite tree-sitter)))
  410. (synopsis "Emacs text editor with @code{tree-sitter} support")
  411. (description "This Emacs build supports tree-sitter.")))
  412. (define-public emacs-next-pgtk
  413. (package
  414. (inherit emacs-next-tree-sitter)
  415. (name "emacs-next-pgtk")
  416. (source
  417. (origin
  418. (inherit (package-source emacs-next-tree-sitter))
  419. (patches
  420. (append (search-patches "emacs-pgtk-super-key-fix.patch")
  421. (origin-patches (package-source emacs-next-tree-sitter))))))
  422. (arguments
  423. (substitute-keyword-arguments (package-arguments emacs-next-tree-sitter)
  424. ((#:configure-flags flags #~'())
  425. #~(cons* "--with-pgtk" #$flags))))
  426. (synopsis "Emacs text editor with @code{pgtk} and @code{tree-sitter} support")
  427. (description "This Emacs build implements graphical UI purely in terms
  428. of GTK and supports tree-sitter.")))
  429. (define-public emacs-next-pgtk-xwidgets
  430. (package
  431. (inherit emacs-next-pgtk)
  432. (name "emacs-next-pgtk-xwidgets")
  433. (synopsis "Emacs text editor with @code{xwidgets} and @code{pgtk} support")
  434. (arguments
  435. (substitute-keyword-arguments (package-arguments emacs-next-pgtk)
  436. ((#:configure-flags flags #~'())
  437. #~(cons "--with-xwidgets" #$flags))))
  438. (inputs
  439. (modify-inputs (package-inputs emacs-next-pgtk)
  440. (prepend gsettings-desktop-schemas webkitgtk-with-libsoup2)))))
  441. (define-public emacs-minimal
  442. ;; This is the version that you should use as an input to packages that just
  443. ;; need to byte-compile .el files.
  444. (package/inherit emacs
  445. (name "emacs-minimal")
  446. (synopsis "The extensible text editor (used only for byte-compilation)")
  447. (build-system gnu-build-system)
  448. (arguments
  449. (substitute-keyword-arguments (package-arguments emacs)
  450. ((#:configure-flags flags #~'())
  451. #~(list "--with-gnutls=no" "--disable-build-details"))
  452. ((#:modules _) (%emacs-modules build-system))
  453. ((#:phases phases)
  454. #~(modify-phases #$phases
  455. (delete 'set-libgccjit-path)
  456. (delete 'patch-compilation-driver)
  457. (delete 'restore-emacs-pdmp)
  458. (delete 'strip-double-wrap)))))
  459. (inputs (list ncurses coreutils gzip))
  460. (native-inputs (list autoconf pkg-config))))
  461. (define-public emacs-xwidgets
  462. (package/inherit emacs
  463. (name "emacs-xwidgets")
  464. (synopsis "The extensible, customizable, self-documenting text
  465. editor (with xwidgets support)")
  466. (build-system gnu-build-system)
  467. (arguments
  468. (substitute-keyword-arguments (package-arguments emacs)
  469. ((#:configure-flags flags #~'())
  470. #~(cons "--with-xwidgets" #$flags))
  471. ((#:modules _) (%emacs-modules build-system))
  472. ((#:phases phases)
  473. #~(modify-phases #$phases
  474. (delete 'restore-emacs-pdmp)
  475. (delete 'strip-double-wrap)))))
  476. (inputs
  477. (modify-inputs (package-inputs emacs)
  478. (prepend webkitgtk-with-libsoup2 libxcomposite)))))
  479. (define-public emacs-motif
  480. (package/inherit emacs
  481. (name "emacs-motif")
  482. (synopsis
  483. "The extensible, customizable, self-documenting text editor (with Motif
  484. toolkit)")
  485. (build-system gnu-build-system)
  486. (inputs (modify-inputs (package-inputs emacs)
  487. (delete "gtk+")
  488. (prepend inotify-tools motif)))
  489. (arguments
  490. (substitute-keyword-arguments
  491. (package-arguments
  492. emacs)
  493. ((#:configure-flags flags #~'())
  494. #~(cons "--with-x-toolkit=motif"
  495. #$flags))
  496. ((#:modules _)
  497. (%emacs-modules build-system))
  498. ((#:phases phases)
  499. #~(modify-phases #$phases
  500. (delete 'restore-emacs-pdmp)
  501. (delete 'strip-double-wrap)))))))
  502. (define-public emacs-no-x
  503. (package/inherit emacs
  504. (name "emacs-no-x")
  505. (synopsis "The extensible, customizable, self-documenting text
  506. editor (console only)")
  507. (build-system gnu-build-system)
  508. (inputs (modify-inputs (package-inputs emacs)
  509. (delete "libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
  510. "imagemagick" "libpng" "librsvg" "libxpm" "libice"
  511. "libsm" "cairo" "pango" "harfbuzz"
  512. ;; These depend on libx11, so remove them as well.
  513. "libotf" "m17n-lib" "dbus")))
  514. (arguments
  515. (substitute-keyword-arguments (package-arguments emacs)
  516. ((#:configure-flags flags #~'())
  517. #~(delete "--with-cairo" #$flags))
  518. ((#:modules _) (%emacs-modules build-system))
  519. ((#:phases phases)
  520. #~(modify-phases #$phases
  521. (delete 'restore-emacs-pdmp)
  522. (delete 'strip-double-wrap)))))))
  523. (define-public emacs-no-x-toolkit
  524. (package/inherit emacs
  525. (name "emacs-no-x-toolkit")
  526. (synopsis "The extensible, customizable, self-documenting text
  527. editor (without an X toolkit)" )
  528. (build-system gnu-build-system)
  529. (inputs (modify-inputs (package-inputs emacs)
  530. (delete "gtk+")
  531. (prepend inotify-tools)))
  532. (arguments
  533. (substitute-keyword-arguments (package-arguments emacs)
  534. ((#:configure-flags flags #~'())
  535. #~(cons "--with-x-toolkit=no" #$flags))
  536. ((#:modules _) (%emacs-modules build-system))
  537. ((#:phases phases)
  538. #~(modify-phases #$phases
  539. (delete 'restore-emacs-pdmp)
  540. (delete 'strip-double-wrap)))))))
  541. (define-public emacs-wide-int
  542. (package/inherit emacs
  543. (name "emacs-wide-int")
  544. (synopsis "The extensible, customizable, self-documenting text
  545. editor (with wide ints)" )
  546. (arguments
  547. (substitute-keyword-arguments (package-arguments emacs)
  548. ((#:configure-flags flags)
  549. #~(cons "--with-wide-int" #$flags))))))
  550. (define-public guile-emacs
  551. (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b")
  552. (revision "0"))
  553. (package
  554. (inherit emacs)
  555. (name "guile-emacs")
  556. (version (git-version "0.0.0" revision commit))
  557. (source (origin
  558. (method git-fetch)
  559. (uri (git-reference
  560. (url "https://git.hcoop.net/git/bpt/emacs.git")
  561. (commit commit)))
  562. (file-name (git-file-name name version))
  563. (patches (search-patches "guile-emacs-fix-configure.patch"))
  564. (sha256
  565. (base32
  566. "0lvcvsz0f4mawj04db35p1dvkffdqkz8pkhc0jzh9j9x2i63kcz6"))))
  567. (native-inputs
  568. (modify-inputs (package-native-inputs emacs)
  569. (prepend autoconf automake guile-for-guile-emacs)))
  570. (arguments
  571. (substitute-keyword-arguments `(;; Build fails if we allow parallel build.
  572. #:parallel-build? #f
  573. ;; Tests aren't passing for now.
  574. #:tests? #f
  575. ,@(package-arguments emacs))
  576. ((#:configure-flags flags ''())
  577. #~(delete "--with-cairo" #$flags))
  578. ((#:phases phases)
  579. #~(modify-phases #$phases
  580. (add-after 'unpack 'autogen
  581. (lambda _
  582. (invoke "sh" "autogen.sh")))
  583. ;; Build sometimes fails: deps/dispnew.d: No such file or directory
  584. (add-before 'build 'make-deps-dir
  585. (lambda _
  586. (invoke "mkdir" "-p" "src/deps")))
  587. (delete 'restore-emacs-pdmp)
  588. (delete 'strip-double-wrap))))))))
  589. (define-public m17n-db
  590. (package
  591. (name "m17n-db")
  592. (version "1.8.0")
  593. (source
  594. (origin
  595. (method url-fetch)
  596. (uri (string-append "mirror://savannah/m17n/m17n-db-"
  597. version ".tar.gz"))
  598. (sha256
  599. (base32
  600. "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5"))))
  601. (build-system gnu-build-system)
  602. (native-inputs
  603. `(("gettext" ,gettext-minimal)))
  604. (arguments
  605. `(#:configure-flags
  606. (list (string-append "--with-charmaps="
  607. (assoc-ref %build-inputs "libc")
  608. "/share/i18n/charmaps"))))
  609. ;; With `guix lint' the home-page URI returns a small page saying
  610. ;; that your browser does not handle frames. This triggers the "URI
  611. ;; returns suspiciously small file" warning.
  612. (home-page "https://www.nongnu.org/m17n/")
  613. (synopsis "Multilingual text processing library (database)")
  614. (description "The m17n library realizes multilingualization of
  615. many aspects of applications. The m17n library represents
  616. multilingual text as an object named M-text. M-text is a string with
  617. attributes called text properties, and designed to substitute for
  618. string in C. Text properties carry any information required to input,
  619. display and edit the text.
  620. This package contains the library database.")
  621. (license license:lgpl2.1+)))
  622. (define-public m17n-lib
  623. (package
  624. (name "m17n-lib")
  625. (version "1.8.0")
  626. (source
  627. (origin
  628. (method url-fetch)
  629. (uri (string-append "mirror://savannah/m17n/m17n-lib-"
  630. version ".tar.gz"))
  631. (sha256
  632. (base32
  633. "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq"))
  634. (patches (search-patches "m17n-lib-1.8.0-use-pkg-config-for-freetype.patch"))))
  635. (build-system gnu-build-system)
  636. (native-inputs
  637. (if (%current-target-system)
  638. (list pkg-config
  639. libtool
  640. gettext-minimal
  641. autoconf automake)
  642. '()))
  643. (inputs
  644. (list fribidi
  645. gd
  646. libotf
  647. libxft
  648. libxml2
  649. m17n-db))
  650. (arguments
  651. `(#:parallel-build? #f
  652. ,@(if (%current-target-system)
  653. '(#:phases
  654. (modify-phases %standard-phases
  655. ;; AC_FUNC_MALLOC and AC_FUNC_REALLOC usually unneeded
  656. ;; see https://lists.gnu.org/archive/html/autoconf/2003-02/msg00017.html
  657. (add-after 'unpack 'fix-rpl_malloc
  658. (lambda _
  659. (substitute* "configure.ac"
  660. (("AC_FUNC_MALLOC") "")
  661. (("AC_FUNC_REALLOC") ""))
  662. ;; let bootstrap phase run.
  663. (delete-file "./configure")))))
  664. '())))
  665. ;; With `guix lint' the home-page URI returns a small page saying
  666. ;; that your browser does not handle frames. This triggers the "URI
  667. ;; returns suspiciously small file" warning.
  668. (home-page "https://www.nongnu.org/m17n/")
  669. (synopsis "Multilingual text processing library (runtime)")
  670. (description "The m17n library realizes multilingualization of
  671. many aspects of applications. The m17n library represents
  672. multilingual text as an object named M-text. M-text is a string with
  673. attributes called text properties, and designed to substitute for
  674. string in C. Text properties carry any information required to input,
  675. display and edit the text.
  676. This package contains the library runtime.")
  677. (license license:lgpl2.1+)))