emacs: Add interface for system generations.
[jackhill/guix/guix.git] / doc / emacs.texi
CommitLineData
457f60fa 1@node Emacs Interface
c554de89 2@chapter Emacs Interface
457f60fa 3
bd53d327 4@cindex Emacs
c554de89
AK
5GNU Guix comes with several useful modules (known as ``guix.el'') for
6GNU@tie{}Emacs which are intended to make an Emacs user interaction with
7Guix convenient and fun.
457f60fa
AK
8
9@menu
bd53d327 10* Initial Setup: Emacs Initial Setup. Preparing @file{~/.emacs}.
c554de89 11* Package Management: Emacs Package Management. Managing packages and generations.
9b0afb0d 12* Popup Interface: Emacs Popup Interface. Magit-like interface for guix commands.
9a130e19 13* Prettify Mode: Emacs Prettify. Abbreviating @file{/gnu/store/@dots{}} file names.
34850cd5 14* Build Log Mode: Emacs Build Log. Highlighting Guix build logs.
187f80c6
AK
15* Completions: Emacs Completions. Completing @command{guix} shell command.
16* Development: Emacs Development. Tools for Guix developers.
32950fc8 17* Hydra: Emacs Hydra. Interface for Guix build farm.
457f60fa
AK
18@end menu
19
c554de89 20
bd53d327 21@node Emacs Initial Setup
c554de89 22@section Initial Setup
457f60fa 23
80ae897f
LC
24On the Guix System Distribution (@pxref{GNU Distribution}), ``guix.el''
25is ready to use, provided Guix is installed system-wide, which is the
26case by default. So if that is what you're using, you can happily skip
27this section and read about the fun stuff.
28
ba3bcec9 29If you're not yet a happy user of GuixSD, a little bit of setup is needed.
457f60fa
AK
30To be able to use ``guix.el'', you need to install the following
31packages:
32
33@itemize
34@item
35@uref{http://www.gnu.org/software/emacs/, GNU Emacs}, version 24.3 or
36later;
37
38@item
39@uref{http://nongnu.org/geiser/, Geiser}, version 0.3 or later: it is
40used for interacting with the Guile process.
41
9b0afb0d
AK
42@item
43@uref{https://github.com/magit/magit/, magit-popup library}. You
44already have this library if you use Magit 2.1.0 or later. This library
45is an optional dependency---it is required only for @kbd{M-x@tie{}guix}
46command (@pxref{Emacs Popup Interface}).
47
457f60fa
AK
48@end itemize
49
a72f18a5
AK
50When it is done ``guix.el'' may be configured by requiring a special
51@code{guix-init} file---i.e., by adding the following code into your
52init file (@pxref{Init File,,, emacs, The GNU Emacs Manual}):
457f60fa
AK
53
54@example
a72f18a5 55(add-to-list 'load-path "/path/to/directory-with-guix.el")
457f60fa
AK
56(require 'guix-init nil t)
57@end example
58
a72f18a5
AK
59So the only thing you need to figure out is where the directory with
60elisp files for Guix is placed. It depends on how you installed Guix:
61
62@itemize
63@item
64If it was installed by a package manager of your distribution or by a
65usual @code{./configure && make && make install} command sequence, then
66elisp files are placed in a standard directory with Emacs packages
67(usually it is @file{/usr/share/emacs/site-lisp/}), which is already in
68@code{load-path}, so there is no need to add that directory there.
69
70@item
71If you used a binary installation method (@pxref{Binary Installation}),
72then Guix is installed somewhere in the store, so the elisp files are
73placed in @file{/gnu/store/@dots{}-guix-0.8.2/share/emacs/site-lisp/} or
74alike. However it is not recommended to refer directly to a store
75directory. Instead you can install Guix using Guix itself with
76@command{guix package -i guix} command (@pxref{Invoking guix package})
77and add @file{~/.guix-profile/share/emacs/site-lisp/} directory to
78@code{load-path} variable.
79
80@item
81If you did not install Guix at all and prefer a hacking way
82(@pxref{Running Guix Before It Is Installed}), along with augmenting
83@code{load-path} you need to set @code{guix-load-path} variable to the
84same directory, so your final configuration will look like this:
457f60fa
AK
85
86@example
a72f18a5
AK
87(let ((dir "/path/to/your-guix-git-tree/emacs"))
88 (add-to-list 'load-path dir)
89 (setq guix-load-path dir))
90(require 'guix-init nil t)
457f60fa 91@end example
a72f18a5 92@end itemize
457f60fa 93
a7f862e4
AK
94By default, along with autoloading (@pxref{Autoload,,, elisp, The GNU
95Emacs Lisp Reference Manual}) the main interactive commands for
96``guix.el'' (@pxref{Emacs Commands}), requiring @code{guix-init} will
97also autoload commands for the Emacs packages installed in your user
98profile.
99
100To disable automatic loading of installed Emacs packages, set
101@code{guix-package-enable-at-startup} variable to @code{nil} before
102requiring @code{guix-init}. This variable has the same meaning for
103Emacs packages installed with Guix, as @code{package-enable-at-startup}
5ec98c3d 104for the built-in Emacs package system (@pxref{Package Installation,,,
a7f862e4
AK
105emacs, The GNU Emacs Manual}).
106
107You can activate Emacs packages installed in your profile whenever you
108want using @kbd{M-x@tie{}guix-emacs-load-autoloads}.
457f60fa 109
c554de89
AK
110
111@node Emacs Package Management
112@section Package Management
457f60fa
AK
113
114Once ``guix.el'' has been successfully configured, you should be able to
c554de89
AK
115use a visual interface for routine package management tasks, pretty much
116like the @command{guix package} command (@pxref{Invoking guix package}).
117Specifically, it makes it easy to:
118
119@itemize
120@item browse and display packages and generations;
121@item search, install, upgrade and remove packages;
122@item display packages from previous generations;
123@item do some other useful things.
124@end itemize
457f60fa
AK
125
126@menu
bd53d327
AK
127* Commands: Emacs Commands. @kbd{M-x guix-@dots{}}
128* General information: Emacs General info. Common for both interfaces.
129* ``List'' buffer: Emacs List buffer. List-like interface.
130* ``Info'' buffer: Emacs Info buffer. Help-like interface.
c554de89 131* Configuration: Emacs Configuration. Configuring the interface.
457f60fa
AK
132@end menu
133
bd53d327 134@node Emacs Commands
c554de89 135@subsection Commands
457f60fa 136
23459fa5
AK
137All commands for displaying packages and generations use the current
138profile, which can be changed with
139@kbd{M-x@tie{}guix-set-current-profile}. Alternatively, if you call any
140of these commands with prefix argument (@kbd{C-u}), you will be prompted
141for a profile just for that command.
142
143Commands for displaying packages:
457f60fa
AK
144
145@table @kbd
23459fa5 146
457f60fa
AK
147@item M-x guix-all-available-packages
148@itemx M-x guix-newest-available-packages
149Display all/newest available packages.
150
151@item M-x guix-installed-packages
23459fa5 152Display all installed packages.
457f60fa
AK
153
154@item M-x guix-obsolete-packages
23459fa5
AK
155Display obsolete packages (the packages that are installed in a profile
156but cannot be found among available packages).
457f60fa
AK
157
158@item M-x guix-search-by-name
159Display package(s) with the specified name.
160
161@item M-x guix-search-by-regexp
162Search for packages by a specified regexp. By default ``name'',
163``synopsis'' and ``description'' of the packages will be searched. This
c80ce104 164can be changed by modifying @code{guix-package-search-params} variable.
457f60fa 165
457f60fa
AK
166@end table
167
23459fa5
AK
168By default, these commands display each output on a separate line. If
169you prefer to see a list of packages---i.e., a list with a package per
170line, use the following setting:
a54a237b
AK
171
172@example
173(setq guix-package-list-type 'package)
174@end example
175
23459fa5
AK
176Commands for displaying generations:
177
178@table @kbd
179
180@item M-x guix-generations
181List all the generations.
182
183@item M-x guix-last-generations
184List the @var{N} last generations. You will be prompted for the number
185of generations.
186
187@item M-x guix-generations-by-time
188List generations matching time period. You will be prompted for the
189period using Org mode time prompt based on Emacs calendar (@pxref{The
773bab64 190date/time prompt,,, org, The Org Manual}).
23459fa5
AK
191
192@end table
457f60fa 193
67cedc4b
AK
194Analogously on GuixSD you can also display system generations:
195
196@table @kbd
197@item M-x guix-system-generations
198@item M-x guix-last-system-generations
199@item M-x guix-system-generations-by-time
200@end table
201
2d7bf949
AK
202You can also invoke the @command{guix pull} command (@pxref{Invoking
203guix pull}) from Emacs using:
204
205@table @kbd
206@item M-x guix-pull
207With @kbd{C-u}, make it verbose.
208@end table
209
210Once @command{guix pull} has succeeded, the Guix REPL is restared. This
211allows you to keep using the Emacs interface with the updated Guix.
212
bd53d327 213@node Emacs General info
c554de89 214@subsection General information
457f60fa
AK
215
216The following keys are available for both ``list'' and ``info'' types of
217buffers:
218
219@table @kbd
220@item l
221@itemx r
222Go backward/forward by the history of the displayed results (this
223history is similar to the history of the Emacs @code{help-mode} or
224@code{Info-mode}).
225
226@item g
227Revert current buffer: update information about the displayed
228packages/generations and redisplay it.
229
230@item R
231Redisplay current buffer (without updating information).
232
5a727cdf
AK
233@item M
234Apply manifest to the current profile or to a specified profile, if
235prefix argument is used. This has the same meaning as @code{--manifest}
236option (@pxref{Invoking guix package}).
237
457f60fa 238@item C-c C-z
96856613
LC
239@cindex REPL
240@cindex read-eval-print loop
457f60fa
AK
241Go to the Guix REPL (@pxref{The REPL,,, geiser, Geiser User Manual}).
242
243@item h
244@itemx ?
245Describe current mode to see all available bindings.
246
247@end table
248
249@emph{Hint:} If you need several ``list'' or ``info'' buffers, you can
250simlpy @kbd{M-x clone-buffer} them, and each buffer will have its own
251history.
252
253@emph{Warning:} Name/version pairs cannot be used to identify packages
254(because a name is not necessarily unique), so ``guix.el'' uses special
255identifiers that live only during a guile session, so if the Guix REPL
256was restarted, you may want to revert ``list'' buffer (by pressing
257@kbd{g}).
258
bd53d327 259@node Emacs List buffer
c554de89 260@subsection ``List'' buffer
457f60fa
AK
261
262An interface of a ``list'' buffer is similar to the interface provided
773bab64 263by ``package.el'' (@pxref{Package Menu,,, emacs, The GNU Emacs Manual}).
457f60fa
AK
264
265Default key bindings available for both ``package-list'' and
266``generation-list'' buffers:
267
268@table @kbd
269@item m
578b98da 270Mark the current entry (with prefix, mark all entries).
457f60fa 271@item u
91cc37a1 272Unmark the current entry (with prefix, unmark all entries).
457f60fa
AK
273@item @key{DEL}
274Unmark backward.
457f60fa
AK
275@item S
276Sort entries by a specified column.
277@end table
278
279A ``package-list'' buffer additionally provides the following bindings:
280
281@table @kbd
282@item @key{RET}
283Describe marked packages (display available information in a
284``package-info'' buffer).
285@item i
a54a237b 286Mark the current package for installation.
457f60fa 287@item d
a54a237b 288Mark the current package for deletion.
91cc37a1 289@item U
a54a237b 290Mark the current package for upgrading.
457f60fa 291@item ^
91cc37a1 292Mark all obsolete packages for upgrading.
6248e326
AK
293@item e
294Edit the definition of the curent package (go to its location). This is
295similar to @command{guix edit} command (@pxref{Invoking guix edit}), but
296for opening a package recipe in the current Emacs instance.
457f60fa 297@item x
a54a237b 298Execute actions on the marked packages.
5c8994d9
AK
299@item B
300Display latest builds of the current package (@pxref{Emacs Hydra}).
457f60fa
AK
301@end table
302
303A ``generation-list'' buffer additionally provides the following
304bindings:
305
306@table @kbd
307@item @key{RET}
308List packages installed in the current generation.
309@item i
310Describe marked generations (display available information in a
311``generation-info'' buffer).
af874238
AK
312@item s
313Switch profile to the current generation.
cb6a5c71
AK
314@item d
315Mark the current generation for deletion (with prefix, mark all
316generations).
317@item x
318Execute actions on the marked generations---i.e., delete generations.
d38bd08c
AK
319@item e
320Run Ediff (@pxref{Top,,, ediff, The Ediff Manual}) on package outputs
321installed in the 2 marked generations. With prefix argument, run Ediff
322on manifests of the marked generations.
323@item D
324@itemx =
325Run Diff (@pxref{Diff Mode,,, emacs, The GNU Emacs Manual}) on package
326outputs installed in the 2 marked generations. With prefix argument,
327run Diff on manifests of the marked generations.
328@item +
329List package outputs added to the latest marked generation comparing
330with another marked generation.
331@item -
332List package outputs removed from the latest marked generation comparing
333with another marked generation.
457f60fa
AK
334@end table
335
bd53d327 336@node Emacs Info buffer
c554de89 337@subsection ``Info'' buffer
457f60fa
AK
338
339The interface of an ``info'' buffer is similar to the interface of
773bab64 340@code{help-mode} (@pxref{Help Mode,,, emacs, The GNU Emacs Manual}).
457f60fa
AK
341
342``Info'' buffer contains some buttons (as usual you may use @key{TAB} /
343@kbd{S-@key{TAB}} to move between buttons---@pxref{Mouse References,,,
773bab64 344emacs, The GNU Emacs Manual}) which can be used to:
457f60fa
AK
345
346@itemize @bullet
347@item (in a ``package-info'' buffer)
348
349@itemize @minus
350@item install/remove a package;
351@item jump to a package location;
352@item browse home page of a package;
353@item describe packages from ``Inputs'' fields.
354@end itemize
355
356@item (in a ``generation-info'' buffer)
357
358@itemize @minus
359@item remove a generation;
af874238 360@item switch to a generation;
457f60fa
AK
361@item list packages installed in a generation;
362@item jump to a generation directory.
363@end itemize
364
365@end itemize
366
56149217
AK
367It is also possible to copy a button label (a link to an URL or a file)
368by pressing @kbd{c} on a button.
369
457f60fa 370
bd53d327 371@node Emacs Configuration
457f60fa
AK
372@subsection Configuration
373
374There are many variables you can modify to change the appearance or
375behavior of Emacs user interface. Some of these variables are described
376in this section. Also you can use Custom Interface (@pxref{Easy
773bab64
AK
377Customization,,, emacs, The GNU Emacs Manual}) to explore/set variables
378(not all) and faces.
457f60fa
AK
379
380@menu
bd53d327
AK
381* Guile and Build Options: Emacs Build Options. Specifying how packages are built.
382* Buffer Names: Emacs Buffer Names. Names of Guix buffers.
383* Keymaps: Emacs Keymaps. Configuring key bindings.
384* Appearance: Emacs Appearance. Settings for visual appearance.
457f60fa
AK
385@end menu
386
bd53d327 387@node Emacs Build Options
457f60fa
AK
388@subsubsection Guile and Build Options
389
390@table @code
391@item guix-guile-program
392If you have some special needs for starting a Guile process, you may set
393this variable, for example:
394
395@example
396(setq guix-guile-program '("/bin/guile" "--no-auto-compile"))
397@end example
398
399@item guix-use-substitutes
400Has the same meaning as @code{--no-substitutes} option (@pxref{Invoking
401guix build}).
402
403@item guix-dry-run
404Has the same meaning as @code{--dry-run} option (@pxref{Invoking guix
405build}).
406
407@end table
408
bd53d327 409@node Emacs Buffer Names
a54a237b
AK
410@subsubsection Buffer Names
411
412Default names of ``guix.el'' buffers (``*Guix@tie{}@dots{}*'') may be
413changed with the following variables:
414
415@table @code
416@item guix-package-list-buffer-name
417@item guix-output-list-buffer-name
418@item guix-generation-list-buffer-name
419@item guix-package-info-buffer-name
420@item guix-output-info-buffer-name
421@item guix-generation-info-buffer-name
422@item guix-repl-buffer-name
423@item guix-internal-repl-buffer-name
a54a237b
AK
424@end table
425
23459fa5
AK
426By default, the name of a profile is also displayed in a ``list'' or
427``info'' buffer name. To change this behavior, use
8bff0c79 428@code{guix-ui-buffer-name-function} variable.
23459fa5
AK
429
430For example, if you want to display all types of results in a single
a54a237b
AK
431buffer (in such case you will probably use a history (@kbd{l}/@kbd{r})
432extensively), you may do it like this:
433
434@example
435(let ((name "Guix Universal"))
436 (setq
437 guix-package-list-buffer-name name
438 guix-output-list-buffer-name name
439 guix-generation-list-buffer-name name
440 guix-package-info-buffer-name name
441 guix-output-info-buffer-name name
8bff0c79 442 guix-generation-info-buffer-name name))
a54a237b
AK
443@end example
444
bd53d327 445@node Emacs Keymaps
457f60fa
AK
446@subsubsection Keymaps
447
448If you want to change default key bindings, use the following keymaps
773bab64 449(@pxref{Init Rebinding,,, emacs, The GNU Emacs Manual}):
457f60fa
AK
450
451@table @code
e40b3c33
AK
452@item guix-buffer-map
453Parent keymap with general keys for any buffer type.
454
455@item guix-ui-map
456Parent keymap with general keys for buffers used for Guix package
457management (for packages, outputs and generations).
74cc6737 458
457f60fa
AK
459@item guix-list-mode-map
460Parent keymap with general keys for ``list'' buffers.
461
462@item guix-package-list-mode-map
463Keymap with specific keys for ``package-list'' buffers.
464
a54a237b
AK
465@item guix-output-list-mode-map
466Keymap with specific keys for ``output-list'' buffers.
467
457f60fa
AK
468@item guix-generation-list-mode-map
469Keymap with specific keys for ``generation-list'' buffers.
470
471@item guix-info-mode-map
472Parent keymap with general keys for ``info'' buffers.
473
474@item guix-package-info-mode-map
475Keymap with specific keys for ``package-info'' buffers.
476
a54a237b
AK
477@item guix-output-info-mode-map
478Keymap with specific keys for ``output-info'' buffers.
479
457f60fa
AK
480@item guix-generation-info-mode-map
481Keymap with specific keys for ``generation-info'' buffers.
482
56149217
AK
483@item guix-info-button-map
484Keymap with keys available when a point is placed on a button.
485
457f60fa
AK
486@end table
487
bd53d327 488@node Emacs Appearance
457f60fa
AK
489@subsubsection Appearance
490
491You can change almost any aspect of ``list'' / ``info'' buffers using
cf910cef
AK
492the following variables (@dfn{ENTRY-TYPE} means @code{package},
493@code{output} or @code{generation}):
457f60fa
AK
494
495@table @code
cf910cef 496@item guix-ENTRY-TYPE-list-format
574f6727 497@itemx guix-ENTRY-TYPE-list-titles
457f60fa
AK
498Specify the columns, their names, what and how is displayed in ``list''
499buffers.
500
9193fb7c 501@item guix-ENTRY-TYPE-info-format
574f6727 502@itemx guix-ENTRY-TYPE-info-titles
2c7ed388 503@itemx guix-info-ignore-empty-values
457f60fa
AK
504@itemx guix-info-param-title-format
505@itemx guix-info-multiline-prefix
506@itemx guix-info-indent
2c7ed388 507@itemx guix-info-fill
457f60fa
AK
508@itemx guix-info-delimiter
509Various settings for ``info'' buffers.
510
511@end table
9a130e19
AK
512
513
9b0afb0d
AK
514@node Emacs Popup Interface
515@section Popup Interface
516
517If you ever used Magit, you know what ``popup interface'' is
518(@pxref{Top,,, magit-popup, Magit-Popup User Manual}). Even if you are
519not acquainted with Magit, there should be no worries as it is very
520intuitive.
521
522So @kbd{M-x@tie{}guix} command provides a top-level popup interface for
523all available guix commands. When you select an option, you'll be
524prompted for a value in the minibuffer. Many values have completions,
525so don't hesitate to press @key{TAB} key. Multiple values (for example,
526packages or lint checkers) should be separated by commas.
527
528After specifying all options and switches for a command, you may choose
529one of the available actions. The following default actions are
530available for all commands:
531
532@itemize
533
534@item
535Run the command in the Guix REPL. It is faster than running
536@code{guix@tie{}@dots{}} command directly in shell, as there is no
537need to run another guile process and to load required modules there.
538
539@item
540Run the command in a shell buffer. You can set
541@code{guix-run-in-shell-function} variable to fine tune the shell buffer
542you want to use.
543
544@item
545Add the command line to the kill ring (@pxref{Kill Ring,,, emacs, The
546GNU Emacs Manual}).
547
548@end itemize
549
5e2b761e
AK
550Several commands (@command{guix graph}, @command{guix system dmd-graph}
551and @command{guix system extension-graph}) also have a ``View graph''
552action, which allows you to view a generated graph using @command{dot}
553command (specified by @code{guix-dot-program} variable). By default a
554PNG file will be saved in @file{/tmp} directory and will be opened
555directly in Emacs. This behavior may be changed with the following
556variables:
557
558@table @code
559
560@item guix-find-file-function
561Function used to open a generated graph. If you want to open a graph in
562an external program, you can do it by modifying this variable---for
563example, you can use a functionality provided by the Org Mode
564(@pxref{Top,,, org, The Org Manual}):
565
566@example
567(setq guix-find-file-function 'org-open-file)
568(add-to-list 'org-file-apps '("\\.png\\'" . "sxiv %s"))
569@end example
570
571@item guix-dot-default-arguments
572Command line arguments to run @command{dot} command. If you change an
573output format (for example, into @code{-Tpdf}), you also need to change
574the next variable.
575
576@item guix-dot-file-name-function
577Function used to define a name of the generated graph file. Default
578name is @file{/tmp/guix-emacs-graph-XXXXXX.png}.
579
580@end table
581
582So, for example, if you want to generate and open a PDF file in your
583Emacs, you may change the settings like this:
584
585@example
586(defun my-guix-pdf-graph ()
587 "/tmp/my-current-guix-graph.pdf")
588
589(setq guix-dot-default-arguments '("-Tpdf")
590 guix-dot-file-name-function 'my-guix-pdf-graph)
591@end example
592
9b0afb0d 593
9a130e19 594@node Emacs Prettify
c554de89 595@section Guix Prettify Mode
9a130e19 596
c554de89
AK
597GNU@tie{}Guix also comes with ``guix-prettify.el''. It provides a minor
598mode for abbreviating store file names by replacing hash sequences of
599symbols with ``@dots{}'':
9a130e19
AK
600
601@example
602/gnu/store/72f54nfp6g1hz873w8z3gfcah0h4nl9p-foo-0.1
603@result{} /gnu/store/…-foo-0.1
604@end example
605
606Once you set up ``guix.el'' (@pxref{Emacs Initial Setup}), the following
607commands become available:
608
609@table @kbd
610
611@item M-x guix-prettify-mode
612Enable/disable prettifying for the current buffer.
613
614@item M-x global-guix-prettify-mode
615Enable/disable prettifying globally.
616
617@end table
618
619To automatically enable @code{guix-prettify-mode} globally on Emacs
620start, add the following line to your init file:
621
622@example
623(global-guix-prettify-mode)
624@end example
625
626If you want to enable it only for specific major modes, add it to the
627mode hooks (@pxref{Hooks,,, emacs, The GNU Emacs Manual}), for example:
628
629@example
630(add-hook 'shell-mode-hook 'guix-prettify-mode)
631(add-hook 'dired-mode-hook 'guix-prettify-mode)
632@end example
00a8dae2
AK
633
634
34850cd5
AK
635@node Emacs Build Log
636@section Build Log Mode
637
638GNU@tie{}Guix provides major and minor modes for highlighting build
639logs. So when you have a file with a package build output---for
640example, a file returned by @command{guix build --log-file @dots{}}
641command (@pxref{Invoking guix build}), you may call @kbd{M-x
642guix-build-log-mode} command in the buffer with this file. This major
643mode highlights some lines specific to build output and provides the
644following key bindings:
645
646@table @kbd
647
648@item M-n
649Move to the next build phase.
650
651@item M-p
652Move to the previous build phase.
653
eda1cc8b
AK
654@item @key{TAB}
655Toggle (show/hide) the body of the current build phase.
656
657@item S-@key{TAB}
658Toggle (show/hide) the bodies of all build phases.
659
34850cd5
AK
660@end table
661
662There is also @kbd{M-x guix-build-log-minor-mode} which also provides
f4044b58
AK
663the same highlighting and the same key bindings as the major mode, but
664prefixed with @kbd{C-c}. By default, this minor mode is enabled in
665shell buffers (@pxref{Interactive Shell,,, emacs, The GNU Emacs
666Manual}). If you don't like it, set
667@code{guix-build-log-minor-mode-activate} to nil.
34850cd5
AK
668
669
00a8dae2 670@node Emacs Completions
c554de89 671@section Shell Completions
00a8dae2
AK
672
673Another feature that becomes available after configuring Emacs interface
674(@pxref{Emacs Initial Setup}) is completing of @command{guix}
675subcommands, options, packages and other things in @code{shell}
676(@pxref{Interactive Shell,,, emacs, The GNU Emacs Manual}) and
677@code{eshell} (@pxref{Top,,, eshell, Eshell: The Emacs Shell}).
678
679It works the same way as other completions do. Just press @key{TAB}
680when your intuition tells you.
681
682And here are some examples, where pressing @key{TAB} may complete
683something:
684
685@itemize @w{}
686
687@item @code{guix pa}@key{TAB}
688@item @code{guix package -}@key{TAB}
689@item @code{guix package --}@key{TAB}
690@item @code{guix package -i gei}@key{TAB}
691@item @code{guix build -L/tm}@key{TAB}
692@item @code{guix build --sy}@key{TAB}
693@item @code{guix build --system=i}@key{TAB}
694@item @code{guix system rec}@key{TAB}
695@item @code{guix lint --checkers=sy}@key{TAB}
696@item @code{guix lint --checkers=synopsis,des}@key{TAB}
697
698@end itemize
187f80c6
AK
699
700
701@node Emacs Development
702@section Development
703
704By default, when you open a Scheme file, @code{guix-devel-mode} will be
705activated (if you don't want it, set @code{guix-devel-activate-mode} to
706nil). This minor mode provides the following key bindings:
707
708@table @kbd
709
710@item C-c . k
711Copy the name of the current Guile module into kill ring
712(@code{guix-devel-copy-module-as-kill}).
713
714@item C-c . u
715Use the current Guile module. Often after opening a Scheme file, you
716want to use a module it defines, so you switch to the Geiser REPL and
717write @code{,use (some module)} there. You may just use this command
718instead (@code{guix-devel-use-module}).
719
1a6c4c2f
AK
720@item C-c . b
721Build a package defined by the current variable definition. The
722building process is run in the current Geiser REPL. If you modified the
723current package definition, don't forget to reevaluate it before calling
724this command---for example, with @kbd{C-M-x} (@pxref{To eval or not to
725eval,,, geiser, Geiser User Manual})
726(@code{guix-devel-build-package-definition}).
727
ad8b83bd
AK
728@item C-c . s
729Build a source derivation of the package defined by the current variable
730definition. This command has the same meaning as @code{guix build -S}
731shell command (@pxref{Invoking guix build})
732(@code{guix-devel-build-package-source}).
733
b94ef11a
AK
734@item C-c . l
735Lint (check) a package defined by the current variable definition
736(@pxref{Invoking guix lint}) (@code{guix-devel-lint-package}).
737
187f80c6 738@end table
1a6c4c2f
AK
739
740Unluckily, there is a limitation related to long-running REPL commands.
741When there is a running process in a Geiser REPL, you are not supposed
742to evaluate anything in a scheme buffer, because this will ``freeze''
743the REPL: it will stop producing any output (however, the evaluating
744process will continue---you will just not see any progress anymore). Be
745aware: even moving the point in a scheme buffer may ``break'' the REPL
746if Autodoc (@pxref{Autodoc and friends,,, geiser, Geiser User Manual})
747is enabled (which is the default).
748
749So you have to postpone editing your scheme buffers until the running
750evaluation will be finished in the REPL.
751
752Alternatively, to avoid this limitation, you may just run another Geiser
753REPL, and while something is being evaluated in the previous REPL, you
754can continue editing a scheme file with the help of the current one.
32950fc8
AK
755
756
757@node Emacs Hydra
758@section Hydra
759
760The continuous integration server at @code{hydra.gnu.org} builds all
761the distribution packages on the supported architectures and serves
762them as substitutes (@pxref{Substitutes}). Continuous integration is
763currently orchestrated by @uref{https://nixos.org/hydra/, Hydra}.
764
765This section describes an Emacs interface to query Hydra to know the
766build status of specific packages, discover recent and ongoing builds,
767view build logs, and so on. This interface is mostly the same as the
768``list''/``info'' interface for displaying packages and generations
769(@pxref{Emacs Package Management}).
770
771The following commands are available:
772
773@table @kbd
774
775@item M-x guix-hydra-latest-builds
776Display latest failed or successful builds (you will be prompted for a
777number of builds). With @kbd{C-u}, you will also be prompted for other
778parameters (project, jobset, job and system).
779
780@item M-x guix-hydra-queued-builds
781Display scheduled or currently running builds (you will be prompted for
782a number of builds).
783
784@item M-x guix-hydra-jobsets
785Display available jobsets (you will be prompted for a project).
786
787@end table
788
789In a list of builds you can press @kbd{L} key to display a build log of
790the current build. Also both a list of builds and a list of jobsets
791provide @kbd{B} key to display latest builds of the current job or
792jobset (don't forget about @kbd{C-u}).