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. |
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. |
00a8dae2 | 15 | * Completions: Emacs Completions. Completing @command{guix} shell command. |
457f60fa AK |
16 | @end menu |
17 | ||
c554de89 | 18 | |
bd53d327 | 19 | @node Emacs Initial Setup |
c554de89 | 20 | @section Initial Setup |
457f60fa | 21 | |
80ae897f LC |
22 | On the Guix System Distribution (@pxref{GNU Distribution}), ``guix.el'' |
23 | is ready to use, provided Guix is installed system-wide, which is the | |
24 | case by default. So if that is what you're using, you can happily skip | |
25 | this section and read about the fun stuff. | |
26 | ||
ba3bcec9 | 27 | If you're not yet a happy user of GuixSD, a little bit of setup is needed. |
457f60fa AK |
28 | To be able to use ``guix.el'', you need to install the following |
29 | packages: | |
30 | ||
31 | @itemize | |
32 | @item | |
33 | @uref{http://www.gnu.org/software/emacs/, GNU Emacs}, version 24.3 or | |
34 | later; | |
35 | ||
36 | @item | |
37 | @uref{http://nongnu.org/geiser/, Geiser}, version 0.3 or later: it is | |
38 | used for interacting with the Guile process. | |
39 | ||
9b0afb0d AK |
40 | @item |
41 | @uref{https://github.com/magit/magit/, magit-popup library}. You | |
42 | already have this library if you use Magit 2.1.0 or later. This library | |
43 | is an optional dependency---it is required only for @kbd{M-x@tie{}guix} | |
44 | command (@pxref{Emacs Popup Interface}). | |
45 | ||
457f60fa AK |
46 | @end itemize |
47 | ||
a72f18a5 AK |
48 | When it is done ``guix.el'' may be configured by requiring a special |
49 | @code{guix-init} file---i.e., by adding the following code into your | |
50 | init file (@pxref{Init File,,, emacs, The GNU Emacs Manual}): | |
457f60fa AK |
51 | |
52 | @example | |
a72f18a5 | 53 | (add-to-list 'load-path "/path/to/directory-with-guix.el") |
457f60fa AK |
54 | (require 'guix-init nil t) |
55 | @end example | |
56 | ||
a72f18a5 AK |
57 | So the only thing you need to figure out is where the directory with |
58 | elisp files for Guix is placed. It depends on how you installed Guix: | |
59 | ||
60 | @itemize | |
61 | @item | |
62 | If it was installed by a package manager of your distribution or by a | |
63 | usual @code{./configure && make && make install} command sequence, then | |
64 | elisp files are placed in a standard directory with Emacs packages | |
65 | (usually it is @file{/usr/share/emacs/site-lisp/}), which is already in | |
66 | @code{load-path}, so there is no need to add that directory there. | |
67 | ||
68 | @item | |
69 | If you used a binary installation method (@pxref{Binary Installation}), | |
70 | then Guix is installed somewhere in the store, so the elisp files are | |
71 | placed in @file{/gnu/store/@dots{}-guix-0.8.2/share/emacs/site-lisp/} or | |
72 | alike. However it is not recommended to refer directly to a store | |
73 | directory. Instead you can install Guix using Guix itself with | |
74 | @command{guix package -i guix} command (@pxref{Invoking guix package}) | |
75 | and add @file{~/.guix-profile/share/emacs/site-lisp/} directory to | |
76 | @code{load-path} variable. | |
77 | ||
78 | @item | |
79 | If you did not install Guix at all and prefer a hacking way | |
80 | (@pxref{Running Guix Before It Is Installed}), along with augmenting | |
81 | @code{load-path} you need to set @code{guix-load-path} variable to the | |
82 | same directory, so your final configuration will look like this: | |
457f60fa AK |
83 | |
84 | @example | |
a72f18a5 AK |
85 | (let ((dir "/path/to/your-guix-git-tree/emacs")) |
86 | (add-to-list 'load-path dir) | |
87 | (setq guix-load-path dir)) | |
88 | (require 'guix-init nil t) | |
457f60fa | 89 | @end example |
a72f18a5 | 90 | @end itemize |
457f60fa | 91 | |
a7f862e4 AK |
92 | By default, along with autoloading (@pxref{Autoload,,, elisp, The GNU |
93 | Emacs Lisp Reference Manual}) the main interactive commands for | |
94 | ``guix.el'' (@pxref{Emacs Commands}), requiring @code{guix-init} will | |
95 | also autoload commands for the Emacs packages installed in your user | |
96 | profile. | |
97 | ||
98 | To disable automatic loading of installed Emacs packages, set | |
99 | @code{guix-package-enable-at-startup} variable to @code{nil} before | |
100 | requiring @code{guix-init}. This variable has the same meaning for | |
101 | Emacs packages installed with Guix, as @code{package-enable-at-startup} | |
5ec98c3d | 102 | for the built-in Emacs package system (@pxref{Package Installation,,, |
a7f862e4 AK |
103 | emacs, The GNU Emacs Manual}). |
104 | ||
105 | You can activate Emacs packages installed in your profile whenever you | |
106 | want using @kbd{M-x@tie{}guix-emacs-load-autoloads}. | |
457f60fa | 107 | |
c554de89 AK |
108 | |
109 | @node Emacs Package Management | |
110 | @section Package Management | |
457f60fa AK |
111 | |
112 | Once ``guix.el'' has been successfully configured, you should be able to | |
c554de89 AK |
113 | use a visual interface for routine package management tasks, pretty much |
114 | like the @command{guix package} command (@pxref{Invoking guix package}). | |
115 | Specifically, it makes it easy to: | |
116 | ||
117 | @itemize | |
118 | @item browse and display packages and generations; | |
119 | @item search, install, upgrade and remove packages; | |
120 | @item display packages from previous generations; | |
121 | @item do some other useful things. | |
122 | @end itemize | |
457f60fa AK |
123 | |
124 | @menu | |
bd53d327 AK |
125 | * Commands: Emacs Commands. @kbd{M-x guix-@dots{}} |
126 | * General information: Emacs General info. Common for both interfaces. | |
127 | * ``List'' buffer: Emacs List buffer. List-like interface. | |
128 | * ``Info'' buffer: Emacs Info buffer. Help-like interface. | |
c554de89 | 129 | * Configuration: Emacs Configuration. Configuring the interface. |
457f60fa AK |
130 | @end menu |
131 | ||
bd53d327 | 132 | @node Emacs Commands |
c554de89 | 133 | @subsection Commands |
457f60fa | 134 | |
23459fa5 AK |
135 | All commands for displaying packages and generations use the current |
136 | profile, which can be changed with | |
137 | @kbd{M-x@tie{}guix-set-current-profile}. Alternatively, if you call any | |
138 | of these commands with prefix argument (@kbd{C-u}), you will be prompted | |
139 | for a profile just for that command. | |
140 | ||
141 | Commands for displaying packages: | |
457f60fa AK |
142 | |
143 | @table @kbd | |
23459fa5 | 144 | |
457f60fa AK |
145 | @item M-x guix-all-available-packages |
146 | @itemx M-x guix-newest-available-packages | |
147 | Display all/newest available packages. | |
148 | ||
149 | @item M-x guix-installed-packages | |
23459fa5 | 150 | Display all installed packages. |
457f60fa AK |
151 | |
152 | @item M-x guix-obsolete-packages | |
23459fa5 AK |
153 | Display obsolete packages (the packages that are installed in a profile |
154 | but cannot be found among available packages). | |
457f60fa AK |
155 | |
156 | @item M-x guix-search-by-name | |
157 | Display package(s) with the specified name. | |
158 | ||
159 | @item M-x guix-search-by-regexp | |
160 | Search for packages by a specified regexp. By default ``name'', | |
161 | ``synopsis'' and ``description'' of the packages will be searched. This | |
162 | can be changed by modifying @code{guix-search-params} variable. | |
163 | ||
457f60fa AK |
164 | @end table |
165 | ||
23459fa5 AK |
166 | By default, these commands display each output on a separate line. If |
167 | you prefer to see a list of packages---i.e., a list with a package per | |
168 | line, use the following setting: | |
a54a237b AK |
169 | |
170 | @example | |
171 | (setq guix-package-list-type 'package) | |
172 | @end example | |
173 | ||
23459fa5 AK |
174 | Commands for displaying generations: |
175 | ||
176 | @table @kbd | |
177 | ||
178 | @item M-x guix-generations | |
179 | List all the generations. | |
180 | ||
181 | @item M-x guix-last-generations | |
182 | List the @var{N} last generations. You will be prompted for the number | |
183 | of generations. | |
184 | ||
185 | @item M-x guix-generations-by-time | |
186 | List generations matching time period. You will be prompted for the | |
187 | period using Org mode time prompt based on Emacs calendar (@pxref{The | |
773bab64 | 188 | date/time prompt,,, org, The Org Manual}). |
23459fa5 AK |
189 | |
190 | @end table | |
457f60fa | 191 | |
2d7bf949 AK |
192 | You can also invoke the @command{guix pull} command (@pxref{Invoking |
193 | guix pull}) from Emacs using: | |
194 | ||
195 | @table @kbd | |
196 | @item M-x guix-pull | |
197 | With @kbd{C-u}, make it verbose. | |
198 | @end table | |
199 | ||
200 | Once @command{guix pull} has succeeded, the Guix REPL is restared. This | |
201 | allows you to keep using the Emacs interface with the updated Guix. | |
202 | ||
bd53d327 | 203 | @node Emacs General info |
c554de89 | 204 | @subsection General information |
457f60fa AK |
205 | |
206 | The following keys are available for both ``list'' and ``info'' types of | |
207 | buffers: | |
208 | ||
209 | @table @kbd | |
210 | @item l | |
211 | @itemx r | |
212 | Go backward/forward by the history of the displayed results (this | |
213 | history is similar to the history of the Emacs @code{help-mode} or | |
214 | @code{Info-mode}). | |
215 | ||
216 | @item g | |
217 | Revert current buffer: update information about the displayed | |
218 | packages/generations and redisplay it. | |
219 | ||
220 | @item R | |
221 | Redisplay current buffer (without updating information). | |
222 | ||
5a727cdf AK |
223 | @item M |
224 | Apply manifest to the current profile or to a specified profile, if | |
225 | prefix argument is used. This has the same meaning as @code{--manifest} | |
226 | option (@pxref{Invoking guix package}). | |
227 | ||
457f60fa AK |
228 | @item C-c C-z |
229 | Go to the Guix REPL (@pxref{The REPL,,, geiser, Geiser User Manual}). | |
230 | ||
231 | @item h | |
232 | @itemx ? | |
233 | Describe current mode to see all available bindings. | |
234 | ||
235 | @end table | |
236 | ||
237 | @emph{Hint:} If you need several ``list'' or ``info'' buffers, you can | |
238 | simlpy @kbd{M-x clone-buffer} them, and each buffer will have its own | |
239 | history. | |
240 | ||
241 | @emph{Warning:} Name/version pairs cannot be used to identify packages | |
242 | (because a name is not necessarily unique), so ``guix.el'' uses special | |
243 | identifiers that live only during a guile session, so if the Guix REPL | |
244 | was restarted, you may want to revert ``list'' buffer (by pressing | |
245 | @kbd{g}). | |
246 | ||
bd53d327 | 247 | @node Emacs List buffer |
c554de89 | 248 | @subsection ``List'' buffer |
457f60fa AK |
249 | |
250 | An interface of a ``list'' buffer is similar to the interface provided | |
773bab64 | 251 | by ``package.el'' (@pxref{Package Menu,,, emacs, The GNU Emacs Manual}). |
457f60fa AK |
252 | |
253 | Default key bindings available for both ``package-list'' and | |
254 | ``generation-list'' buffers: | |
255 | ||
256 | @table @kbd | |
257 | @item m | |
578b98da | 258 | Mark the current entry (with prefix, mark all entries). |
457f60fa | 259 | @item u |
91cc37a1 | 260 | Unmark the current entry (with prefix, unmark all entries). |
457f60fa AK |
261 | @item @key{DEL} |
262 | Unmark backward. | |
457f60fa AK |
263 | @item S |
264 | Sort entries by a specified column. | |
265 | @end table | |
266 | ||
267 | A ``package-list'' buffer additionally provides the following bindings: | |
268 | ||
269 | @table @kbd | |
270 | @item @key{RET} | |
271 | Describe marked packages (display available information in a | |
272 | ``package-info'' buffer). | |
273 | @item i | |
a54a237b | 274 | Mark the current package for installation. |
457f60fa | 275 | @item d |
a54a237b | 276 | Mark the current package for deletion. |
91cc37a1 | 277 | @item U |
a54a237b | 278 | Mark the current package for upgrading. |
457f60fa | 279 | @item ^ |
91cc37a1 | 280 | Mark all obsolete packages for upgrading. |
6248e326 AK |
281 | @item e |
282 | Edit the definition of the curent package (go to its location). This is | |
283 | similar to @command{guix edit} command (@pxref{Invoking guix edit}), but | |
284 | for opening a package recipe in the current Emacs instance. | |
457f60fa | 285 | @item x |
a54a237b | 286 | Execute actions on the marked packages. |
457f60fa AK |
287 | @end table |
288 | ||
289 | A ``generation-list'' buffer additionally provides the following | |
290 | bindings: | |
291 | ||
292 | @table @kbd | |
293 | @item @key{RET} | |
294 | List packages installed in the current generation. | |
295 | @item i | |
296 | Describe marked generations (display available information in a | |
297 | ``generation-info'' buffer). | |
af874238 AK |
298 | @item s |
299 | Switch profile to the current generation. | |
cb6a5c71 AK |
300 | @item d |
301 | Mark the current generation for deletion (with prefix, mark all | |
302 | generations). | |
303 | @item x | |
304 | Execute actions on the marked generations---i.e., delete generations. | |
d38bd08c AK |
305 | @item e |
306 | Run Ediff (@pxref{Top,,, ediff, The Ediff Manual}) on package outputs | |
307 | installed in the 2 marked generations. With prefix argument, run Ediff | |
308 | on manifests of the marked generations. | |
309 | @item D | |
310 | @itemx = | |
311 | Run Diff (@pxref{Diff Mode,,, emacs, The GNU Emacs Manual}) on package | |
312 | outputs installed in the 2 marked generations. With prefix argument, | |
313 | run Diff on manifests of the marked generations. | |
314 | @item + | |
315 | List package outputs added to the latest marked generation comparing | |
316 | with another marked generation. | |
317 | @item - | |
318 | List package outputs removed from the latest marked generation comparing | |
319 | with another marked generation. | |
457f60fa AK |
320 | @end table |
321 | ||
bd53d327 | 322 | @node Emacs Info buffer |
c554de89 | 323 | @subsection ``Info'' buffer |
457f60fa AK |
324 | |
325 | The interface of an ``info'' buffer is similar to the interface of | |
773bab64 | 326 | @code{help-mode} (@pxref{Help Mode,,, emacs, The GNU Emacs Manual}). |
457f60fa AK |
327 | |
328 | ``Info'' buffer contains some buttons (as usual you may use @key{TAB} / | |
329 | @kbd{S-@key{TAB}} to move between buttons---@pxref{Mouse References,,, | |
773bab64 | 330 | emacs, The GNU Emacs Manual}) which can be used to: |
457f60fa AK |
331 | |
332 | @itemize @bullet | |
333 | @item (in a ``package-info'' buffer) | |
334 | ||
335 | @itemize @minus | |
336 | @item install/remove a package; | |
337 | @item jump to a package location; | |
338 | @item browse home page of a package; | |
339 | @item describe packages from ``Inputs'' fields. | |
340 | @end itemize | |
341 | ||
342 | @item (in a ``generation-info'' buffer) | |
343 | ||
344 | @itemize @minus | |
345 | @item remove a generation; | |
af874238 | 346 | @item switch to a generation; |
457f60fa AK |
347 | @item list packages installed in a generation; |
348 | @item jump to a generation directory. | |
349 | @end itemize | |
350 | ||
351 | @end itemize | |
352 | ||
56149217 AK |
353 | It is also possible to copy a button label (a link to an URL or a file) |
354 | by pressing @kbd{c} on a button. | |
355 | ||
457f60fa | 356 | |
bd53d327 | 357 | @node Emacs Configuration |
457f60fa AK |
358 | @subsection Configuration |
359 | ||
360 | There are many variables you can modify to change the appearance or | |
361 | behavior of Emacs user interface. Some of these variables are described | |
362 | in this section. Also you can use Custom Interface (@pxref{Easy | |
773bab64 AK |
363 | Customization,,, emacs, The GNU Emacs Manual}) to explore/set variables |
364 | (not all) and faces. | |
457f60fa AK |
365 | |
366 | @menu | |
bd53d327 AK |
367 | * Guile and Build Options: Emacs Build Options. Specifying how packages are built. |
368 | * Buffer Names: Emacs Buffer Names. Names of Guix buffers. | |
369 | * Keymaps: Emacs Keymaps. Configuring key bindings. | |
370 | * Appearance: Emacs Appearance. Settings for visual appearance. | |
457f60fa AK |
371 | @end menu |
372 | ||
bd53d327 | 373 | @node Emacs Build Options |
457f60fa AK |
374 | @subsubsection Guile and Build Options |
375 | ||
376 | @table @code | |
377 | @item guix-guile-program | |
378 | If you have some special needs for starting a Guile process, you may set | |
379 | this variable, for example: | |
380 | ||
381 | @example | |
382 | (setq guix-guile-program '("/bin/guile" "--no-auto-compile")) | |
383 | @end example | |
384 | ||
385 | @item guix-use-substitutes | |
386 | Has the same meaning as @code{--no-substitutes} option (@pxref{Invoking | |
387 | guix build}). | |
388 | ||
389 | @item guix-dry-run | |
390 | Has the same meaning as @code{--dry-run} option (@pxref{Invoking guix | |
391 | build}). | |
392 | ||
393 | @end table | |
394 | ||
bd53d327 | 395 | @node Emacs Buffer Names |
a54a237b AK |
396 | @subsubsection Buffer Names |
397 | ||
398 | Default names of ``guix.el'' buffers (``*Guix@tie{}@dots{}*'') may be | |
399 | changed with the following variables: | |
400 | ||
401 | @table @code | |
402 | @item guix-package-list-buffer-name | |
403 | @item guix-output-list-buffer-name | |
404 | @item guix-generation-list-buffer-name | |
405 | @item guix-package-info-buffer-name | |
406 | @item guix-output-info-buffer-name | |
407 | @item guix-generation-info-buffer-name | |
408 | @item guix-repl-buffer-name | |
409 | @item guix-internal-repl-buffer-name | |
a54a237b AK |
410 | @end table |
411 | ||
23459fa5 AK |
412 | By default, the name of a profile is also displayed in a ``list'' or |
413 | ``info'' buffer name. To change this behavior, use | |
414 | @code{guix-buffer-name-function} variable. | |
415 | ||
416 | For example, if you want to display all types of results in a single | |
a54a237b AK |
417 | buffer (in such case you will probably use a history (@kbd{l}/@kbd{r}) |
418 | extensively), you may do it like this: | |
419 | ||
420 | @example | |
421 | (let ((name "Guix Universal")) | |
422 | (setq | |
423 | guix-package-list-buffer-name name | |
424 | guix-output-list-buffer-name name | |
425 | guix-generation-list-buffer-name name | |
426 | guix-package-info-buffer-name name | |
427 | guix-output-info-buffer-name name | |
23459fa5 AK |
428 | guix-generation-info-buffer-name name |
429 | guix-buffer-name-function #'guix-buffer-name-simple)) | |
a54a237b AK |
430 | @end example |
431 | ||
bd53d327 | 432 | @node Emacs Keymaps |
457f60fa AK |
433 | @subsubsection Keymaps |
434 | ||
435 | If you want to change default key bindings, use the following keymaps | |
773bab64 | 436 | (@pxref{Init Rebinding,,, emacs, The GNU Emacs Manual}): |
457f60fa AK |
437 | |
438 | @table @code | |
74cc6737 AK |
439 | @item guix-root-map |
440 | Parent keymap with general keys for all guix modes. | |
441 | ||
457f60fa AK |
442 | @item guix-list-mode-map |
443 | Parent keymap with general keys for ``list'' buffers. | |
444 | ||
445 | @item guix-package-list-mode-map | |
446 | Keymap with specific keys for ``package-list'' buffers. | |
447 | ||
a54a237b AK |
448 | @item guix-output-list-mode-map |
449 | Keymap with specific keys for ``output-list'' buffers. | |
450 | ||
457f60fa AK |
451 | @item guix-generation-list-mode-map |
452 | Keymap with specific keys for ``generation-list'' buffers. | |
453 | ||
454 | @item guix-info-mode-map | |
455 | Parent keymap with general keys for ``info'' buffers. | |
456 | ||
457 | @item guix-package-info-mode-map | |
458 | Keymap with specific keys for ``package-info'' buffers. | |
459 | ||
a54a237b AK |
460 | @item guix-output-info-mode-map |
461 | Keymap with specific keys for ``output-info'' buffers. | |
462 | ||
457f60fa AK |
463 | @item guix-generation-info-mode-map |
464 | Keymap with specific keys for ``generation-info'' buffers. | |
465 | ||
56149217 AK |
466 | @item guix-info-button-map |
467 | Keymap with keys available when a point is placed on a button. | |
468 | ||
457f60fa AK |
469 | @end table |
470 | ||
bd53d327 | 471 | @node Emacs Appearance |
457f60fa AK |
472 | @subsubsection Appearance |
473 | ||
474 | You can change almost any aspect of ``list'' / ``info'' buffers using | |
475 | the following variables: | |
476 | ||
477 | @table @code | |
478 | @item guix-list-column-format | |
479 | @itemx guix-list-column-titles | |
480 | @itemx guix-list-column-value-methods | |
481 | Specify the columns, their names, what and how is displayed in ``list'' | |
482 | buffers. | |
483 | ||
484 | @item guix-info-displayed-params | |
485 | @itemx guix-info-insert-methods | |
486 | @itemx guix-info-ignore-empty-vals | |
487 | @itemx guix-info-param-title-format | |
488 | @itemx guix-info-multiline-prefix | |
489 | @itemx guix-info-indent | |
490 | @itemx guix-info-fill-column | |
491 | @itemx guix-info-delimiter | |
492 | Various settings for ``info'' buffers. | |
493 | ||
494 | @end table | |
9a130e19 AK |
495 | |
496 | ||
9b0afb0d AK |
497 | @node Emacs Popup Interface |
498 | @section Popup Interface | |
499 | ||
500 | If you ever used Magit, you know what ``popup interface'' is | |
501 | (@pxref{Top,,, magit-popup, Magit-Popup User Manual}). Even if you are | |
502 | not acquainted with Magit, there should be no worries as it is very | |
503 | intuitive. | |
504 | ||
505 | So @kbd{M-x@tie{}guix} command provides a top-level popup interface for | |
506 | all available guix commands. When you select an option, you'll be | |
507 | prompted for a value in the minibuffer. Many values have completions, | |
508 | so don't hesitate to press @key{TAB} key. Multiple values (for example, | |
509 | packages or lint checkers) should be separated by commas. | |
510 | ||
511 | After specifying all options and switches for a command, you may choose | |
512 | one of the available actions. The following default actions are | |
513 | available for all commands: | |
514 | ||
515 | @itemize | |
516 | ||
517 | @item | |
518 | Run the command in the Guix REPL. It is faster than running | |
519 | @code{guix@tie{}@dots{}} command directly in shell, as there is no | |
520 | need to run another guile process and to load required modules there. | |
521 | ||
522 | @item | |
523 | Run the command in a shell buffer. You can set | |
524 | @code{guix-run-in-shell-function} variable to fine tune the shell buffer | |
525 | you want to use. | |
526 | ||
527 | @item | |
528 | Add the command line to the kill ring (@pxref{Kill Ring,,, emacs, The | |
529 | GNU Emacs Manual}). | |
530 | ||
531 | @end itemize | |
532 | ||
533 | ||
9a130e19 | 534 | @node Emacs Prettify |
c554de89 | 535 | @section Guix Prettify Mode |
9a130e19 | 536 | |
c554de89 AK |
537 | GNU@tie{}Guix also comes with ``guix-prettify.el''. It provides a minor |
538 | mode for abbreviating store file names by replacing hash sequences of | |
539 | symbols with ``@dots{}'': | |
9a130e19 AK |
540 | |
541 | @example | |
542 | /gnu/store/72f54nfp6g1hz873w8z3gfcah0h4nl9p-foo-0.1 | |
543 | @result{} /gnu/store/…-foo-0.1 | |
544 | @end example | |
545 | ||
546 | Once you set up ``guix.el'' (@pxref{Emacs Initial Setup}), the following | |
547 | commands become available: | |
548 | ||
549 | @table @kbd | |
550 | ||
551 | @item M-x guix-prettify-mode | |
552 | Enable/disable prettifying for the current buffer. | |
553 | ||
554 | @item M-x global-guix-prettify-mode | |
555 | Enable/disable prettifying globally. | |
556 | ||
557 | @end table | |
558 | ||
559 | To automatically enable @code{guix-prettify-mode} globally on Emacs | |
560 | start, add the following line to your init file: | |
561 | ||
562 | @example | |
563 | (global-guix-prettify-mode) | |
564 | @end example | |
565 | ||
566 | If you want to enable it only for specific major modes, add it to the | |
567 | mode hooks (@pxref{Hooks,,, emacs, The GNU Emacs Manual}), for example: | |
568 | ||
569 | @example | |
570 | (add-hook 'shell-mode-hook 'guix-prettify-mode) | |
571 | (add-hook 'dired-mode-hook 'guix-prettify-mode) | |
572 | @end example | |
00a8dae2 AK |
573 | |
574 | ||
34850cd5 AK |
575 | @node Emacs Build Log |
576 | @section Build Log Mode | |
577 | ||
578 | GNU@tie{}Guix provides major and minor modes for highlighting build | |
579 | logs. So when you have a file with a package build output---for | |
580 | example, a file returned by @command{guix build --log-file @dots{}} | |
581 | command (@pxref{Invoking guix build}), you may call @kbd{M-x | |
582 | guix-build-log-mode} command in the buffer with this file. This major | |
583 | mode highlights some lines specific to build output and provides the | |
584 | following key bindings: | |
585 | ||
586 | @table @kbd | |
587 | ||
588 | @item M-n | |
589 | Move to the next build phase. | |
590 | ||
591 | @item M-p | |
592 | Move to the previous build phase. | |
593 | ||
eda1cc8b AK |
594 | @item @key{TAB} |
595 | Toggle (show/hide) the body of the current build phase. | |
596 | ||
597 | @item S-@key{TAB} | |
598 | Toggle (show/hide) the bodies of all build phases. | |
599 | ||
34850cd5 AK |
600 | @end table |
601 | ||
602 | There is also @kbd{M-x guix-build-log-minor-mode} which also provides | |
603 | the same highlighting (but not key bindings). And as it is a minor | |
604 | mode, it can be enabled in any buffer. For example, if you are building | |
605 | some package in a shell buffer (@pxref{Interactive Shell,,, emacs, The | |
606 | GNU Emacs Manual}), you may enable @command{guix-build-log-minor-mode} | |
607 | to make it more colorful. Guix build output is rather specific, so this | |
608 | new highlighting shouldn't conflict with the existing one. | |
609 | ||
610 | ||
00a8dae2 | 611 | @node Emacs Completions |
c554de89 | 612 | @section Shell Completions |
00a8dae2 AK |
613 | |
614 | Another feature that becomes available after configuring Emacs interface | |
615 | (@pxref{Emacs Initial Setup}) is completing of @command{guix} | |
616 | subcommands, options, packages and other things in @code{shell} | |
617 | (@pxref{Interactive Shell,,, emacs, The GNU Emacs Manual}) and | |
618 | @code{eshell} (@pxref{Top,,, eshell, Eshell: The Emacs Shell}). | |
619 | ||
620 | It works the same way as other completions do. Just press @key{TAB} | |
621 | when your intuition tells you. | |
622 | ||
623 | And here are some examples, where pressing @key{TAB} may complete | |
624 | something: | |
625 | ||
626 | @itemize @w{} | |
627 | ||
628 | @item @code{guix pa}@key{TAB} | |
629 | @item @code{guix package -}@key{TAB} | |
630 | @item @code{guix package --}@key{TAB} | |
631 | @item @code{guix package -i gei}@key{TAB} | |
632 | @item @code{guix build -L/tm}@key{TAB} | |
633 | @item @code{guix build --sy}@key{TAB} | |
634 | @item @code{guix build --system=i}@key{TAB} | |
635 | @item @code{guix system rec}@key{TAB} | |
636 | @item @code{guix lint --checkers=sy}@key{TAB} | |
637 | @item @code{guix lint --checkers=synopsis,des}@key{TAB} | |
638 | ||
639 | @end itemize |