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