emacs: Improve minibuffer messages.
[jackhill/guix/guix.git] / doc / emacs.texi
CommitLineData
457f60fa
AK
1@node Emacs Interface
2@section Emacs Interface
3
bd53d327 4@cindex Emacs
457f60fa
AK
5GNU Guix comes with a visual user interface for GNU@tie{}Emacs, known
6as ``guix.el''. It can be used for routine package management tasks,
7pretty much like the @command{guix package} command (@pxref{Invoking
8guix package}). Specifically, ``guix.el'' makes it easy to:
9
10@itemize
11@item browse and display packages and generations;
12@item search, install, upgrade and remove packages;
13@item display packages from previous generations;
14@item do some other useful things.
15@end itemize
16
17@menu
bd53d327
AK
18* Initial Setup: Emacs Initial Setup. Preparing @file{~/.emacs}.
19* Usage: Emacs Usage. Using the interface.
20* Configuration: Emacs Configuration. Configuring the interface.
457f60fa
AK
21@end menu
22
bd53d327 23@node Emacs Initial Setup
457f60fa
AK
24@subsection Initial Setup
25
26To be able to use ``guix.el'', you need to install the following
27packages:
28
29@itemize
30@item
31@uref{http://www.gnu.org/software/emacs/, GNU Emacs}, version 24.3 or
32later;
33
34@item
35@uref{http://nongnu.org/geiser/, Geiser}, version 0.3 or later: it is
36used for interacting with the Guile process.
37
38@end itemize
39
40When it is done, add the following into your init file (@pxref{Init
41File,,, emacs, The Emacs Editor}):
42
43@example
44(require 'guix-init nil t)
45@end example
46
47However there is a chance that @code{load-path} of your Emacs does not
48contain a directory with ``guix.el'' (usually it is
49@file{/usr/share/emacs/site-lisp/}). In that case you need to add it
50before requiring (@pxref{Lisp Libraries,,, emacs, The Emacs Editor}):
51
52@example
53(add-to-list 'load-path "/path/to/directory-with-guix.el")
54(require 'guix-init)
55@end example
56
57Do not worry about the efficiency of that @code{require} thing. It will
58not load the whole ``guix.el'' package, it will just autoload the main
59interactive commands (@pxref{Autoload,,, elisp, Emacs Lisp}).
60
61
bd53d327 62@node Emacs Usage
457f60fa
AK
63@subsection Usage
64
65Once ``guix.el'' has been successfully configured, you should be able to
66use commands for displaying packages and generations. This information
67can be displayed in a ``list'' or ``info'' buffer.
68
69@menu
bd53d327
AK
70* Commands: Emacs Commands. @kbd{M-x guix-@dots{}}
71* General information: Emacs General info. Common for both interfaces.
72* ``List'' buffer: Emacs List buffer. List-like interface.
73* ``Info'' buffer: Emacs Info buffer. Help-like interface.
457f60fa
AK
74@end menu
75
bd53d327 76@node Emacs Commands
457f60fa
AK
77@subsubsection Commands
78
23459fa5
AK
79All commands for displaying packages and generations use the current
80profile, which can be changed with
81@kbd{M-x@tie{}guix-set-current-profile}. Alternatively, if you call any
82of these commands with prefix argument (@kbd{C-u}), you will be prompted
83for a profile just for that command.
84
85Commands for displaying packages:
457f60fa
AK
86
87@table @kbd
23459fa5 88
457f60fa
AK
89@item M-x guix-all-available-packages
90@itemx M-x guix-newest-available-packages
91Display all/newest available packages.
92
93@item M-x guix-installed-packages
23459fa5 94Display all installed packages.
457f60fa
AK
95
96@item M-x guix-obsolete-packages
23459fa5
AK
97Display obsolete packages (the packages that are installed in a profile
98but cannot be found among available packages).
457f60fa
AK
99
100@item M-x guix-search-by-name
101Display package(s) with the specified name.
102
103@item M-x guix-search-by-regexp
104Search for packages by a specified regexp. By default ``name'',
105``synopsis'' and ``description'' of the packages will be searched. This
106can be changed by modifying @code{guix-search-params} variable.
107
457f60fa
AK
108@end table
109
23459fa5
AK
110By default, these commands display each output on a separate line. If
111you prefer to see a list of packages---i.e., a list with a package per
112line, use the following setting:
a54a237b
AK
113
114@example
115(setq guix-package-list-type 'package)
116@end example
117
23459fa5
AK
118Commands for displaying generations:
119
120@table @kbd
121
122@item M-x guix-generations
123List all the generations.
124
125@item M-x guix-last-generations
126List the @var{N} last generations. You will be prompted for the number
127of generations.
128
129@item M-x guix-generations-by-time
130List generations matching time period. You will be prompted for the
131period using Org mode time prompt based on Emacs calendar (@pxref{The
132date/time prompt,,, org, Org Mode Manual}).
133
134@end table
457f60fa 135
2d7bf949
AK
136You can also invoke the @command{guix pull} command (@pxref{Invoking
137guix pull}) from Emacs using:
138
139@table @kbd
140@item M-x guix-pull
141With @kbd{C-u}, make it verbose.
142@end table
143
144Once @command{guix pull} has succeeded, the Guix REPL is restared. This
145allows you to keep using the Emacs interface with the updated Guix.
146
bd53d327 147@node Emacs General info
457f60fa
AK
148@subsubsection General information
149
150The following keys are available for both ``list'' and ``info'' types of
151buffers:
152
153@table @kbd
154@item l
155@itemx r
156Go backward/forward by the history of the displayed results (this
157history is similar to the history of the Emacs @code{help-mode} or
158@code{Info-mode}).
159
160@item g
161Revert current buffer: update information about the displayed
162packages/generations and redisplay it.
163
164@item R
165Redisplay current buffer (without updating information).
166
167@item C-c C-z
168Go to the Guix REPL (@pxref{The REPL,,, geiser, Geiser User Manual}).
169
170@item h
171@itemx ?
172Describe current mode to see all available bindings.
173
174@end table
175
176@emph{Hint:} If you need several ``list'' or ``info'' buffers, you can
177simlpy @kbd{M-x clone-buffer} them, and each buffer will have its own
178history.
179
180@emph{Warning:} Name/version pairs cannot be used to identify packages
181(because a name is not necessarily unique), so ``guix.el'' uses special
182identifiers that live only during a guile session, so if the Guix REPL
183was restarted, you may want to revert ``list'' buffer (by pressing
184@kbd{g}).
185
bd53d327 186@node Emacs List buffer
457f60fa
AK
187@subsubsection ``List'' buffer
188
189An interface of a ``list'' buffer is similar to the interface provided
190by ``package.el'' (@pxref{Package Menu,,, emacs, The Emacs Editor}).
191
192Default key bindings available for both ``package-list'' and
193``generation-list'' buffers:
194
195@table @kbd
196@item m
197Mark the current entry.
198@item M
199Mark all entries.
200@item u
91cc37a1 201Unmark the current entry (with prefix, unmark all entries).
457f60fa
AK
202@item @key{DEL}
203Unmark backward.
457f60fa
AK
204@item S
205Sort entries by a specified column.
206@end table
207
208A ``package-list'' buffer additionally provides the following bindings:
209
210@table @kbd
211@item @key{RET}
212Describe marked packages (display available information in a
213``package-info'' buffer).
214@item i
a54a237b 215Mark the current package for installation.
457f60fa 216@item d
a54a237b 217Mark the current package for deletion.
91cc37a1 218@item U
a54a237b 219Mark the current package for upgrading.
457f60fa 220@item ^
91cc37a1 221Mark all obsolete packages for upgrading.
457f60fa 222@item x
a54a237b 223Execute actions on the marked packages.
457f60fa
AK
224@end table
225
226A ``generation-list'' buffer additionally provides the following
227bindings:
228
229@table @kbd
230@item @key{RET}
231List packages installed in the current generation.
232@item i
233Describe marked generations (display available information in a
234``generation-info'' buffer).
af874238
AK
235@item s
236Switch profile to the current generation.
cb6a5c71
AK
237@item d
238Mark the current generation for deletion (with prefix, mark all
239generations).
240@item x
241Execute actions on the marked generations---i.e., delete generations.
457f60fa
AK
242@end table
243
bd53d327 244@node Emacs Info buffer
457f60fa
AK
245@subsubsection ``Info'' buffer
246
247The interface of an ``info'' buffer is similar to the interface of
248@code{help-mode} (@pxref{Help Mode,,, emacs, The Emacs Editor}).
249
250``Info'' buffer contains some buttons (as usual you may use @key{TAB} /
251@kbd{S-@key{TAB}} to move between buttons---@pxref{Mouse References,,,
252emacs, The Emacs Editor}) which can be used to:
253
254@itemize @bullet
255@item (in a ``package-info'' buffer)
256
257@itemize @minus
258@item install/remove a package;
259@item jump to a package location;
260@item browse home page of a package;
261@item describe packages from ``Inputs'' fields.
262@end itemize
263
264@item (in a ``generation-info'' buffer)
265
266@itemize @minus
267@item remove a generation;
af874238 268@item switch to a generation;
457f60fa
AK
269@item list packages installed in a generation;
270@item jump to a generation directory.
271@end itemize
272
273@end itemize
274
275
bd53d327 276@node Emacs Configuration
457f60fa
AK
277@subsection Configuration
278
279There are many variables you can modify to change the appearance or
280behavior of Emacs user interface. Some of these variables are described
281in this section. Also you can use Custom Interface (@pxref{Easy
282Customization,,, emacs, The Emacs Editor}) to explore/set variables (not
283all) and faces.
284
285@menu
bd53d327
AK
286* Guile and Build Options: Emacs Build Options. Specifying how packages are built.
287* Buffer Names: Emacs Buffer Names. Names of Guix buffers.
288* Keymaps: Emacs Keymaps. Configuring key bindings.
289* Appearance: Emacs Appearance. Settings for visual appearance.
457f60fa
AK
290@end menu
291
bd53d327 292@node Emacs Build Options
457f60fa
AK
293@subsubsection Guile and Build Options
294
295@table @code
296@item guix-guile-program
297If you have some special needs for starting a Guile process, you may set
298this variable, for example:
299
300@example
301(setq guix-guile-program '("/bin/guile" "--no-auto-compile"))
302@end example
303
304@item guix-use-substitutes
305Has the same meaning as @code{--no-substitutes} option (@pxref{Invoking
306guix build}).
307
308@item guix-dry-run
309Has the same meaning as @code{--dry-run} option (@pxref{Invoking guix
310build}).
311
312@end table
313
bd53d327 314@node Emacs Buffer Names
a54a237b
AK
315@subsubsection Buffer Names
316
317Default names of ``guix.el'' buffers (``*Guix@tie{}@dots{}*'') may be
318changed with the following variables:
319
320@table @code
321@item guix-package-list-buffer-name
322@item guix-output-list-buffer-name
323@item guix-generation-list-buffer-name
324@item guix-package-info-buffer-name
325@item guix-output-info-buffer-name
326@item guix-generation-info-buffer-name
327@item guix-repl-buffer-name
328@item guix-internal-repl-buffer-name
a54a237b
AK
329@end table
330
23459fa5
AK
331By default, the name of a profile is also displayed in a ``list'' or
332``info'' buffer name. To change this behavior, use
333@code{guix-buffer-name-function} variable.
334
335For example, if you want to display all types of results in a single
a54a237b
AK
336buffer (in such case you will probably use a history (@kbd{l}/@kbd{r})
337extensively), you may do it like this:
338
339@example
340(let ((name "Guix Universal"))
341 (setq
342 guix-package-list-buffer-name name
343 guix-output-list-buffer-name name
344 guix-generation-list-buffer-name name
345 guix-package-info-buffer-name name
346 guix-output-info-buffer-name name
23459fa5
AK
347 guix-generation-info-buffer-name name
348 guix-buffer-name-function #'guix-buffer-name-simple))
a54a237b
AK
349@end example
350
bd53d327 351@node Emacs Keymaps
457f60fa
AK
352@subsubsection Keymaps
353
354If you want to change default key bindings, use the following keymaps
355(@pxref{Init Rebinding,,, emacs, The Emacs Editor}):
356
357@table @code
358@item guix-list-mode-map
359Parent keymap with general keys for ``list'' buffers.
360
361@item guix-package-list-mode-map
362Keymap with specific keys for ``package-list'' buffers.
363
a54a237b
AK
364@item guix-output-list-mode-map
365Keymap with specific keys for ``output-list'' buffers.
366
457f60fa
AK
367@item guix-generation-list-mode-map
368Keymap with specific keys for ``generation-list'' buffers.
369
370@item guix-info-mode-map
371Parent keymap with general keys for ``info'' buffers.
372
373@item guix-package-info-mode-map
374Keymap with specific keys for ``package-info'' buffers.
375
a54a237b
AK
376@item guix-output-info-mode-map
377Keymap with specific keys for ``output-info'' buffers.
378
457f60fa
AK
379@item guix-generation-info-mode-map
380Keymap with specific keys for ``generation-info'' buffers.
381
382@end table
383
bd53d327 384@node Emacs Appearance
457f60fa
AK
385@subsubsection Appearance
386
387You can change almost any aspect of ``list'' / ``info'' buffers using
388the following variables:
389
390@table @code
391@item guix-list-column-format
392@itemx guix-list-column-titles
393@itemx guix-list-column-value-methods
394Specify the columns, their names, what and how is displayed in ``list''
395buffers.
396
397@item guix-info-displayed-params
398@itemx guix-info-insert-methods
399@itemx guix-info-ignore-empty-vals
400@itemx guix-info-param-title-format
401@itemx guix-info-multiline-prefix
402@itemx guix-info-indent
403@itemx guix-info-fill-column
404@itemx guix-info-delimiter
405Various settings for ``info'' buffers.
406
407@end table