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