aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorGlenn Morris2012-11-10 15:13:33 -0800
committerGlenn Morris2012-11-10 15:13:33 -0800
commit6baf66d53bbedd85a443e0d69d1f4311a93f0677 (patch)
tree38d7a00d5f7d5aecb86285d334fa15a31e5fbab1 /doc
parent05a859c1bd9cd07b2c0fad06a0694e88ea929fcf (diff)
parente4e46889223296e8875548d278340b21db449a4a (diff)
downloademacs-6baf66d53bbedd85a443e0d69d1f4311a93f0677.tar.gz
emacs-6baf66d53bbedd85a443e0d69d1f4311a93f0677.zip
Merge from emacs-24; up to 2012-11-08T14:54:03Z!monnier@iro.umontreal.ca
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/ChangeLog43
-rw-r--r--doc/emacs/ack.texi8
-rw-r--r--doc/emacs/buffers.texi186
-rw-r--r--doc/emacs/dired.texi20
-rw-r--r--doc/emacs/display.texi28
-rw-r--r--doc/emacs/emacs.texi3
-rw-r--r--doc/emacs/files.texi23
-rw-r--r--doc/emacs/mini.texi54
-rw-r--r--doc/emacs/misc.texi48
-rw-r--r--doc/emacs/trouble.texi59
-rw-r--r--doc/lispref/ChangeLog36
-rw-r--r--doc/lispref/edebug.texi4
-rw-r--r--doc/lispref/elisp.texi7
-rw-r--r--doc/lispref/frames.texi14
-rw-r--r--doc/lispref/lists.texi44
-rw-r--r--doc/lispref/searching.texi27
-rw-r--r--doc/lispref/variables.texi119
-rw-r--r--doc/lispref/windows.texi528
-rw-r--r--doc/misc/ChangeLog29
-rw-r--r--doc/misc/cl.texi151
-rw-r--r--doc/misc/url.texi644
21 files changed, 1334 insertions, 741 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index c7cbc78f910..f6d536a08d1 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,46 @@
12012-11-10 Glenn Morris <rgm@gnu.org>
2
3 * misc.texi (Terminal emulator): Rename `term-face' to `term'.
4
5 * emacs.texi (Acknowledgments): Add profiler author.
6 * ack.texi (Acknowledgments): Add some recent contributions.
7
82012-11-10 Chong Yidong <cyd@gnu.org>
9
10 * files.texi (Diff Mode): Doc fixes for
11 diff-delete-trailing-whitespace (Bug#12831).
12
13 * trouble.texi (Crashing): Copyedits.
14
152012-11-10 Glenn Morris <rgm@gnu.org>
16
17 * files.texi (Diff Mode): Trailing whitespace updates.
18
192012-11-10 Chong Yidong <cyd@gnu.org>
20
21 * misc.texi (Terminal emulator): Document Term mode faces.
22
23 * mini.texi (Basic Minibuffer): New node. Document
24 minibuffer-electric-default-mode.
25
26 * display.texi (Visual Line Mode): Fix index entry.
27
28 * buffers.texi (Several Buffers): List Buffer Menu command anmes,
29 and index the keybindings. Document tabulated-list-sort.
30 (Kill Buffer): Capitalize Buffer Menu.
31
32 * trouble.texi (Memory Full): Capitalize Buffer Menu.
33
342012-11-10 Eli Zaretskii <eliz@gnu.org>
35
36 * display.texi (Auto Scrolling): Clarify that scroll-step is
37 ignored when scroll-conservatively is set to a non-zero value.
38 (Bug#12801)
39
402012-11-10 Chong Yidong <cyd@gnu.org>
41
42 * dired.texi (Dired Updating): Doc fix (Bug#11744).
43
12012-10-30 Michael Albinus <michael.albinus@gmx.de> 442012-10-30 Michael Albinus <michael.albinus@gmx.de>
2 45
3 * trouble.texi (Known Problems): Mention command `debbugs-gnu-usertags'. 46 * trouble.texi (Known Problems): Mention command `debbugs-gnu-usertags'.
diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi
index 79710f4992b..9fdead70f8a 100644
--- a/doc/emacs/ack.texi
+++ b/doc/emacs/ack.texi
@@ -244,8 +244,9 @@ files as ``thumbnails''.
244 244
245@item 245@item
246Julien Danjou wrote an implementation of ``Desktop Notifications'' 246Julien Danjou wrote an implementation of ``Desktop Notifications''
247(@file{notifications.el}); and @file{color.el}, a library for general 247(@file{notifications.el}, and related packages for ERC and Gnus);
248color manipulation. He also made various contributions to Gnus. 248and @file{color.el}, a library for general color manipulation.
249He also made various contributions to Gnus.
249 250
250@item 251@item
251Vivek Dasmohapatra wrote @file{htmlfontify.el}, to convert a buffer or 252Vivek Dasmohapatra wrote @file{htmlfontify.el}, to convert a buffer or
@@ -790,6 +791,9 @@ mode-sensitive insertion of text into new files.
790Yukihiro Matsumoto and Nobuyoshi Nakada wrote Ruby-mode. 791Yukihiro Matsumoto and Nobuyoshi Nakada wrote Ruby-mode.
791 792
792@item 793@item
794Tomohiro Matsuyama wrote the native Elisp profiler.
795
796@item
793Thomas May wrote @file{blackbox.el}, a version of the traditional 797Thomas May wrote @file{blackbox.el}, a version of the traditional
794blackbox game. 798blackbox game.
795 799
diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi
index dfd8f792300..8c6705cc0c9 100644
--- a/doc/emacs/buffers.texi
+++ b/doc/emacs/buffers.texi
@@ -309,7 +309,7 @@ whose names begin with a space, which are used internally by Emacs.
309To kill internal buffers as well, call @code{kill-matching-buffers} 309To kill internal buffers as well, call @code{kill-matching-buffers}
310with a prefix argument. 310with a prefix argument.
311 311
312 The buffer menu feature is also convenient for killing various 312 The Buffer Menu feature is also convenient for killing various
313buffers. @xref{Several Buffers}. 313buffers. @xref{Several Buffers}.
314 314
315@vindex kill-buffer-hook 315@vindex kill-buffer-hook
@@ -339,7 +339,7 @@ the Customization buffer to set the variable @code{midnight-mode} to
339 339
340@node Several Buffers 340@node Several Buffers
341@section Operating on Several Buffers 341@section Operating on Several Buffers
342@cindex buffer menu 342@cindex Buffer Menu
343 343
344@table @kbd 344@table @kbd
345@item M-x buffer-menu 345@item M-x buffer-menu
@@ -348,7 +348,7 @@ Begin editing a buffer listing all Emacs buffers.
348Similar, but do it in another window. 348Similar, but do it in another window.
349@end table 349@end table
350 350
351 The @dfn{buffer menu} opened by @kbd{C-x C-b} (@pxref{List Buffers}) 351 The @dfn{Buffer Menu} opened by @kbd{C-x C-b} (@pxref{List Buffers})
352does not merely list buffers. It also allows you to perform various 352does not merely list buffers. It also allows you to perform various
353operations on buffers, through an interface similar to Dired 353operations on buffers, through an interface similar to Dired
354(@pxref{Dired}). You can save buffers, kill them (here called 354(@pxref{Dired}). You can save buffers, kill them (here called
@@ -356,106 +356,169 @@ operations on buffers, through an interface similar to Dired
356 356
357@findex buffer-menu 357@findex buffer-menu
358@findex buffer-menu-other-window 358@findex buffer-menu-other-window
359 To use the buffer menu, type @kbd{C-x C-b} and switch to the window 359 To use the Buffer Menu, type @kbd{C-x C-b} and switch to the window
360displaying the @file{*Buffer List*} buffer. You can also type 360displaying the @file{*Buffer List*} buffer. You can also type
361@kbd{M-x buffer-menu} to open the buffer menu in the selected window. 361@kbd{M-x buffer-menu} to open the Buffer Menu in the selected window.
362Alternatively, the command @kbd{M-x buffer-menu-other-window} opens 362Alternatively, the command @kbd{M-x buffer-menu-other-window} opens
363the buffer menu in another window, and selects that window. 363the Buffer Menu in another window, and selects that window.
364 364
365 The buffer menu is a read-only buffer, and can be changed only 365 The Buffer Menu is a read-only buffer, and can be changed only
366through the special commands described in this section. The usual 366through the special commands described in this section. The usual
367cursor motion commands can be used in this buffer. The 367cursor motion commands can be used in this buffer. The following
368following commands apply to the buffer described on the current line: 368commands apply to the buffer described on the current line:
369 369
370@table @kbd 370@table @kbd
371@item d 371@item d
372Request to delete (kill) the buffer, then move down. The request 372@findex Buffer-menu-delete
373shows as a @samp{D} on the line, before the buffer name. Requested 373@kindex d @r{(Buffer Menu)}
374deletions take place when you type the @kbd{x} command. 374Flag the buffer for deletion (killing), then move point to the next
375line (@code{Buffer-menu-delete}). The deletion flag is indicated by
376the character @samp{D} on the line, before the buffer name. The
377deletion occurs only when you type the @kbd{x} command (see below).
378
375@item C-d 379@item C-d
376Like @kbd{d} but move up afterwards instead of down. 380@findex Buffer-menu-delete-backwards
381@kindex C-d @r{(Buffer Menu)}
382Like @kbd{d}, but move point up instead of down
383(@code{Buffer-menu-delete-backwards}).
384
377@item s 385@item s
378Request to save the buffer. The request shows as an @samp{S} on the 386@findex Buffer-menu-save
379line. Requested saves take place when you type the @kbd{x} command. 387@kindex s @r{(Buffer Menu)}
380You may request both saving and deletion for the same buffer. 388Flag the buffer for saving (@code{Buffer-menu-save}). The save flag
389is indicated by the character @samp{S} on the line, before the buffer
390name. The saving occurs only when you type @kbd{x}. You may request
391both saving and deletion for the same buffer.
392
381@item x 393@item x
382Perform previously requested deletions and saves. 394@findex Buffer-menu-execute
395@kindex x @r{(Buffer Menu)}
396Perform all flagged deletions and saves (@code{Buffer-menu-execute}).
397
383@item u 398@item u
384Remove any request made for the current line, and move down. 399@findex Buffer-menu-unmark
400@kindex u @r{(Buffer Menu)}
401Remove all flags from the current line, and move down
402(@code{Buffer-menu-unmark}).
403
385@item @key{DEL} 404@item @key{DEL}
386Move to previous line and remove any request made for that line. 405@findex Buffer-menu-backup-unmark
406@kindex DEL @r{(Buffer Menu)}
407Move to the previous line and remove all flags on that line
408(@code{Buffer-menu-backup-unmark}).
387@end table 409@end table
388 410
389 The @kbd{d}, @kbd{C-d}, @kbd{s} and @kbd{u} commands to add or remove 411@noindent
390flags also move down (or up) one line. They accept a numeric argument 412The commands for adding or removing flags, @kbd{d}, @kbd{C-d}, @kbd{s}
391as a repeat count. 413and @kbd{u}, all accept a numeric argument as a repeat count.
392 414
393 These commands operate immediately on the buffer listed on the current 415 The following commands operate immediately on the buffer listed on
394line: 416the current line. They also accept a numeric argument as a repeat
417count.
395 418
396@table @kbd 419@table @kbd
397@item ~ 420@item ~
398Mark the buffer ``unmodified''. The command @kbd{~} does this 421@findex Buffer-menu-not-modified
399immediately when you type it. 422@kindex ~ @r{(Buffer Menu)}
423Mark the buffer as unmodified (@code{Buffer-menu-not-modified}).
424@xref{Save Commands}.
425
400@item % 426@item %
401Toggle the buffer's read-only flag. The command @kbd{%} does 427@findex Buffer-menu-toggle-read-only
402this immediately when you type it. 428@kindex % @r{(Buffer Menu)}
429Toggle the buffer's read-only status
430(@code{Buffer-menu-toggle-read-only}). @xref{Misc Buffer}.
431
403@item t 432@item t
404Visit the buffer as a tags table. @xref{Select Tags Table}. 433@findex Buffer-menu-visit-tags-table
434@kindex % @r{(Buffer Menu)}
435Visit the buffer as a tags table
436(@code{Buffer-menu-visit-tags-table}). @xref{Select Tags Table}.
405@end table 437@end table
406 438
407 There are also commands to select another buffer or buffers: 439 The following commands are used to select another buffer or buffers:
408 440
409@table @kbd 441@table @kbd
410@item q 442@item q
411Quit the buffer menu---immediately display the most recent formerly 443@findex quit-window
412visible buffer in its place. 444@kindex q @r{(Buffer Menu)}
445Quit the Buffer Menu (@code{quit-window}). The most recent formerly
446visible buffer is displayed in its place.
447
413@item @key{RET} 448@item @key{RET}
414@itemx f 449@itemx f
415Immediately select this line's buffer in place of the @file{*Buffer 450@findex Buffer-menu-this-window
416List*} buffer. 451@kindex f @r{(Buffer Menu)}
452@kindex RET @r{(Buffer Menu)}
453Select this line's buffer, replacing the @file{*Buffer List*} buffer
454in its window (@code{Buffer-menu-this-window}).
455
417@item o 456@item o
418Immediately select this line's buffer in another window as if by 457@findex Buffer-menu-other-window
419@kbd{C-x 4 b}, leaving @file{*Buffer List*} visible. 458@kindex o @r{(Buffer Menu)}
459Select this line's buffer in another window, as if by @kbd{C-x 4 b},
460leaving @file{*Buffer List*} visible
461(@code{Buffer-menu-other-window}).
462
420@item C-o 463@item C-o
421Immediately display this line's buffer in another window, but don't 464@findex Buffer-menu-switch-other-window
422select the window. 465@kindex C-o @r{(Buffer Menu)}
466Display this line's buffer in another window, without selecting it
467(@code{Buffer-menu-switch-other-window}).
468
423@item 1 469@item 1
424Immediately select this line's buffer in a full-screen window. 470@findex Buffer-menu-1-window
471@kindex 1 @r{(Buffer Menu)}
472Select this line's buffer in a full-frame window
473(@code{Buffer-menu-1-window}).
474
425@item 2 475@item 2
426Immediately set up two windows, with this line's buffer selected in 476@findex Buffer-menu-2-window
427one, and the previously current buffer (aside from the buffer 477@kindex 2 @r{(Buffer Menu)}
428@file{*Buffer List*}) displayed in the other. 478Set up two windows on the current frame, with this line's buffer
479selected in one, and a previously current buffer (aside from
480@file{*Buffer List*}) in the other (@code{Buffer-menu-2-window}).
481
429@item b 482@item b
430Bury the buffer listed on this line. 483@findex Buffer-menu-bury
484@kindex b @r{(Buffer Menu)}
485Bury this line's buffer (@code{Buffer-menu-bury}).
486
431@item m 487@item m
488@findex Buffer-menu-mark
489@kindex m @r{(Buffer Menu)}
432Mark this line's buffer to be displayed in another window if you exit 490Mark this line's buffer to be displayed in another window if you exit
433with the @kbd{v} command. The request shows as a @samp{>} at the 491with the @kbd{v} command (@code{Buffer-menu-mark}). The display flag
434beginning of the line. (A single buffer may not have both a delete 492is indicated by the character @samp{>} at the beginning of the line.
435request and a display request.) 493(A single buffer may not have both deletion and display flags.)
494
436@item v 495@item v
437Immediately select this line's buffer, and also display in other windows 496@findex Buffer-menu-select
438any buffers previously marked with the @kbd{m} command. If you have not 497@kindex v @r{(Buffer Menu)}
439marked any buffers, this command is equivalent to @kbd{1}. 498Select this line's buffer, and also display in other windows any
499buffers flagged with the @kbd{m} command (@code{Buffer-menu-select}).
500If you have not flagged any buffers, this command is equivalent to
501@kbd{1}.
440@end table 502@end table
441 503
442 There is also a command that affects the entire buffer list: 504 The following commands affect the entire buffer list:
443 505
444@table @kbd 506@table @kbd
507@item S
508@findex tabulated-list-sort
509@kindex S @r{(Buffer Menu)}
510Sort the Buffer Menu entries according to their values in the column
511at point. With a numeric prefix argument @var{n}, sort according to
512the @var{n}-th column (@code{tabulated-list-sort}).
513
445@item T 514@item T
446Delete, or reinsert, lines for non-file buffers. This command toggles 515@findex Buffer-menu-toggle-files-only
447the inclusion of such buffers in the buffer list. 516@kindex T @r{(Buffer Menu)}
517Delete, or reinsert, lines for non-file buffers
518@code{Buffer-menu-toggle-files-only}). This command toggles the
519inclusion of such buffers in the buffer list.
448@end table 520@end table
449 521
450 What @code{buffer-menu} actually does is create and switch to a
451suitable buffer, and turn on Buffer Menu mode in it. Everything else
452described above is implemented by the special commands provided in
453Buffer Menu mode. One consequence of this is that you can switch from
454the @file{*Buffer List*} buffer to another Emacs buffer, and edit
455there. You can reselect the @file{*Buffer List*} buffer later, to
456perform the operations already requested, or you can kill it, or pay
457no further attention to it.
458
459 Normally, the buffer @file{*Buffer List*} is not updated 522 Normally, the buffer @file{*Buffer List*} is not updated
460automatically when buffers are created and killed; its contents are 523automatically when buffers are created and killed; its contents are
461just text. If you have created, deleted or renamed buffers, the way 524just text. If you have created, deleted or renamed buffers, the way
@@ -633,7 +696,6 @@ C-b}. To customize this buffer list, use the @code{bs} Custom group
633@findex msb-mode 696@findex msb-mode
634@cindex mode, MSB 697@cindex mode, MSB
635@cindex MSB mode 698@cindex MSB mode
636@cindex buffer menu
637@findex mouse-buffer-menu 699@findex mouse-buffer-menu
638@kindex C-Down-Mouse-1 700@kindex C-Down-Mouse-1
639 MSB global minor mode (``MSB'' stands for ``mouse select buffer'') 701 MSB global minor mode (``MSB'' stands for ``mouse select buffer'')
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index c08dc02b04b..69b72b2c73a 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -1170,17 +1170,17 @@ automatically when you revisit it, by setting the variable
1170 1170
1171@kindex k @r{(Dired)} 1171@kindex k @r{(Dired)}
1172@findex dired-do-kill-lines 1172@findex dired-do-kill-lines
1173 To delete the specified @emph{file lines} from the buffer---not 1173 To delete @emph{file lines} from the buffer---without actually
1174delete the files---type @kbd{k} (@code{dired-do-kill-lines}). Like 1174deleting the files---type @kbd{k} (@code{dired-do-kill-lines}). Like
1175the file-operating commands, this command operates on the next @var{n} 1175the file-operating commands, this command operates on the next @var{n}
1176files, or on the marked files if any; but it does not operate on the 1176files, or on the marked files if any. However, it does not operate on
1177current file as a last resort. 1177the current file, since otherwise mistyping @kbd{k} could be annoying.
1178 1178
1179 If you use @kbd{k} with a numeric prefix argument to kill the line 1179 If you use @kbd{k} to kill the line for a directory file which you
1180for a file that is a directory, which you have inserted in the Dired 1180had inserted in the Dired buffer as a subdirectory
1181buffer as a subdirectory, it removed that subdirectory line from the 1181(@pxref{Subdirectories in Dired}), it removes the subdirectory listing
1182buffer as well. Typing @kbd{C-u k} on the header line for a 1182as well. Typing @kbd{C-u k} on the header line for a subdirectory
1183subdirectory also removes the subdirectory line from the Dired buffer. 1183also removes the subdirectory line from the Dired buffer.
1184 1184
1185 The @kbd{g} command brings back any individual lines that you have 1185 The @kbd{g} command brings back any individual lines that you have
1186killed in this way, but not subdirectories---you must use @kbd{i} to 1186killed in this way, but not subdirectories---you must use @kbd{i} to
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index 90bfcf147c5..b6ab4913f9c 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -221,20 +221,27 @@ visible portion of the text.
221if you set @code{scroll-conservatively} to a small number @var{n}, 221if you set @code{scroll-conservatively} to a small number @var{n},
222then if you move point just a little off the screen (less than @var{n} 222then if you move point just a little off the screen (less than @var{n}
223lines), Emacs scrolls the text just far enough to bring point back on 223lines), Emacs scrolls the text just far enough to bring point back on
224screen. By default, @code{scroll-conservatively} is@tie{}0. If you 224screen. If doing so fails to make point visible, Emacs centers point
225set @code{scroll-conservatively} to a large number (larger than 100), 225in the window. By default, @code{scroll-conservatively} is@tie{}0.
226Emacs will never center point as result of scrolling, even if point 226If you set @code{scroll-conservatively} to a large number (larger than
227moves far away from the text previously displayed in the window. With 227100), Emacs will never center point as result of scrolling, even if
228such a large value, Emacs will always scroll text just enough for 228point moves far away from the text previously displayed in the window.
229With such a large value, Emacs will always scroll text just enough for
229bringing point into view, so point will end up at the top or bottom of 230bringing point into view, so point will end up at the top or bottom of
230the window, depending on the scroll direction. 231the window, depending on the scroll direction.
231 232
232@vindex scroll-step 233@vindex scroll-step
233 The variable @code{scroll-step} determines how many lines to scroll 234 An alternative way of controlling how Emacs scrolls text is by
234the window when point moves off the screen. If moving by that number 235customizing the variable @code{scroll-step}. Its value determines how
235of lines fails to bring point back into view, point is centered 236many lines to scroll the window when point moves off the screen. If
236instead. The default value is zero, which causes point to always be 237moving by that number of lines fails to bring point back into view,
237centered after scrolling. 238point is centered instead. The default value is zero, which causes
239point to always be centered after scrolling.
240
241 Since both @code{scroll-conservatively} and @code{scroll-step}
242control automatic scrolling in contradicting ways, you should set only
243one of them. If you customize both, the value of
244@code{scroll-conservatively} takes precedence.
238 245
239@cindex aggressive scrolling 246@cindex aggressive scrolling
240@vindex scroll-up-aggressively 247@vindex scroll-up-aggressively
@@ -1493,6 +1500,7 @@ attempts to wrap the line at word boundaries near the right window
1493edge. This makes the text easier to read, as wrapping does not occur 1500edge. This makes the text easier to read, as wrapping does not occur
1494in the middle of words. 1501in the middle of words.
1495 1502
1503@cindex mode, Visual Line
1496@cindex Visual Line mode 1504@cindex Visual Line mode
1497@findex visual-line-mode 1505@findex visual-line-mode
1498@findex global-visual-line-mode 1506@findex global-visual-line-mode
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index e7e0feb9e88..005215de645 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -261,6 +261,7 @@ Basic Editing Commands
261 261
262The Minibuffer 262The Minibuffer
263 263
264* Basic Minibuffer:: Basic usage of the minibuffer.
264* Minibuffer File:: Entering file names with the minibuffer. 265* Minibuffer File:: Entering file names with the minibuffer.
265* Minibuffer Edit:: How to edit in the minibuffer. 266* Minibuffer Edit:: How to edit in the minibuffer.
266* Completion:: An abbreviation facility for minibuffer input. 267* Completion:: An abbreviation facility for minibuffer input.
@@ -1402,7 +1403,7 @@ Martin Lorentzon, Dave Love, Eric Ludlam, Károly L@H{o}rentey, Sascha
1402Lüdecke, Greg McGary, Roland McGrath, Michael McNamara, Alan Mackenzie, 1403Lüdecke, Greg McGary, Roland McGrath, Michael McNamara, Alan Mackenzie,
1403Christopher J.@: Madsen, Neil M.@: Mager, Ken Manheimer, Bill Mann, 1404Christopher J.@: Madsen, Neil M.@: Mager, Ken Manheimer, Bill Mann,
1404Brian Marick, Simon Marshall, Bengt Martensson, Charlie Martin, 1405Brian Marick, Simon Marshall, Bengt Martensson, Charlie Martin,
1405Yukihiro Matsumoto, David Maus, Thomas May, Will Mengarini, David 1406Yukihiro Matsumoto, Tomohiro Matsuyama, David Maus, Thomas May, Will Mengarini, David
1406Megginson, Stefan Merten, Ben A.@: Mesander, Wayne Mesard, Brad 1407Megginson, Stefan Merten, Ben A.@: Mesander, Wayne Mesard, Brad
1407Miller, Lawrence Mitchell, Richard Mlynarik, Gerd Moellmann, Stefan 1408Miller, Lawrence Mitchell, Richard Mlynarik, Gerd Moellmann, Stefan
1408Monnier, Keith Moore, Jan Moringen, Morioka Tomohiko, Glenn Morris, 1409Monnier, Keith Moore, Jan Moringen, Morioka Tomohiko, Glenn Morris,
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 36cd3658e2d..8b609891caf 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -1341,7 +1341,7 @@ contents of the hunk.
1341 You can edit a Diff mode buffer like any other buffer. (If it is 1341 You can edit a Diff mode buffer like any other buffer. (If it is
1342read-only, you need to make it writable first. @xref{Misc Buffer}.) 1342read-only, you need to make it writable first. @xref{Misc Buffer}.)
1343Whenever you change a hunk, Diff mode attempts to automatically 1343Whenever you change a hunk, Diff mode attempts to automatically
1344correct the line numbers in the hunk headers, to ensure that the diff 1344correct the line numbers in the hunk headers, to ensure that the patch
1345remains ``correct''. To disable automatic line number correction, 1345remains ``correct''. To disable automatic line number correction,
1346change the variable @code{diff-update-on-the-fly} to @code{nil}. 1346change the variable @code{diff-update-on-the-fly} to @code{nil}.
1347 1347
@@ -1470,11 +1470,22 @@ name from the patch itself. This is useful for making log entries for
1470functions that are deleted by the patch. 1470functions that are deleted by the patch.
1471@end table 1471@end table
1472 1472
1473 By default, Diff mode highlights trailing whitespace on modified 1473@c Trailing whitespace is NOT shown by default.
1474lines, so that they are more obvious. This is done by enabling 1474@c Emacs's dir-locals file enables this (for some reason).
1475Whitespace mode in the Diff buffer (@pxref{Useless Whitespace}). Diff 1475@cindex trailing whitespace, in patches
1476mode buffers are set up so that Whitespace mode avoids highlighting 1476@findex diff-delete-trailing-whitespace
1477trailing whitespace occurring in the diff context. 1477 Patches sometimes include trailing whitespace on modified lines, as
1478an unintentional and undesired change. There are two ways to deal
1479with this problem. Firstly, if you enable Whitespace mode in a Diff
1480buffer (@pxref{Useless Whitespace}), it automatically highlights
1481trailing whitespace in modified lines. Secondly, you can use the
1482command @kbd{M-x diff-delete-trailing-whitespace}, which searches for
1483trailing whitespace in the lines modified by the patch, and removes
1484that whitespace in both the patch and the patched source file(s).
1485This command does not save the modifications that it makes, so you can
1486decide whether to save the changes (the list of modified files is
1487displayed in the echo area). With a prefix argument, it tries to
1488modify the original source files rather than the patched source files.
1478 1489
1479@node Misc File Ops 1490@node Misc File Ops
1480@section Miscellaneous File Operations 1491@section Miscellaneous File Operations
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index e5a84bda56d..ebccedacc05 100644
--- a/doc/emacs/mini.texi
+++ b/doc/emacs/mini.texi
@@ -13,24 +13,54 @@ special-purpose buffer with a small amount of screen space. You can
13use the usual Emacs editing commands in the minibuffer to edit the 13use the usual Emacs editing commands in the minibuffer to edit the
14argument text. 14argument text.
15 15
16@menu
17* Basic Minibuffer:: Basic usage of the minibuffer.
18* Minibuffer File:: Entering file names with the minibuffer.
19* Minibuffer Edit:: How to edit in the minibuffer.
20* Completion:: An abbreviation facility for minibuffer input.
21* Minibuffer History:: Reusing recent minibuffer arguments.
22* Repetition:: Re-executing commands that used the minibuffer.
23* Passwords:: Entering passwords in the echo area.
24* Yes or No Prompts:: Replying yes or no in the echo area.
25@end menu
26
27@node Basic Minibuffer
28@section Using the Minibuffer
29
16@cindex prompt 30@cindex prompt
17 When the minibuffer is in use, it appears in the echo area, with a 31 When the minibuffer is in use, it appears in the echo area, with a
18cursor. The minibuffer starts with a @dfn{prompt} in a distinct 32cursor. The minibuffer starts with a @dfn{prompt}, usually ending
19color, usually ending with a colon. The prompt states what kind of 33with a colon. The prompt states what kind of input is expected, and
20input is expected, and how it will be used. 34how it will be used. The prompt is highlighted using the
35@code{minibuffer-prompt} face (@pxref{Faces}).
21 36
22 The simplest way to enter a minibuffer argument is to type the text, 37 The simplest way to enter a minibuffer argument is to type the text,
23then @key{RET} to submit the argument and exit the minibuffer. You 38then @key{RET} to submit the argument and exit the minibuffer.
24can cancel the minibuffer, and the command that wants the argument, by 39Alternatively, you can type @kbd{C-g} to exit the minibuffer by
25typing @kbd{C-g}. 40cancelling the command asking for the argument (@pxref{Quitting}).
26 41
27@cindex default argument 42@cindex default argument
28 Sometimes, a @dfn{default argument} appears in the prompt, inside 43 Sometimes, the prompt shows a @dfn{default argument}, inside
29parentheses before the colon. This default will be used as the 44parentheses before the colon. This default will be used as the
30argument if you just type @key{RET}. For example, commands that read 45argument if you just type @key{RET}. For example, commands that read
31buffer names usually show a buffer name as the default; you can type 46buffer names usually show a buffer name as the default; you can type
32@key{RET} to operate on that default buffer. 47@key{RET} to operate on that default buffer.
33 48
49@cindex Minibuffer Electric Default mode
50@cindex mode, Minibuffer Electric Default
51@findex minibuffer-electric-default-mode
52@vindex minibuffer-eldef-shorten-default
53 If you enable Minibuffer Electric Default mode, a global minor mode,
54Emacs hides the default argument as soon as you modify the contents of
55the minibuffer (since typing @key{RET} would no longer submit that
56default). If you ever bring back the original minibuffer text, the
57prompt again shows the default. Furthermore, if you change the
58variable @code{minibuffer-eldef-shorten-default} to a non-@code{nil}
59value, the default argument is displayed as @samp{[@var{default}]}
60instead of @samp{(default @var{default})}, saving some screen space.
61To enable this minor mode, type @kbd{M-x
62minibuffer-electric-default-mode}.
63
34 Since the minibuffer appears in the echo area, it can conflict with 64 Since the minibuffer appears in the echo area, it can conflict with
35other uses of the echo area. If an error message or an informative 65other uses of the echo area. If an error message or an informative
36message is emitted while the minibuffer is active, the message hides 66message is emitted while the minibuffer is active, the message hides
@@ -38,16 +68,6 @@ the minibuffer for a few seconds, or until you type something; then
38the minibuffer comes back. While the minibuffer is in use, keystrokes 68the minibuffer comes back. While the minibuffer is in use, keystrokes
39do not echo. 69do not echo.
40 70
41@menu
42* Minibuffer File:: Entering file names with the minibuffer.
43* Minibuffer Edit:: How to edit in the minibuffer.
44* Completion:: An abbreviation facility for minibuffer input.
45* Minibuffer History:: Reusing recent minibuffer arguments.
46* Repetition:: Re-executing commands that used the minibuffer.
47* Passwords:: Entering passwords in the echo area.
48* Yes or No Prompts:: Replying yes or no in the echo area.
49@end menu
50
51@node Minibuffer File 71@node Minibuffer File
52@section Minibuffers for File Names 72@section Minibuffers for File Names
53 73
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 4f0a1009e30..244920a23ae 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1186,30 +1186,39 @@ underlying shell, of course.
1186@subsection Emacs Terminal Emulator 1186@subsection Emacs Terminal Emulator
1187@findex term 1187@findex term
1188 1188
1189 To run a subshell in a terminal emulator, use @kbd{M-x term}. This 1189 To run a subshell in a text terminal emulator, use @kbd{M-x term}.
1190creates (or reuses) a buffer named @file{*terminal*}, and runs a 1190This creates (or reuses) a buffer named @file{*terminal*}, and runs a
1191subshell with input coming from your keyboard, and output going to 1191subshell with input coming from your keyboard, and output going to
1192that buffer. 1192that buffer.
1193 1193
1194@cindex line mode @r{(terminal emulator)}
1195@cindex char mode @r{(terminal emulator)}
1194 The terminal emulator uses Term mode, which has two input modes. In 1196 The terminal emulator uses Term mode, which has two input modes. In
1195line mode, Term basically acts like Shell mode (@pxref{Shell Mode}). 1197@dfn{line mode}, Term basically acts like Shell mode (@pxref{Shell
1196 1198Mode}). In @dfn{char mode}, each character is sent directly to the
1197 In char mode, each character is sent directly to the subshell, as 1199subshell, as terminal input; the sole exception is the terminal escape
1198``terminal input''. Any ``echoing'' of your input is the 1200character, which by default is @kbd{C-c} (@pxref{Term Mode}). Any
1199responsibility of the subshell. The sole exception is the terminal 1201echoing of your input is the responsibility of the subshell; any
1200escape character, which by default is @kbd{C-c} (@pxref{Term Mode}). 1202terminal output from the subshell goes into the buffer, advancing
1201Any ``terminal output'' from the subshell goes into the buffer, 1203point.
1202advancing point.
1203 1204
1204 Some programs (such as Emacs itself) need to control the appearance 1205 Some programs (such as Emacs itself) need to control the appearance
1205on the terminal screen in detail. They do this by sending special 1206of the terminal screen in detail. They do this by emitting special
1206control codes. The exact control codes needed vary from terminal to 1207control codes. Term mode recognizes and handles ANSI-standard
1207terminal, but nowadays most terminals and terminal emulators 1208VT100-style escape sequences, which are accepted by most modern
1208(including @code{xterm}) understand the ANSI-standard (VT100-style) 1209terminals, including @command{xterm}. (Hence, you can actually run
1209escape sequences. Term mode recognizes these escape sequences, and 1210Emacs inside an Emacs Term window.)
1210handles each one appropriately, changing the buffer so that the 1211
1211appearance of the window matches what it would be on a real terminal. 1212 The @code{term} face specifies the default appearance of text
1212You can actually run Emacs inside an Emacs Term window. 1213in the terminal emulator (the default is the same appearance as the
1214@code{default} face). When terminal control codes are used to change
1215the appearance of text, these are represented in the terminal emulator
1216by the faces @code{term-color-black}, @code{term-color-red},
1217@code{term-color-green}, @code{term-color-yellow}
1218@code{term-color-blue}, @code{term-color-magenta},
1219@code{term-color-cyan}, @code{term-color-white},
1220@code{term-color-underline}, and @code{term-color-bold}.
1221@xref{Faces}.
1213 1222
1214 You can also Term mode to communicate with a device connected to a 1223 You can also Term mode to communicate with a device connected to a
1215serial port. @xref{Serial Terminal}. 1224serial port. @xref{Serial Terminal}.
@@ -1224,6 +1233,9 @@ examining your input. But some shells can tell Term what the current
1224directory is. This is done automatically by @code{bash} version 1.15 1233directory is. This is done automatically by @code{bash} version 1.15
1225and later. 1234and later.
1226 1235
1236
1237
1238
1227@node Term Mode 1239@node Term Mode
1228@subsection Term Mode 1240@subsection Term Mode
1229@cindex Term mode 1241@cindex Term mode
diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi
index fc99ff3d7bf..1a891a62b33 100644
--- a/doc/emacs/trouble.texi
+++ b/doc/emacs/trouble.texi
@@ -275,24 +275,25 @@ will disappear from the mode line. That means you can safely go on
275editing in the same Emacs session. 275editing in the same Emacs session.
276 276
277 Do not use @kbd{M-x buffer-menu} to save or kill buffers when you run 277 Do not use @kbd{M-x buffer-menu} to save or kill buffers when you run
278out of memory, because the buffer menu needs a fair amount of memory 278out of memory, because the Buffer Menu needs a fair amount of memory
279itself, and the reserve supply may not be enough. 279itself, and the reserve supply may not be enough.
280 280
281@node Crashing 281@node Crashing
282@subsection When Emacs Crashes 282@subsection When Emacs Crashes
283 283
284 Emacs is not supposed to crash, but if it does, before it exits it 284@cindex crash report
285reports a brief summary of the crash to the standard error stream 285 Emacs is not supposed to crash, but if it does, it produces a
286@code{stderr}. If enabled, a crashed Emacs also generates a core dump 286@dfn{crash report} prior to exiting. The crash report is printed to
287containing voluminous data about the crash. On many platforms you can 287the standard error stream. If Emacs was started from a graphical
288enable core dumps by putting the shell command @samp{ulimit -c unlimited} 288desktop, the standard error stream is commonly redirected to a file
289into your shell startup script. The crash report and core dump can be 289such as @file{~/.xsession-errors}, so you can look for the crash
290used when debugging the same version of Emacs on the same platform. 290report there.
291 291
292The format of the crash report depends on the platform, and some 292 The format of the crash report depends on the platform. On some
293platforms support backtraces. 293platforms, such as those using the GNU C Library, the crash report
294Here is an example, generated on x86-64 GNU/Linux with version 2.15 of 294includes a @dfn{backtrace} describing the execution state prior to
295the GNU C Library: 295crashing, which can be used to help debug the crash. Here is an
296example:
296 297
297@example 298@example
298Fatal error 11: Segmentation fault 299Fatal error 11: Segmentation fault
@@ -304,25 +305,18 @@ emacs[0x4ed504]
304/lib64/libpthread.so.0(read+0xe)[0x375220e08e] 305/lib64/libpthread.so.0(read+0xe)[0x375220e08e]
305emacs[0x509af6] 306emacs[0x509af6]
306emacs[0x5acc26] 307emacs[0x5acc26]
307emacs[0x5adbfb] 308@dots{}
308emacs[0x56566b]
309emacs[0x59bac3]
310emacs[0x565151]
311...
312@end example 309@end example
313 310
314@noindent 311@noindent
315The number @samp{11} is the system signal number that corresponds to 312The number @samp{11} is the system signal number corresponding to the
316the problem, a segmentation fault here. The three dots at the end 313crash---in this case a segmentation fault. The hexadecimal numbers
317indicate that Emacs suppressed further backtrace entries, in the 314are program addresses, which can be associated with source code lines
318interest of brevity. 315using a debugging tool. For example, the GDB command
319 316@samp{list *0x509af6} prints the source-code lines corresponding to
320The hexadecimal program addresses can be useful in debugging sessions. 317the @samp{emacs[0x509af6]} entry. If your system has the
321For example, the GDB command @samp{list *0x509af6} prints the 318@command{addr2line} utility, the following shell command outputs a
322source-code lines corresponding to the @samp{emacs[0x509af6]} entry in 319backtrace with source-code line numbers:
323the backtrace. Or, if your system has @command{addr2line}, the
324following shell command outputs a backtrace with source-code line
325numbers:
326 320
327@example 321@example
328sed -n 's/.*\[\(.*\)]$/\1/p' @var{backtrace} | 322sed -n 's/.*\[\(.*\)]$/\1/p' @var{backtrace} |
@@ -334,6 +328,15 @@ Here, @var{backtrace} is the name of a text file containing a copy of
334the backtrace, and @var{bindir} is the name of the directory that 328the backtrace, and @var{bindir} is the name of the directory that
335contains the Emacs executable. 329contains the Emacs executable.
336 330
331@cindex core dump
332 Optionally, Emacs can generate a @dfn{core dump} when it crashes. A
333core dump is a file containing voluminous data about the state of the
334program prior to the crash, usually examined by loading it into a
335debugger such as GDB. On many platforms, core dumps are disabled by
336default, and you must explicitly enable them by running the shell
337command @samp{ulimit -c unlimited} (e.g.@: in your shell startup
338script).
339
337@node After a Crash 340@node After a Crash
338@subsection Recovery After a Crash 341@subsection Recovery After a Crash
339 342
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index f5aad901d44..7eb75ceac55 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,39 @@
12012-11-10 Martin Rudalics <rudalics@gmx.at>
2
3 * elisp.texi (Top): Add Recombining Windows to menu.
4 * windows.texi (Recombining Windows): New subsection.
5 (Splitting Windows): Rewrite text on handling of window
6 combinations and move it to new subsection.
7
82012-11-10 Chong Yidong <cyd@gnu.org>
9
10 * searching.texi (Replacing Match): Document \? in replace-match.
11
12 * variables.texi (Creating Buffer-Local): Document setq-local and
13 defvar-local.
14 (Setting Generalized Variables): Arrange table alphabetically.
15
16 * lists.texi (List Elements, List Variables): Clarify descriptions
17 of push and pop for generalized variables.
18
19 * edebug.texi (Specification List): setf is no longer CL-only.
20
212012-11-10 Glenn Morris <rgm@gnu.org>
22
23 * variables.texi (Adding Generalized Variables):
24 Update description of FIX-RETURN expansion.
25
26 * variables.texi (Setting Generalized Variables):
27 Split most of previous contents into this subsection.
28 (Adding Generalized Variables): New subsection.
29 Move note on lack of setf functions here from misc/cl.texi.
30
31 * elisp.texi: Add Generalized Variables subsections to detailed menu.
32
332012-11-10 Chong Yidong <cyd@gnu.org>
34
35 * frames.texi (Initial Parameters): Doc fix (Bug#12144).
36
12012-11-08 Michael Albinus <michael.albinus@gmx.de> 372012-11-08 Michael Albinus <michael.albinus@gmx.de>
2 38
3 * os.texi (Notifications): Update descriptions of 39 * os.texi (Notifications): Update descriptions of
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi
index 0211f9e1b9c..b5edda06bad 100644
--- a/doc/lispref/edebug.texi
+++ b/doc/lispref/edebug.texi
@@ -1211,9 +1211,7 @@ A single unevaluated Lisp object, which is not instrumented.
1211A single evaluated expression, which is instrumented. 1211A single evaluated expression, which is instrumented.
1212 1212
1213@item place 1213@item place
1214@c I can't see that this index entry is useful without any explanation. 1214A generalized variable. @xref{Generalized Variables}.
1215@c @findex edebug-unwrap
1216A place to store a value, as in the Common Lisp @code{setf} construct.
1217 1215
1218@item body 1216@item body
1219Short for @code{&rest form}. See @code{&rest} below. 1217Short for @code{&rest form}. See @code{&rest} below.
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 06a2ebfcaf8..a70558bf09f 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -502,6 +502,11 @@ Buffer-Local Variables
502* Default Value:: The default value is seen in buffers 502* Default Value:: The default value is seen in buffers
503 that don't have their own buffer-local values. 503 that don't have their own buffer-local values.
504 504
505Generalized Variables
506
507* Setting Generalized Variables:: The @code{setf} macro.
508* Adding Generalized Variables:: Defining new @code{setf} forms.
509
505Functions 510Functions
506 511
507* What Is a Function:: Lisp functions vs. primitives; terminology. 512* What Is a Function:: Lisp functions vs. primitives; terminology.
@@ -996,6 +1001,8 @@ Windows
996* Resizing Windows:: Changing the sizes of windows. 1001* Resizing Windows:: Changing the sizes of windows.
997* Splitting Windows:: Splitting one window into two windows. 1002* Splitting Windows:: Splitting one window into two windows.
998* Deleting Windows:: Deleting a window gives its space to other windows. 1003* Deleting Windows:: Deleting a window gives its space to other windows.
1004* Recombining Windows:: Preserving the frame layout when splitting and
1005 deleting windows.
999* Selecting Windows:: The selected window is the one that you edit in. 1006* Selecting Windows:: The selected window is the one that you edit in.
1000* Cyclic Window Ordering:: Moving around the existing windows. 1007* Cyclic Window Ordering:: Moving around the existing windows.
1001* Buffers and Windows:: Each window displays the contents of a buffer. 1008* Buffers and Windows:: Each window displays the contents of a buffer.
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index f58d62675e5..27d55c4fdb9 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -419,16 +419,16 @@ the initial frame, specify the same parameters in
419@code{initial-frame-alist} with values that match the X resources. 419@code{initial-frame-alist} with values that match the X resources.
420@end defopt 420@end defopt
421 421
422If these parameters specify a separate @dfn{minibuffer-only frame} with
423@code{(minibuffer . nil)}, and you have not created one, Emacs creates
424one for you.
425
426@cindex minibuffer-only frame 422@cindex minibuffer-only frame
423If these parameters include @code{(minibuffer . nil)}, that indicates
424that the initial frame should have no minibuffer. In this case, Emacs
425creates a separate @dfn{minibuffer-only frame} as well.
426
427@defopt minibuffer-frame-alist 427@defopt minibuffer-frame-alist
428This variable's value is an alist of parameter values used when 428This variable's value is an alist of parameter values used when
429creating an initial minibuffer-only frame. This is the 429creating an initial minibuffer-only frame (i.e.@: the minibuffer-only
430minibuffer-only frame that Emacs creates if @code{initial-frame-alist} 430frame that Emacs creates if @code{initial-frame-alist} specifies a
431specifies a frame with no minibuffer. 431frame with no minibuffer).
432@end defopt 432@end defopt
433 433
434@defopt default-frame-alist 434@defopt default-frame-alist
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index 458db838177..40e8d08f72c 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -234,17 +234,15 @@ This is in contrast to @code{cdr}, which signals an error if
234@end defun 234@end defun
235 235
236@defmac pop listname 236@defmac pop listname
237This macro is a way of examining the @sc{car} of a list, 237This macro provides a convenient way to examine the @sc{car} of a
238and taking it off the list, all at once. 238list, and take it off the list, all at once. It operates on the list
239@c FIXME I don't think is a particularly good way to do it, 239stored in @var{listname}. It removes the first element from the list,
240@c but generalized variables have not been introduced yet. 240saves the @sc{cdr} into @var{listname}, then returns the removed
241(In fact, this macro can act on generalized variables, not just lists. 241element.
242@xref{Generalized Variables}.) 242
243 243In the simplest case, @var{listname} is an unquoted symbol naming a
244It operates on the list which is stored in the symbol @var{listname}. 244list; in that case, this macro is equivalent to @w{@code{(prog1
245It removes this element from the list by setting @var{listname} 245(car listname) (setq listname (cdr listname)))}}.
246to the @sc{cdr} of its old value---but it also returns the @sc{car}
247of that list, which is the element being removed.
248 246
249@example 247@example
250x 248x
@@ -255,7 +253,10 @@ x
255 @result{} (b c) 253 @result{} (b c)
256@end example 254@end example
257 255
258@noindent 256More generally, @var{listname} can be a generalized variable. In that
257case, this macro saves into @var{listname} using @code{setf}.
258@xref{Generalized Variables}.
259
259For the @code{push} macro, which adds an element to a list, 260For the @code{push} macro, which adds an element to a list,
260@xref{List Variables}. 261@xref{List Variables}.
261@end defmac 262@end defmac
@@ -683,13 +684,12 @@ Some examples:
683 These functions, and one macro, provide convenient ways 684 These functions, and one macro, provide convenient ways
684to modify a list which is stored in a variable. 685to modify a list which is stored in a variable.
685 686
686@defmac push newelt listname 687@defmac push element listname
687This macro provides an alternative way to write 688This macro creates a new list whose @sc{car} is @var{element} and
688@code{(setq @var{listname} (cons @var{newelt} @var{listname}))}. 689whose @sc{cdr} is the list specified by @var{listname}, and saves that
689@c FIXME I don't think is a particularly good way to do it, 690list in @var{listname}. In the simplest case, @var{listname} is an
690@c but generalized variables have not been introduced yet. 691unquoted symbol naming a list, and this macro is equivalent
691(In fact, this macro can act on generalized variables, not just lists. 692to @w{@code{(setq @var{listname} (cons @var{element} @var{listname}))}}.
692@xref{Generalized Variables}.)
693 693
694@example 694@example
695(setq l '(a b)) 695(setq l '(a b))
@@ -700,7 +700,11 @@ l
700 @result{} (c a b) 700 @result{} (c a b)
701@end example 701@end example
702 702
703@noindent 703More generally, @code{listname} can be a generalized variable. In
704that case, this macro does the equivalent of @w{@code{(setf
705@var{listname} (cons @var{element} @var{listname}))}}.
706@xref{Generalized Variables}.
707
704For the @code{pop} macro, which removes the first element from a list, 708For the @code{pop} macro, which removes the first element from a list,
705@xref{List Elements}. 709@xref{List Elements}.
706@end defmac 710@end defmac
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 56c96363e81..f165381a0f8 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -1310,22 +1310,31 @@ part of one of the following sequences:
1310@table @asis 1310@table @asis
1311@item @samp{\&} 1311@item @samp{\&}
1312@cindex @samp{&} in replacement 1312@cindex @samp{&} in replacement
1313@samp{\&} stands for the entire text being replaced. 1313This stands for the entire text being replaced.
1314 1314
1315@item @samp{\@var{n}} 1315@item @samp{\@var{n}}, where @var{n} is a digit
1316@cindex @samp{\@var{n}} in replacement 1316@cindex @samp{\@var{n}} in replacement
1317@samp{\@var{n}}, where @var{n} is a digit, stands for the text that 1317This stands for the text that matched the @var{n}th subexpression in
1318matched the @var{n}th subexpression in the original regexp. 1318the original regexp. Subexpressions are those expressions grouped
1319Subexpressions are those expressions grouped inside @samp{\(@dots{}\)}. 1319inside @samp{\(@dots{}\)}. If the @var{n}th subexpression never
1320If the @var{n}th subexpression never matched, an empty string is substituted. 1320matched, an empty string is substituted.
1321 1321
1322@item @samp{\\} 1322@item @samp{\\}
1323@cindex @samp{\} in replacement 1323@cindex @samp{\} in replacement
1324@samp{\\} stands for a single @samp{\} in the replacement text. 1324This stands for a single @samp{\} in the replacement text.
1325
1326@item @samp{\?}
1327This stands for itself (for compatibility with @code{replace-regexp}
1328and related commands; @pxref{Regexp Replacement,,, emacs, The GNU
1329Emacs Manual}).
1325@end table 1330@end table
1326 1331
1327These substitutions occur after case conversion, if any, 1332@noindent
1328so the strings they substitute are never case-converted. 1333Any other character following @samp{\} signals an error.
1334
1335The substitutions performed by @samp{\&} and @samp{\@var{n}} occur
1336after case conversion, if any. Therefore, the strings they substitute
1337are never case-converted.
1329 1338
1330If @var{subexp} is non-@code{nil}, that says to replace just 1339If @var{subexp} is non-@code{nil}, that says to replace just
1331subexpression number @var{subexp} of the regexp that was matched, not 1340subexpression number @var{subexp} of the regexp that was matched, not
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index 88b7909126e..c8451527d4f 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -1262,6 +1262,13 @@ needed if you use the @var{local} argument to @code{add-hook} or
1262@code{remove-hook}. 1262@code{remove-hook}.
1263@end deffn 1263@end deffn
1264 1264
1265@defmac setq-local variable value
1266This macro creates a buffer-local binding in the current buffer for
1267@var{variable}, and gives it the buffer-local value @var{value}. It
1268is equivalent to calling @code{make-local-variable} followed by
1269@code{setq}. @var{variable} should be an unquoted symbol.
1270@end defmac
1271
1265@deffn Command make-variable-buffer-local variable 1272@deffn Command make-variable-buffer-local variable
1266This function marks @var{variable} (a symbol) automatically 1273This function marks @var{variable} (a symbol) automatically
1267buffer-local, so that any subsequent attempt to set it will make it 1274buffer-local, so that any subsequent attempt to set it will make it
@@ -1297,6 +1304,14 @@ on having separate values in separate buffers, then using
1297@code{make-variable-buffer-local} can be the best solution. 1304@code{make-variable-buffer-local} can be the best solution.
1298@end deffn 1305@end deffn
1299 1306
1307@defmac defvar-local variable value &optional docstring
1308This macro defines @var{variable} as a variable with initial value
1309@var{value} and @var{docstring}, and marks it as automatically
1310buffer-local. It is equivalent to calling @code{defvar} followed by
1311@code{make-variable-buffer-local}. @var{variable} should be an
1312unquoted symbol.
1313@end defmac
1314
1300@defun local-variable-p variable &optional buffer 1315@defun local-variable-p variable &optional buffer
1301This returns @code{t} if @var{variable} is buffer-local in buffer 1316This returns @code{t} if @var{variable} is buffer-local in buffer
1302@var{buffer} (which defaults to the current buffer); otherwise, 1317@var{buffer} (which defaults to the current buffer); otherwise,
@@ -1948,7 +1963,6 @@ Attempting to assign them any other value will result in an error:
1948@error{} Wrong type argument: integerp, 1000.0 1963@error{} Wrong type argument: integerp, 1000.0
1949@end example 1964@end example
1950 1965
1951@c FIXME? Not sure this is the right place for this section.
1952@node Generalized Variables 1966@node Generalized Variables
1953@section Generalized Variables 1967@section Generalized Variables
1954 1968
@@ -1958,13 +1972,20 @@ a regular Lisp variable. But the @sc{car}s and @sc{cdr}s of lists, elements
1958of arrays, properties of symbols, and many other locations are also 1972of arrays, properties of symbols, and many other locations are also
1959places where Lisp values are stored. 1973places where Lisp values are stored.
1960 1974
1961@c FIXME? Not sure this is a useful analogy...
1962Generalized variables are analogous to ``lvalues'' in the C 1975Generalized variables are analogous to ``lvalues'' in the C
1963language, where @samp{x = a[i]} gets an element from an array 1976language, where @samp{x = a[i]} gets an element from an array
1964and @samp{a[i] = x} stores an element using the same notation. 1977and @samp{a[i] = x} stores an element using the same notation.
1965Just as certain forms like @code{a[i]} can be lvalues in C, there 1978Just as certain forms like @code{a[i]} can be lvalues in C, there
1966is a set of forms that can be generalized variables in Lisp. 1979is a set of forms that can be generalized variables in Lisp.
1967 1980
1981@menu
1982* Setting Generalized Variables:: The @code{setf} macro.
1983* Adding Generalized Variables:: Defining new @code{setf} forms.
1984@end menu
1985
1986@node Setting Generalized Variables
1987@subsection The @code{setf} Macro
1988
1968The @code{setf} macro is the most basic way to operate on generalized 1989The @code{setf} macro is the most basic way to operate on generalized
1969variables. The @code{setf} form is like @code{setq}, except that it 1990variables. The @code{setf} form is like @code{setq}, except that it
1970accepts arbitrary place forms on the left side rather than just 1991accepts arbitrary place forms on the left side rather than just
@@ -1998,14 +2019,16 @@ so there is no performance penalty for using it in compiled code.
1998A call to any of the following standard Lisp functions: 2019A call to any of the following standard Lisp functions:
1999 2020
2000@smallexample 2021@smallexample
2001car cdr nth nthcdr 2022aref cddr symbol-function
2002caar cadr cdar cddr 2023car elt symbol-plist
2003aref elt get gethash 2024caar get symbol-value
2004symbol-function symbol-value symbol-plist 2025cadr gethash
2026cdr nth
2027cdar nthcdr
2005@end smallexample 2028@end smallexample
2006 2029
2007@item 2030@item
2008The following Emacs-specific functions are also @code{setf}-able: 2031A call to any of the following Emacs-specific functions:
2009 2032
2010@smallexample 2033@smallexample
2011default-value process-get 2034default-value process-get
@@ -2022,8 +2045,8 @@ process-filter
2022@end itemize 2045@end itemize
2023 2046
2024@noindent 2047@noindent
2025Using any forms other than these in the @var{place} argument to 2048@code{setf} signals an error if you pass a @var{place} form that it
2026@code{setf} will signal an error. 2049does not know how to handle.
2027 2050
2028@c And for cl-lib's cl-getf. 2051@c And for cl-lib's cl-getf.
2029Note that for @code{nthcdr}, the list argument of the function must 2052Note that for @code{nthcdr}, the list argument of the function must
@@ -2049,3 +2072,81 @@ place can be used to insert or delete at any position in a list.
2049The @file{cl-lib} library defines various extensions for generalized 2072The @file{cl-lib} library defines various extensions for generalized
2050variables, including additional @code{setf} places. 2073variables, including additional @code{setf} places.
2051@xref{Generalized Variables,,, cl, Common Lisp Extensions}. 2074@xref{Generalized Variables,,, cl, Common Lisp Extensions}.
2075
2076
2077@node Adding Generalized Variables
2078@subsection Defining new @code{setf} forms
2079
2080This section describes how to define new forms that @code{setf} can
2081operate on.
2082
2083@defmac gv-define-simple-setter name setter &optional fix-return
2084This macro enables you to easily define @code{setf} methods for simple
2085cases. @var{name} is the name of a function, macro, or special form.
2086You can use this macro whenever @var{name} has a directly
2087corresponding @var{setter} function that updates it, e.g.,
2088@code{(gv-define-simple-setter car setcar)}.
2089
2090This macro translates a call of the form
2091
2092@example
2093(setf (@var{name} @var{args}@dots{}) @var{value})
2094@end example
2095
2096into
2097@example
2098(@var{setter} @var{args}@dots{} @var{value})
2099@end example
2100
2101@noindent
2102Such a @code{setf} call is documented to return @var{value}. This is
2103no problem with, e.g., @code{car} and @code{setcar}, because
2104@code{setcar} returns the value that it set. If your @var{setter}
2105function does not return @var{value}, use a non-@code{nil} value for
2106the @var{fix-return} argument of @code{gv-define-simple-setter}. This
2107expands into something equivalent to
2108@example
2109(let ((temp @var{value}))
2110 (@var{setter} @var{args}@dots{} temp)
2111 temp)
2112@end example
2113so ensuring that it returns the correct result.
2114@end defmac
2115
2116
2117@defmac gv-define-setter name arglist &rest body
2118This macro allows for more complex @code{setf} expansions than the
2119previous form. You may need to use this form, for example, if there
2120is no simple setter function to call, or if there is one but it
2121requires different arguments to the place form.
2122
2123This macro expands the form
2124@code{(setf (@var{name} @var{args}@dots{}) @var{value})} by
2125first binding the @code{setf} argument forms
2126@code{(@var{value} @var{args}@dots{})} according to @var{arglist},
2127and then executing @var{body}. @var{body} should return a Lisp
2128form that does the assignment, and finally returns the value that was
2129set. An example of using this macro is:
2130
2131@example
2132(gv-define-setter caar (val x) `(setcar (car ,x) ,val))
2133@end example
2134@end defmac
2135
2136@c FIXME? Not sure what, if anything, to say about this.
2137@ignore
2138@defmac gv-define-expander name handler
2139This is the most general way to define a new @code{setf} expansion.
2140@end defmac
2141@end ignore
2142
2143@cindex CL note---no @code{setf} functions
2144Common Lisp defines another way to specify the @code{setf} behavior of
2145a function, namely ``@code{setf} functions'', whose names are lists
2146@code{(setf @var{name})} rather than symbols. For example,
2147@code{(defun (setf foo) @dots{})} defines the function that is used
2148when @code{setf} is applied to @code{foo}. Emacs does not support
2149this. It is a compile-time error to use @code{setf} on a form that
2150has not already had an appropriate expansion defined. In Common Lisp,
2151this is not an error since the function @code{(setf @var{func})} might
2152be defined later.
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 2fbb59cd1dd..bb02b1d54fd 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -16,8 +16,10 @@ is displayed in windows.
16* Windows and Frames:: Relating windows to the frame they appear on. 16* Windows and Frames:: Relating windows to the frame they appear on.
17* Window Sizes:: Accessing a window's size. 17* Window Sizes:: Accessing a window's size.
18* Resizing Windows:: Changing the sizes of windows. 18* Resizing Windows:: Changing the sizes of windows.
19* Splitting Windows:: Splitting one window into two windows. 19* Splitting Windows:: Creating a new window.
20* Deleting Windows:: Deleting a window gives its space to other windows. 20* Deleting Windows:: Removing a window from its frame.
21* Recombining Windows:: Preserving the frame layout when splitting and
22 deleting windows.
21* Selecting Windows:: The selected window is the one that you edit in. 23* Selecting Windows:: The selected window is the one that you edit in.
22* Cyclic Window Ordering:: Moving around the existing windows. 24* Cyclic Window Ordering:: Moving around the existing windows.
23* Buffers and Windows:: Each window displays the contents of a buffer. 25* Buffers and Windows:: Each window displays the contents of a buffer.
@@ -587,7 +589,7 @@ function @code{window-resizable} above.
587The choice of which window edges this function alters depends on the 589The choice of which window edges this function alters depends on the
588values of the option @code{window-combination-resize} and the 590values of the option @code{window-combination-resize} and the
589combination limits of the involved windows; in some cases, it may alter 591combination limits of the involved windows; in some cases, it may alter
590both edges. @xref{Splitting Windows}. To resize by moving only the 592both edges. @xref{Recombining Windows}. To resize by moving only the
591bottom or right edge of a window, use the function 593bottom or right edge of a window, use the function
592@code{adjust-window-trailing-edge}, below. 594@code{adjust-window-trailing-edge}, below.
593@end defun 595@end defun
@@ -795,26 +797,169 @@ A new live window @var{W2} is created, to the left of the internal
795window @var{W3}. A new internal window @var{W1} is created, becoming 797window @var{W3}. A new internal window @var{W1} is created, becoming
796the new root window. 798the new root window.
797 799
798@defopt window-combination-resize 800 For interactive use, Emacs provides two commands which always split
799If this variable is @code{nil}, @code{split-window} can only split a 801the selected window. These call @code{split-window} internally.
800window (denoted by @var{window}) if @var{window}'s screen area is large
801enough to accommodate both itself and the new window.
802 802
803If this variable is @code{t}, @code{split-window} tries to resize all 803@deffn Command split-window-right &optional size
804windows that are part of the same combination as @var{window}, in order 804This function splits the selected window into two side-by-side
805to accommodate the new window. In particular, this may allow 805windows, putting the selected window on the left. If @var{size} is
806@code{split-window} to succeed even if @var{window} is a fixed-size 806positive, the left window gets @var{size} columns; if @var{size} is
807window or too small to ordinarily split. Furthermore, subsequently 807negative, the right window gets @minus{}@var{size} columns.
808resizing or deleting @var{window} may resize all other windows in its 808@end deffn
809combination.
810 809
811The default is @code{nil}. Other values are reserved for future use. 810@deffn Command split-window-below &optional size
812The value of this variable is ignored when 811This function splits the selected window into two windows, one above
813@code{window-combination-limit} is non-@code{nil} (see below). 812the other, leaving the upper window selected. If @var{size} is
813positive, the upper window gets @var{size} lines; if @var{size} is
814negative, the lower window gets @minus{}@var{size} lines.
815@end deffn
816
817@defopt split-window-keep-point
818If the value of this variable is non-@code{nil} (the default),
819@code{split-window-below} behaves as described above.
820
821If it is @code{nil}, @code{split-window-below} adjusts point in each
822of the two windows to minimize redisplay. (This is useful on slow
823terminals.) It selects whichever window contains the screen line that
824point was previously on. Note that this only affects
825@code{split-window-below}, not the lower-level @code{split-window}
826function.
814@end defopt 827@end defopt
815 828
816 To illustrate the effect of @code{window-combination-resize}, 829@node Deleting Windows
817consider the following window configuration: 830@section Deleting Windows
831@cindex deleting windows
832
833 @dfn{Deleting} a window removes it from the frame's window tree. If
834the window is a live window, it disappears from the screen. If the
835window is an internal window, its child windows are deleted too.
836
837 Even after a window is deleted, it continues to exist as a Lisp
838object, until there are no more references to it. Window deletion can
839be reversed, by restoring a saved window configuration (@pxref{Window
840Configurations}).
841
842@deffn Command delete-window &optional window
843This function removes @var{window} from display and returns
844@code{nil}. If @var{window} is omitted or @code{nil}, it defaults to
845the selected window. If deleting the window would leave no more
846windows in the window tree (e.g. if it is the only live window in the
847frame), an error is signaled.
848
849By default, the space taken up by @var{window} is given to one of its
850adjacent sibling windows, if any. However, if the variable
851@code{window-combination-resize} is non-@code{nil}, the space is
852proportionally distributed among any remaining windows in the window
853combination. @xref{Recombining Windows}.
854
855The behavior of this function may be altered by the window parameters
856of @var{window}, so long as the variable
857@code{ignore-window-parameters} is @code{nil}. If the value of
858the @code{delete-window} window parameter is @code{t}, this function
859ignores all other window parameters. Otherwise, if the value of the
860@code{delete-window} window parameter is a function, that function is
861called with the argument @var{window}, in lieu of the usual action of
862@code{delete-window}. Otherwise, this function obeys the
863@code{window-atom} or @code{window-side} window parameter, if any.
864@xref{Window Parameters}.
865@end deffn
866
867@deffn Command delete-other-windows &optional window
868This function makes @var{window} fill its frame, by deleting other
869windows as necessary. If @var{window} is omitted or @code{nil}, it
870defaults to the selected window. The return value is @code{nil}.
871
872The behavior of this function may be altered by the window parameters
873of @var{window}, so long as the variable
874@code{ignore-window-parameters} is @code{nil}. If the value of
875the @code{delete-other-windows} window parameter is @code{t}, this
876function ignores all other window parameters. Otherwise, if the value
877of the @code{delete-other-windows} window parameter is a function,
878that function is called with the argument @var{window}, in lieu of the
879usual action of @code{delete-other-windows}. Otherwise, this function
880obeys the @code{window-atom} or @code{window-side} window parameter,
881if any. @xref{Window Parameters}.
882@end deffn
883
884@deffn Command delete-windows-on &optional buffer-or-name frame
885This function deletes all windows showing @var{buffer-or-name}, by
886calling @code{delete-window} on those windows. @var{buffer-or-name}
887should be a buffer, or the name of a buffer; if omitted or @code{nil},
888it defaults to the current buffer. If there are no windows showing
889the specified buffer, this function does nothing. If the specified
890buffer is a minibuffer, an error is signaled.
891
892If there is a dedicated window showing the buffer, and that window is
893the only one on its frame, this function also deletes that frame if it
894is not the only frame on the terminal.
895
896The optional argument @var{frame} specifies which frames to operate
897on:
898
899@itemize @bullet
900@item @code{nil}
901means operate on all frames.
902@item @code{t}
903means operate on the selected frame.
904@item @code{visible}
905means operate on all visible frames.
906@item @code{0}
907means operate on all visible or iconified frames.
908@item A frame
909means operate on that frame.
910@end itemize
911
912Note that this argument does not have the same meaning as in other
913functions which scan all live windows (@pxref{Cyclic Window
914Ordering}). Specifically, the meanings of @code{t} and @code{nil} here
915are the opposite of what they are in those other functions.
916@end deffn
917
918
919@node Recombining Windows
920@section Recombining Windows
921
922When deleting the last sibling of a window @code{W}, its parent window
923is deleted too, with @code{W} replacing it in the window tree. This
924means that @code{W} must be recombined with its parent's siblings to
925form a new window combination (@pxref{Windows and Frames}). In some
926occasions, deleting a live window may even entail the deletion of two
927internal windows.
928
929@smallexample
930@group
931 ______________________________________
932 | ______ ____________________________ |
933 || || __________________________ ||
934 || ||| ___________ ___________ |||
935 || |||| || ||||
936 || ||||____W6_____||_____W7____||||
937 || |||____________W4____________|||
938 || || __________________________ ||
939 || ||| |||
940 || ||| |||
941 || |||____________W5____________|||
942 ||__W2__||_____________W3_____________ |
943 |__________________W1__________________|
944
945@end group
946@end smallexample
947
948@noindent
949Deleting @code{W5} in this configuration normally causes the deletion of
950@code{W3} and @code{W4}. The remaining live windows @code{W2},
951@code{W6} and @code{W7} are recombined to form a new horizontal
952combination with parent @code{W1}.
953
954 Sometimes, however, it makes sense to not delete a parent window like
955@code{W4}. In particular, a parent window should not be removed when it
956was used to preserve a combination embedded in a combination of the same
957type. Such embeddings make sense to assure that when you split a window
958and subsequently delete the new window, Emacs reestablishes the layout
959of the associated frame as it existed before the splitting.
960
961 Consider a scenario starting with two live windows @code{W2} and
962@code{W3} and their parent @code{W1}.
818 963
819@smallexample 964@smallexample
820@group 965@group
@@ -824,10 +969,10 @@ consider the following window configuration:
824 || || 969 || ||
825 || || 970 || ||
826 || || 971 || ||
827 ||_________________W2_________________||
828 | ____________________________________ |
829 || || 972 || ||
830 || || 973 || ||
974 ||_________________W2_________________||
975 | ____________________________________ |
831 || || 976 || ||
832 || || 977 || ||
833 ||_________________W3_________________|| 978 ||_________________W3_________________||
@@ -837,8 +982,7 @@ consider the following window configuration:
837@end smallexample 982@end smallexample
838 983
839@noindent 984@noindent
840If @code{window-combination-resize} is @code{nil}, splitting window 985Split @code{W2} to make a new window @code{W4} as follows.
841@code{W3} leaves the size of @code{W2} unchanged:
842 986
843@smallexample 987@smallexample
844@group 988@group
@@ -846,24 +990,25 @@ If @code{window-combination-resize} is @code{nil}, splitting window
846 | ____________________________________ | 990 | ____________________________________ |
847 || || 991 || ||
848 || || 992 || ||
849 || ||
850 || ||
851 ||_________________W2_________________|| 993 ||_________________W2_________________||
852 | ____________________________________ | 994 | ____________________________________ |
853 || || 995 || ||
854 ||_________________W3_________________||
855 | ____________________________________ |
856 || || 996 || ||
857 ||_________________W4_________________|| 997 ||_________________W4_________________||
998 | ____________________________________ |
999 || ||
1000 || ||
1001 ||_________________W3_________________||
858 |__________________W1__________________| 1002 |__________________W1__________________|
859 1003
860@end group 1004@end group
861@end smallexample 1005@end smallexample
862 1006
863@noindent 1007@noindent
864If @code{window-combination-resize} is @code{t}, splitting @code{W3} 1008Now, when enlarging a window vertically, Emacs tries to obtain the
865instead leaves all three live windows with approximately the same 1009corresponding space from its lower sibling, provided such a window
866height: 1010exists. In our scenario, enlarging @code{W4} will steal space from
1011@code{W3}.
867 1012
868@smallexample 1013@smallexample
869@group 1014@group
@@ -875,36 +1020,119 @@ height:
875 | ____________________________________ | 1020 | ____________________________________ |
876 || || 1021 || ||
877 || || 1022 || ||
1023 || ||
1024 || ||
1025 ||_________________W4_________________||
1026 | ____________________________________ |
878 ||_________________W3_________________|| 1027 ||_________________W3_________________||
1028 |__________________W1__________________|
1029
1030@end group
1031@end smallexample
1032
1033@noindent
1034Deleting @code{W4} will now give its entire space to @code{W2},
1035including the space earlier stolen from @code{W3}.
1036
1037@smallexample
1038@group
1039 ______________________________________
879 | ____________________________________ | 1040 | ____________________________________ |
880 || || 1041 || ||
881 || || 1042 || ||
882 ||_________________W4_________________|| 1043 || ||
1044 || ||
1045 || ||
1046 || ||
1047 || ||
1048 || ||
1049 ||_________________W2_________________||
1050 | ____________________________________ |
1051 ||_________________W3_________________||
883 |__________________W1__________________| 1052 |__________________W1__________________|
884 1053
885@end group 1054@end group
886@end smallexample 1055@end smallexample
887 1056
1057@noindent
1058This can be counterintutive, in particular if @code{W4} were used for
1059displaying a buffer only temporarily (@pxref{Temporary Displays}), and
1060you want to continue working with the initial layout.
1061
1062The behavior can be fixed by making a new parent window when splitting
1063@code{W2}. The variable described next allows to do that.
1064
888@defopt window-combination-limit 1065@defopt window-combination-limit
889If the value of this variable is @code{t}, the @code{split-window} 1066This variable controls whether splitting a window shall make a new
890function always creates a new internal window. If the value is 1067parent window. The following values are recognized:
891@code{nil}, the new live window is allowed to share the existing 1068
1069@table @code
1070@item nil
1071This means that the new live window is allowed to share the existing
892parent window, if one exists, provided the split occurs in the same 1072parent window, if one exists, provided the split occurs in the same
893direction as the existing window combination (otherwise, a new 1073direction as the existing window combination (otherwise, a new internal
894internal window is created anyway). The default is @code{nil}. Other 1074window is created anyway).
895values are reserved for future use. 1075
896 1076@item window-size
897Thus, if the value of this variable is at all times @code{t}, then at 1077In this case @code{display-buffer} makes a new parent window if it is
898all times every window tree is a binary tree (a tree where each window 1078passed a @code{window-height} or @code{window-width} entry in the
899except the root window has exactly one sibling). 1079@var{alist} argument (@pxref{Display Action Functions}).
900 1080
901Furthermore, @code{split-window} calls 1081@item temp-buffer
902@code{set-window-combination-limit} on the newly-created internal 1082This value causes the creation of a new parent window when a window is
903window, recording the current value of this variable. This affects 1083split for showing a temporary buffer (@pxref{Temporary Displays}) only.
904how the window tree is rearranged when the child windows are deleted 1084
905(see below). 1085@item display-buffer
1086This means that when @code{display-buffer} (@pxref{Choosing Window})
1087splits a window it always makes a new parent window.
1088
1089@item t
1090In this case a new parent window is always created when splitting a
1091window. Thus, if the value of this variable is at all times @code{t},
1092then at all times every window tree is a binary tree (a tree where each
1093window except the root window has exactly one sibling).
1094@end table
1095
1096The default is @code{nil}. Other values are reserved for future use.
1097
1098If, as a consequence of this variable's setting, @code{split-window}
1099makes a new parent window, it also calls
1100@code{set-window-combination-limit} (see below) on the newly-created
1101internal window. This affects how the window tree is rearranged when
1102the child windows are deleted (see below).
906@end defopt 1103@end defopt
907 1104
1105 If @code{window-combination-limit} is @code{t}, splitting @code{W2} in
1106the initial configuration of our scenario would have produced this:
1107
1108@smallexample
1109@group
1110 ______________________________________
1111 | ____________________________________ |
1112 || __________________________________ ||
1113 ||| |||
1114 |||________________W2________________|||
1115 || __________________________________ ||
1116 ||| |||
1117 |||________________W4________________|||
1118 ||_________________W5_________________||
1119 | ____________________________________ |
1120 || ||
1121 || ||
1122 ||_________________W3_________________||
1123 |__________________W1__________________|
1124
1125@end group
1126@end smallexample
1127
1128@noindent
1129A new internal window @code{W5} has been created; its children are
1130@code{W2} and the new live window @code{W4}. Now, @code{W2} is the only
1131sibling of @code{W4}, so enlarging @code{W4} will try to shrink
1132@code{W2}, leaving @code{W3} unaffected. Observe that @code{W5}
1133represents a vertical combination of two windows embedded in the
1134vertical combination @code{W1}.
1135
908@cindex window combination limit 1136@cindex window combination limit
909@defun set-window-combination-limit window limit 1137@defun set-window-combination-limit window limit
910This functions sets the @dfn{combination limit} of the window 1138This functions sets the @dfn{combination limit} of the window
@@ -912,25 +1140,52 @@ This functions sets the @dfn{combination limit} of the window
912function @code{window-combination-limit}. See below for its effects; 1140function @code{window-combination-limit}. See below for its effects;
913note that it is only meaningful for internal windows. The 1141note that it is only meaningful for internal windows. The
914@code{split-window} function automatically calls this function, passing 1142@code{split-window} function automatically calls this function, passing
915the value of the variable @code{window-combination-limit} as 1143it @code{t} as @var{limit}, provided the value of the variable
916@var{limit}. 1144@code{window-combination-limit} is @code{t} when it is called.
917@end defun 1145@end defun
918 1146
919@defun window-combination-limit window 1147@defun window-combination-limit window
920This function returns the combination limit for @var{window}. 1148This function returns the combination limit for @var{window}.
921 1149
922The combination limit is meaningful only for an internal window. If 1150The combination limit is meaningful only for an internal window. If it
923it is @code{nil}, then Emacs is allowed to automatically delete 1151is @code{nil}, then Emacs is allowed to automatically delete
924@var{window}, in response to a window deletion, in order to group the 1152@var{window}, in response to a window deletion, in order to group the
925child windows of @var{window} with its sibling windows to form a new 1153child windows of @var{window} with its sibling windows to form a new
926window combination. If the combination limit is @code{t}, the child 1154window combination. If the combination limit is @code{t}, the child
927windows of @var{window} are never automatically re-combined with its 1155windows of @var{window} are never automatically recombined with its
928siblings. 1156siblings.
1157
1158If, in the configuration shown at the beginning of this section, the
1159combination limit of @code{W4} (the parent window of @code{W6} and
1160@code{W7}) is @code{t}, deleting @code{W5} will not implicitly delete
1161@code{W4} too.
929@end defun 1162@end defun
930 1163
931 To illustrate the effect of @code{window-combination-limit}, 1164Alternatively, the problems sketched above can be avoided by always
932consider the following configuration (throughout this example, we will 1165resizing all windows in the same combination whenever one of its windows
933assume that @code{window-combination-resize} is @code{nil}): 1166is split or deleted. This also permits to split windows that would be
1167otherwise too small for such an operation.
1168
1169@defopt window-combination-resize
1170If this variable is @code{nil}, @code{split-window} can only split a
1171window (denoted by @var{window}) if @var{window}'s screen area is large
1172enough to accommodate both itself and the new window.
1173
1174If this variable is @code{t}, @code{split-window} tries to resize all
1175windows that are part of the same combination as @var{window}, in order
1176to accommodate the new window. In particular, this may allow
1177@code{split-window} to succeed even if @var{window} is a fixed-size
1178window or too small to ordinarily split. Furthermore, subsequently
1179resizing or deleting @var{window} may resize all other windows in its
1180combination.
1181
1182The default is @code{nil}. Other values are reserved for future use.
1183The value of this variable is ignored when
1184@code{window-combination-limit} is non-@code{nil}.
1185@end defopt
1186
1187 To illustrate the effect of @code{window-combination-resize}, consider
1188the following frame layout.
934 1189
935@smallexample 1190@smallexample
936@group 1191@group
@@ -940,12 +1195,12 @@ assume that @code{window-combination-resize} is @code{nil}):
940 || || 1195 || ||
941 || || 1196 || ||
942 || || 1197 || ||
943 || ||
944 || ||
945 ||_________________W2_________________|| 1198 ||_________________W2_________________||
946 | ____________________________________ | 1199 | ____________________________________ |
947 || || 1200 || ||
948 || || 1201 || ||
1202 || ||
1203 || ||
949 ||_________________W3_________________|| 1204 ||_________________W3_________________||
950 |__________________W1__________________| 1205 |__________________W1__________________|
951 1206
@@ -953,8 +1208,8 @@ assume that @code{window-combination-resize} is @code{nil}):
953@end smallexample 1208@end smallexample
954 1209
955@noindent 1210@noindent
956If @code{window-combination-limit} is @code{nil}, splitting @code{W2} 1211If @code{window-combination-resize} is @code{nil}, splitting window
957into two windows, one above the other, yields 1212@code{W3} leaves the size of @code{W2} unchanged:
958 1213
959@smallexample 1214@smallexample
960@group 1215@group
@@ -962,171 +1217,50 @@ into two windows, one above the other, yields
962 | ____________________________________ | 1217 | ____________________________________ |
963 || || 1218 || ||
964 || || 1219 || ||
965 ||_________________W2_________________||
966 | ____________________________________ |
967 || || 1220 || ||
968 || || 1221 || ||
969 ||_________________W4_________________|| 1222 ||_________________W2_________________||
970 | ____________________________________ | 1223 | ____________________________________ |
971 || || 1224 || ||
972 || ||
973 ||_________________W3_________________|| 1225 ||_________________W3_________________||
1226 | ____________________________________ |
1227 || ||
1228 ||_________________W4_________________||
974 |__________________W1__________________| 1229 |__________________W1__________________|
975 1230
976@end group 1231@end group
977@end smallexample 1232@end smallexample
978 1233
979@noindent 1234@noindent
980The newly-created window, @code{W4}, shares the same internal window 1235If @code{window-combination-resize} is @code{t}, splitting @code{W3}
981@code{W1}. If @code{W4} is resized, it is allowed to resize the other 1236instead leaves all three live windows with approximately the same
982live window, @code{W3}. 1237height:
983
984 If @code{window-combination-limit} is @code{t}, splitting @code{W2}
985in the initial configuration would instead have produced this:
986 1238
987@smallexample 1239@smallexample
988@group 1240@group
989 ______________________________________ 1241 ______________________________________
990 | ____________________________________ | 1242 | ____________________________________ |
991 || __________________________________ || 1243 || ||
992 ||| ||| 1244 || ||
993 |||________________W2________________||| 1245 ||_________________W2_________________||
994 || __________________________________ ||
995 ||| |||
996 |||________________W4________________|||
997 ||_________________W5_________________||
998 | ____________________________________ | 1246 | ____________________________________ |
999 || || 1247 || ||
1000 || || 1248 || ||
1001 ||_________________W3_________________|| 1249 ||_________________W3_________________||
1250 | ____________________________________ |
1251 || ||
1252 || ||
1253 ||_________________W4_________________||
1002 |__________________W1__________________| 1254 |__________________W1__________________|
1003 1255
1004@end group 1256@end group
1005@end smallexample 1257@end smallexample
1006 1258
1007@noindent 1259@noindent
1008A new internal window @code{W5} has been created; its children are 1260Deleting any of the live windows @code{W2}, @code{W3} or @code{W4} will
1009@code{W2} and the new live window @code{W4}. Now, @code{W2} is the 1261distribute its space proportionally among the two remaining live
1010only sibling of @code{W4}, so resizing @code{W4} will resize 1262windows.
1011@code{W2}, leaving @code{W3} unaffected.
1012
1013 For interactive use, Emacs provides two commands which always split
1014the selected window. These call @code{split-window} internally.
1015
1016@deffn Command split-window-right &optional size
1017This function splits the selected window into two side-by-side
1018windows, putting the selected window on the left. If @var{size} is
1019positive, the left window gets @var{size} columns; if @var{size} is
1020negative, the right window gets @minus{}@var{size} columns.
1021@end deffn
1022
1023@deffn Command split-window-below &optional size
1024This function splits the selected window into two windows, one above
1025the other, leaving the upper window selected. If @var{size} is
1026positive, the upper window gets @var{size} lines; if @var{size} is
1027negative, the lower window gets @minus{}@var{size} lines.
1028@end deffn
1029
1030@defopt split-window-keep-point
1031If the value of this variable is non-@code{nil} (the default),
1032@code{split-window-below} behaves as described above.
1033 1263
1034If it is @code{nil}, @code{split-window-below} adjusts point in each
1035of the two windows to minimize redisplay. (This is useful on slow
1036terminals.) It selects whichever window contains the screen line that
1037point was previously on. Note that this only affects
1038@code{split-window-below}, not the lower-level @code{split-window}
1039function.
1040@end defopt
1041
1042@node Deleting Windows
1043@section Deleting Windows
1044@cindex deleting windows
1045
1046 @dfn{Deleting} a window removes it from the frame's window tree. If
1047the window is a live window, it disappears from the screen. If the
1048window is an internal window, its child windows are deleted too.
1049
1050 Even after a window is deleted, it continues to exist as a Lisp
1051object, until there are no more references to it. Window deletion can
1052be reversed, by restoring a saved window configuration (@pxref{Window
1053Configurations}).
1054
1055@deffn Command delete-window &optional window
1056This function removes @var{window} from display and returns
1057@code{nil}. If @var{window} is omitted or @code{nil}, it defaults to
1058the selected window. If deleting the window would leave no more
1059windows in the window tree (e.g. if it is the only live window in the
1060frame), an error is signaled.
1061
1062By default, the space taken up by @var{window} is given to one of its
1063adjacent sibling windows, if any. However, if the variable
1064@code{window-combination-resize} is non-@code{nil}, the space is
1065proportionally distributed among any remaining windows in the window
1066combination. @xref{Splitting Windows}.
1067
1068The behavior of this function may be altered by the window parameters
1069of @var{window}, so long as the variable
1070@code{ignore-window-parameters} is @code{nil}. If the value of
1071the @code{delete-window} window parameter is @code{t}, this function
1072ignores all other window parameters. Otherwise, if the value of the
1073@code{delete-window} window parameter is a function, that function is
1074called with the argument @var{window}, in lieu of the usual action of
1075@code{delete-window}. Otherwise, this function obeys the
1076@code{window-atom} or @code{window-side} window parameter, if any.
1077@xref{Window Parameters}.
1078@end deffn
1079
1080@deffn Command delete-other-windows &optional window
1081This function makes @var{window} fill its frame, by deleting other
1082windows as necessary. If @var{window} is omitted or @code{nil}, it
1083defaults to the selected window. The return value is @code{nil}.
1084
1085The behavior of this function may be altered by the window parameters
1086of @var{window}, so long as the variable
1087@code{ignore-window-parameters} is @code{nil}. If the value of
1088the @code{delete-other-windows} window parameter is @code{t}, this
1089function ignores all other window parameters. Otherwise, if the value
1090of the @code{delete-other-windows} window parameter is a function,
1091that function is called with the argument @var{window}, in lieu of the
1092usual action of @code{delete-other-windows}. Otherwise, this function
1093obeys the @code{window-atom} or @code{window-side} window parameter,
1094if any. @xref{Window Parameters}.
1095@end deffn
1096
1097@deffn Command delete-windows-on &optional buffer-or-name frame
1098This function deletes all windows showing @var{buffer-or-name}, by
1099calling @code{delete-window} on those windows. @var{buffer-or-name}
1100should be a buffer, or the name of a buffer; if omitted or @code{nil},
1101it defaults to the current buffer. If there are no windows showing
1102the specified buffer, this function does nothing. If the specified
1103buffer is a minibuffer, an error is signaled.
1104
1105If there is a dedicated window showing the buffer, and that window is
1106the only one on its frame, this function also deletes that frame if it
1107is not the only frame on the terminal.
1108
1109The optional argument @var{frame} specifies which frames to operate
1110on:
1111
1112@itemize @bullet
1113@item @code{nil}
1114means operate on all frames.
1115@item @code{t}
1116means operate on the selected frame.
1117@item @code{visible}
1118means operate on all visible frames.
1119@item @code{0}
1120means operate on all visible or iconified frames.
1121@item A frame
1122means operate on that frame.
1123@end itemize
1124
1125Note that this argument does not have the same meaning as in other
1126functions which scan all live windows (@pxref{Cyclic Window
1127Ordering}). Specifically, the meanings of @code{t} and @code{nil} here
1128are the opposite of what they are in those other functions.
1129@end deffn
1130 1264
1131@node Selecting Windows 1265@node Selecting Windows
1132@section Selecting Windows 1266@section Selecting Windows
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 0a32fd82044..2518e72ef1e 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,32 @@
12012-11-10 Chong Yidong <cyd@gnu.org>
2
3 * url.texi (Introduction): Move url-configuration-directory to
4 Customization node.
5 (Parsed URIs): Split into its own node.
6 (URI Encoding): New node.
7 (Defining New URLs): Remove empty chapter.
8 (Retrieving URLs): Add an introduction. Doc fix for url-retrieve.
9 Improve docs for url-queue-*.
10 (Supported URL Types): Copyedits. Delete empty subnodes.
11
12 * url.texi (Introduction): Rename from Getting Started. Rewrite
13 the introduction.
14 (URI Parsing): Rewrite. Omit the obsolete attributes slot.
15
162012-11-10 Glenn Morris <rgm@gnu.org>
17
18 * cl.texi (Obsolete Setf Customization):
19 Revert defsetf example to the more correct let rather than prog1.
20 Give define-modify-macro, defsetf, and define-setf-method
21 gv.el replacements.
22
23 * cl.texi (Overview): Mention EIEIO here, as well as the appendix.
24 (Setf Extensions): Remove obsolete reference.
25 (Obsolete Setf Customization):
26 Move note on lack of setf functions to lispref/variables.texi.
27 Undocument get-setf-method, since it no longer exists.
28 Mention simple defsetf replaced by gv-define-simple-setter.
29
12012-11-03 Glenn Morris <rgm@gnu.org> 302012-11-03 Glenn Morris <rgm@gnu.org>
2 31
3 * cl.texi: Further general copyedits. 32 * cl.texi: Further general copyedits.
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index e182c2600f9..a50be1027f3 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -107,7 +107,8 @@ for various reasons:
107@item 107@item
108Some features are too complex or bulky relative to their benefit 108Some features are too complex or bulky relative to their benefit
109to Emacs Lisp programmers. CLOS and Common Lisp streams are fine 109to Emacs Lisp programmers. CLOS and Common Lisp streams are fine
110examples of this group. 110examples of this group. (The separate package EIEIO implements
111a subset of CLOS functionality. @xref{Top, , Introduction, eieio, EIEIO}.)
111 112
112@item 113@item
113Other features cannot be implemented without modification to the 114Other features cannot be implemented without modification to the
@@ -974,7 +975,7 @@ a
974The generalized variable @code{buffer-substring}, listed above, 975The generalized variable @code{buffer-substring}, listed above,
975also works in this way by replacing a portion of the current buffer. 976also works in this way by replacing a portion of the current buffer.
976 977
977@c FIXME? Also `eq'? (see cl-lib.el) 978@c FIXME? Also `eq'? (see cl-lib.el)
978 979
979@c Currently commented out in cl.el. 980@c Currently commented out in cl.el.
980@ignore 981@ignore
@@ -989,13 +990,10 @@ only interesting when used with places you define yourself with
989@xref{Obsolete Setf Customization}. 990@xref{Obsolete Setf Customization}.
990@end ignore 991@end ignore
991 992
993@c FIXME? Is this still true?
992@item 994@item
993A macro call, in which case the macro is expanded and @code{setf} 995A macro call, in which case the macro is expanded and @code{setf}
994is applied to the resulting form. 996is applied to the resulting form.
995
996@item
997Any form for which a @code{defsetf} or @code{define-setf-method}
998has been made. @xref{Obsolete Setf Customization}.
999@end itemize 997@end itemize
1000 998
1001@c FIXME should this be in lispref? It seems self-evident. 999@c FIXME should this be in lispref? It seems self-evident.
@@ -2867,7 +2865,6 @@ temporary variables.
2867This function creates a new, uninterned symbol (using @code{make-symbol}) 2865This function creates a new, uninterned symbol (using @code{make-symbol})
2868with a unique name. (The name of an uninterned symbol is relevant 2866with a unique name. (The name of an uninterned symbol is relevant
2869only if the symbol is printed.) By default, the name is generated 2867only if the symbol is printed.) By default, the name is generated
2870@c FIXME no longer true?
2871from an increasing sequence of numbers, @samp{G1000}, @samp{G1001}, 2868from an increasing sequence of numbers, @samp{G1000}, @samp{G1001},
2872@samp{G1002}, etc. If the optional argument @var{x} is a string, that 2869@samp{G1002}, etc. If the optional argument @var{x} is a string, that
2873string is used as a prefix instead of @samp{G}. Uninterned symbols 2870string is used as a prefix instead of @samp{G}. Uninterned symbols
@@ -4481,14 +4478,6 @@ The @code{equal} predicate does not distinguish
4481between IEEE floating-point plus and minus zero. The @code{cl-equalp} 4478between IEEE floating-point plus and minus zero. The @code{cl-equalp}
4482predicate has several differences with Common Lisp; @pxref{Predicates}. 4479predicate has several differences with Common Lisp; @pxref{Predicates}.
4483 4480
4484@c FIXME consider moving to lispref
4485@ignore
4486The @code{setf} mechanism is entirely compatible, except that
4487setf-methods return a list of five values rather than five
4488values directly. Also, the new ``@code{setf} function'' concept
4489(typified by @code{(defun (setf foo) @dots{})}) is not implemented.
4490@end ignore
4491
4492The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols} 4481The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols}
4493with no @var{obarray} argument. In Common Lisp, this form would 4482with no @var{obarray} argument. In Common Lisp, this form would
4494iterate over all symbols in all packages. Since Emacs obarrays 4483iterate over all symbols in all packages. Since Emacs obarrays
@@ -4907,15 +4896,17 @@ Common Lisp defines three macros, @code{define-modify-macro},
4907@code{defsetf}, and @code{define-setf-method}, that allow the 4896@code{defsetf}, and @code{define-setf-method}, that allow the
4908user to extend generalized variables in various ways. 4897user to extend generalized variables in various ways.
4909In Emacs, these are obsolete, replaced by various features of 4898In Emacs, these are obsolete, replaced by various features of
4910@file{gv.el} in Emacs 24.3. Many of the implementation 4899@file{gv.el} in Emacs 24.3.
4911details in the following are out-of-date. 4900@xref{Adding Generalized Variables,,,elisp,GNU Emacs Lisp Reference Manual}.
4912@c FIXME this whole section needs updating. 4901
4913 4902
4914@defmac define-modify-macro name arglist function [doc-string] 4903@defmac define-modify-macro name arglist function [doc-string]
4915This macro defines a ``read-modify-write'' macro similar to 4904This macro defines a ``read-modify-write'' macro similar to
4916@code{cl-incf} and @code{cl-decf}. The macro @var{name} is defined 4905@code{cl-incf} and @code{cl-decf}. You can replace this macro
4917to take a @var{place} argument followed by additional arguments 4906with @code{gv-letplace}.
4918described by @var{arglist}. The call 4907
4908The macro @var{name} is defined to take a @var{place} argument
4909followed by additional arguments described by @var{arglist}. The call
4919 4910
4920@example 4911@example
4921(@var{name} @var{place} @var{args}@dots{}) 4912(@var{name} @var{place} @var{args}@dots{})
@@ -4938,8 +4929,8 @@ which in turn is roughly equivalent to
4938For example: 4929For example:
4939 4930
4940@example 4931@example
4941(define-modify-macro cl-incf (&optional (n 1)) +) 4932(define-modify-macro incf (&optional (n 1)) +)
4942(define-modify-macro cl-concatf (&rest args) concat) 4933(define-modify-macro concatf (&rest args) concat)
4943@end example 4934@end example
4944 4935
4945Note that @code{&key} is not allowed in @var{arglist}, but 4936Note that @code{&key} is not allowed in @var{arglist}, but
@@ -4948,16 +4939,31 @@ Note that @code{&key} is not allowed in @var{arglist}, but
4948Most of the modify macros defined by Common Lisp do not exactly 4939Most of the modify macros defined by Common Lisp do not exactly
4949follow the pattern of @code{define-modify-macro}. For example, 4940follow the pattern of @code{define-modify-macro}. For example,
4950@code{push} takes its arguments in the wrong order, and @code{pop} 4941@code{push} takes its arguments in the wrong order, and @code{pop}
4951is completely irregular. You can define these macros ``by hand'' 4942is completely irregular.
4952using @code{get-setf-method}, or consult the source 4943
4953to see how to use the internal @code{setf} building blocks. 4944The above @code{incf} example could be written using
4945@code{gv-letplace} as:
4946@example
4947(defmacro incf (place &optional n)
4948 (gv-letplace (getter setter) place
4949 (macroexp-let2 nil v (or n 1)
4950 (funcall setter `(+ ,v ,getter)))))
4951@end example
4952@ignore
4953(defmacro concatf (place &rest args)
4954 (gv-letplace (getter setter) place
4955 (macroexp-let2 nil v (mapconcat 'identity args "")
4956 (funcall setter `(concat ,getter ,v)))))
4957@end ignore
4954@end defmac 4958@end defmac
4955 4959
4956@defmac defsetf access-fn update-fn 4960@defmac defsetf access-fn update-fn
4957This is the simpler of two @code{defsetf} forms. Where 4961This is the simpler of two @code{defsetf} forms, and is
4958@var{access-fn} is the name of a function which accesses a place, 4962replaced by @code{gv-define-simple-setter}.
4959this declares @var{update-fn} to be the corresponding store 4963
4960function. From now on, 4964With @var{access-fn} the name of a function that accesses a place,
4965this declares @var{update-fn} to be the corresponding store function.
4966From now on,
4961 4967
4962@example 4968@example
4963(setf (@var{access-fn} @var{arg1} @var{arg2} @var{arg3}) @var{value}) 4969(setf (@var{access-fn} @var{arg1} @var{arg2} @var{arg3}) @var{value})
@@ -4972,7 +4978,7 @@ will be expanded to
4972 4978
4973@noindent 4979@noindent
4974The @var{update-fn} is required to be either a true function, or 4980The @var{update-fn} is required to be either a true function, or
4975a macro which evaluates its arguments in a function-like way. Also, 4981a macro that evaluates its arguments in a function-like way. Also,
4976the @var{update-fn} is expected to return @var{value} as its result. 4982the @var{update-fn} is expected to return @var{value} as its result.
4977Otherwise, the above expansion would not obey the rules for the way 4983Otherwise, the above expansion would not obey the rules for the way
4978@code{setf} is supposed to behave. 4984@code{setf} is supposed to behave.
@@ -4988,25 +4994,32 @@ something more like
4988 temp) 4994 temp)
4989@end example 4995@end example
4990 4996
4991Some examples of the use of @code{defsetf}, drawn from the standard 4997Some examples are:
4992suite of setf methods, are:
4993 4998
4994@example 4999@example
4995(defsetf car setcar) 5000(defsetf car setcar)
4996(defsetf symbol-value set)
4997(defsetf buffer-name rename-buffer t) 5001(defsetf buffer-name rename-buffer t)
4998@end example 5002@end example
5003
5004These translate directly to @code{gv-define-simple-setter}:
5005
5006@example
5007(gv-define-simple-setter car setcar)
5008(gv-define-simple-setter buffer-name rename-buffer t)
5009@end example
4999@end defmac 5010@end defmac
5000 5011
5001@defmac defsetf access-fn arglist (store-var) forms@dots{} 5012@defmac defsetf access-fn arglist (store-var) forms@dots{}
5002This is the second, more complex, form of @code{defsetf}. It is 5013This is the second, more complex, form of @code{defsetf}.
5003rather like @code{defmacro} except for the additional @var{store-var} 5014It can be replaced by @code{gv-define-setter}.
5004argument. The @var{forms} should return a Lisp form that stores 5015
5005the value of @var{store-var} into the generalized variable formed 5016This form of @code{defsetf} is rather like @code{defmacro} except for
5006by a call to @var{access-fn} with arguments described by @var{arglist}. 5017the additional @var{store-var} argument. The @var{forms} should
5007The @var{forms} may begin with a string which documents the @code{setf} 5018return a Lisp form that stores the value of @var{store-var} into the
5008method (analogous to the doc string that appears at the front of a 5019generalized variable formed by a call to @var{access-fn} with
5009function). 5020arguments described by @var{arglist}. The @var{forms} may begin with
5021a string which documents the @code{setf} method (analogous to the doc
5022string that appears at the front of a function).
5010 5023
5011For example, the simple form of @code{defsetf} is shorthand for 5024For example, the simple form of @code{defsetf} is shorthand for
5012 5025
@@ -5021,20 +5034,28 @@ macros like @code{cl-incf} that invoke this
5021setf-method will insert temporary variables as needed to make 5034setf-method will insert temporary variables as needed to make
5022sure the apparent order of evaluation is preserved. 5035sure the apparent order of evaluation is preserved.
5023 5036
5024Another example drawn from the standard package: 5037Another standard example:
5025 5038
5026@example 5039@example
5027(defsetf nth (n x) (store) 5040(defsetf nth (n x) (store)
5028 (list 'setcar (list 'nthcdr n x) store)) 5041 `(setcar (nthcdr ,n ,x) ,store))
5042@end example
5043
5044You could write this using @code{gv-define-setter} as:
5045
5046@example
5047(gv-define-setter nth (store n x)
5048 `(setcar (nthcdr ,n ,x) ,store))
5029@end example 5049@end example
5030@end defmac 5050@end defmac
5031 5051
5032@defmac define-setf-method access-fn arglist forms@dots{} 5052@defmac define-setf-method access-fn arglist forms@dots{}
5033This is the most general way to create new place forms. When 5053This is the most general way to create new place forms. You can
5034a @code{setf} to @var{access-fn} with arguments described by 5054replace this by @code{gv-define-setter} or @code{gv-define-expander}.
5035@var{arglist} is expanded, the @var{forms} are evaluated and 5055
5036must return a list of five items: 5056When a @code{setf} to @var{access-fn} with arguments described by
5037@c FIXME Is this still true? 5057@var{arglist} is expanded, the @var{forms} are evaluated and must
5058return a list of five items:
5038 5059
5039@enumerate 5060@enumerate
5040@item 5061@item
@@ -5063,6 +5084,9 @@ This is exactly like the Common Lisp macro of the same name,
5063except that the method returns a list of five values rather 5084except that the method returns a list of five values rather
5064than the five values themselves, since Emacs Lisp does not 5085than the five values themselves, since Emacs Lisp does not
5065support Common Lisp's notion of multiple return values. 5086support Common Lisp's notion of multiple return values.
5087(Note that the @code{setf} implementation provided by @file{gv.el}
5088does not use this five item format. Its use here is only for
5089backwards compatibility.)
5066 5090
5067Once again, the @var{forms} may begin with a documentation string. 5091Once again, the @var{forms} may begin with a documentation string.
5068 5092
@@ -5078,45 +5102,22 @@ turn out to be unnecessary, so there is little reason for the
5078setf-method itself to optimize. 5102setf-method itself to optimize.
5079@end defmac 5103@end defmac
5080 5104
5105@c Removed in Emacs 24.3, not possible to make a compatible replacement.
5106@ignore
5081@defun get-setf-method place &optional env 5107@defun get-setf-method place &optional env
5082This function returns the setf-method for @var{place}, by 5108This function returns the setf-method for @var{place}, by
5083invoking the definition previously recorded by @code{defsetf} 5109invoking the definition previously recorded by @code{defsetf}
5084or @code{define-setf-method}. The result is a list of five 5110or @code{define-setf-method}. The result is a list of five
5085values as described above. You can use this function to build 5111values as described above. You can use this function to build
5086your own @code{cl-incf}-like modify macros. 5112your own @code{cl-incf}-like modify macros.
5087@c These no longer exist.
5088@ignore
5089(Actually, it is better to use the internal functions
5090@code{cl-setf-do-modify} and @code{cl-setf-do-store}, which are a bit
5091easier to use and which also do a number of optimizations; consult the
5092source code for the @code{cl-incf} function for a simple example.)
5093@end ignore
5094 5113
5095The argument @var{env} specifies the ``environment'' to be 5114The argument @var{env} specifies the ``environment'' to be
5096passed on to @code{macroexpand} if @code{get-setf-method} should 5115passed on to @code{macroexpand} if @code{get-setf-method} should
5097need to expand a macro in @var{place}. It should come from 5116need to expand a macro in @var{place}. It should come from
5098an @code{&environment} argument to the macro or setf-method 5117an @code{&environment} argument to the macro or setf-method
5099that called @code{get-setf-method}. 5118that called @code{get-setf-method}.
5100
5101@c FIXME No longer true.
5102See also the source code for the setf-method for
5103@c Also @code{apply}, but that is commented out.
5104@code{substring}, which works by calling @code{get-setf-method} on a
5105simpler case, then massaging the result.
5106@end defun 5119@end defun
5107 5120@end ignore
5108@c FIXME does not belong here any more, maybe in lispref?
5109Modern Common Lisp defines a second, independent way to specify
5110the @code{setf} behavior of a function, namely ``@code{setf}
5111functions'' whose names are lists @code{(setf @var{name})}
5112rather than symbols. For example, @code{(defun (setf foo) @dots{})}
5113defines the function that is used when @code{setf} is applied to
5114@code{foo}. This package does not currently support @code{setf}
5115functions. In particular, it is a compile-time error to use
5116@code{setf} on a form which has not already been @code{defsetf}'d
5117or otherwise declared; in newer Common Lisps, this would not be
5118an error since the function @code{(setf @var{func})} might be
5119defined later.
5120 5121
5121 5122
5122@node GNU Free Documentation License 5123@node GNU Free Documentation License
diff --git a/doc/misc/url.texi b/doc/misc/url.texi
index 898a9994a86..fdb3ab452f2 100644
--- a/doc/misc/url.texi
+++ b/doc/misc/url.texi
@@ -18,7 +18,7 @@
18@end direntry 18@end direntry
19 19
20@copying 20@copying
21This file documents the Emacs Lisp URL loading package. 21This is the manual for the @code{url} Emacs Lisp library.
22 22
23Copyright @copyright{} 1993-1999, 2002, 2004-2012 Free Software Foundation, Inc. 23Copyright @copyright{} 1993-1999, 2002, 2004-2012 Free Software Foundation, Inc.
24 24
@@ -57,10 +57,10 @@ developing GNU and promoting software freedom.''
57@end ifnottex 57@end ifnottex
58 58
59@menu 59@menu
60* Getting Started:: Preparing your program to use URLs. 60* Introduction:: About the @code{url} library.
61* URI Parsing:: Parsing (and unparsing) URIs.
61* Retrieving URLs:: How to use this package to retrieve a URL. 62* Retrieving URLs:: How to use this package to retrieve a URL.
62* Supported URL Types:: Descriptions of URL types currently supported. 63* Supported URL Types:: Descriptions of URL types currently supported.
63* Defining New URLs:: How to define a URL loader for a new protocol.
64* General Facilities:: URLs can be cached, accessed via a gateway 64* General Facilities:: URLs can be cached, accessed via a gateway
65 and tracked in a history list. 65 and tracked in a history list.
66* Customization:: Variables you can alter. 66* Customization:: Variables you can alter.
@@ -70,93 +70,129 @@ developing GNU and promoting software freedom.''
70* Concept Index:: 70* Concept Index::
71@end menu 71@end menu
72 72
73@node Getting Started 73@node Introduction
74@chapter Getting Started 74@chapter Introduction
75@cindex URLs, definition 75@cindex URL
76@cindex URIs 76@cindex URI
77@cindex uniform resource identifier
78@cindex uniform resource locator
77 79
78@dfn{Uniform Resource Locators} (URLs) are a specific form of 80A @dfn{Uniform Resource Identifier} (URI) is a specially-formatted
79@dfn{Uniform Resource Identifiers} (URI) described in RFC 2396 which 81name, such as an Internet address, that identifies some name or
80updates RFC 1738 and RFC 1808. RFC 2016 defines uniform resource 82resource. The format of URIs is described in RFC 3986, which updates
81agents. 83and replaces the earlier RFCs 2732, 2396, 1808, and 1738. A
84@dfn{Uniform Resource Locator} (URL) is an older but still-common
85term, which basically refers to a URI corresponding to a resource that
86can be accessed (usually over a network) in a specific way.
82 87
83URIs have the form @var{scheme}:@var{scheme-specific-part}, where the 88 Here are some examples of URIs (taken from RFC 3986):
84@var{scheme}s supported by this library are described below.
85@xref{Supported URL Types}.
86 89
87FTP, NFS, HTTP, HTTPS, @code{rlogin}, @code{telnet}, tn3270, 90@example
88IRC and gopher URLs all have the form 91ftp://ftp.is.co.za/rfc/rfc1808.txt
92http://www.ietf.org/rfc/rfc2396.txt
93ldap://[2001:db8::7]/c=GB?objectClass?one
94mailto:John.Doe@@example.com
95news:comp.infosystems.www.servers.unix
96tel:+1-816-555-1212
97telnet://192.0.2.16:80/
98urn:oasis:names:specification:docbook:dtd:xml:4.1.2
99@end example
100
101 This manual describes the @code{url} library, an Emacs Lisp library
102for parsing URIs and retrieving the resources to which they refer.
103(The library is so-named for historical reasons; nowadays, the ``URI''
104terminology is regarded as the more general one, and ``URL'' is
105technically obsolete despite its widespread vernacular usage.)
106
107@node URI Parsing
108@chapter URI Parsing
109
110 A URI consists of several @dfn{components}, each having a different
111meaning. For example, the URI
89 112
90@example 113@example
91@var{scheme}://@r{[}@var{userinfo}@@@r{]}@var{hostname}@r{[}:@var{port}@r{]}@r{[}/@var{path}@r{]} 114http://www.gnu.org/software/emacs/
92@end example 115@end example
116
93@noindent 117@noindent
94where @samp{@r{[}} and @samp{@r{]}} delimit optional parts. 118specifies the scheme component @samp{http}, the hostname component
95@var{userinfo} sometimes takes the form @var{username}:@var{password} 119@samp{www.gnu.org}, and the path component @samp{/software/emacs/}.
96but you should beware of the security risks of sending cleartext 120
97passwords. @var{hostname} may be a domain name or a dotted decimal 121@cindex parsed URIs
98address. If the @samp{:@var{port}} is omitted then the library will 122 The format of URIs is specified by RFC 3986. The @code{url} library
99use the ``well known'' port for that service when accessing URLs. With 123provides the Lisp function @code{url-generic-parse-url}, a (mostly)
100the possible exception of @code{telnet}, it is rare for ports to be 124standard-compliant URI parser, as well as function
101specified, and it is possible using a non-standard port may have 125@code{url-recreate-url}, which converts a parsed URI back into a URI
102undesired consequences if a different service is listening on that 126string.
103port (e.g., an HTTP URL specifying the SMTP port can cause mail to be 127
104sent). @c , but @xref{Other Variables, url-bad-port-list}. 128@defun url-generic-parse-url uri-string
105The meaning of the @var{path} component depends on the service. 129This function returns a parsed version of the string @var{uri-string}.
130@end defun
106 131
107@menu 132@defun url-recreate-url uri-obj
108* Configuration:: 133@cindex unparsing URLs
109* Parsed URLs:: URLs are parsed into vector structures. 134Given a parsed URI, this function returns the corresponding URI string.
110@end menu 135@end defun
111 136
112@node Configuration 137@cindex parsed URI
113@section Configuration 138 The return value of @code{url-generic-parse-url}, and the argument
139expected by @code{url-recreate-url}, is a @dfn{parsed URI}: a CL
140structure whose slots hold the various components of the URI.
141@xref{top,the CL Manual,,cl,GNU Emacs Common Lisp Emulation}, for
142details about CL structures. Most of the other functions in the
143@code{url} library act on parsed URIs.
114 144
115@defvar url-configuration-directory 145@menu
116@cindex @file{~/.url} 146* Parsed URIs:: Format of parsed URI structures.
117@cindex configuration files 147* URI Encoding:: Non-@acronym{ASCII} characters in URIs.
118The directory in which URL configuration files, the cache etc., 148@end menu
119reside. The old default was @file{~/.url}, and this directory
120is still used if it exists. The new default is a @file{url/}
121directory in @code{user-emacs-directory}, which is normally
122@file{~/.emacs.d}.
123@end defvar
124 149
125@node Parsed URLs 150@node Parsed URIs
126@section Parsed URLs 151@section Parsed URI structures
127@cindex parsed URLs
128The library functions typically operate on @dfn{parsed} versions of
129URLs. These are actually CL structures (vectors) of the form:
130 152
131@example 153 Each parsed URI structure contains the following slots:
132[cl-struct-url @var{type} @var{user} @var{password} @var{host} @var{port} @var{filename} @var{target} @var{attributes} @var{fullness} @var{use-cookies}]
133@end example
134 154
135@noindent where 155@table @code
136@table @var
137@item type 156@item type
138is the type of the URL scheme, e.g., @code{http} 157The URI scheme (a string, e.g.@: @code{http}). @xref{Supported URL
158Types}, for a list of schemes that the @code{url} library knows how to
159process. This slot can also be @code{nil}, if the URI is not fully
160specified.
161
139@item user 162@item user
140is the username associated with it, or @code{nil}; 163The user name (a string), or @code{nil}.
164
141@item password 165@item password
142is the user password associated with it, or @code{nil}; 166The user password (a string), or @code{nil}. The use of this URI
167component is strongly discouraged; nowadays, passwords are transmitted
168by other means, not as part of a URI.
169
143@item host 170@item host
144is the host name associated with it, or @code{nil}; 171The host name (a string), or @code{nil}. If present, this is
172typically a domain name or IP address.
173
145@item port 174@item port
146is the port number associated with it, or @code{nil}; 175The port number (an integer), or @code{nil}. Omitting this component
176usually means to use the ``standard'' port associated with the URI
177scheme.
178
147@item filename 179@item filename
148is the ``file'' part of it, or @code{nil}. This doesn't necessarily 180The combination of the ``path'' and ``query'' components of the URI (a
149actually refer to a file; 181string), or @code{nil}. If the query component is present, it is the
182substring following the first @samp{?} character, and the path
183component is the substring before the @samp{?}. The meaning of these
184components is scheme-dependent; they do not necessarily refer to a
185file on a disk.
186
150@item target 187@item target
151is the target part, or @code{nil}; 188The fragment component (a string), or @code{nil}. The fragment
152@item attributes 189component specifies a ``secondary resource'', such as a section of a
153is the attributes associated with it, or @code{nil}; 190webpage.
191
154@item fullness 192@item fullness
155is @code{t} for a fully-specified URL, with a host part indicated by 193This is @code{t} if the URI is fully specified, i.e.@: the
156@samp{//} after the scheme part. 194hierarchical components of the URI (the hostname and/or username
157@item use-cookies 195and/or password) are preceded by @samp{//}.
158is @code{nil} to neither send or store cookies to the server, @code{t}
159otherwise.
160@end table 196@end table
161 197
162@findex url-type 198@findex url-type
@@ -168,64 +204,165 @@ otherwise.
168@findex url-target 204@findex url-target
169@findex url-attributes 205@findex url-attributes
170@findex url-fullness 206@findex url-fullness
171These attributes have accessors named @code{url-@var{part}}, where 207These slots have accessors named @code{url-@var{part}}, where
172@var{part} is the name of one of the elements above, e.g., 208@var{part} is the slot name. For example, the accessor for the
173@code{url-host}. These attributes can be set with the same accessors 209@code{host} slot is the function @code{url-host}. The @code{url-port}
174using @code{setf}: 210accessor returns the default port for the URI scheme if the parsed
211URI's @var{port} slot is @code{nil}.
212
213 The slots can be set using @code{setf}. For example:
175 214
176@example 215@example
177(setf (url-port url) 80) 216(setf (url-port url) 80)
178@end example 217@end example
179 218
180If @var{port} is @var{nil}, @code{url-port} returns the default port 219@node URI Encoding
181of the protocol. 220@section URI Encoding
182 221
183There are functions for parsing and unparsing between the string and 222@cindex percent encoding
184vector forms. 223 The @code{url-generic-parse-url} parser does not obey RFC 3986 in
224one respect: it allows non-@acronym{ASCII} characters in URI strings.
225
226 Strictly speaking, RFC 3986 compatible URIs may only consist of
227@acronym{ASCII} characters; non-@acronym{ASCII} characters are
228represented by converting them to UTF-8 byte sequences, and performing
229@dfn{percent encoding} on the bytes. For example, the o-umlaut
230character is converted to the UTF-8 byte sequence @samp{\xD3\xA7},
231then percent encoded to @samp{%D3%A7}. (Certain ``reserved''
232@acronym{ASCII} characters must also be percent encoded when they
233appear in URI components.)
234
235 The function @code{url-encode-url} can be used to convert a URI
236string containing arbitrary characters to one that is properly
237percent-encoded in accordance with RFC 3986.
238
239@defun url-encode-url url-string
240This function return a properly URI-encoded version of
241@var{url-string}. It also performs @dfn{URI normalization},
242e.g.@: converting the scheme component to lowercase if it was
243previously uppercase.
244@end defun
185 245
186@defun url-generic-parse-url url 246 To convert between a string containing arbitrary characters and a
187Return a parsed version of the string @var{url}. 247percent-encoded all-@acronym{ASCII} string, use the functions
248@code{url-hexify-string} and @code{url-unhex-string}:
249
250@defun url-hexify-string string &optional allowed-chars
251This function performs percent-encoding on @var{string}, and returns
252the result.
253
254If @var{string} is multibyte, it is first converted to a UTF-8 byte
255string. Each byte corresponding to an allowed character is left
256as-is, while all other bytes are converted to a three-character
257sequence: @samp{%} followed by two upper-case hex digits.
258
259@vindex url-unreserved-chars
260@cindex unreserved characters
261The allowed characters are specified by @var{allowed-chars}. If this
262argument is @code{nil}, the allowed characters are those specified as
263@dfn{unreserved characters} by RFC 3986 (see the variable
264@code{url-unreserved-chars}). Otherwise, @var{allowed-chars} should
265be a vector whose @var{n}-th element is non-@code{nil} if character
266@var{n} is allowed.
188@end defun 267@end defun
189 268
190@defun url-recreate-url url 269@defun url-unhex-string string &optional allow-newlines
191@cindex unparsing URLs 270This function replaces percent-encoding sequences in @var{string} with
192Recreates a URL string from the parsed @var{url}. 271their character equivalents, and returns the resulting string.
272
273If @var{allow-newlines} is non-@code{nil}, it allows the decoding of
274carriage returns and line feeds, which are normally forbidden in URIs.
193@end defun 275@end defun
194 276
195@node Retrieving URLs 277@node Retrieving URLs
196@chapter Retrieving URLs 278@chapter Retrieving URLs
197 279
280 The @code{url} library defines the following three functions for
281retrieving the data specified by a URL. The actual retrieval protocol
282depends on the URL's URI scheme, and is performed by lower-level
283scheme-specific functions. (Those lower-level functions are not
284documented here, and generally should not be called directly.)
285
286 In each of these functions, the @var{url} argument can be either a
287string or a parsed URL structure. If it is a string, that string is
288passed through @code{url-encode-url} before using it, to ensure that
289it is properly URI-encoded (@pxref{URI Encoding}).
290
198@defun url-retrieve-synchronously url 291@defun url-retrieve-synchronously url
199Retrieve @var{url} synchronously and return a buffer containing the 292This function synchronously retrieves the data specified by @var{url},
200data. @var{url} is either a string or a parsed URL structure. Return 293and returns a buffer containing the data. The return value is
201@code{nil} if there are no data associated with it (the case for dired, 294@code{nil} if there is no data associated with the URL (as is the case
202info, or mailto URLs that need no further processing). 295for @code{dired}, @code{info}, and @code{mailto} URLs).
203@end defun 296@end defun
204 297
205@defun url-retrieve url callback &optional cbargs silent no-cookies 298@defun url-retrieve url callback &optional cbargs silent no-cookies
206Retrieve @var{url} asynchronously and call @var{callback} with args 299This function retrieves @var{url} asynchronously, calling the function
207@var{cbargs} when finished. The callback is called when the object 300@var{callback} when the object has been completely retrieved. The
208has been completely retrieved, with the current buffer containing the 301return value is the buffer into which the data will be inserted, or
209object and any MIME headers associated with it. @var{url} is either a 302@code{nil} if the process has already completed.
210string or a parsed URL structure. Returns the buffer @var{url} will 303
211load into, or @code{nil} if the process has already completed. 304The callback function is called this way:
212If the optional argument @var{silent} is non-@code{nil}, suppress 305
213progress messages. If the optional argument @var{no-cookies} is 306@example
214non-@code{nil}, do not store or send cookies. 307(apply @var{callback} @var{status} @var{cbargs})
308@end example
309
310@noindent
311where @var{status} is a plist representing what happened during the
312retrieval, with most recent events first, or an empty list if no
313events have occurred. Each pair in the plist is one of:
314
315@table @code
316@item (:redirect @var{redirected-to})
317This means that the request was redirected to the URL
318@var{redirected-to}.
319
320@item (:error (@var{error-symbol} . @var{data}))
321This means that an error occurred. If so desired, the error can be
322signaled with @code{(signal @var{error-symbol} @var{data})}.
323@end table
324
325When the callback function is called, the current buffer is the one
326containing the retrieved data (if any). The buffer also contains any
327MIME headers associated with the data retrieval.
328
329If the optional argument @var{silent} is non-@code{nil}, progress
330messages are suppressed. If the optional argument @var{no-cookies} is
331non-@code{nil}, cookies are not stored or sent.
215@end defun 332@end defun
216 333
217@vindex url-queue-parallel-processes
218@vindex url-queue-timeout
219@defun url-queue-retrieve url callback &optional cbargs silent no-cookies 334@defun url-queue-retrieve url callback &optional cbargs silent no-cookies
220This acts like the @code{url-retrieve} function, but with limits on 335This function acts like @code{url-retrieve}, but with limits on the
221the degree of parallelism. The option @code{url-queue-parallel-processes} 336number of concurrently-running network processes. The option
222controls the number of concurrent processes, and the option 337@code{url-queue-parallel-processes} controls the number of concurrent
223@code{url-queue-timeout} sets a timeout in seconds. 338processes, and the option @code{url-queue-timeout} sets a timeout in
339seconds.
340
341To use this function, you must @code{(require 'url-queue)}.
224@end defun 342@end defun
225 343
344@vindex url-queue-parallel-processes
345@defopt url-queue-parallel-processes
346The value of this option is an integer specifying the maximum number
347of concurrent @code{url-queue-retrieve} network processes. If the
348number of @code{url-queue-retrieve} calls is larger than this number,
349later ones are queued until ealier ones are finished.
350@end defopt
351
352@vindex url-queue-timeout
353@defopt url-queue-timeout
354The value of this option is a number specifying the maximum lifetime
355of a @code{url-queue-retrieve} network process, once it is started.
356If a process is not finished by then, it is killed and removed from
357the queue.
358@end defopt
359
226@node Supported URL Types 360@node Supported URL Types
227@chapter Supported URL Types 361@chapter Supported URL Types
228 362
363This chapter describes functions and variables affecting URL retrieval
364for specific schemes.
365
229@menu 366@menu
230* http/https:: Hypertext Transfer Protocol. 367* http/https:: Hypertext Transfer Protocol.
231* file/ftp:: Local files and FTP archives. 368* file/ftp:: Local files and FTP archives.
@@ -236,48 +373,31 @@ controls the number of concurrent processes, and the option
236* irc:: Internet Relay Chat. 373* irc:: Internet Relay Chat.
237* data:: Embedded data URLs. 374* data:: Embedded data URLs.
238* nfs:: Networked File System 375* nfs:: Networked File System
239@c * finger::
240@c * gopher::
241@c * netrek::
242@c * prospero::
243* cid:: Content-ID.
244* about::
245* ldap:: Lightweight Directory Access Protocol 376* ldap:: Lightweight Directory Access Protocol
246* imap:: IMAP mailboxes.
247* man:: Unix man pages. 377* man:: Unix man pages.
248@end menu 378@end menu
249 379
250@node http/https 380@node http/https
251@section @code{http} and @code{https} 381@section @code{http} and @code{https}
252 382
253The scheme @code{http} is Hypertext Transfer Protocol. The library 383The @code{http} scheme refers to the Hypertext Transfer Protocol. The
254supports version 1.1, specified in RFC 2616. (This supersedes 1.0, 384@code{url} library supports HTTP version 1.1, specified in RFC 2616.
255defined in RFC 1945) HTTP URLs have the following form, where most of 385Its default port is 80.
256the parts are optional: 386
257@example 387 The @code{https} scheme is a secure version of @code{http}, with
258http://@var{user}:@var{password}@@@var{host}:@var{port}/@var{path}?@var{searchpart}#@var{fragment} 388transmission via SSL. It is defined in RFC 2069, and its default port
259@end example 389is 443. When using @code{https}, the @code{url} library performs SSL
260@c The @code{:@var{port}} part is optional, and @var{port} defaults to 390encryption via the @code{ssl} library, by forcing the @code{ssl}
261@c 80. The @code{/@var{path}} part, if present, is a slash-separated 391gateway method to be used. @xref{Gateways in general}.
262@c series elements. The @code{?@var{searchpart}}, if present, is the
263@c query for a search or the content of a form submission. The
264@c @code{#fragment} part, if present, is a location in the document.
265
266The scheme @code{https} is a secure version of @code{http}, with
267transmission via SSL. It is defined in RFC 2069. Its default port is
268443. This scheme depends on SSL support in Emacs via the
269@file{ssl.el} library and is actually implemented by forcing the
270@code{ssl} gateway method to be used. @xref{Gateways in general}.
271 392
272@defopt url-honor-refresh-requests 393@defopt url-honor-refresh-requests
273This controls honoring of HTTP @samp{Refresh} headers by which 394If this option is non-@code{nil} (the default), the @code{url} library
274servers can direct clients to reload documents from the same URL or a 395honors the HTTP @samp{Refresh} header, which is used by servers to
275or different one. @code{nil} means they will not be honored, 396direct clients to reload documents from the same URL or a or different
276@code{t} (the default) means they will always be honored, and 397one. If the value is @code{nil}, the @samp{Refresh} header is
277otherwise the user will be asked on each request. 398ignored; any other value means to ask the user on each request.
278@end defopt 399@end defopt
279 400
280
281@menu 401@menu
282* Cookies:: 402* Cookies::
283* HTTP language/coding:: 403* HTTP language/coding::
@@ -409,26 +529,32 @@ emacs-mime, The Emacs MIME Manual}.
409@cindex compressed files 529@cindex compressed files
410@cindex dired 530@cindex dired
411 531
532The @code{ftp} and @code{file} schemes are defined in RFC 1808. The
533@code{url} library treats @samp{ftp:} and @samp{file:} as synonymous.
534Such URLs have the form
535
412@example 536@example
413ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} 537ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
414file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} 538file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
415@end example 539@end example
416 540
417These schemes are defined in RFC 1808. 541@noindent
418@samp{ftp:} and @samp{file:} are synonymous in this library. They 542If the URL specifies a local file, it is retrieved by reading the file
419allow reading arbitrary files from hosts. Either @samp{ange-ftp} 543contents in the usual way. If it specifies a remote file, it is
420(Emacs) or @samp{efs} (XEmacs) is used to retrieve them from remote 544retrieved using the Ange-FTP package. @xref{Remote Files,,, emacs,
421hosts. Local files are accessed directly. 545The GNU Emacs Manual}.
422 546
423Compressed files are handled, but support is hard-coded so that 547 When retrieving a compressed file, it is automatically uncompressed
424@code{jka-compr-compression-info-list} and so on have no affect. 548if it has the file suffix @file{.z}, @file{.gz}, @file{.Z},
425Suffixes recognized are @samp{.z}, @samp{.gz}, @samp{.Z} and 549@file{.bz2}, or @file{.xz}. (The list of supported suffixes is
426@samp{.bz2}. 550hard-coded, and cannot be altered by customizing
551@code{jka-compr-compression-info-list}.)
427 552
428@defopt url-directory-index-file 553@defopt url-directory-index-file
429The filename to look for when indexing a directory, default 554This option specifies the filename to look for when a @code{file} or
430@samp{"index.html"}. If this file exists, and is readable, then it 555@code{ftp} URL specifies a directory. The default is
431will be viewed instead of using @code{dired} to view the directory. 556@file{index.html}. If this file exists and is readable, it is viewed.
557Otherwise, Emacs visits the directory using Dired.
432@end defopt 558@end defopt
433 559
434@node info 560@node info
@@ -437,47 +563,53 @@ will be viewed instead of using @code{dired} to view the directory.
437@cindex Texinfo 563@cindex Texinfo
438@findex Info-goto-node 564@findex Info-goto-node
439 565
566The @code{info} scheme is non-standard. Such URLs have the form
567
440@example 568@example
441info:@var{file}#@var{node} 569info:@var{file}#@var{node}
442@end example 570@end example
443 571
444Info URLs are not officially defined. They invoke 572@noindent
445@code{Info-goto-node} with argument @samp{(@var{file})@var{node}}. 573and are retrieved by invoking @code{Info-goto-node} with argument
446@samp{#@var{node}} is optional, defaulting to @samp{Top}. 574@samp{(@var{file})@var{node}}. If @samp{#@var{node}} is omitted, the
575@samp{Top} node is opened.
447 576
448@node mailto 577@node mailto
449@section mailto 578@section mailto
450 579
451@cindex mailto 580@cindex mailto
452@cindex email 581@cindex email
453A mailto URL will send an email message to the address in the 582A @code{mailto} URL specifies an email message to be sent to a given
454URL, for example @samp{mailto:foo@@bar.com} would compose a 583email address. For example, @samp{mailto:foo@@bar.com} specifies
455message to @samp{foo@@bar.com}. 584sending a message to @samp{foo@@bar.com}. The ``retrieval method''
456 585for such URLs is to open a mail composition buffer in which the
457@defopt url-mail-command 586appropriate content (e.g.@: the recipient address) has been filled in.
458@vindex mail-user-agent
459The function called whenever url needs to send mail. This should
460normally be left to default from @var{mail-user-agent}. @xref{Mail
461Methods, , Mail-Composition Methods, emacs, The GNU Emacs Manual}.
462@end defopt
463 587
464An @samp{X-Url-From} header field containing the URL of the document 588 As defined in RFC 2368, a @code{mailto} URL has the form
465that contained the mailto URL is added if that URL is known.
466 589
467RFC 2368 extends the definition of mailto URLs in RFC 1738.
468The form of a mailto URL is
469@example 590@example
470@samp{mailto:@var{mailbox}[?@var{header}=@var{contents}[&@var{header}=@var{contents}]]} 591@samp{mailto:@var{mailbox}[?@var{header}=@var{contents}[&@var{header}=@var{contents}]]}
471@end example 592@end example
472@noindent where an arbitrary number of @var{header}s can be added. If the
473@var{header} is @samp{body}, then @var{contents} is put in the body
474otherwise a @var{header} header field is created with @var{contents}
475as its contents. Note that the URL library does not consider any
476headers ``dangerous'' so you should check them before sending the
477message.
478 593
479@c Fixme: update 594@noindent
480Email messages are defined in @sc{rfc}822. 595where an arbitrary number of @var{header}s can be added. If the
596@var{header} is @samp{body}, then @var{contents} is put in the message
597body; otherwise, a @var{header} header field is created with
598@var{contents} as its contents. Note that the @code{url} library does
599not perform any checking of @var{header} or @var{contents}, so you
600should check them before sending the message.
601
602@defopt url-mail-command
603@vindex mail-user-agent
604The value of this variable is the function called whenever url needs
605to send mail. This should normally be left its default, which is the
606standard mail-composition command @code{compose-mail}. @xref{Sending
607Mail,,, emacs, The GNU Emacs Manual}.
608@end defopt
609
610 If the document containing the @code{mailto} URL itself possessed a
611known URL, Emacs automatically inserts an @samp{X-Url-From} header
612field into the mail buffer, specifying that URL.
481 613
482@node news/nntp/snews 614@node news/nntp/snews
483@section @code{news}, @code{nntp} and @code{snews} 615@section @code{news}, @code{nntp} and @code{snews}
@@ -487,11 +619,13 @@ Email messages are defined in @sc{rfc}822.
487@cindex NNTP 619@cindex NNTP
488@cindex snews 620@cindex snews
489 621
490@c draft-gilman-news-url-01 622The @code{news}, @code{nntp}, and @code{snews} schemes, defined in RFC
491The network news URL scheme take the following forms following RFC 6231738, are used for reading Usenet newsgroups. For compatibility with
4921738 except that for compatibility with other clients, host and port 624non-standard-compliant news clients, the @code{url} library allows
493fields may be included in news URLs though they are properly only 625host and port fields to be included in @code{news} URLs, even though
494allowed for nntp an snews. 626they are properly only allowed for @code{nntp} and @code{snews}.
627
628 @code{news} and @code{nntp} URLs have the following form:
495 629
496@table @samp 630@table @samp
497@item news:@var{newsgroup} 631@item news:@var{newsgroup}
@@ -506,24 +640,22 @@ Retrieves a list of all available newsgroups;
506Similar to the @samp{news} versions. 640Similar to the @samp{news} versions.
507@end table 641@end table
508 642
509@samp{:@var{port}} is optional and defaults to :119. 643 The default port for @code{nntp} (and @code{news}) is 119. The
510 644difference between an @code{nntp} URL and a @code{news} URL is that an
511@samp{snews} is the same as @samp{nntp} except that the default port 645@code{nttp} URL may specify an article by its number. The
512is :563. 646@samp{snews} scheme is the same as @samp{nntp}, except that it is
513@cindex SSL 647tunneled through SSL and has default port 563.
514(It is tunneled through SSL.)
515 648
516An @samp{nntp} URL is the same as a news URL, except that the URL may 649 These URLs are retrieved via the Gnus package.
517specify an article by its number.
518 650
519@defopt url-news-server
520This variable can be used to override the default news server.
521Usually this will be set by the Gnus package, which is used to fetch
522news.
523@cindex environment variable 651@cindex environment variable
524@vindex NNTPSERVER 652@vindex NNTPSERVER
525It may be set from the conventional environment variable 653@defopt url-news-server
526@code{NNTPSERVER}. 654This variable specifies the default news server from which to fetch
655news, if no server was specified in the URL. The default value,
656@code{nil}, means to use the server specified by the standard
657environment variable @samp{NNTPSERVER}, or @samp{news} if that
658environment variable is unset.
527@end defopt 659@end defopt
528 660
529@node rlogin/telnet/tn3270 661@node rlogin/telnet/tn3270
@@ -534,12 +666,15 @@ It may be set from the conventional environment variable
534@cindex terminal emulation 666@cindex terminal emulation
535@findex terminal-emulator 667@findex terminal-emulator
536 668
537These URL schemes from RFC 1738 for logon via a terminal emulator have 669These URL schemes are defined in RFC 1738, and are used for logging in
538the form 670via a terminal emulator. They have the form
671
539@example 672@example
540telnet://@var{user}:@var{password}@@@var{host}:@var{port} 673telnet://@var{user}:@var{password}@@@var{host}:@var{port}
541@end example 674@end example
542but the @code{:@var{password}} component is ignored. 675
676@noindent
677but the @var{password} component is ignored.
543 678
544To handle rlogin, telnet and tn3270 URLs, a @code{rlogin}, 679To handle rlogin, telnet and tn3270 URLs, a @code{rlogin},
545@code{telnet} or @code{tn3270} (the program names and arguments are 680@code{telnet} or @code{tn3270} (the program names and arguments are
@@ -553,39 +688,43 @@ Well-known ports are used if the URL does not specify a port.
553@cindex ZEN IRC 688@cindex ZEN IRC
554@cindex ERC 689@cindex ERC
555@cindex rcirc 690@cindex rcirc
556@c Fixme: reference (was http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt) 691
557@dfn{Internet Relay Chat} (IRC) is handled by handing off the @sc{irc} 692 The @code{irc} scheme is defined in the Internet Draft at
558session to a function named in @code{url-irc-function}. 693@url{http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt} (which
694was never approved as an RFC). Such URLs have the form
695
696@example
697irc://@var{host}:@var{port}/@var{target},@var{needpass}
698@end example
699
700@noindent
701and are retrieved by opening an @acronym{IRC} session using the
702function specified by @code{url-irc-function}.
559 703
560@defopt url-irc-function 704@defopt url-irc-function
561A function to actually open an IRC connection. 705The value of this option is a function, which is called to open an IRC
562This function 706connection for @code{irc} URLs. This function must take five
563must take five arguments, @var{host}, @var{port}, @var{channel}, 707arguments, @var{host}, @var{port}, @var{channel}, @var{user} and
564@var{user} and @var{password}. The @var{channel} argument specifies the 708@var{password}. The @var{channel} argument specifies the channel to
565channel to join immediately, this can be @code{nil}. By default this is 709join immediately, and may be @code{nil}.
566@code{url-irc-rcirc}. 710
711The default is @code{url-irc-rcirc}, which uses the Rcirc package.
712Other options are @code{url-irc-erc} (which uses ERC) and
713@code{url-irc-zenirc} (which uses ZenIRC).
567@end defopt 714@end defopt
568@defun url-irc-rcirc host port channel user password
569Processes the arguments and lets @code{rcirc} handle the session.
570@end defun
571@defun url-irc-erc host port channel user password
572Processes the arguments and lets @code{ERC} handle the session.
573@end defun
574@defun url-irc-zenirc host port channel user password
575Processes the arguments and lets @code{zenirc} handle the session.
576@end defun
577 715
578@node data 716@node data
579@section data 717@section data
580@cindex data URLs 718@cindex data URLs
581 719
720 The @code{data} scheme, defined in RFC 2397, contains MIME data in
721the URL itself. Such URLs have the form
722
582@example 723@example
583data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data} 724data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data}
584@end example 725@end example
585 726
586Data URLs contain MIME data in the URL itself. They are defined in 727@noindent
587RFC 2397.
588
589@var{media-type} is a MIME @samp{Content-Type} string, possibly 728@var{media-type} is a MIME @samp{Content-Type} string, possibly
590including parameters. It defaults to 729including parameters. It defaults to
591@samp{text/plain;charset=US-ASCII}. The @samp{text/plain} can be 730@samp{text/plain;charset=US-ASCII}. The @samp{text/plain} can be
@@ -598,14 +737,14 @@ present, the @var{data} are base64-encoded.
598@cindex Network File System 737@cindex Network File System
599@cindex automounter 738@cindex automounter
600 739
740The @code{nfs} scheme, defined in RFC 2224, is similar to @code{ftp}
741except that it points to a file on a remote host that is handled by an
742NFS automounter on the local host. Such URLs have the form
743
601@example 744@example
602nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} 745nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
603@end example 746@end example
604 747
605The @samp{nfs:} scheme is defined in RFC 2224. It is similar to
606@samp{ftp:} except that it points to a file on a remote host that is
607handled by the automounter on the local host.
608
609@defvar url-nfs-automounter-directory-spec 748@defvar url-nfs-automounter-directory-spec
610@end defvar 749@end defvar
611A string saying how to invoke the NFS automounter. Certain @samp{%} 750A string saying how to invoke the NFS automounter. Certain @samp{%}
@@ -628,15 +767,6 @@ A literal @samp{%}.
628 767
629Each can be used any number of times. 768Each can be used any number of times.
630 769
631@node cid
632@section cid
633@cindex Content-ID
634
635RFC 2111
636
637@node about
638@section about
639
640@node ldap 770@node ldap
641@section ldap 771@section ldap
642@cindex LDAP 772@cindex LDAP
@@ -644,50 +774,21 @@ RFC 2111
644 774
645The LDAP scheme is defined in RFC 2255. 775The LDAP scheme is defined in RFC 2255.
646 776
647@node imap
648@section imap
649@cindex IMAP
650
651RFC 2192
652
653@node man 777@node man
654@section man 778@section man
655@cindex @command{man} 779@cindex @command{man}
656@cindex Unix man pages 780@cindex Unix man pages
657@findex man 781@findex man
658 782
783The @code{man} scheme is a non-standard one. Such URLs have the form
784
659@example 785@example
660@samp{man:@var{page-spec}} 786@samp{man:@var{page-spec}}
661@end example 787@end example
662 788
663This is a non-standard scheme. @var{page-spec} is passed directly to 789@noindent
664the Lisp @code{man} function. 790and are retrieved by passing @var{page-spec} to the Lisp function
665 791@code{man}.
666@node Defining New URLs
667@chapter Defining New URLs
668
669@menu
670* Naming conventions::
671* Required functions::
672* Optional functions::
673* Asynchronous fetching::
674* Supporting file-name-handlers::
675@end menu
676
677@node Naming conventions
678@section Naming conventions
679
680@node Required functions
681@section Required functions
682
683@node Optional functions
684@section Optional functions
685
686@node Asynchronous fetching
687@section Asynchronous fetching
688
689@node Supporting file-name-handlers
690@section Supporting file-name-handlers
691 792
692@node General Facilities 793@node General Facilities
693@chapter General Facilities 794@chapter General Facilities
@@ -1108,11 +1209,9 @@ You can use this function to do completion of URLs from the history.
1108@node Customization 1209@node Customization
1109@chapter Customization 1210@chapter Customization
1110 1211
1111@section Environment Variables
1112
1113@cindex environment variables 1212@cindex environment variables
1114The following environment variables affect the library's operation at 1213 The following environment variables affect the @code{url} library's
1115startup. 1214operation at startup.
1116 1215
1117@table @code 1216@table @code
1118@item TMPDIR 1217@item TMPDIR
@@ -1122,10 +1221,21 @@ If this is defined, @var{url-temporary-directory} is initialized from
1122it. 1221it.
1123@end table 1222@end table
1124 1223
1125@section General User Options 1224 The following user options affect the general operation of
1225@code{url} library.
1126 1226
1127The following user options, settable with Customize, affect the 1227@defopt url-configuration-directory
1128general operation of the package. 1228@cindex configuration files
1229The value of this variable specifies the name of the directory where
1230the @code{url} library stores its various configuration files, cache
1231files, etc.
1232
1233The default value specifies a subdirectory named @file{url/} in the
1234standard Emacs user data directory specified by the variable
1235@code{user-emacs-directory} (normally @file{~/.emacs.d}). However,
1236the old default was @file{~/.url}, and this directory is used instead
1237if it exists.
1238@end defopt
1129 1239
1130@defopt url-debug 1240@defopt url-debug
1131@cindex debugging 1241@cindex debugging