;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013-2017, 2019, 2021-2022, 2025 Ludovic Courtès ;;; Copyright © 2013 Andreas Enge ;;; Copyright © 2014 Taylan Ulrich Bayirli/Kammer ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Mark H Weaver ;;; Copyright © 2014, 2015, 2016, 2017 Alex Kost ;;; Copyright © 2016, 2018 Arun Isaac ;;; Copyright © 2016 Federico Beffa ;;; Copyright © 2016 David Thompson ;;; Copyright © 2016 Nikita ;;; Copyright © 2017 Marius Bakke ;;; Copyright © 2017, 2019, 2020, 2023, 2024 Maxim Cournoyer ;;; Copyright © 2017 Alex Vong ;;; Copyright © 2017, 2018 Ricardo Wurmus ;;; Copyright © 2017, 2023, 2024, 2025 Janneke Nieuwenhuizen ;;; Copyright © 2018, 2023 Efraim Flashner ;;; Copyright © 2018 Mathieu Othacehe ;;; Copyright © 2018, 2019, 2021 Tobias Geerinckx-Rice ;;; Copyright © 2019 Jesse John Gildersleve ;;; Copyright © 2019 Valentin Ignatev ;;; Copyright © 2019, 2021 Liliana Marie Prikler ;;; Copyright © 2019 Amin Bandali ;;; Copyright © 2020 Jack Hill ;;; Copyright © 2020 Morgan Smith ;;; Copyright © 2022 Zhu Zihao ;;; Copyright © 2023 Declan Tsien ;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com> ;;; Copyright © 2025 Nicolas Graves ;;; Copyright © 2025 Jake Forster ;;; Copyright © 2025 John Kehayias ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages emacs) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix gexp) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix build-system) #:use-module (guix build-system gnu) #:use-module (guix build-system glib-or-gtk) #:use-module (gnu packages) #:use-module (gnu packages acl) #:use-module (gnu packages autotools) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages fontutils) #:use-module (gnu packages freedesktop) #:use-module (gnu packages fribidi) #:use-module (gnu packages gawk) #:use-module (gnu packages gcc) #:use-module (gnu packages gd) #:use-module (gnu packages gettext) #:use-module (gnu packages ghostscript) #:use-module (gnu packages glib) #:use-module (gnu packages gnome) ; for librsvg #:use-module (gnu packages gtk) #:use-module (gnu packages guile) #:use-module (gnu packages image) #:use-module (gnu packages imagemagick) #:use-module (gnu packages lesstif) ; motif #:use-module (gnu packages linux) ; alsa-lib, gpm #:use-module (gnu packages mail) ; for mailutils #:use-module (gnu packages multiprecision) #:use-module (gnu packages ncurses) #:use-module (gnu packages pdf) #:use-module (gnu packages pkg-config) #:use-module (gnu packages selinux) #:use-module (gnu packages sqlite) #:use-module (gnu packages texinfo) #:use-module (gnu packages tls) #:use-module (gnu packages tree-sitter) #:use-module (gnu packages web) ; for jansson #:use-module (gnu packages webkit) #:use-module (gnu packages xml) #:use-module (gnu packages xorg) #:use-module (guix utils) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:export (emacs->emacs-next)) (define (%emacs-modules build-system) (let ((which (build-system-name build-system))) `((guix build ,(symbol-append which '-build-system)) (guix build utils) (srfi srfi-1) (ice-9 ftw)))) (define* (emacs-ert-selector excluded-tests #:key run-nativecomp run-expensive run-unstable) "Create an ERT selector that excludes tests." (string-append "(not (or " (if run-nativecomp "" "(tag :nativecomp) ") (if run-expensive "" "(tag :expensive-test) ") (if run-unstable "" "(tag :unstable) ") (string-join (map (lambda (test) ;; This is a regex (string-append "\\\"^" test "\\$\\\"")) (sort excluded-tests stringemacs-next emacs #:optional name #:key (version (package-version emacs-next-minimal)) (source (package-source emacs-next-minimal))) (package (inherit emacs) (name (or name (and (string-prefix? "emacs" (package-name emacs)) (string-append "emacs-next" (string-drop (package-name emacs) (string-length "emacs")))))) (version version) (source source) (arguments (substitute-keyword-arguments arguments ((#:make-flags flags #~'()) #~(append #$flags (list (string-append "SELECTOR=" #$%emacs-next-selector)))))))) (define-public emacs-next (emacs->emacs-next emacs)) (define-public emacs-next-pgtk (emacs->emacs-next emacs-pgtk)) (define-public emacs-next-pgtk-xwidgets (emacs->emacs-next emacs-pgtk-xwidgets)) (define-deprecated-package emacs-next-tree-sitter emacs-next) (define-public guile-emacs (let ((upstream-version "31.0.50") (commit "f2d0459d6a4cda8b7c38b6fb12a55f1330ba50fa") (revision "2")) (package (inherit emacs) (name "guile-emacs") (version (git-version upstream-version revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://codeberg.org/lyrra/guilemacs") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "0ry0dn9xrndpz54hs92dnnsw4xa4qn4lz898ldlh2rs47ah1f4wl")))) (native-inputs (modify-inputs native-inputs (prepend autoconf automake guile-for-guile-emacs))) (inputs (modify-inputs inputs (prepend imagemagick))) (home-page "https://guile-emacs.org") (synopsis "Emacs text editor powered by Guile('s elisp implementation)") (description "Guile-Emacs brings Emacs and Guile together by providing a new Elisp implementation based on Guile's compiler technology, serving as the basis for a more expressive and extensible version of Elisp. Started in 2014 as a GSOC project, Guile-Emacs was resurrected in 2024.") (arguments (substitute-keyword-arguments `(#:strip-binaries? #f ,@(package-arguments emacs)) ((#:configure-flags flags ''()) #~`(#$(string-append "CFLAGS=-Og -ggdb3" " -Wno-error=implicit-function-declaration" " -Wno-error=implicit-int" " -Wno-error=incompatible-pointer-types" " -Wno-error=int-conversion" " -Wno-error=shift-count-negative") "--with-native-compilation=no" "--without-modules" "--without-threads" "--with-jpeg=no" "--without-cairo" "--without-tree-sitter" "--with-imagemagick" ,@(fold delete #$flags '("CFLAGS=-g -O2 -Wno-error=incompatible-pointer-types" "--with-cairo" "--with-modules" "--with-native-compilation=aot")))) ((#:make-flags flags #~'()) #~(list "V=1")) ((#:phases phases) #~(modify-phases #$phases (add-after 'unpack 'autogen (lambda _ (invoke "sh" "autogen.sh"))) (delete 'patch-compilation-driver) (delete 'set-libgccjit-path) (delete 'validate-comp-integrity) (delete 'restore-emacs-pdmp) (delete 'build-trampolines) (delete 'install-site-start) (replace 'wrap-emacs-paths ;; Restrict EMACSLOADPATH to builtin packages. (lambda _ (let ((lisp-dirs (list (string-append #$output "/share/emacs/" #$upstream-version "/lisp"))) (inputs '#$(map (match-lambda ((name directory) #~(#$name . #$directory))) (package-inputs this-package)))) (for-each (lambda (prog) (wrap-program prog ;; Some variants rely on uname being in PATH for Tramp. ;; Tramp paths can't be hardcoded, because they need to ;; be portable. `("PATH" suffix ,(map dirname (list (search-input-file inputs "/bin/gzip") ;; for coreutils (search-input-file inputs "/bin/yes")))) ;; We use "=" because loading non-builtin packages is ;; currently not supported and prevents guile-emacs ;; from running. `("EMACSLOADPATH" = ,lisp-dirs))) (find-files (string-append #$output "/bin") ;; Matches versioned and unversioned emacs binaries. ;; We don't patch emacsclient, because it takes its ;; environment variables from emacs. ;; Likewise, we don't need to patch helper binaries ;; like etags, ctags or ebrowse. "^emacs(-[0-9]+(\\.[0-9]+)*)?$"))))) (add-after 'configure 'touch-lisp/finder-inf.el (lambda _ (call-with-output-file "lisp/finder-inf.el" (lambda (port) (display port)))))))))))) (define-public m17n-db (package (name "m17n-db") (version "1.8.0") (source (origin (method url-fetch) (uri (string-append "mirror://savannah/m17n/m17n-db-" version ".tar.gz")) (sha256 (base32 "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5")))) (build-system gnu-build-system) (native-inputs `(("gettext" ,gettext-minimal))) (arguments `(#:configure-flags (list (string-append "--with-charmaps=" (assoc-ref %build-inputs "libc") "/share/i18n/charmaps")))) ;; With `guix lint' the home-page URI returns a small page saying ;; that your browser does not handle frames. This triggers the "URI ;; returns suspiciously small file" warning. (home-page "https://www.nongnu.org/m17n/") (synopsis "Multilingual text processing library (database)") (description "The m17n library realizes multilingualization of many aspects of applications. The m17n library represents multilingual text as an object named M-text. M-text is a string with attributes called text properties, and designed to substitute for string in C. Text properties carry any information required to input, display and edit the text. This package contains the library database.") (license license:lgpl2.1+))) (define-public m17n-lib (package (name "m17n-lib") (version "1.8.0") (source (origin (method url-fetch) (uri (string-append "mirror://savannah/m17n/m17n-lib-" version ".tar.gz")) (sha256 (base32 "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq")) (patches (search-patches "m17n-lib-1.8.0-use-pkg-config-for-freetype.patch")))) (build-system gnu-build-system) (native-inputs (if (%current-target-system) (list pkg-config libtool gettext-minimal autoconf automake) '())) (inputs (list fribidi gd libotf libxft libxml2 m17n-db)) (arguments `(#:parallel-build? #f ,@(if (%current-target-system) '(#:phases (modify-phases %standard-phases ;; AC_FUNC_MALLOC and AC_FUNC_REALLOC usually unneeded ;; see https://lists.gnu.org/archive/html/autoconf/2003-02/msg00017.html (add-after 'unpack 'fix-rpl_malloc (lambda _ (substitute* "configure.ac" (("AC_FUNC_MALLOC") "") (("AC_FUNC_REALLOC") "")) ;; let bootstrap phase run. (delete-file "./configure"))))) '()))) ;; With `guix lint' the home-page URI returns a small page saying ;; that your browser does not handle frames. This triggers the "URI ;; returns suspiciously small file" warning. (home-page "https://www.nongnu.org/m17n/") (synopsis "Multilingual text processing library (runtime)") (description "The m17n library realizes multilingualization of many aspects of applications. The m17n library represents multilingual text as an object named M-text. M-text is a string with attributes called text properties, and designed to substitute for string in C. Text properties carry any information required to input, display and edit the text. This package contains the library runtime.") (license license:lgpl2.1+)))