aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorK. Handa2016-01-03 17:53:43 +0900
committerK. Handa2016-01-03 17:53:43 +0900
commitfb6d826c69939c2d016c1b824d4e9bcb53d9e643 (patch)
treeb9ce862d6cbe25e740203421984df21e4cbadbf4 /doc/lispref
parent536f48e9a2251b9e654ea974bd90ff2f40218753 (diff)
parent91917dd58ec5278e555b9c693a830749083e8f89 (diff)
downloademacs-fb6d826c69939c2d016c1b824d4e9bcb53d9e643.tar.gz
emacs-fb6d826c69939c2d016c1b824d4e9bcb53d9e643.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/buffers.texi4
-rw-r--r--doc/lispref/display.texi40
-rw-r--r--doc/lispref/elisp.texi20
-rw-r--r--doc/lispref/eval.texi9
-rw-r--r--doc/lispref/files.texi32
-rw-r--r--doc/lispref/frames.texi40
-rw-r--r--doc/lispref/functions.texi17
-rw-r--r--doc/lispref/help.texi12
-rw-r--r--doc/lispref/internals.texi4
-rw-r--r--doc/lispref/loading.texi61
-rw-r--r--doc/lispref/modes.texi63
-rw-r--r--doc/lispref/os.texi17
-rw-r--r--doc/lispref/positions.texi12
-rw-r--r--doc/lispref/processes.texi48
-rw-r--r--doc/lispref/strings.texi13
-rw-r--r--doc/lispref/syntax.texi8
-rw-r--r--doc/lispref/text.texi166
-rw-r--r--doc/lispref/tips.texi16
-rw-r--r--doc/lispref/windows.texi128
19 files changed, 606 insertions, 104 deletions
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 45a21c8e806..55fa5bcd6f0 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -716,7 +716,9 @@ The special commands of these modes bind @code{buffer-read-only} to
716 716
717@defvar buffer-read-only 717@defvar buffer-read-only
718This buffer-local variable specifies whether the buffer is read-only. 718This buffer-local variable specifies whether the buffer is read-only.
719The buffer is read-only if this variable is non-@code{nil}. 719The buffer is read-only if this variable is non-@code{nil}. However,
720characters that have the @code{inhibit-read-only} text property can
721still be modified. @xref{Special Properties, inhibit-read-only}.
720@end defvar 722@end defvar
721 723
722@defvar inhibit-read-only 724@defvar inhibit-read-only
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index ad248b116ed..d1ac85a7cab 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -330,7 +330,7 @@ support them, then @code{message-box} uses the echo area, like
330@code{message}. 330@code{message}.
331@end defun 331@end defun
332 332
333@defun display-message-or-buffer message &optional buffer-name not-this-window frame 333@defun display-message-or-buffer message &optional buffer-name action frame
334This function displays the message @var{message}, which may be either a 334This function displays the message @var{message}, which may be either a
335string or a buffer. If it is shorter than the maximum height of the 335string or a buffer. If it is shorter than the maximum height of the
336echo area, as defined by @code{max-mini-window-height}, it is displayed 336echo area, as defined by @code{max-mini-window-height}, it is displayed
@@ -346,7 +346,7 @@ pop-up buffer is used, defaulting to @file{*Message*}. In the case
346where @var{message} is a string and displayed in the echo area, it is 346where @var{message} is a string and displayed in the echo area, it is
347not specified whether the contents are inserted into the buffer anyway. 347not specified whether the contents are inserted into the buffer anyway.
348 348
349The optional arguments @var{not-this-window} and @var{frame} are as for 349The optional arguments @var{action} and @var{frame} are as for
350@code{display-buffer}, and only used if a buffer is displayed. 350@code{display-buffer}, and only used if a buffer is displayed.
351@end defun 351@end defun
352 352
@@ -1889,12 +1889,13 @@ end of the result if it falls short of @var{width}. It is also used at
1889the beginning of the result if one multi-column character in 1889the beginning of the result if one multi-column character in
1890@var{string} extends across the column @var{start-column}. 1890@var{string} extends across the column @var{start-column}.
1891 1891
1892@vindex truncate-string-ellipsis
1892If @var{ellipsis} is non-@code{nil}, it should be a string which will 1893If @var{ellipsis} is non-@code{nil}, it should be a string which will
1893replace the end of @var{string} (including any padding) if it extends 1894replace the end of @var{string} (including any padding) if it extends
1894beyond @var{width}, unless the display width of @var{string} is equal 1895beyond @var{width}, unless the display width of @var{string} is equal
1895to or less than the display width of @var{ellipsis}. If 1896to or less than the display width of @var{ellipsis}. If
1896@var{ellipsis} is non-@code{nil} and not a string, it stands for 1897@var{ellipsis} is non-@code{nil} and not a string, it stands for
1897@code{"..."}. 1898the value of the variable @code{truncate-string-ellipsis}.
1898 1899
1899@example 1900@example
1900(truncate-string-to-width "\tab\t" 12 4) 1901(truncate-string-to-width "\tab\t" 12 4)
@@ -3659,6 +3660,39 @@ tag (or @code{nil}, which stands for the default langsys), and each
3659@end table 3660@end table
3660@end defun 3661@end defun
3661 3662
3663@cindex font information for layout
3664The following four functions return size information about fonts used
3665by various faces, allowing various layout considerations in Lisp
3666programs. These functions take face remapping into consideration,
3667returning information about the remapped face, if the face in question
3668was remapped. @xref{Face Remapping}.
3669
3670@defun default-font-width
3671This function returns the average width in pixels of the font used by
3672the current buffer's default face.
3673@end defun
3674
3675@defun default-font-height
3676This function returns the height in pixels of the font used by the
3677current buffer's default face.
3678@end defun
3679
3680@defun window-font-width &optional window face
3681This function returns the average width in pixels for the font used by
3682@var{face} in @var{window}. The specified @var{window} must be a live
3683window. If @code{nil} or omitted, @var{window} defaults to the
3684selected window, and @var{face} defaults to the default face in
3685@var{window}.
3686@end defun
3687
3688@defun window-font-height &optional window face
3689This function returns the height in pixels for the font used by
3690@var{face} in @var{window}. The specified @var{window} must be a live
3691window. If @code{nil} or omitted, @var{window} defaults to the
3692selected window, and @var{face} defaults to the default face in
3693@var{window}.
3694@end defun
3695
3662@node Fringes 3696@node Fringes
3663@section Fringes 3697@section Fringes
3664@cindex fringes 3698@cindex fringes
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 2d3548f65ba..56d303e2e9e 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -467,6 +467,10 @@ Control Structures
467* Generators:: Generic sequences and coroutines. 467* Generators:: Generic sequences and coroutines.
468* Nonlocal Exits:: Jumping out of a sequence. 468* Nonlocal Exits:: Jumping out of a sequence.
469 469
470Conditionals
471
472* Pattern matching case statement:: How to use @code{pcase}.
473
470Nonlocal Exits 474Nonlocal Exits
471 475
472* Catch and Throw:: Nonlocal exits for the program's own purposes. 476* Catch and Throw:: Nonlocal exits for the program's own purposes.
@@ -535,6 +539,7 @@ Functions
535* Function Cells:: Accessing or setting the function definition 539* Function Cells:: Accessing or setting the function definition
536 of a symbol. 540 of a symbol.
537* Closures:: Functions that enclose a lexical environment. 541* Closures:: Functions that enclose a lexical environment.
542* Advising Functions:: Adding to the definition of a function.
538* Obsolete Functions:: Declaring functions obsolete. 543* Obsolete Functions:: Declaring functions obsolete.
539* Inline Functions:: Defining functions that the compiler 544* Inline Functions:: Defining functions that the compiler
540 will expand inline. 545 will expand inline.
@@ -552,6 +557,13 @@ Lambda Expressions
552* Argument List:: Details and special features of argument lists. 557* Argument List:: Details and special features of argument lists.
553* Function Documentation:: How to put documentation in a function. 558* Function Documentation:: How to put documentation in a function.
554 559
560Advising Emacs Lisp Functions
561
562* Core Advising Primitives:: Primitives to manipulate advice.
563* Advising Named Functions:: Advising named functions.
564* Advice combinators:: Ways to compose advice.
565* Porting old advice:: Adapting code using the old defadvice.
566
555Macros 567Macros
556 568
557* Simple Macro:: A basic example. 569* Simple Macro:: A basic example.
@@ -602,6 +614,7 @@ Loading
602* Unloading:: How to unload a library that was loaded. 614* Unloading:: How to unload a library that was loaded.
603* Hooks for Loading:: Providing code to be run when 615* Hooks for Loading:: Providing code to be run when
604 particular libraries are loaded. 616 particular libraries are loaded.
617* Dynamic Modules:: Modules provide additional Lisp primitives.
605 618
606Byte Compilation 619Byte Compilation
607 620
@@ -1191,6 +1204,10 @@ Text Properties
1191* Not Intervals:: Why text properties do not use 1204* Not Intervals:: Why text properties do not use
1192 Lisp-visible text intervals. 1205 Lisp-visible text intervals.
1193 1206
1207Parsing HTML and XML
1208
1209* Document Object Model:: Access, manipulate and search the @acronym{DOM}.
1210
1194Non-@acronym{ASCII} Characters 1211Non-@acronym{ASCII} Characters
1195 1212
1196* Text Representations:: How Emacs represents text. 1213* Text Representations:: How Emacs represents text.
@@ -1530,9 +1547,12 @@ GNU Emacs Internals
1530* Building Emacs:: How the dumped Emacs is made. 1547* Building Emacs:: How the dumped Emacs is made.
1531* Pure Storage:: Kludge to make preloaded Lisp functions shareable. 1548* Pure Storage:: Kludge to make preloaded Lisp functions shareable.
1532* Garbage Collection:: Reclaiming space for Lisp objects no longer used. 1549* Garbage Collection:: Reclaiming space for Lisp objects no longer used.
1550* Stack-allocated Objects:: Temporary conses and strings on C stack.
1533* Memory Usage:: Info about total size of Lisp objects made so far. 1551* Memory Usage:: Info about total size of Lisp objects made so far.
1552* C Dialect:: What C variant Emacs is written in.
1534* Writing Emacs Primitives:: Writing C code for Emacs. 1553* Writing Emacs Primitives:: Writing C code for Emacs.
1535* Object Internals:: Data formats of buffers, windows, processes. 1554* Object Internals:: Data formats of buffers, windows, processes.
1555* C Integer Types:: How C integer types are used inside Emacs.
1536 1556
1537Object Internals 1557Object Internals
1538 1558
diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi
index 067dbd2d99f..dfad9fb709d 100644
--- a/doc/lispref/eval.texi
+++ b/doc/lispref/eval.texi
@@ -780,7 +780,8 @@ to specify this function, but it is more robust to use the
780@deffn Command eval-buffer &optional buffer-or-name stream filename unibyte print 780@deffn Command eval-buffer &optional buffer-or-name stream filename unibyte print
781This is similar to @code{eval-region}, but the arguments provide 781This is similar to @code{eval-region}, but the arguments provide
782different optional features. @code{eval-buffer} operates on the 782different optional features. @code{eval-buffer} operates on the
783entire accessible portion of buffer @var{buffer-or-name}. 783entire accessible portion of buffer @var{buffer-or-name}
784(@pxref{Narrowing,,, emacs, The GNU Emacs Manual}).
784@var{buffer-or-name} can be a buffer, a buffer name (a string), or 785@var{buffer-or-name} can be a buffer, a buffer name (a string), or
785@code{nil} (or omitted), which means to use the current buffer. 786@code{nil} (or omitted), which means to use the current buffer.
786@var{stream} is used as in @code{eval-region}, unless @var{stream} is 787@var{stream} is used as in @code{eval-region}, unless @var{stream} is
@@ -833,9 +834,9 @@ The value of this variable is a list of the values returned by all the
833expressions that were read, evaluated, and printed from buffers 834expressions that were read, evaluated, and printed from buffers
834(including the minibuffer) by the standard Emacs commands which do 835(including the minibuffer) by the standard Emacs commands which do
835this. (Note that this does @emph{not} include evaluation in 836this. (Note that this does @emph{not} include evaluation in
836@file{*ielm*} buffers, nor evaluation using @kbd{C-j} in 837@file{*ielm*} buffers, nor evaluation using @kbd{C-j}, @kbd{C-x C-e},
837@code{lisp-interaction-mode}.) The elements are ordered most recent 838and similar evaluation commands in @code{lisp-interaction-mode}.) The
838first. 839elements are ordered most recent first.
839 840
840@example 841@example
841@group 842@group
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 9a1b2cd217f..918bf5becbd 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -2030,11 +2030,6 @@ form.
2030@end example 2030@end example
2031@end defun 2031@end defun
2032 2032
2033@defun directory-name-p filename
2034This function returns non-@code{nil} if @var{filename} ends with a
2035forward slash (@samp{/}) character.
2036@end defun
2037
2038@node Directory Names 2033@node Directory Names
2039@subsection Directory Names 2034@subsection Directory Names
2040@cindex directory name 2035@cindex directory name
@@ -2076,6 +2071,13 @@ string (if it does not already end in one).
2076@end example 2071@end example
2077@end defun 2072@end defun
2078 2073
2074@defun directory-name-p filename
2075This function returns non-@code{nil} if @var{filename} ends with a
2076directory separator character. This is the forward slash @samp{/} on
2077Unix and GNU systems; MS-Windows and MS-DOS recognize both the forward
2078slash and the backslash @samp{\} as directory separators.
2079@end defun
2080
2079@defun directory-file-name dirname 2081@defun directory-file-name dirname
2080This function returns a string representing @var{dirname} in a form 2082This function returns a string representing @var{dirname} in a form
2081that the operating system will interpret as the name of a file (a 2083that the operating system will interpret as the name of a file (a
@@ -2632,12 +2634,20 @@ An error is signaled if @var{directory} is not the name of a directory
2632that can be read. 2634that can be read.
2633@end defun 2635@end defun
2634 2636
2635@defun directory-files-recursively directory match &optional include-directories 2637@defun directory-files-recursively directory regexp &optional include-directories
2636Return all files under @var{directory} whose file names match 2638Return all files under @var{directory} whose names match @var{regexp}.
2637@var{match} recursively. The file names are returned depth first, 2639This function searches the specified @var{directory} and its
2638meaning that contents of sub-directories are returned before contents 2640sub-directories, recursively, for files whose basenames (i.e., without
2639of the directories. If @var{include-directories} is non-@code{nil}, 2641the leading directories) match the specified @var{regexp}, and returns
2640also return directory names that have matching names. 2642a list of the absolute file names of the matching files
2643(@pxref{Relative File Names, absolute file names}). The file names
2644are returned in depth-first order, meaning that files in some
2645sub-directory are returned before the files in its parent directory.
2646In addition, matching files found in each subdirectory are sorted
2647alphabetically by their basenames. By default, directories whose
2648names match @var{regexp} are omitted from the list, but if the
2649optional argument @var{include-directories} is non-@code{nil}, they
2650are included.
2641@end defun 2651@end defun
2642 2652
2643@defun directory-files-and-attributes directory &optional full-name match-regexp nosort id-format 2653@defun directory-files-and-attributes directory &optional full-name match-regexp nosort id-format
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 3ae33082fc4..80a4af29f1a 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -557,7 +557,7 @@ The top left corner of the native frame specifies the @dfn{native
557position} of the frame. (1)--(3) in the drawing above indicate that 557position} of the frame. (1)--(3) in the drawing above indicate that
558position for the various builds: 558position for the various builds:
559 559
560@itemize @w 560@itemize @w{}
561@item (1) non-toolkit and terminal frames 561@item (1) non-toolkit and terminal frames
562 562
563@item (2) Lucid, Motif and Windows frames 563@item (2) Lucid, Motif and Windows frames
@@ -1001,18 +1001,40 @@ parameters of @var{frame} and their values. If @var{frame} is
1001@end defun 1001@end defun
1002 1002
1003@defun modify-frame-parameters frame alist 1003@defun modify-frame-parameters frame alist
1004This function alters the parameters of frame @var{frame} based on the 1004This function alters the frame @var{frame} based on the elements of
1005elements of @var{alist}. Each element of @var{alist} has the form 1005@var{alist}. Each element of @var{alist} has the form
1006@code{(@var{parm} . @var{value})}, where @var{parm} is a symbol naming a 1006@code{(@var{parm} . @var{value})}, where @var{parm} is a symbol naming
1007parameter. If you don't mention a parameter in @var{alist}, its value 1007a parameter. If you don't mention a parameter in @var{alist}, its
1008doesn't change. If @var{frame} is @code{nil}, it defaults to the selected 1008value doesn't change. If @var{frame} is @code{nil}, it defaults to
1009frame. 1009the selected frame.
1010
1011Some parameters are only meaningful for frames on certain kinds of
1012display (@pxref{Frames}). If @var{alist} includes parameters that are
1013not meaningful for the @var{frame}'s display, this function will
1014change its value in the frame's parameter list, but will otherwise
1015ignore it.
1016
1017When @var{alist} specifies more than one parameter whose value can
1018affect the new size of @var{frame}, the final size of the frame may
1019differ according to the toolkit used. For example, specifying that a
1020frame should from now on have a menu and/or tool bar instead of none and
1021simultaneously specifying the new height of the frame will inevitably
1022lead to a recalculation of the frame's height. Conceptually, in such
1023case, this function will try to have the explicit height specification
1024prevail. It cannot be excluded, however, that the addition (or removal)
1025of the menu or tool bar, when eventually performed by the toolkit, will
1026defeat this intention.
1027
1028Sometimes, binding @code{frame-inhibit-implied-resize} (@pxref{Implied
1029Frame Resizing}) to a non-@code{nil} value around calls to this function
1030may fix the problem sketched here. Sometimes, however, exactly such
1031binding may be hit by the problem.
1010@end defun 1032@end defun
1011 1033
1012@defun set-frame-parameter frame parm value 1034@defun set-frame-parameter frame parm value
1013This function sets the frame parameter @var{parm} to the specified 1035This function sets the frame parameter @var{parm} to the specified
1014@var{value}. If @var{frame} is @code{nil}, it defaults to the 1036@var{value}. If @var{frame} is @code{nil}, it defaults to the selected
1015selected frame. 1037frame.
1016@end defun 1038@end defun
1017 1039
1018@defun modify-all-frames-parameters alist 1040@defun modify-all-frames-parameters alist
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 8835667b82d..7cc041fa77e 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -861,15 +861,18 @@ into a list. @code{mapc} always returns @var{sequence}.
861 861
862@defun mapconcat function sequence separator 862@defun mapconcat function sequence separator
863@code{mapconcat} applies @var{function} to each element of 863@code{mapconcat} applies @var{function} to each element of
864@var{sequence}: the results, which must be strings, are concatenated. 864@var{sequence}; the results, which must be sequences of characters
865Between each pair of result strings, @code{mapconcat} inserts the string 865(strings, vectors, or lists), are concatenated into a single string
866@var{separator}. Usually @var{separator} contains a space or comma or 866return value. Between each pair of result sequences, @code{mapconcat}
867other suitable punctuation. 867inserts the characters from @var{separator}, which also must be a
868string, or a vector or list of characters. @xref{Sequences Arrays
869Vectors}.
868 870
869The argument @var{function} must be a function that can take one 871The argument @var{function} must be a function that can take one
870argument and return a string. The argument @var{sequence} can be any 872argument and returns a sequence of characters: a string, a vector, or
871kind of sequence except a char-table; that is, a list, a vector, a 873a list. The argument @var{sequence} can be any kind of sequence
872bool-vector, or a string. 874except a char-table; that is, a list, a vector, a bool-vector, or a
875string.
873 876
874@example 877@example
875@group 878@group
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index 387587a4203..685995b395f 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -352,16 +352,16 @@ string in Emacs Lisp.
352@defvar text-quoting-style 352@defvar text-quoting-style
353@cindex curved quotes 353@cindex curved quotes
354@cindex curly quotes 354@cindex curly quotes
355The value of this variable specifies the style used to generate text 355The value of this variable is a symbol that specifies the style Emacs
356quotes. If the variable's value is @code{curve}, the style is 356should use for single quotes in the wording of help and messages.
357If the variable's value is @code{curve}, the style is
357@t{‘like this’} with curved single quotes. If the value is 358@t{‘like this’} with curved single quotes. If the value is
358@code{straight}, the style is @t{'like this'} with straight 359@code{straight}, the style is @t{'like this'} with straight
359apostrophes. If the value is @code{grave}, the style is @t{`like 360apostrophes. If the value is @code{grave}, the style is @t{`like
360this'} with grave accent and apostrophe. The default value @code{nil} 361this'} with grave accent and apostrophe, the standard style
362before Emacs version 25. The default value @code{nil}
361acts like @code{curve} if curved single quotes are displayable, and 363acts like @code{curve} if curved single quotes are displayable, and
362like @code{grave} otherwise. To use the traditional @code{grave} 364like @code{grave} otherwise.
363style, put the line @code{(setq text-quoting-style 'grave)} into your
364@file{~/.emacs} file.
365@end defvar 365@end defvar
366 366
367@defun substitute-command-keys string 367@defun substitute-command-keys string
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index e620da0b4ff..e111d358ba0 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -32,7 +32,9 @@ executable. You don't have to know this material to build and install
32Emacs, since the makefiles do all these things automatically. This 32Emacs, since the makefiles do all these things automatically. This
33information is pertinent to Emacs developers. 33information is pertinent to Emacs developers.
34 34
35 Compilation of the C source files in the @file{src} directory 35 Building Emacs requires GNU Make version 3.81 or later.
36
37 Compilation of the C source files in the @file{src} directory
36produces an executable file called @file{temacs}, also called a 38produces an executable file called @file{temacs}, also called a
37@dfn{bare impure Emacs}. It contains the Emacs Lisp interpreter and 39@dfn{bare impure Emacs}. It contains the Emacs Lisp interpreter and
38I/O routines, but not the editing commands. 40I/O routines, but not the editing commands.
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index 82de765876e..e01f3161731 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -29,7 +29,15 @@ into a buffer and evaluated there. (Indeed, most code is tested this
29way.) Most often, the forms are function definitions and variable 29way.) Most often, the forms are function definitions and variable
30definitions. 30definitions.
31 31
32For on-demand loading of external libraries, @pxref{Dynamic Libraries}. 32 Emacs can also load compiled dynamic modules: shared libraries that
33provide additional functionality for use in Emacs Lisp programs, just
34like a package written in Emacs Lisp would. When a dynamic module is
35loaded, Emacs calls a specially-named initialization function which
36the module needs to implement, and which exposes the additional
37functions and variables to Emacs Lisp programs.
38
39For on-demand loading of external libraries which are known in advance
40to be required by certain Emacs primitives, @pxref{Dynamic Libraries}.
33 41
34@menu 42@menu
35* How Programs Do Loading:: The @code{load} function and others. 43* How Programs Do Loading:: The @code{load} function and others.
@@ -43,6 +51,7 @@ For on-demand loading of external libraries, @pxref{Dynamic Libraries}.
43* Unloading:: How to unload a library that was loaded. 51* Unloading:: How to unload a library that was loaded.
44* Hooks for Loading:: Providing code to be run when 52* Hooks for Loading:: Providing code to be run when
45 particular libraries are loaded. 53 particular libraries are loaded.
54* Dynamic Modules:: Modules provide additional Lisp primitives.
46@end menu 55@end menu
47 56
48@node How Programs Do Loading 57@node How Programs Do Loading
@@ -1076,3 +1085,53 @@ defined in another library (those meant for outside use), you can do
1076it immediately---there is no need to wait until the library is loaded. 1085it immediately---there is no need to wait until the library is loaded.
1077If you need to call functions defined by that library, you should load 1086If you need to call functions defined by that library, you should load
1078the library, preferably with @code{require} (@pxref{Named Features}). 1087the library, preferably with @code{require} (@pxref{Named Features}).
1088
1089@node Dynamic Modules
1090@section Emacs Dynamic Modules
1091@cindex dynamic modules
1092
1093@c FIXME: This is intentionally incomplete, as the module integration
1094@c is not yet finished. To be refined later.
1095 A @dfn{dynamic Emacs module} is a shared library that provides
1096additional functionality for use in Emacs Lisp programs, just like a
1097package written in Emacs Lisp would.
1098
1099 Functions that load Emacs Lisp packages can also load dynamic
1100modules. They recognize dynamic modules by looking at their file-name
1101extension, a.k.a.@: ``suffix''. This suffix is platform-dependent.
1102
1103@defvar module-file-suffix
1104This variable holds the system-dependent value of the file-name
1105extension of the module files. Its value is @file{.so} on Posix hosts
1106and @file{.dll} on MS-Windows.
1107@end defvar
1108
1109@findex emacs_module_init
1110@vindex plugin_is_GPL_compatible
1111Every dynamic module should export a C-callable function named
1112@code{emacs_module_init}, which Emacs will call as part of the call to
1113@code{load} or @code{require} which loads the module. It should also
1114export a symbol named @code{plugin_is_GPL_compatible} to indicate that
1115its code is released under the GPL or compatible license; Emacs will
1116refuse to load modules that don't export such a symbol.
1117
1118If a module needs to call Emacs functions, it should do so through the
1119API defined and documented in the header file @file{emacs-module.h}
1120that is part of the Emacs distribution.
1121
1122@cindex user-ptr object
1123Modules can create @code{user-ptr} Lisp objects that embed pointers to
1124C struct's defined by the module. This is useful for keeping around
1125complex data structures created by a module, to be passed back to the
1126module's functions. User-ptr objects can also have associated
1127@dfn{finalizers} -- functions to be run when the object is GC'ed; this
1128is useful for freeing any resources allocated for the underlying data
1129structure, such as memory, open file descriptors, etc.
1130
1131@defun user-ptrp object
1132This function returns @code{t} if its argument is a @code{user-ptr}
1133object.
1134@end defun
1135
1136Loadable modules in Emacs are enabled by using the
1137@kbd{--with-modules} option at configure time.
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index a1747707d11..3b8550e13b9 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -2509,6 +2509,53 @@ Search-based fontification happens second.
2509@node Font Lock Basics 2509@node Font Lock Basics
2510@subsection Font Lock Basics 2510@subsection Font Lock Basics
2511 2511
2512 The Font Lock functionality is based on several basic functions.
2513Each of these calls the function specified by the corresponding
2514variable. This indirection allows major modes to modify the way
2515fontification works in the buffers of that mode, and even use the Font
2516Lock mechanisms for features that have nothing to do with
2517fontification. (This is why the description below says ``should''
2518when it describes what the functions do: the major mode can customize
2519the values of the corresponding variables to do something entirely
2520different.) The variables mentioned below are described in @ref{Other
2521Font Lock Variables}.
2522
2523@ftable @code
2524@item font-lock-fontify-buffer
2525This function should fontify the current buffer's accessible portion,
2526by calling the function specified by
2527@code{font-lock-fontify-buffer-function}.
2528
2529@item font-lock-unfontify-buffer
2530Used when turning Font Lock off to remove the fontification. Calls
2531the function specified by @code{font-lock-unfontify-buffer-function}.
2532
2533@item font-lock-fontify-region beg end &optional loudly
2534Should fontify the region between @var{beg} and @var{end}. If
2535@var{loudly} is non-@code{nil}, should display status messages while
2536fontifying. Calls the function specified by
2537@code{font-lock-fontify-region-function}.
2538
2539@item font-lock-unfontify-region beg end
2540Should remove fontification from the region between @var{beg} and
2541@var{end}. Calls the function specified by
2542@code{font-lock-unfontify-region-function}.
2543
2544@item font-lock-flush &optional beg end
2545This function should mark the fontification of the region between
2546@var{beg} and @var{end} as outdated. If not specified or @code{nil},
2547@var{beg} and @var{end} default to the beginning and end of the
2548buffer's accessible portion. Calls the function specified by
2549@code{font-lock-flush-function}.
2550
2551@item font-lock-ensure &optional beg end
2552This function should make sure the region between @var{beg} and
2553@var{end} has been fontified. The optional arguments @var{beg} and
2554@var{end} default to the beginning and the end of the buffer's
2555accessible portion. Calls the function specified by
2556@code{font-lock-ensure-function}.
2557@end ftable
2558
2512 There are several variables that control how Font Lock mode highlights 2559 There are several variables that control how Font Lock mode highlights
2513text. But major modes should not set any of these variables directly. 2560text. But major modes should not set any of these variables directly.
2514Instead, they should set @code{font-lock-defaults} as a buffer-local 2561Instead, they should set @code{font-lock-defaults} as a buffer-local
@@ -2936,6 +2983,22 @@ arguments, the beginning and end of the region. The default value is
2936@code{font-lock-default-unfontify-region}. 2983@code{font-lock-default-unfontify-region}.
2937@end defvar 2984@end defvar
2938 2985
2986@defvar font-lock-flush-function
2987Function to use for declaring that a region's fontification is out of
2988date. It takes two arguments, the beginning and end of the region.
2989The default value of this variable is
2990@code{font-lock-after-change-function}.
2991@end defvar
2992
2993@defvar font-lock-ensure-function
2994Function to use for making sure a region of the current buffer has
2995been fontified. It is called with two arguments, the beginning and
2996end of the region. The default value of this variable is a function
2997that calls @code{font-lock-default-fontify-buffer} if the buffer is
2998not fontified; the effect is to make sure the entire accessible
2999portion of the buffer is fontified.
3000@end defvar
3001
2939@defun jit-lock-register function &optional contextual 3002@defun jit-lock-register function &optional contextual
2940This function tells Font Lock mode to run the Lisp function 3003This function tells Font Lock mode to run the Lisp function
2941@var{function} any time it has to fontify or refontify part of the 3004@var{function} any time it has to fontify or refontify part of the
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 17a0b47ad06..92e3ee2b33c 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -902,6 +902,9 @@ Hewlett-Packard HPUX operating system.
902@item irix 902@item irix
903Silicon Graphics Irix system. 903Silicon Graphics Irix system.
904 904
905@item nacl
906Google Native Client (@acronym{NaCl}) sandboxing system.
907
905@item ms-dos 908@item ms-dos
906Microsoft's DOS@. Emacs compiled with DJGPP for MS-DOS binds 909Microsoft's DOS@. Emacs compiled with DJGPP for MS-DOS binds
907@code{system-type} to @code{ms-dos} even when you run it on MS-Windows. 910@code{system-type} to @code{ms-dos} even when you run it on MS-Windows.
@@ -911,7 +914,7 @@ AT&T Unix System V.
911 914
912@item windows-nt 915@item windows-nt
913Microsoft Windows NT, 9X and later. The value of @code{system-type} 916Microsoft Windows NT, 9X and later. The value of @code{system-type}
914is always @code{windows-nt}, e.g., even on Windows 7. 917is always @code{windows-nt}, e.g., even on Windows 10.
915 918
916@end table 919@end table
917 920
@@ -2922,6 +2925,18 @@ means complete; it is intended to give you an idea of the security
2922issues involved, rather than to be a security checklist. 2925issues involved, rather than to be a security checklist.
2923 2926
2924@table @asis 2927@table @asis
2928@item File local variables
2929@cindex file local variables
2930A file that Emacs visits can contain variable settings that affects
2931the buffer visiting that file; @xref{File Local Variables}.
2932Similarly, a directory can specify local variable values common to all
2933files in that directory; @xref{Directory Local Variables}. Although
2934Emacs takes some effort to protect against misuse of these variables,
2935a security hole can be created merely by a package setting
2936@code{safe-local-variable} too optimistically, a problem that is all
2937too common. To disable this feature for both files and directories,
2938set @code{enable-local-variables} to @code{nil}.
2939
2925@item Access control 2940@item Access control
2926Although Emacs normally respects access permissions of the underlying 2941Although Emacs normally respects access permissions of the underlying
2927operating system, in some cases it handles accesses specially. For 2942operating system, in some cases it handles accesses specially. For
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index 72b76ce5c8f..9daf5cef059 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -572,6 +572,18 @@ The value returned is the window line number point has moved to, with
572the top line in the window numbered 0. 572the top line in the window numbered 0.
573@end deffn 573@end deffn
574 574
575@vindex move-to-window-group-line-function
576@defun move-to-window-group-line count
577This function is like @code{move-to-window-line}, except that when the
578selected window is a part of a group of windows (@pxref{Window
579Group}), @code{move-to-window-group-line} will move to a position with
580respect to the entire group, not just the single window. This
581condition holds when the buffer local variable
582@code{move-to-window-group-line-function} is set to a function. In
583this case, @code{move-to-window-group-line} calls the function with
584the argument @var{count}, then returns its result.
585@end defun
586
575@defun compute-motion from frompos to topos width offsets window 587@defun compute-motion from frompos to topos width offsets window
576This function scans the current buffer, calculating screen positions. 588This function scans the current buffer, calculating screen positions.
577It scans the buffer forward from position @var{from}, assuming that is 589It scans the buffer forward from position @var{from}, assuming that is
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 0ce696ad533..41255e7e8d0 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -737,10 +737,12 @@ If @var{stopped} is non-@code{nil}, start the process in the
737stopped state. 737stopped state.
738 738
739@item :filter @var{filter} 739@item :filter @var{filter}
740Initialize the process filter to @var{filter}. 740Initialize the process filter to @var{filter}. If not specified, a
741default filter will be provided. @xref{Filter Functions}.
741 742
742@item :sentinel @var{sentinel} 743@item :sentinel @var{sentinel}
743Initialize the process sentinel to @var{sentinel}. 744Initialize the process sentinel to @var{sentinel}. If not specified,
745a default sentinel will be used. @xref{Sentinels}.
744 746
745@item :stderr @var{stderr} 747@item :stderr @var{stderr}
746Associate @var{stderr} with the standard error of the process. 748Associate @var{stderr} with the standard error of the process.
@@ -789,10 +791,12 @@ If @var{stopped} is non-@code{nil}, start the process in the
789stopped state. 791stopped state.
790 792
791@item :filter @var{filter} 793@item :filter @var{filter}
792Initialize the process filter to @var{filter}. 794Initialize the process filter to @var{filter}. If not specified, a
795default filter will be provided. @xref{Filter Functions}.
793 796
794@item :sentinel @var{sentinel} 797@item :sentinel @var{sentinel}
795Initialize the process sentinel to @var{sentinel}. 798Initialize the process sentinel to @var{sentinel}. If not specified,
799a default sentinel will be used. @xref{Sentinels}.
796@end table 800@end table
797 801
798The original argument list, modified with the actual connection 802The original argument list, modified with the actual connection
@@ -922,9 +926,10 @@ For a network process, the values include (see
922@item :buffer 926@item :buffer
923The associated value is the process buffer. 927The associated value is the process buffer.
924@item :filter 928@item :filter
925The associated value is the process filter function. 929The associated value is the process filter function. @xref{Filter
930Functions}.
926@item :sentinel 931@item :sentinel
927The associated value is the process sentinel function. 932The associated value is the process sentinel function. @xref{Sentinels}.
928@item :remote 933@item :remote
929In a connection, the address in internal format of the remote peer. 934In a connection, the address in internal format of the remote peer.
930@item :local 935@item :local
@@ -1379,6 +1384,7 @@ subprocess with a @code{SIGHUP} signal (@pxref{Signals to Processes}).
1379@cindex filter function 1384@cindex filter function
1380@cindex process filter 1385@cindex process filter
1381 1386
1387@cindex default filter function of a process
1382 A process @dfn{filter function} is a function that receives the 1388 A process @dfn{filter function} is a function that receives the
1383standard output from the associated process. @emph{All} output from 1389standard output from the associated process. @emph{All} output from
1384that process is passed to the filter. The default filter simply 1390that process is passed to the filter. The default filter simply
@@ -1632,21 +1638,43 @@ also called if the process exits. The sentinel receives two
1632arguments: the process for which the event occurred, and a string 1638arguments: the process for which the event occurred, and a string
1633describing the type of event. 1639describing the type of event.
1634 1640
1641@cindex default sentinel function of a process
1642 If no sentinel function was specified for a process, it will use the
1643default sentinel function, which inserts a message in the process's
1644buffer with the process name and the string describing the event.
1645
1635 The string describing the event looks like one of the following: 1646 The string describing the event looks like one of the following:
1636 1647
1637@c FIXME? Also "killed\n" - see example below?
1638@itemize @bullet 1648@itemize @bullet
1639@item 1649@item
1640@code{"finished\n"}. 1650@code{"finished\n"}.
1641 1651
1642@item 1652@item
1643@code{"exited abnormally with code @var{exitcode}\n"}. 1653@code{"deleted\n"}.
1654
1655@item
1656@code{"exited abnormally with code @var{exitcode} (core dumped)\n"}.
1657The ``core dumped'' part is optional, and only appears if the process
1658dumped core.
1659
1660@item
1661@code{"failed with code @var{fail-code}\n"}.
1662
1663@item
1664@code{"@var{signal-description} (core dumped)\n"}. The
1665@var{signal-description} is a system-dependent textual description of
1666a signal, e.g., @code{"killed"} for @code{SIGKILL}. The ``core
1667dumped'' part is optional, and only appears if the process dumped
1668core.
1669
1670@item
1671@code{"open from @var{host-name}\n"}.
1644 1672
1645@item 1673@item
1646@code{"@var{name-of-signal}\n"}. 1674@code{"open\n"}.
1647 1675
1648@item 1676@item
1649@code{"@var{name-of-signal} (core dumped)\n"}. 1677@code{"connection broken by remote peer\n"}.
1650@end itemize 1678@end itemize
1651 1679
1652 A sentinel runs only while Emacs is waiting (e.g., for terminal 1680 A sentinel runs only while Emacs is waiting (e.g., for terminal
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index f8685d9312c..8aa4539bd78 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -465,6 +465,7 @@ Representations}.
465@code{string-equal} is another name for @code{string=}. 465@code{string-equal} is another name for @code{string=}.
466@end defun 466@end defun
467 467
468@cindex locale-dependent string equivalence
468@defun string-collate-equalp string1 string2 &optional locale ignore-case 469@defun string-collate-equalp string1 string2 &optional locale ignore-case
469This function returns @code{t} if @var{string1} and @var{string2} are 470This function returns @code{t} if @var{string1} and @var{string2} are
470equal with respect to collation rules. A collation rule is not only 471equal with respect to collation rules. A collation rule is not only
@@ -493,6 +494,7 @@ systems.
493If @var{ignore-case} is non-@code{nil}, characters are converted to lower-case 494If @var{ignore-case} is non-@code{nil}, characters are converted to lower-case
494before comparing them. 495before comparing them.
495 496
497@vindex w32-collate-ignore-punctuation
496To emulate Unicode-compliant collation on MS-Windows systems, 498To emulate Unicode-compliant collation on MS-Windows systems,
497bind @code{w32-collate-ignore-punctuation} to a non-@code{nil} value, since 499bind @code{w32-collate-ignore-punctuation} to a non-@code{nil} value, since
498the codeset part of the locale cannot be @code{"UTF-8"} on MS-Windows. 500the codeset part of the locale cannot be @code{"UTF-8"} on MS-Windows.
@@ -518,7 +520,7 @@ optional argument @var{ignore-case} is non-@code{nil}, the comparison
518ignores case differences. 520ignores case differences.
519@end defun 521@end defun
520 522
521@cindex lexical comparison 523@cindex lexical comparison of strings
522@defun string< string1 string2 524@defun string< string1 string2
523@c (findex string< causes problems for permuted index!!) 525@c (findex string< causes problems for permuted index!!)
524This function compares two strings a character at a time. It 526This function compares two strings a character at a time. It
@@ -576,6 +578,7 @@ are used.
576@code{string-lessp} is another name for @code{string<}. 578@code{string-lessp} is another name for @code{string<}.
577@end defun 579@end defun
578 580
581@cindex locale-dependent string comparison
579@defun string-collate-lessp string1 string2 &optional locale ignore-case 582@defun string-collate-lessp string1 string2 &optional locale ignore-case
580This function returns @code{t} if @var{string1} is less than 583This function returns @code{t} if @var{string1} is less than
581@var{string2} in collation order. A collation order is not only 584@var{string2} in collation order. A collation order is not only
@@ -594,15 +597,15 @@ for sorting (@pxref{Sequence Functions}):
594@end group 597@end group
595@end example 598@end example
596 599
597This behavior is system-dependent; punctuation and whitespace are 600This behavior is system-dependent; e.g., punctuation and whitespace
598never ignored on Cygwin, regardless of locale. 601are never ignored on Cygwin, regardless of locale.
599 602
600The optional argument @var{locale}, a string, overrides the setting of 603The optional argument @var{locale}, a string, overrides the setting of
601your current locale identifier for collation. The value is system 604your current locale identifier for collation. The value is system
602dependent; a @var{locale} @code{"en_US.UTF-8"} is applicable on POSIX 605dependent; a @var{locale} @code{"en_US.UTF-8"} is applicable on POSIX
603systems, while it would be, e.g., @code{"enu_USA.1252"} on MS-Windows 606systems, while it would be, e.g., @code{"enu_USA.1252"} on MS-Windows
604systems. The @var{locale} @code{"POSIX"} lets @code{string-collate-lessp} 607systems. The @var{locale} value of @code{"POSIX"} or @code{"C"} lets
605behave like @code{string-lessp}: 608@code{string-collate-lessp} behave like @code{string-lessp}:
606 609
607@example 610@example
608@group 611@group
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi
index 7a984e3d87b..831ebd12f55 100644
--- a/doc/lispref/syntax.texi
+++ b/doc/lispref/syntax.texi
@@ -945,6 +945,14 @@ whitespace by the functions in this section and by @code{forward-sexp},
945The behavior of @code{parse-partial-sexp} is also affected by 945The behavior of @code{parse-partial-sexp} is also affected by
946@code{parse-sexp-lookup-properties} (@pxref{Syntax Properties}). 946@code{parse-sexp-lookup-properties} (@pxref{Syntax Properties}).
947 947
948@defvar comment-end-can-be-escaped
949If this buffer local variable is non-@code{nil}, a single character
950which usually terminates a comment doesn't do so when that character
951is escaped. This is used in C and C++ Modes, where line comments
952starting with @samp{//} can be continued onto the next line by
953escaping the newline with @samp{\}.
954@end defvar
955
948You can use @code{forward-comment} to move forward or backward over 956You can use @code{forward-comment} to move forward or backward over
949one comment or several comments. 957one comment or several comments.
950 958
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 6d9d26f0ad1..f3679a88f74 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -899,13 +899,25 @@ adds it to the most recent element. It determines automatically (using
899@code{last-command}) whether the previous command was a kill command, 899@code{last-command}) whether the previous command was a kill command,
900and if so appends the killed text to the most recent entry. 900and if so appends the killed text to the most recent entry.
901 901
902@deffn Command kill-region start end 902@cindex filtering killed text
903This function kills the text in the region defined by @var{start} and 903 The commands described below can filter the killed text before they
904@var{end}. The text is deleted but saved in the kill ring, along with 904save it in the kill ring. They call @code{filter-buffer-substring}
905its text properties. The value is always @code{nil}. 905(@pxref{Buffer Contents}) to perform the filtering. By default,
906there's no filtering, but major and minor modes and hook functions can
907set up filtering, so that text saved in the kill ring is different
908from what was in the buffer.
909
910@deffn Command kill-region start end &optional region
911This function kills the stretch of text between @var{start} and
912@var{end}; but if the optional argument @var{region} is
913non-@code{nil}, it ignores @var{start} and @var{end}, and kills the
914text in the current region instead. The text is deleted but saved in
915the kill ring, along with its text properties. The value is always
916@code{nil}.
906 917
907In an interactive call, @var{start} and @var{end} are point and 918In an interactive call, @var{start} and @var{end} are point and
908the mark. 919the mark, and @var{region} is always non-@code{nil}, so the command
920always kills the text in the current region.
909 921
910If the buffer or text is read-only, @code{kill-region} modifies the kill 922If the buffer or text is read-only, @code{kill-region} modifies the kill
911ring just the same, then signals an error without modifying the buffer. 923ring just the same, then signals an error without modifying the buffer.
@@ -919,18 +931,20 @@ error if the buffer or text is read-only. Instead, it simply returns,
919updating the kill ring but not changing the buffer. 931updating the kill ring but not changing the buffer.
920@end defopt 932@end defopt
921 933
922@deffn Command copy-region-as-kill start end 934@deffn Command copy-region-as-kill start end &optional region
923This command saves the region defined by @var{start} and @var{end} on 935This function saves the stretch of text between @var{start} and
924the kill ring (including text properties), but does not delete the text 936@var{end} on the kill ring (including text properties), but does not
925from the buffer. It returns @code{nil}. 937delete the text from the buffer. However, if the optional argument
938@var{region} is non-@code{nil}, the function ignores @var{start} and
939@var{end}, and saves the current region instead. It always returns
940@code{nil}.
941
942In an interactive call, @var{start} and @var{end} are point and
943the mark, and @var{region} is always non-@code{nil}, so the command
944always saves the text in the current region.
926 945
927The command does not set @code{this-command} to @code{kill-region}, so a 946The command does not set @code{this-command} to @code{kill-region}, so a
928subsequent kill command does not append to the same kill ring entry. 947subsequent kill command does not append to the same kill ring entry.
929
930@c FIXME Why is it better? Why isn't copy-region-as-kill obsolete then?
931@c Why is it used in many places in Emacs?
932In Lisp programs, it is better to use @code{kill-new} or
933@code{kill-append} instead of this command. @xref{Low-Level Kill Ring}.
934@end deffn 948@end deffn
935 949
936@node Yanking 950@node Yanking
@@ -1343,27 +1357,39 @@ This function places a boundary element in the undo list. The undo
1343command stops at such a boundary, and successive undo commands undo 1357command stops at such a boundary, and successive undo commands undo
1344to earlier and earlier boundaries. This function returns @code{nil}. 1358to earlier and earlier boundaries. This function returns @code{nil}.
1345 1359
1346The editor command loop automatically calls @code{undo-boundary} just
1347before executing each key sequence, so that each undo normally undoes
1348the effects of one command. As an exception, the command
1349@code{self-insert-command}, which produces self-inserting input
1350characters (@pxref{Commands for Insertion}), may remove the boundary
1351inserted by the command loop: a boundary is accepted for the first
1352such character, the next 19 consecutive self-inserting input
1353characters do not have boundaries, and then the 20th does; and so on
1354as long as the self-inserting characters continue. Hence, sequences
1355of consecutive character insertions can be undone as a group.
1356
1357All buffer modifications add a boundary whenever the previous undoable
1358change was made in some other buffer. This is to ensure that
1359each command makes a boundary in each buffer where it makes changes.
1360
1361Calling this function explicitly is useful for splitting the effects of 1360Calling this function explicitly is useful for splitting the effects of
1362a command into more than one unit. For example, @code{query-replace} 1361a command into more than one unit. For example, @code{query-replace}
1363calls @code{undo-boundary} after each replacement, so that the user can 1362calls @code{undo-boundary} after each replacement, so that the user can
1364undo individual replacements one by one. 1363undo individual replacements one by one.
1364
1365Mostly, however, this function is called automatically at an
1366appropriate time.
1367@end defun
1368
1369@defun undo-auto-amalgamate
1370@cindex amalgamating commands, and undo
1371The editor command loop automatically calls @code{undo-boundary} just
1372before executing each key sequence, so that each undo normally undoes
1373the effects of one command. A few exceptional commands are
1374@dfn{amalgamating}: these commands generally cause small changes to
1375buffers, so with these a boundary is inserted only every 20th command,
1376allowing to undo them as a group. By default, commands
1377@code{self-insert-command}, which produces self-inserting input
1378characters (@pxref{Commands for Insertion}), and @code{delete-char}
1379which deletes characters (@pxref{Deletion}) are amalgamating.
1380Where a command affects the contents of several buffers, as may happen,
1381for example, when a function on the @code{post-command-hook} affects a
1382buffer other than the @code{current-buffer}, then @code{undo-boundary}
1383will be called in each of the affected buffers.
1365@end defun 1384@end defun
1366 1385
1386@defvar undo-auto-current-boundary-timer
1387Some buffers, such as process buffers, can change even when no
1388commands are executing. In these cases, @code{undo-boundary} is
1389normally called periodically by the timer in this variable. Setting
1390this variable to non-@code{nil} prevents this behavior.
1391@end defvar
1392
1367@defvar undo-in-progress 1393@defvar undo-in-progress
1368This variable is normally @code{nil}, but the undo commands bind it to 1394This variable is normally @code{nil}, but the undo commands bind it to
1369@code{t}. This is so that various kinds of change hooks can tell when 1395@code{t}. This is so that various kinds of change hooks can tell when
@@ -2336,6 +2362,84 @@ already indented, it calls @code{completion-at-point} to complete the
2336text at point (@pxref{Completion in Buffers}). 2362text at point (@pxref{Completion in Buffers}).
2337@end defopt 2363@end defopt
2338 2364
2365@cindex literate programming
2366@cindex multi-mode indentation
2367 Some major modes need to support embedded regions of text whose
2368syntax belongs to a different major mode. Examples include
2369@dfn{literate programming} source files that combine documentation and
2370snippets of source code, Yacc/Bison programs that include snippets of
2371plain C code, etc. To correctly indent the embedded chunks, the major
2372mode needs to delegate the indentation to another mode's indentation
2373engine (e.g., call @code{c-indent-defun} for C code or
2374@code{python-indent-line} for Python), while providing it with some
2375context to guide the indentation. The following facilities support
2376such multi-mode indentation.
2377
2378@defvar prog-indentation-context
2379This variable, when non-@code{nil}, holds the indentation context for
2380the sub-mode's indentation engine provided by the superior major mode.
2381The value should be a list of the form @code{(@var{first-column}
2382@w{(@var{start} . @var{end})} @code{prev-chunk})}. The members of the
2383list have the following meaning:
2384
2385@table @var
2386@item first-column
2387The column to be used for top-level constructs. This replaces the
2388default value of the top-level column used by the sub-mode, usually
2389zero.
2390@item start
2391@itemx end
2392The region of the code chunk to be indented by the sub-mode. The
2393value of @var{end} can be @code{nil}, which stands for the value of
2394@code{point-max}.
2395@item prev-chunk
2396If this is non-@code{nil}, it should provide the sub-mode's
2397indentation engine with a virtual context of the code chunk. Valid
2398values include:
2399
2400@itemize @minus
2401@item
2402A string whose contents is the text the sub-mode's indentation engine
2403should consider to precede the code chunk. The sub-mode's indentation
2404engine can add text properties to that string, to be reused in
2405repeated calls with the same string, thus using it as a cache. An
2406example where this is useful is code chunks that need to be indented
2407as function bodies, but lack the function's preamble---the string
2408could then include that missing preamble.
2409@item
2410A function. It is expected to be called with the start position of
2411the current chunk, and should return a cons cell
2412@w{@code{(@var{prev-start} . @var{prev-end})}} that specifies the
2413region of the previous code chunk, or @code{nil} if there is no previous
2414chunk. This is useful in literate-programming sources, where code is
2415split into chunks, and correct indentation needs to access previous
2416chunks.
2417@end itemize
2418@end table
2419@end defvar
2420
2421The following convenience functions should be used by major mode's
2422indentation engine in support of invocations as sub-modes of another
2423major mode.
2424
2425@defun prog-first-column
2426Call this function instead of using a literal value (usually, zero) of
2427the column number for indenting top-level program constructs. The
2428function's value is the column number to use for top-level constructs.
2429When no superior mode is in effect, this function returns zero.
2430@end defun
2431
2432@defun prog-widen
2433Call this function instead of @code{widen} to remove any restrictions
2434imposed by the mode's indentation engine and restore the restrictions
2435recorded in @code{prog-indentation-context}. This prevents the
2436indentation engine of a sub-mode from inadvertently operating on text
2437outside of the chunk it was supposed to indent, and preserves the
2438restriction imposed by the superior mode. When no superior mode is in
2439effect, this function just calls @code{widen}.
2440@end defun
2441
2442
2339@node Region Indent 2443@node Region Indent
2340@subsection Indenting an Entire Region 2444@subsection Indenting an Entire Region
2341 2445
@@ -3256,8 +3360,8 @@ and then remove the property. @xref{Read Only Buffers}.
3256 3360
3257@item inhibit-read-only 3361@item inhibit-read-only
3258@kindex inhibit-read-only @r{(text property)} 3362@kindex inhibit-read-only @r{(text property)}
3259If a character has the property @code{inhibit-read-only}, and the 3363Characters that have the property @code{inhibit-read-only} can be
3260buffer is read-only, editing the character in question is allowed. 3364edited even in read-only buffers. @xref{Read Only Buffers}.
3261 3365
3262@item invisible 3366@item invisible
3263@kindex invisible @r{(text property)} 3367@kindex invisible @r{(text property)}
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index d9cbf473306..ffce920bf4e 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -14,11 +14,17 @@ it gives advice on making effective use of the features described in the
14previous chapters, and describes conventions Emacs Lisp programmers 14previous chapters, and describes conventions Emacs Lisp programmers
15should follow. 15should follow.
16 16
17@findex checkdoc
18@findex checkdoc-current-buffer
19@findex checkdoc-file
17 You can automatically check some of the conventions described below by 20 You can automatically check some of the conventions described below by
18running the command @kbd{M-x checkdoc RET} when visiting a Lisp file. 21running the command @kbd{M-x checkdoc RET} when visiting a Lisp file.
19It cannot check all of the conventions, and not all the warnings it 22It cannot check all of the conventions, and not all the warnings it
20gives necessarily correspond to problems, but it is worth examining them 23gives necessarily correspond to problems, but it is worth examining them
21all. 24all. Alternatively, use the command @kbd{M-x checkdoc-current-buffer RET}
25to check the conventions in the current buffer, or @code{checkdoc-file}
26when you want to check a file in batch mode, e.g., with a command run by
27@kbd{@w{M-x compile RET}}.
22 28
23@menu 29@menu
24* Coding Conventions:: Conventions for clean and robust programs. 30* Coding Conventions:: Conventions for clean and robust programs.
@@ -1007,8 +1013,14 @@ of multiple files, we recommend not writing the version in every file,
1007but only the main one. 1013but only the main one.
1008 1014
1009@item Keywords 1015@item Keywords
1016@vindex checkdoc-package-keywords-flag
1017@findex checkdoc-package-keywords
1010This line lists keywords for the @code{finder-by-keyword} help command. 1018This line lists keywords for the @code{finder-by-keyword} help command.
1011Please use that command to see a list of the meaningful keywords. 1019Please use that command to see a list of the meaningful keywords. The
1020command @kbd{M-x checkdoc-package-keywords RET} will find and display
1021any keywords that are not in @code{finder-known-keywords}. If you set
1022the variable @code{checkdoc-package-keywords-flag} non-@code{nil},
1023checkdoc commands will include the keyword verification in its checks.
1012 1024
1013This field is how people will find your package when they're looking 1025This field is how people will find your package when they're looking
1014for things by topic. To separate the keywords, you can use spaces, 1026for things by topic. To separate the keywords, you can use spaces,
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 357247ef433..e45201b0570 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -133,6 +133,30 @@ This function returns the selected window (which is always a live
133window). 133window).
134@end defun 134@end defun
135 135
136@anchor{Window Group}Sometimes several windows collectively and
137cooperatively display a buffer, for example, under the management of
138Follow Mode (@pxref{Follow Mode,,, emacs}), where the windows together
139display a bigger portion of the buffer than one window could alone.
140It is often useful to consider such a @dfn{window group} as a single
141entity. Several functions such as @code{window-group-start}
142(@pxref{Window Start and End}) allow you to do this by supplying, as
143an argument, one of the windows as a stand in for the whole group.
144
145@defun selected-window-group
146@vindex selected-window-group-function
147When the selected window is a member of a group of windows, this
148function returns a list of the windows in the group, ordered such that
149the first window in the list is displaying the earliest part of the
150buffer, and so on. Otherwise the function returns a list containing
151just the selected window.
152
153The selected window is considered part of a group when the buffer
154local variable @code{selected-window-group-function} is set to a
155function. In this case, @code{selected-window-group} calls it with no
156arguments and returns its result (which should be the list of windows
157in the group).
158@end defun
159
136@node Windows and Frames 160@node Windows and Frames
137@section Windows and Frames 161@section Windows and Frames
138 162
@@ -521,9 +545,9 @@ its pixel height is the pixel height of the screen areas spanned by its
521children. 545children.
522@end defun 546@end defun
523 547
524@cindex window pixel height 548@cindex window pixel width
525@cindex pixel height of a window 549@cindex pixel width of a window
526@cindex total pixel height of a window 550@cindex total pixel width of a window
527 551
528@defun window-pixel-width &optional Lisp_Object &optional window 552@defun window-pixel-width &optional Lisp_Object &optional window
529This function returns the width of window @var{window} in pixels. 553This function returns the width of window @var{window} in pixels.
@@ -558,7 +582,6 @@ that of the root window on that frame. If @var{window} is omitted or
558 582
559@cindex window body height 583@cindex window body height
560@cindex body height of a window 584@cindex body height of a window
561@cindex window body width
562The @dfn{body height} of a window is the height of its text area, which 585The @dfn{body height} of a window is the height of its text area, which
563does not include a mode or header line, a horizontal scroll bar, or a 586does not include a mode or header line, a horizontal scroll bar, or a
564bottom divider. 587bottom divider.
@@ -578,9 +601,8 @@ counted. It also means that the height of a window's body can never
578exceed its total height as returned by @code{window-total-height}. 601exceed its total height as returned by @code{window-total-height}.
579@end defun 602@end defun
580 603
604@cindex window body width
581@cindex body width of a window 605@cindex body width of a window
582@cindex body size of a window
583@cindex window body size
584The @dfn{body width} of a window is the width of its text area, which 606The @dfn{body width} of a window is the width of its text area, which
585does not include the scroll bar, fringes, margins or a right divider. 607does not include the scroll bar, fringes, margins or a right divider.
586 608
@@ -599,6 +621,8 @@ counted. It also means that the width of a window's body can never
599exceed its total width as returned by @code{window-total-width}. 621exceed its total width as returned by @code{window-total-width}.
600@end defun 622@end defun
601 623
624@cindex window body size
625@cindex body size of a window
602@defun window-body-size &optional window horizontal pixelwise 626@defun window-body-size &optional window horizontal pixelwise
603This function returns the body height or body width of @var{window}. If 627This function returns the body height or body width of @var{window}. If
604@var{horizontal} is omitted or @code{nil}, it is equivalent to calling 628@var{horizontal} is omitted or @code{nil}, it is equivalent to calling
@@ -607,7 +631,7 @@ to calling @code{window-body-width}. In either case, the optional
607argument @var{pixelwise} is passed to the function called. 631argument @var{pixelwise} is passed to the function called.
608@end defun 632@end defun
609 633
610 For compatibility with previous versions of Emacs, 634For compatibility with previous versions of Emacs,
611@code{window-height} is an alias for @code{window-total-height}, and 635@code{window-height} is an alias for @code{window-total-height}, and
612@code{window-width} is an alias for @code{window-body-width}. These 636@code{window-width} is an alias for @code{window-body-width}. These
613aliases are considered obsolete and will be removed in the future. 637aliases are considered obsolete and will be removed in the future.
@@ -635,6 +659,22 @@ Functions for retrieving the height and/or width of window dividers
635(@pxref{Scroll Bars}), and display margins (@pxref{Display Margins}) are 659(@pxref{Scroll Bars}), and display margins (@pxref{Display Margins}) are
636described in the corresponding sections. 660described in the corresponding sections.
637 661
662If your Lisp program needs to make layout decisions, you will find the
663following function useful:
664
665@defun window-max-chars-per-line &optional window face
666This function returns the number of characters displayed in the
667specified @var{face} in the specified @var{window} (which must be a
668live window). If @var{face} was remapped (@pxref{Face Remapping}),
669the information is returned for the remapped face. If omitted or
670@code{nil}, @var{face} defaults to the default face, and @var{window}
671defaults to the selected window. Unlike @code{window-body-width},
672this function accounts for the actual size of the @var{face}'s font,
673instead of working in units of frame's canonical character width. It
674also accounts for space used by the continuation glyph, if
675@var{window} lacks one or both of its fringes.
676@end defun
677
638@cindex fixed-size window 678@cindex fixed-size window
639@vindex window-min-height 679@vindex window-min-height
640@vindex window-min-width 680@vindex window-min-width
@@ -643,7 +683,7 @@ or split them (@pxref{Splitting Windows}), obey the variables
643@code{window-min-height} and @code{window-min-width}, which specify the 683@code{window-min-height} and @code{window-min-width}, which specify the
644smallest allowable window height and width. They also obey the variable 684smallest allowable window height and width. They also obey the variable
645@code{window-size-fixed}, with which a window can be @dfn{fixed} in 685@code{window-size-fixed}, with which a window can be @dfn{fixed} in
646size: 686size (@pxref{Preserving Window Sizes}).
647 687
648@defopt window-min-height 688@defopt window-min-height
649This option specifies the minimum total height, in lines, of any window. 689This option specifies the minimum total height, in lines, of any window.
@@ -3082,6 +3122,17 @@ window-start position; if you move point, do not expect the window-start
3082position to change in response until after the next redisplay. 3122position to change in response until after the next redisplay.
3083@end defun 3123@end defun
3084 3124
3125@defun window-group-start &optional window
3126@vindex window-group-start-function
3127This function is like @code{window-start}, except that when
3128@var{window} is a part of a group of windows (@pxref{Window Group}),
3129@code{window-group-start} returns the start position of the entire
3130group. This condition holds when the buffer local variable
3131@code{window-group-start-function} is set to a function. In this
3132case, @code{window-group-start} calls the function with the single
3133argument @var{window}, then returns its result.
3134@end defun
3135
3085@cindex window end position 3136@cindex window end position
3086@defun window-end &optional window update 3137@defun window-end &optional window update
3087This function returns the position where display of its buffer ends in 3138This function returns the position where display of its buffer ends in
@@ -3108,6 +3159,18 @@ way real redisplay would do. It does not alter the
3108text will end if scrolling is not required. 3159text will end if scrolling is not required.
3109@end defun 3160@end defun
3110 3161
3162@vindex window-group-end-function
3163@defun window-group-end window update
3164This function is like @code{window-end}, except that when @var{window}
3165is a part of a group of windows (@pxref{Window Group}),
3166@code{window-group-end} returns the end position of the entire group.
3167This condition holds when the buffer local variable
3168@code{window-group-end-function} is set to a function. In this case,
3169@code{window-group-end} calls the function with the two arguments
3170@var{window} and @var{update}, then returns its result. The argument
3171@var{update} has the same meaning as in @code{window-end}.
3172@end defun
3173
3111@defun set-window-start window position &optional noforce 3174@defun set-window-start window position &optional noforce
3112This function sets the display-start position of @var{window} to 3175This function sets the display-start position of @var{window} to
3113@var{position} in @var{window}'s buffer. It returns @var{position}. 3176@var{position} in @var{window}'s buffer. It returns @var{position}.
@@ -3171,6 +3234,19 @@ off screen at the next redisplay, then redisplay computes a new window-start
3171position that works well with point, and thus @var{position} is not used. 3234position that works well with point, and thus @var{position} is not used.
3172@end defun 3235@end defun
3173 3236
3237@vindex set-window-group-start-function
3238@defun set-window-group-start window position &optional noforce
3239This function is like @code{set-window-start}, except that when
3240@var{window} is a part of a group of windows (@pxref{Window Group}),
3241@code{set-window-group-start} sets the start position of the entire
3242group. This condition holds when the buffer local variable
3243@code{set-window-group-start-function} is set to a function. In this
3244case, @code{set-window-group-start} calls the function with the three
3245arguments @var{window}, @var{position}, and @var{noforce}, then
3246returns its result. The arguments @var{position} and @var{noforce} in
3247this function have the same meaning as in @code{set-window-start}.
3248@end defun
3249
3174@defun pos-visible-in-window-p &optional position window partially 3250@defun pos-visible-in-window-p &optional position window partially
3175This function returns non-@code{nil} if @var{position} is within the 3251This function returns non-@code{nil} if @var{position} is within the
3176range of text currently visible on the screen in @var{window}. It 3252range of text currently visible on the screen in @var{window}. It
@@ -3212,6 +3288,21 @@ Here is an example:
3212@end example 3288@end example
3213@end defun 3289@end defun
3214 3290
3291@vindex pos-visible-in-window-group-p-function
3292@defun pos-visible-in-window-group-p &optional position window partially
3293This function is like @code{pos-visible-in-window-p}, except that when
3294@var{window} is a part of a group of windows (@pxref{Window Group}),
3295@code{pos-visible-in-window-group-p} tests the visibility of @var{pos}
3296in the entire group, not just in the single @var{window}. This
3297condition holds when the buffer local variable
3298@code{pos-visible-in-window-group-p-function} is set to a function.
3299In this case @code{pos-visible-in-window-group-p} calls the function
3300with the three arguments @var{position}, @var{window}, and
3301@var{partially}, then returns its result. The arguments
3302@var{position} and @var{partially} have the same meaning as in
3303@code{pos-visible-in-window-p}.
3304@end defun
3305
3215@defun window-line-height &optional line window 3306@defun window-line-height &optional line window
3216This function returns the height of text line @var{line} in 3307This function returns the height of text line @var{line} in
3217@var{window}. If @var{line} is one of @code{header-line} or 3308@var{window}. If @var{line} is one of @code{header-line} or
@@ -3455,6 +3546,19 @@ the top of the window. The command @code{recenter-top-bottom} offers
3455a more convenient way to achieve this. 3546a more convenient way to achieve this.
3456@end deffn 3547@end deffn
3457 3548
3549@vindex recenter-window-group-function
3550@defun recenter-window-group &optional count
3551This function is like @code{recenter}, except that when the selected
3552window is part of a group of windows (@pxref{Window Group}),
3553@code{recenter-window-group} scrolls the entire group. This condition
3554holds when the buffer local variable
3555@code{recenter-window-group-function} is set to a function. In this
3556case, @code{recenter-window-group} calls the function with the
3557argument @var{count}, then returns its result. The argument
3558@var{count} has the same meaning as in @code{recenter}, but with
3559respect to the entire window group.
3560@end defun
3561
3458@defopt recenter-redisplay 3562@defopt recenter-redisplay
3459If this variable is non-@code{nil}, calling @code{recenter} with a 3563If this variable is non-@code{nil}, calling @code{recenter} with a
3460@code{nil} argument redraws the frame. The default value is 3564@code{nil} argument redraws the frame. The default value is
@@ -4264,10 +4368,10 @@ work.
4264@end defvar 4368@end defvar
4265 4369
4266@defvar window-size-change-functions 4370@defvar window-size-change-functions
4267This variable holds a list of functions to be called if the size of any 4371This variable holds a list of functions to be called if the size of
4268window changes for any reason. The functions are called just once per 4372any window changes for any reason. The functions are called at the
4269redisplay, and just once for each frame on which size changes have 4373beginning of a redisplay cycle, and just once for each frame on which
4270occurred. 4374size changes have occurred.
4271 4375
4272Each function receives the frame as its sole argument. There is no 4376Each function receives the frame as its sole argument. There is no
4273direct way to find out which windows on that frame have changed size, or 4377direct way to find out which windows on that frame have changed size, or