b’\n \n

\n

\n Triton Famme logo\n \n \n

\n

\n

\n

\n

\n \n \n

\n

\n \n \n

Compiling GNU Emacs 30 on Debian 12

\n \n \n

\n

\n

\n

\n \n

\n

\n \n \n

Prologue

\n\t

\n\t In this blog, I'll show you how to compile Emacs on\nGNU/Linux Debian 12. But the procedure is of course easily adaptable\nto any GNU/Linux OS, since we'll only be installing a few packages\nusing their package manager. To make everything tutti , we will also\n\t add a native compiler and tree-sitter.\n
\n

Native compilation

\na€¦in Emacs is the process of translating and converting Emacs Lisp source code to machine code, which allows Emacs Lisp to run more efficiently and faster each time it is run.\n
\nNative compilation in Emacs is not a new feature; it was introduced in version 28.1.\n
\nThe result of native compilation is a binary blob that (can) be subsequently loaded when Emacs starts.\n
\n
\n

Tree-sitter

\n\nTree-sitter is a syntax tree analysis library used to parse code as it\nis manipulated. It is a tool that allows you to analyze the syntax\nstructure of a programming language and provides an interface to\nperform various operations such as code refactoring, dependency\nvisualization, or documentation generation.\n\nTree-sitter supports different programming languages and allows users\nto define their own “recipes”.\n\nNormally, when working with code (meaning highlighting it, folding it,\nmoving it to definitions,a€¦) some kind of parser working with regular\nexpressions was used.\n\nTree-sitter (supposedly) provides better parsing than a regular\nexpression parser. Regular expressions work with characters or a group\nof characters, and these must appear in the displayed text in a\ndefined order. However, a tree-sitter is capable of parsing and\nrecognizing more complex patterns of structured language, including\nsyntax.\n\nThe regular expression parser requires that the entire input text be\nread and processed at once, which is memory and computing power\nintensive when dealing with large files. Tree-sitter works\nincrementally and performs parsing without the need to load the entire\ntext at once.\n\nThe regular expression parser only works with the linear structure of\nthe text and cannot capture its hierarchy. Tree-sitter is able to\nunderstand the hierarchical structure of the text and provide\ninformation about different levels of structure - such as nested code\nblocks and so on.\n
\n
\n

Installation

\n
\n

Installing the necessary tools and libraries

\n\nTo successfully compile GNU Emacs, we will need some additional tools\nand libraries that may not be present in a normal OS installation.\n\n \n\nThese are:\n\n

\n| git              | tool for storing, managing and tracking changes to project source code                                |\n| autoconf         | (simplified) used to generate a Makefile file for compilation                                         |\n| texinfo          | tool for working with and converting documentation                                                    |\n| gnutls-bin       | libraries for using SSL/TLS protocols (if we want to use Emacs as a mail client)                      |\n| libgccjit-12-dev | library containing the language independent JIT (Just-In-Time) compiler needed for native compilation |\n| gcc              | is probably not necessary to introduce the C compiler                                                 |\n| libgtk2.0-dev    | GTK libraries if Emacs is to run in its own rendered window and not in the terminal                   |\n| libgnutls28-dev  | libraries for compiling for gnutls-bin                                                                |\n| libxpm-dev       | libraries to support xpm graphics filesknižnice pre podporu xpm grafických súborov                    |\n| libgif-dev       | a€¦ and detto for gif                                                                                   |\n| libtinfo-dev     | transition package for libncurses                                                                     |\n

\n
\nWithout hesitation or second thoughts 😏, we copy the command:\n

\n  sudo apt install git autoconf make texinfo gnutls-bin libgccjit-12-dev gcc libgtk2.0-dev libgnutls28-dev lib libxpm-dev libgif-dev

\n

\n\n

Tree-sitter

\n\nAccording to the tutorial on [Mastering Emacs: How to Get Started with Tree-Sitter](https://www.masteringemacs.org/article/how-to-get-started-tree- sitter):\n
\nDownload the latest version of tree-sitter:\n\n

\n  git clone https://github.com/tree-sitter/tree-sitter.git

\n
\nAnd compile the program using the familiar three-line magic:\n
\n

\n  cd tree-sitter/\n  make\n  sudo make install\n

\n
\nAnd (if we haven't already) if we define one more variable so that Emacs doesn't fiddle during starting up:\n

\n  export LD_LIBRARY_PATH=/usr/local/lib/\n

\n
\n\n

GNU Emacs 30

\n\nFrom the savannah repositories we'll download the Emacs source code:\n

\n  git clone -b master git://git.sv.gnu.org/emacs.git\n

\n
\nNext up:\n

\n  cd emacs\n

\n
\nRun autogen.sh , which is used to generate configuration files and scripts for compilation and installation\n
\n

\n  ./autogen.sh\n

\n
\nAnd then we run configure , with parameters\nfor tree-sitter support and native compilation. \n\n
\n

\n  ./configure --with-tree-sitter --with-native-compilation --with-mailutils --with-pop\n

\n\n( --with-pop - if we also require POP3 protocol when downloading emails)\n
\n \nFollowed by the classic:\n

\n  make\n  sudo make install\n

\n
\n

Tree-sitter setting

\n
\n\nSomewhere in the initialization file, we put a list of addresses from where the rules for that language can be downloaded:\n

\n  (setq treesit-language-source-alist\n    \'((bash "https://github.com/tree-sitter/tree-sitter-bash"))\n     (cmake "https://github.com/uyha/tree-sitter-cmake")\n     (c "https://github.com/tree-sitter/tree-sitter-c")\n     (css "https://github.com/tree-sitter/tree-sitter-css")\n     (elisp "https://github.com/Wilfred/tree-sitter-elisp")\n     (go "https://github.com/tree-sitter/tree-sitter-go")\n     (html "https://github.com/tree-sitter/tree-sitter-html")\n     (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")\n     (json "https://github.com/tree-sitter/tree-sitter-json")\n     (make "https://github.com/alemuller/tree-sitter-make")\n     (markdown "https://github.com/ikatyang/tree-sitter-markdown")\n     (python "https://github.com/tree-sitter/tree-sitter-python")\n     (toml "https://github.com/tree-sitter/tree-sitter-toml")\n     (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")\n     (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")\n     (yaml "https://github.com/ikatyang/tree-sitter-yaml")))\n

\n
\nAnd run the\n

\n  M-x treesit-install-language-grammar\n

command.\n
\n
\n\nWell, we have compiled Emacs in versiona€¦ well, last version, for me it was testing version 30.\n\nBut I haven't deployed it to full operation yet.\n\n\t

\n\t
\nA couple of pictures at the end:\n

\n

\n![Fig. 1: Installed version 30](https://famme.sk/blog- obr/emacs29/00-emacs_30.png) Fig. 1: Installed version 30 \n

\n\n![Fig. 2: ts-c-mode](https://famme.sk/blog-obr/emacs29/01-treesiter- pre-c.png) Fig. 2: ts-c-mode \n\n\n\n\t\n

\n

\n \n

\n

\n \n

\n

\n \n \n

O našej spoločnosti

\n Naša firma TRITON FAMME s.r.o., ako nasledovník firiem TRITON\n a FAMME pôsobí na trhu od roku 2005 (firma FAMME od roku\n 1996). Orientujeme sa na predaj poľnohospodárskej, lesníckej a\n komunálnej techniky, na návrhy, realizáciu prípadne\n rekonštrukcie technologických liniek na pozberové spracovanie\n zemiakov spolu so skladovými technológiami na Slovensku i v\n zahraničí.
\n Vykonávame tiež servisnú činnosť technologických liniek, nielen\n na Slovensku, ale aj v okolitých krajinách, a v krajinách\n bývalého Sovietskeho zväzu. \n

\n \n

\n

  • Obchodné meno spoločnosti:
    \n

\n

  • IČO: \n

  • DIČ / IČ DPH \n

\n \n \n

\n

  • Triton Famme s.r.o.
    \n

\n

  • 48 320 404 \n \n

    • 2120129781 / SK2120129781 \n \n

\n \n

\n \n

\n

\n \n \n

Kontaktujte nás

\n pre viac informácií a poradenstvo \n

\n

  • Sídlo Levočská 862/28,
    \n 058 01 Poprad

\n \n

* Kancelária JilemnickÃ(C)ho\n 307/77  

\n 059 51 Veľká Lomnica

\n \n

  • E-mail triton (zav.)\n famme.sk \n

  • Telefóny Richard Fabo:\n +421 905 829 763
    \n Miroslav Fabo: +421 905 381 924

\n

\n \n

\n

\n \n

Design: TEMPLATED\n Images: Unsplash (CC0)\n

\n

\n

\n

Pocitadlo.sk

\n \n’

  • oantolin
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    What’s with all the occurrences of \n?

    • rglullis@communick.newsOPM
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      1 year ago

      Oh, I am sorry! That was me experimenting with Lemmy’s SDK to see if I could create a post out of a reddit submission. My original idea was to use the output from readability, convert it to markdown and then save in the “body” field, but only after I ran it on some of posts I noticed that I was getting a byte stream instead of a string. This is why the body starts with \b and has all the \n.

      I edited the body on my post, but it seems that the updated has propagated through the different instances?