Changed info manual dir category to "Emacs".
[elpher.git] / elpher.texi
1 \input texinfo @c -*-texinfo-*-
2
3 @setfilename elpher.info
4 @settitle Elpher Manual v1.0.0
5
6 @dircategory Emacs
7 @direntry
8 * Elpher: (elpher).     A gopher client for Emacs.
9 @end direntry
10
11 @copying
12 This manual documents Elpher, a gopher client for Emacs.
13
14 Copyright @copyright{} 2019 Tim Vaughan
15
16 @quotation
17 The source and documentation of Elpher is free software.  You can
18 redistribute it and/or modify it under the terms of the GNU General
19 Public License as published by the Free Software Foundation; either
20 version 3, or (at your option) any later version.
21
22 Elpher is distributed in the hope that it will be useful, but WITHOUT
23 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24 FITNElpher FOR A PARTICULAR PURPOSE. See the GNU General Public License in
25 the file COPYING in the same directory as this file for more details.
26 @end quotation
27 @end copying
28
29 @titlepage
30 @title Elpher Gopher Client Manual
31 @author Tim Vaughan
32
33 @page
34 @vskip 0pt plus 1filll
35 @insertcopying
36 @end titlepage
37
38 @contents
39
40 @ifnottex
41 @node Top, Introduction, (dir), (dir)
42 @top Elpher
43
44 @insertcopying
45 @end ifnottex
46
47 @macro keycmd{key,cmd}
48 @item \key\  (@code{\cmd\})
49 @findex \cmd\
50 @end macro
51
52 @menu
53 * Introduction::                Elpher Overview: what's this all about?
54 * Installation::                Installing Elpher
55 * Quick Start::                 Get up and running quickly
56 * Navigation::                  Fundamentals of Elpher navigation
57 * Bookmarks::                   How to record and visit bookmarks
58 * Character encodings::         How Elpher handles different character encodings
59 * Encrypted connections::       How and when TLS is enabled
60 * Customization::               How to customize various aspects of Elpher
61 * Command Index::
62 @end menu
63
64 @node Introduction, Installation, Top, Top
65 @chapter Introduction
66
67 Elpher aims to be a capable and practical gopher client for Emacs.  Its
68 focus is on easy keyboard-driven navigation based on sensible default
69 bindings (with out-of-the-box support for Evil).  It is intended to be
70 robust and behave in non-surprising ways at all times.  Additionally,
71 Elpher provides the following bells and whistles:
72
73 @itemize
74 @item
75 followable web and gopher links in plain text,
76
77 @item
78 an easily navigable history, sporting caching of visited pages (both
79 content and cursor position),
80
81 @item
82 auto-completing menu item navigation,
83
84 @item
85 direct visualization of image files where supported (no writing to
86 disk), and
87
88 @item
89 a simple bookmark management system.
90 @end itemize
91
92 Elpher is still under active development.  Although we try very hard to
93 ensure that releases are bug-free, this cannot be guaranteed.  However,
94 this also means that any usability features that you feel are missing
95 can likely by incorporated quickly, so please get in touch if you
96 have some ideas.
97
98 @node Installation, Quick Start, Introduction, Top
99 @chapter Installation
100
101 Elpher is available from the MELPA package repository.  If you have
102 never installed packages from this repository before, you'll need
103 to follow the instructions at @url{https://melpa.org/#/getting-started}.
104
105 @noindent To install Elpher, enter the following:
106
107 @example
108 @kbd{M-x package-install @key{RET} elpher @key{RET}}
109 @end example
110
111 @noindent To uninstall, use
112
113 @example
114 @kbd{M-x package-delete @key{RET} elpher @key{RET}}.
115 @end example
116
117 While not recommended, it is also possible to install Elpher directly by
118 downloading the file @file{elpher.el} from
119 @url{https://github.com/tgvaughan/elpher}, adding it to a directory in
120 your @code{load-path}, and then adding
121
122 @example
123 (require 'elpher)
124 @end example
125
126 @noindent to your Emacs initialization file.
127
128 @node Quick Start, Navigation, Installation, Top
129 @chapter Quick Start
130
131 Before diving into the minutiae of the different commands available,
132 we will quickly describe how to get up and running with Elpher.
133
134 Once installed, you can launch Elpher using
135
136 @example
137 @kbd{M-x elpher @key{RET}}
138 @end example
139
140 @noindent This will switch to the *Elpher* buffer and display a start
141 page, with information on each of the default keyboard bindings.
142
143 From here you can move point between links (which may be menu items or
144 inline URLs in text files) by using @key{TAB} and @kbd{S-@key{TAB}},
145 as in Info.  You can also jump directly to a menu item using @key{m}, or
146 use the standard Emacs or Evil motion and search commands to find your
147 way around.  To open a link, press @key{RET}.  (Where a mouse is
148 available, Clicking on a link with the mouse cursor has the same
149 effect.)
150
151 To return to the page you just followed the link from, press @key{u}.
152
153 Elpher caches (for the duration of an Emacs session) both page contents
154 and the position of point on each of the pages (gopher menus, query
155 results, or text pages) you visit, restoring these when you next visit
156 the same page.  Thus, pressing @key{u} displays the previous page in
157 exactly the same state as when you left, meaning that you can quickly
158 and visually explore the different documents in a menu without having to
159 wait for anything to reload.
160
161 Of course, sometimes you'll @emph{want} to reload the current page
162 rather than stick with the cached version.  To do this use @key{R}.
163 (This is particularly useful for search query results, where this
164 allows you to perform a different search.)
165
166 That's more-or-less it. Elpher supports a number of other features, such
167 as bookmarking, support for different coding schemes and TLS encryption,
168 and a variety of customization options, all of which are explained in
169 the rest of this document.  However the emphasis is on keeping the basic
170 navigation experience as intuitive and responsive as possible.
171
172 @node Navigation, Bookmarks, Quick Start, Top
173 @chapter Navigation
174 by 
175 Throughout this manual, we use the word ``page'' to refer to any
176 visualization of a response from a gopher server, be it a
177 menu/directory, query result, text file or image.  We use
178
179 Elpher's navigation interface is inspired by the Emacs Info mode.
180 Movement within a page is essentially the same as moving
181 around any other text file in Emacs, but with special keys
182 for quickly jumping between menu items and URLs in text files.
183 Movement between pages is facilitated by a simple linear history
184 coupled with caching of pages and cursor position.
185
186 @menu
187 * Within-page navigation::      Moving about within a page
188 * Between-page navigation::     Commands for moving between pages
189 * History and Caching::         Explanation of how Elpher represents history
190 @end menu
191
192
193 @node Within-page navigation, Between-page navigation, Navigation, Navigation
194 @section Within-page navigation
195
196 To move about within a page, you should be able use the same keys you usually
197 use to browse files in Emacs.  This is even true when Evil mode is
198 enabled. Paragraph hopping, searching etc should work as usual.
199
200 In addition, the following commands are provided for quickly moving between
201 links and menu items.
202
203 @table @asis
204 @keycmd{@key{TAB}, elpher-next-link}
205 Move to the next link or menu item in the file.
206
207 @keycmd{@kbd{Shift-@key{TAB}}/@key{backtab}, @code{elpher-prev-link}}
208 Move to the previous link or menu item in the file.
209
210 @keycmd{@key{m}, elpher-jump}
211 Jump directly to a link within a file by specifying its display string
212 or link text.  (Unlike the previous two commands, this immediately opens
213 the selected link.
214 @end table
215
216 The following commands can be used to retrieve information about the
217 current page, or the address of the link at point:
218
219 @table @asis
220 @keycmd{@key{i}, elpher-info-link}
221 Display host, port and selector information for the link at point.
222
223 @keycmd{@key{I}, elpher-info-current}
224 Display host, port and selector information for the current page.
225
226 @keycmd{@key{c}, elpher-copy-link-url}
227 Add URL representing address of link at point to the kill-ring and the
228 system clipboard (if available).
229
230 @keycmd{@key{C}, elpher-copy-current-url}
231 Add URL representing address of the current page to the kill-ring and
232 the system clipboard (if available).
233
234 @keycmd{@key{d}, elpher-download}
235 Download link at point and save the result as a file.  The minibuffer
236 will prompt for the name of the file to write, with the default name being
237 the display string (if available) associated with the link.
238
239 @keycmd{@key{D}, elpher-download-current}
240 This is similar to @code{elpher-download}, but instead applies to the
241 current page rather than a link.
242
243 @keycmd{@key{w}, elpher-view-raw}
244 This displays the raw server response for the current page.  While not
245 useful for general browsing, it is useful for debugging incorrect rendering
246 or out-of-spec server responses.
247 @end table
248
249 @node Between-page navigation, History and Caching, Within-page navigation, Navigation
250 @section Between-page navigation
251
252 Moving to a different page can be accomplished in several ways,
253 described by the following command:
254
255 @table @asis
256 @keycmd{@key{RET}\, @kbd{mouse-1}, elpher-follow-link}
257 Follow the menu item or link at point (or selected with the mouse).
258
259 Exactly what is meant by ``follow'' depends on the kind of item selected:
260
261 @itemize
262 @item
263 For text or menu type items or links, the current page text is replaced
264 by the text of this item.  Unless the customization variable
265 @code{elpher-use-header} (@pxref{Customization}) is 
266 @code{nil}, the display string of the link is displayed in the buffer header.
267 Links to images behave similarly on Emacs systems supporting the display of
268 bitmap graphics, however their content is not cached in memory by default.
269
270 @item
271 When followed, links to search/query items (type 7) prompt for input in
272 the minibuffer then display the results in the same way as for text and menu
273 items.
274
275 @item
276 Following links to binary files (and image files on unsupported systems)
277 causes Elpher to prompt for a filename in which to save the content.
278
279 @item
280 Following links of type `h' with a selector having the `URL:' prefix, or
281 non-gopher URLs in text files, will result in Elpher using an external
282 programme to open the URL.  This will be either the default system browser
283 or, if the @code{elpher-open-urls-with-eww} customization variable is non-nil,
284 Emacs' own EWW browser. (See @pxref{Customization}.) 
285
286 @end itemize
287
288 Once a text, menu or query response page has been displayed, its contents are
289 cached for the duration of the Emacs session. 
290
291 @keycmd{@key{g}, elpher-go}
292 Open a particular page by specifying either its URL or directly entering
293 a host, port and selector.
294
295 Note that if a non-gopher protocol is used in the URL the result will be 
296 the same as following a URL link of the same type from a gopher menu.
297
298 @keycmd{@key{O}, elpher-root-dir}
299 Open the root page (empty selector) on the current host.
300
301 @keycmd{@key{u}, elpher-back}
302 Return to the previous page, where ``previous'' means the page where the
303 page which was displayed immediately before the current page.
304 @end table
305
306
307 @node History and Caching,  , Between-page navigation, Navigation
308 @section History and Caching 
309
310 The history and caching strategy in Elpher is extremely simple, but
311 may be confusing without a good mental model of how it works.  That
312 is what this section attempts to provide.
313
314 Essentially, @strong{every} time you navigate to a new page, either
315 by clicking or pressing @key{RET} on a link, using @key{g} to jump
316 to a new page by its address, or using @key{O} to open the root selector,
317 the following two things occur:
318
319 @enumerate
320 @item
321 the cursor position and content for the original page are recorded in an
322 in-memory cache, and
323
324 @item
325 the original page is set as the ``parent'' of the new page.
326 @end enumerate
327
328 The only way to return to pages in this history is by using @key{u},
329 which returns to the previous of the current page.
330 @footnote{The addition of the new page to the history happens even if
331 the new page is one that has been seen before. This is mostly the
332 desired behaviour.  However, opening an explicit ``back'' link provided
333 by a gopher menu will also add a new entry to the history.  Unless you
334 haven't yet visited that menu, it's therefore better to use @key{u} to
335 go back in this case.}
336
337 One aspect that may seem peculiar is that Elpher lacks a corresponding ``next'' or
338 ``forward'' command.  However, since Elpher caches the position of point,
339 this will be automatically positioned on the link that was most recently followed
340 from a given page.  This means that, at least for links followed from menus
341 and text files, the inverse of @key{u} is actually just @key{RET}.
342
343
344 @node Bookmarks, Character encodings, Navigation, Top
345 @chapter Bookmarks
346
347 Elpher has a very simple link bookmarking system involving the
348 following commands:
349
350 @table @asis
351 @keycmd{@key{a}, elpher-bookmark-link}
352 Add a bookmark for the link at point.  The minibuffer will prompt for
353 a name for the bookmark, which defaults to the display string.
354
355 @keycmd{@key{A}, elpher-bookmark-current}
356 Add a bookmark for the current page.  The minibuffer will prompt for
357 a name for the bookmark, defaulting to the display string associated
358 with the link that was followed to reach the current page.
359
360 @keycmd{@key{x}, elpher-unbookmark-link}
361 Immediately remove the bookmark (if one exists) to the link at point.
362
363 @keycmd{@key{X}, elpher-unbookmark-current}
364 Immediately remove the bookmark (if one exists) to the current page.
365
366 @keycmd{@key{B}, elpher-bookmarks}
367 Open a page displaying all current bookmarks.  Note that this bookmark
368 page is added to the history just as if you had opened it using a link.
369 Thus to return to the previous page, use @kbd{u}.  This also means
370 that you can peruse the various bookmarks by visiting them in turn, 
371 using @kbd{u} to return to the bookmark page (where the position of point
372 is cached), then moving to another bookmarked link and so on.
373 @end table
374
375 Bookmarks are stored as a s-exp in the file @file{elpher-bookmarks}
376 in the user emacs directory (usually @file{~/.emacs.d/}).
377 Any command which modifies the list of bookmarks immediately updates
378 this file.
379
380 @node Character encodings, Encrypted connections, Bookmarks, Top
381 @chapter Character encodings
382
383 Responses Elpher retrieves from servers are initially read as pure
384 binary data.  When the data is intended to be interpreted as textual (as
385 determined by the type parameter of the gopher menu item or the gopher
386 URL), this data needs to be @emph{decoded} into a sequence of
387 characters.  To do this properly requires knowledge of the encoding
388 system used by whoever authored the document.
389
390 Unfortunately gopher lacks a systematic way of acquiring this necessary
391 information. Thus, the details of the coding system must be either inferred from the binary data,
392 or must be specified by the user.
393
394 By default, Elpher applies Emacs' built-in character encoding detection
395 system to the full (undecoded) response data and uses this to attempt to
396 convert it into a character string.
397 (See @pxref{Recognize coding, Recognizing coding systems, ,emacs}.) While
398 this approach can be okay, it is important to realize that its inference
399 algorithm is extremely primitive and depends heavily on assumptions based
400 on the language settings of your emacs system.
401
402 The alternative is to explicitly set the coding system used for decoding
403 using the following command:
404
405 @table @asis
406 @keycmd{@key{S},elpher-set-coding-system}
407 Causes a elpher to prompt for a coding system to use for decoding
408 future text.  The @key{TAB} key can be used at this prompt to display a
409 list of alternatives (which is extensive) and to auto-complete.  An empty
410 response will cause Elpher to return to its default auto-detection
411 behaviour.
412 @end table
413
414 Note that changing the coding system only affects newly loaded text.
415 Thus, if text has already been decoded using an incorrect system, you
416 will need to select the correct coding and then reload the text using
417 @key{R}.
418
419
420 @node Encrypted connections, Customization, Character encodings, Top
421 @chapter Encrypted connections
422
423 While RFC 1436 does not broach the topic of encryption at all, several
424 modern gopher servers can serve content over encrypted connections,
425 and a common choice for this is TLS.
426
427 Elpher can retrieve selectors using Emacs' built-in TLS support which
428 uses the GnuTLS library. (It is possible to build emacs without
429 GnuTLS, in which case encryption is not supported.)
430
431 To retrieve documents using TLS, Elpher's TLS mode must be enabled.
432 This can be directly toggled using @key{T}, but note that just as with
433 the character encoding, changing this mode only affects subsequent
434 connections.
435
436 Alternatively, TLS mode is @emph{automatically} enabled whenever
437 gopher URLs starting with @code{gophers://} are followed.
438
439 The mode is sticky, so it remains active until switched off.
440 It can also be automatically switched off when a TLS connection fails.
441 In this case Elpher will prompt for your confirmation to ensure that
442 you can't accidentally make a non-TLS connection.
443
444
445 @node Customization, Command Index, Encrypted connections, Top
446 @chapter Customization
447
448 Various parts of Elpher can be customized via the 
449 variables belonging to the elpher customization group, accessible
450 using
451
452 @example
453 @kbd{M-x customize-group elpher @key{RET}}
454 @end example
455
456 @noindent This group contains a number of faces that can be modified to change
457 the appearance of Elpher, including one face per menu item type.
458
459 The group also contains variables for customizing the behaviour of
460 Elpher.  This includes how to open arbitrary (non-gopher) URLs,
461 whether to display buffer headers, whether to look for naked URLs in
462 gopher menus (as opposed to just plain text files), and whether
463 to prompt for confirmation when switching away from TLS.
464
465 See the customization group itself for details.
466
467 @node Command Index,  , Customization, Top
468 @unnumbered Command Index
469
470 @printindex fn
471
472 @bye