aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-03-31 00:31:24 +0800
committerChong Yidong2012-03-31 00:31:24 +0800
commit5319014e4f4453155b1a8159c96c8ef1137e6c45 (patch)
tree26ccb8b85cb48b3ddb941c371e3b7840527e71fb
parentdc1783452e55eb290eb3a31e763f52c9d08c322f (diff)
downloademacs-5319014e4f4453155b1a8159c96c8ef1137e6c45.tar.gz
emacs-5319014e4f4453155b1a8159c96c8ef1137e6c45.zip
Updates for Display chapter of Lisp manual.
* doc/lispref/display.texi (Image Formats): Add imagemagick type. (Image Descriptors): Mention how they are used. (ImageMagick Images): Clarify role of imagemagick-register-types. (Character Display): Don't mention glyph tables. (Display Tables): Use make-glyph-code in example. (Glyphs): Avoid "simple glyph code" terminology. Note that glyph tables are semi-obsolete. De-document create-glyph. (Glyphless Chars): Note that display tables override this. (Bidirectional Display): Copyedits. Introduce "bidirectional reordering" terminology, and use it. * doc/emacs/files.texi (File Conveniences): Clarify Imagemagick discussion. * lisp/image.el (imagemagick-types-inhibit) (imagemagick-register-types): Doc fix.
-rw-r--r--admin/FOR-RELEASE2
-rw-r--r--doc/emacs/ChangeLog4
-rw-r--r--doc/emacs/files.texi38
-rw-r--r--doc/lispref/ChangeLog13
-rw-r--r--doc/lispref/display.texi663
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/image.el26
7 files changed, 388 insertions, 363 deletions
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE
index 10e589371c4..1f498e06c31 100644
--- a/admin/FOR-RELEASE
+++ b/admin/FOR-RELEASE
@@ -191,7 +191,7 @@ compile.texi cyd
191control.texi cyd 191control.texi cyd
192customize.texi cyd 192customize.texi cyd
193debugging.texi cyd 193debugging.texi cyd
194display.texi 194display.texi cyd
195edebug.texi 195edebug.texi
196elisp.texi 196elisp.texi
197errors.texi rgm 197errors.texi rgm
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 56a63b1a0eb..85e3054f293 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,7 @@
12012-03-30 Chong Yidong <cyd@gnu.org>
2
3 * files.texi (File Conveniences): Clarify Imagemagick discussion.
4
12012-03-22 Glenn Morris <rgm@gnu.org> 52012-03-22 Glenn Morris <rgm@gnu.org>
2 6
3 * dired.texi (Operating on Files): Fix dired-recursive-copies default. 7 * dired.texi (Operating on Files): Fix dired-recursive-copies default.
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 0d38728f7cf..b0d4e130c67 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -1911,27 +1911,35 @@ point. Partial Completion mode offers other features extending
1911@cindex images, viewing 1911@cindex images, viewing
1912@cindex image animation 1912@cindex image animation
1913@cindex animated images 1913@cindex animated images
1914 Visiting image files automatically selects Image mode. This major 1914 Visiting image files automatically selects Image mode. In this
1915mode allows you to toggle between displaying the file as an image in 1915major mode, you can type @kbd{C-c C-c} (@code{image-toggle-display})
1916the Emacs buffer, and displaying its underlying text representation, 1916to toggle between displaying the file as an image in the Emacs buffer,
1917using the command @kbd{C-c C-c} (@code{image-toggle-display}). This 1917and displaying its underlying text (or raw byte) representation.
1918works only when Emacs can display the specific image type@footnote{If 1918Displaying the file as an image works only if Emacs is compiled with
1919your Emacs was compiled with ImageMagick support, then after using 1919support for displaying such images. If the displayed image is wider
1920@code{imagemagick-register-types}, you can view in Image mode any
1921image type that ImageMagick supports; @pxref{ImageMagick Images,,,
1922elisp, The Emacs Lisp Reference Manual}}. If the displayed image is wider
1923or taller than the frame, the usual point motion keys (@kbd{C-f}, 1920or taller than the frame, the usual point motion keys (@kbd{C-f},
1924@kbd{C-p}, and so forth) cause different parts of the image to be 1921@kbd{C-p}, and so forth) cause different parts of the image to be
1925displayed. If the image can be animated, then the command @kbd{RET} 1922displayed. If the image can be animated, the command @kbd{RET}
1926(@code{image-toggle-animation}), will start (or stop) animating it. 1923(@code{image-toggle-animation}) starts or stops the animation.
1927Animation plays once, unless the option @code{image-animate-loop} is 1924Animation plays once, unless the option @code{image-animate-loop} is
1928non-@code{nil}. Currently, Emacs only supports animated GIF files 1925non-@code{nil}. Currently, Emacs only supports animation in GIF
1929(@pxref{Animated Images,,, elisp, The Emacs Lisp Reference Manual}). 1926files.
1927
1928@cindex ImageMagick support
1929 If your Emacs was compiled with ImageMagick support, it is possible
1930to view a much wider variety of image types in Image mode, by
1931rendering the images via ImageMagick. However, this feature is
1932currently disabled by default. To enable it, add the following line
1933to your init file:
1934
1935@example
1936(imagemagick-register-types)
1937@end example
1930 1938
1931@findex thumbs-mode 1939@findex thumbs-mode
1932@findex mode, thumbs 1940@findex mode, thumbs
1933 See also the Image-Dired package (@pxref{Image-Dired}) for viewing 1941 The Image-Dired package can also be used to view images as
1934images as thumbnails. 1942thumbnails. @xref{Image-Dired}.
1935 1943
1936@node Filesets 1944@node Filesets
1937@section Filesets 1945@section Filesets
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index f714638cdc9..332632fb21c 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,16 @@
12012-03-30 Chong Yidong <cyd@gnu.org>
2
3 * display.texi (Image Formats): Add imagemagick type.
4 (Image Descriptors): Mention how they are used.
5 (ImageMagick Images): Clarify role of imagemagick-register-types.
6 (Character Display): Don't mention glyph tables.
7 (Display Tables): Use make-glyph-code in example.
8 (Glyphs): Avoid "simple glyph code" terminology. Note that glyph
9 tables are semi-obsolete. De-document create-glyph.
10 (Glyphless Chars): Note that display tables override this.
11 (Bidirectional Display): Copyedits. Introduce "bidirectional
12 reordering" terminology, and use it.
13
12012-03-30 Glenn Morris <rgm@gnu.org> 142012-03-30 Glenn Morris <rgm@gnu.org>
2 15
3 * edebug.texi (Jumping): Give name of `i' binding. 16 * edebug.texi (Jumping): Give name of `i' binding.
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index b3bf78c4799..12b30dc599c 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -1402,7 +1402,7 @@ of them:
1402@table @code 1402@table @code
1403@item priority 1403@item priority
1404@kindex priority @r{(overlay property)} 1404@kindex priority @r{(overlay property)}
1405This property's value (which should be a nonnegative integer number) 1405This property's value (which should be a non-negative integer number)
1406determines the priority of the overlay. No priority, or @code{nil}, 1406determines the priority of the overlay. No priority, or @code{nil},
1407means zero. 1407means zero.
1408 1408
@@ -1557,7 +1557,7 @@ sense---only on the screen.
1557This property specifies a display spec to prepend to each 1557This property specifies a display spec to prepend to each
1558non-continuation line at display-time. @xref{Truncation}. 1558non-continuation line at display-time. @xref{Truncation}.
1559 1559
1560@itemx wrap-prefix 1560@item wrap-prefix
1561This property specifies a display spec to prepend to each continuation 1561This property specifies a display spec to prepend to each continuation
1562line at display-time. @xref{Truncation}. 1562line at display-time. @xref{Truncation}.
1563 1563
@@ -4118,95 +4118,103 @@ displayed (@pxref{Display Feature Testing}).
4118@cindex image formats 4118@cindex image formats
4119@cindex image types 4119@cindex image types
4120 4120
4121 Emacs can display a number of different image formats; some of them 4121 Emacs can display a number of different image formats. Some of
4122are supported only if particular support libraries are installed on 4122these image formats are supported only if particular support libraries
4123your machine. In some environments, Emacs can load support libraries 4123are installed. On some platforms, Emacs can load support libraries on
4124on demand; if so, the variable @code{dynamic-library-alist} 4124demand; if so, the variable @code{dynamic-library-alist} can be used
4125(@pxref{Dynamic Libraries}) can be used to modify the set of known 4125to modify the set of known names for these dynamic libraries.
4126names for these dynamic libraries (though it is not possible to add 4126@xref{Dynamic Libraries}.
4127new image formats). Note that image types @code{pbm} and @code{xbm} 4127
4128do not depend on external libraries and are always available in Emacs. 4128 Supported image formats (and the required support libraries) include
4129 4129PBM and XBM (which do not depend on support libraries and are always
4130 The supported image formats (and the necessary library files) 4130available), XPM (@code{libXpm}), GIF (@code{libgif} or
4131include XBM, XPM (@code{libXpm} and @code{libz}), GIF (@code{libgif} 4131@code{libungif}), PostScript (@code{gs}), JPEG (@code{libjpeg}), TIFF
4132or @code{libungif}), PostScript, PBM, JPEG (@code{libjpeg}), TIFF
4133(@code{libtiff}), PNG (@code{libpng}), and SVG (@code{librsvg}). 4132(@code{libtiff}), PNG (@code{libpng}), and SVG (@code{librsvg}).
4134 4133
4135 You specify one of these formats with an image type symbol. The image 4134 Each of these image formats is associated with an @dfn{image type
4136type symbols are @code{xbm}, @code{xpm}, @code{gif}, @code{postscript}, 4135symbol}. The symbols for the above formats are, respectively,
4137@code{pbm}, @code{jpeg}, @code{tiff}, @code{png}, and @code{svg}. 4136@code{pbm}, @code{xbm}, @code{xpm}, @code{gif}, @code{postscript},
4137@code{jpeg}, @code{tiff}, @code{png}, and @code{svg}.
4138
4139 Furthermore, if you build Emacs with ImageMagick
4140(@code{libMagickWand}) support, Emacs can display any image format
4141that ImageMagick can. @xref{ImageMagick Images}. All images
4142displayed via ImageMagick have type symbol @code{imagemagick}.
4138 4143
4139@defvar image-types 4144@defvar image-types
4140This variable contains a list of those image type symbols that are 4145This variable contains a list of type symbols for image formats which
4141potentially supported in the current configuration. 4146are potentially supported in the current configuration.
4142@emph{Potentially} here means that Emacs knows about the image types, 4147
4143not necessarily that they can be loaded (they could depend on 4148``Potentially'' means that Emacs knows about the image types, not
4144unavailable dynamic libraries, for example). 4149necessarily that they can be used (for example, they could depend on
4145 4150unavailable dynamic libraries). To know which image types are really
4146To know which image types are really available, use 4151available, use @code{image-type-available-p}.
4147@code{image-type-available-p}.
4148@end defvar 4152@end defvar
4149 4153
4150@defun image-type-available-p type 4154@defun image-type-available-p type
4151This function returns non-@code{nil} if image type @var{type} is 4155This function returns non-@code{nil} if images of type @var{type} can
4152available, i.e., if images of this type can be loaded and displayed in 4156be loaded and displayed. @var{type} must be an image type symbol.
4153Emacs. @var{type} should be one of the types contained in
4154@code{image-types}.
4155 4157
4156For image types whose support libraries are statically linked, this 4158For image types whose support libraries are statically linked, this
4157function always returns @code{t}; for other image types, it returns 4159function always returns @code{t}. For image types whose support
4158@code{t} if the dynamic library could be loaded, @code{nil} otherwise. 4160libraries are dynamically loaded, it returns @code{t} if the library
4161could be loaded and @code{nil} otherwise.
4159@end defun 4162@end defun
4160 4163
4161@node Image Descriptors 4164@node Image Descriptors
4162@subsection Image Descriptors 4165@subsection Image Descriptors
4163@cindex image descriptor 4166@cindex image descriptor
4164 4167
4165 An image description is a list of the form @code{(image . @var{props})}, 4168 An @dfn{image descriptor} is a list which specifies the underlying
4166where @var{props} is a property list containing alternating keyword 4169data for an image, and how to display it. It is typically used as the
4167symbols (symbols whose names start with a colon) and their values. 4170value of a @code{display} overlay or text property (@pxref{Other
4168You can use any Lisp object as a property, but the only properties 4171Display Specs}); but @xref{Showing Images}, for convenient helper
4169that have any special meaning are certain symbols, all of them keywords. 4172functions to insert images into buffers.
4170 4173
4171 Every image descriptor must contain the property @code{:type 4174 Each image descriptor has the form @code{(image . @var{props})},
4172@var{type}} to specify the format of the image. The value of @var{type} 4175where @var{props} is a property list of alternating keyword symbols
4173should be an image type symbol; for example, @code{xpm} for an image in 4176and values, including at least the pair @code{:type @var{TYPE}} which
4174XPM format. 4177specifies the image type.
4175 4178
4176 Here is a list of other properties that are meaningful for all image 4179 The following is a list of properties that are meaningful for all
4177types: 4180image types (there are also properties which are meaningful only for
4181certain image types, as documented in the following subsections):
4178 4182
4179@table @code 4183@table @code
4184@item :type @var{type}
4185The image type.
4186@ifnottex
4187@xref{Image Formats}.
4188@end ifnottex
4189Every image descriptor must include this property.
4190
4180@item :file @var{file} 4191@item :file @var{file}
4181The @code{:file} property says to load the image from file 4192This says to load the image from file @var{file}. If @var{file} is
4182@var{file}. If @var{file} is not an absolute file name, it is expanded 4193not an absolute file name, it is expanded in @code{data-directory}.
4183in @code{data-directory}.
4184 4194
4185@item :data @var{data} 4195@item :data @var{data}
4186The @code{:data} property says the actual contents of the image. 4196This specifies the raw image data. Each image descriptor must have
4187Each image must use either @code{:data} or @code{:file}, but not both. 4197either @code{:data} or @code{:file}, but not both.
4188For most image types, the value of the @code{:data} property should be a
4189string containing the image data; we recommend using a unibyte string.
4190 4198
4191Before using @code{:data}, look for further information in the section 4199For most image types, the value of a @code{:data} property should be a
4192below describing the specific image format. For some image types, 4200string containing the image data. Some image types do not support
4193@code{:data} may not be supported; for some, it allows other data types; 4201@code{:data}; for some others, @code{:data} alone is not enough, so
4194for some, @code{:data} alone is not enough, so you need to use other 4202you need to use other image properties along with @code{:data}. See
4195image properties along with @code{:data}. 4203the following subsections for details.
4196 4204
4197@item :margin @var{margin} 4205@item :margin @var{margin}
4198The @code{:margin} property specifies how many pixels to add as an 4206This specifies how many pixels to add as an extra margin around the
4199extra margin around the image. The value, @var{margin}, must be a 4207image. The value, @var{margin}, must be a non-negative number, or a
4200non-negative number, or a pair @code{(@var{x} . @var{y})} of such 4208pair @code{(@var{x} . @var{y})} of such numbers. If it is a pair,
4201numbers. If it is a pair, @var{x} specifies how many pixels to add 4209@var{x} specifies how many pixels to add horizontally, and @var{y}
4202horizontally, and @var{y} specifies how many pixels to add vertically. 4210specifies how many pixels to add vertically. If @code{:margin} is not
4203If @code{:margin} is not specified, the default is zero. 4211specified, the default is zero.
4204 4212
4205@item :ascent @var{ascent} 4213@item :ascent @var{ascent}
4206The @code{:ascent} property specifies the amount of the image's 4214This specifies the amount of the image's height to use for its
4207height to use for its ascent---that is, the part above the baseline. 4215ascent---that is, the part above the baseline. The value,
4208The value, @var{ascent}, must be a number in the range 0 to 100, or 4216@var{ascent}, must be a number in the range 0 to 100, or the symbol
4209the symbol @code{center}. 4217@code{center}.
4210 4218
4211If @var{ascent} is a number, that percentage of the image's height is 4219If @var{ascent} is a number, that percentage of the image's height is
4212used for its ascent. 4220used for its ascent.
@@ -4219,16 +4227,15 @@ properties and overlays that apply to the image.
4219If this property is omitted, it defaults to 50. 4227If this property is omitted, it defaults to 50.
4220 4228
4221@item :relief @var{relief} 4229@item :relief @var{relief}
4222The @code{:relief} property, if non-@code{nil}, adds a shadow rectangle 4230This adds a shadow rectangle around the image. The value,
4223around the image. The value, @var{relief}, specifies the width of the 4231@var{relief}, specifies the width of the shadow lines, in pixels. If
4224shadow lines, in pixels. If @var{relief} is negative, shadows are drawn 4232@var{relief} is negative, shadows are drawn so that the image appears
4225so that the image appears as a pressed button; otherwise, it appears as 4233as a pressed button; otherwise, it appears as an unpressed button.
4226an unpressed button.
4227 4234
4228@item :conversion @var{algorithm} 4235@item :conversion @var{algorithm}
4229The @code{:conversion} property, if non-@code{nil}, specifies a 4236This specifies a conversion algorithm that should be applied to the
4230conversion algorithm that should be applied to the image before it is 4237image before it is displayed; the value, @var{algorithm}, specifies
4231displayed; the value, @var{algorithm}, specifies which algorithm. 4238which algorithm.
4232 4239
4233@table @code 4240@table @code
4234@item laplace 4241@item laplace
@@ -4498,30 +4505,41 @@ specifying the bounding box of the PostScript image, analogous to the
4498@cindex ImageMagick images 4505@cindex ImageMagick images
4499@cindex images, support for more formats 4506@cindex images, support for more formats
4500 4507
4501 If you build Emacs with ImageMagick (@url{http://www.imagemagick.org}) 4508 If you build Emacs with ImageMagick support, you can use the
4502support, you can use the ImageMagick library to load many image formats. 4509ImageMagick library to load many image formats. The image type symbol
4503 4510for images loaded via ImageMagick is @code{imagemagick}, regardless of
4504@findex imagemagick-types 4511the actual underlying image format.
4505@findex imagemagick-register-types 4512
4506The function @code{imagemagick-types} returns a list of image file 4513@defun imagemagick-types
4507extensions that your installation of ImageMagick supports. To enable 4514This function returns a list of image file extensions supported by the
4508support, you must call the function @code{imagemagick-register-types}. 4515current ImageMagick installation.
4509This enables Emacs to visit these file types in @code{image-mode} 4516@end defun
4510(@pxref{File Conveniences,,, emacs, The GNU Emacs Manual}). 4517
4511If your Emacs was not compiled with ImageMagick support, then 4518 By default, Emacs does not use ImageMagick to display images in
4512@code{imagemagick-types} will be undefined and 4519Image mode, e.g.@: when visiting such files with @kbd{C-x C-f}. This
4513@code{imagemagick-register-types} will do nothing. 4520feature is enabled by calling @code{imagemagick-register-types}.
4514 4521
4515@vindex imagemagick-types-inhibit 4522@defun imagemagick-register-types
4516The variable @code{imagemagick-types-inhibit} specifies a list of 4523This function enables using Image mode to visit image files supported
4517image types that you do @emph{not} want ImageMagick to handle. It is 4524by ImageMagick. @xref{File Conveniences,,, emacs, The GNU Emacs
4518a list of symbols, each of which has the same name as one of the 4525Manual}. It also causes @code{create-image} and other helper
4519format tags used internally by ImageMagick (i.e., as 4526functions to associate such file names with the @code{imagemagick}
4520@code{imagemagick-types} returns). ImageMagick has a very broad 4527image type (@pxref{Defining Images}).
4521definition of what an image is, for example it includes such file 4528
4522types as C files and HTML files. It is not appropriate to treat these 4529All image file extensions supported by ImageMagick are registered,
4523as images in Emacs. You can add any other ImageMagick type that you 4530except those specified in @code{imagemagick-types-inhibit}. If Emacs
4524wish to this list. 4531was not compiled with ImageMagick support, this function does nothing.
4532@end defun
4533
4534@defopt imagemagick-types-inhibit
4535This variable specifies a list of image types that should @emph{not}
4536be registered by @code{imagemagick-register-types}. Each entry in
4537this list should be one of the symbols returned by
4538@code{imagemagick-types}. The default value lists several file types
4539that are considered ``images'' by ImageMagick, but which should not be
4540considered as images by Emacs, including C files and HTML files.
4541@end defopt
4542
4525@ignore 4543@ignore
4526@c I don't know what this means. I suspect it means eg loading jpg 4544@c I don't know what this means. I suspect it means eg loading jpg
4527@c images via libjpeg or ImageMagick. But it doesn't work. 4545@c images via libjpeg or ImageMagick. But it doesn't work.
@@ -4538,17 +4556,9 @@ loaders).
4538For example, if you never want to use the ImageMagick loader to view 4556For example, if you never want to use the ImageMagick loader to view
4539JPEG files, add @code{JPG} to this list. 4557JPEG files, add @code{JPG} to this list.
4540@end ignore 4558@end ignore
4541Note that ImageMagick often distinguishes between several different
4542types of a particular format (e.g., @code{JPG}, @code{JPEG},
4543@code{PJPEG}, etc.), and you may need to add all versions to this
4544list.
4545
4546@c Not sure this should even be in the manual at all.
4547@vindex imagemagick-render-type
4548If you wish to experiment with the performance of the ImageMagick
4549loader, see the variable @code{imagemagick-render-type}.
4550 4559
4551Images loaded with ImageMagick support a few new display specifications: 4560 Images loaded with ImageMagick support the following additional
4561image descriptor properties:
4552 4562
4553@table @code 4563@table @code
4554@item :width, :height 4564@item :width, :height
@@ -4568,7 +4578,6 @@ such as DJVM. You can use the @code{image-metadata} function to
4568retrieve the total number of images in an image bundle. 4578retrieve the total number of images in an image bundle.
4569@end table 4579@end table
4570 4580
4571
4572@node Other Image Types 4581@node Other Image Types
4573@subsection Other Image Types 4582@subsection Other Image Types
4574@cindex PBM 4583@cindex PBM
@@ -4767,10 +4776,10 @@ This function inserts @var{image} in the current buffer at point, like
4767@code{insert-image}, but splits the image into @var{rows}x@var{cols} 4776@code{insert-image}, but splits the image into @var{rows}x@var{cols}
4768equally sized slices. 4777equally sized slices.
4769 4778
4770If an image is inserted ``sliced'', then the Emacs display engine will 4779If an image is inserted ``sliced'', Emacs displays each slice as a
4771treat each slice as a separate image, and allow more intuitive 4780separate image, and allow more intuitive scrolling up/down, instead of
4772scrolling up/down, instead of jumping up/down the entire image when 4781jumping up/down the entire image when paging through a buffer that
4773paging through a buffer that displays (large) images. 4782displays (large) images.
4774@end defun 4783@end defun
4775 4784
4776@defun put-image image pos &optional string area 4785@defun put-image image pos &optional string area
@@ -5624,9 +5633,6 @@ Here is an example of calling this function explicitly.
5624@smallexample 5633@smallexample
5625@group 5634@group
5626(defun interactive-blink-matching-open () 5635(defun interactive-blink-matching-open ()
5627@c Do not break this line! -- rms.
5628@c The first line of a doc string
5629@c must stand alone.
5630 "Indicate momentarily the start of sexp before point." 5636 "Indicate momentarily the start of sexp before point."
5631 (interactive) 5637 (interactive)
5632@end group 5638@end group
@@ -5642,23 +5648,19 @@ Here is an example of calling this function explicitly.
5642@node Character Display 5648@node Character Display
5643@section Character Display 5649@section Character Display
5644 5650
5645@cindex glyph 5651 This section describes how characters are actually displayed by
5646This section describes how characters are actually displayed by Emacs. 5652Emacs. Typically, a character is displayed as a @dfn{glyph} (a
5647Typically, a character is displayed as a @dfn{glyph} (a graphical 5653graphical symbol which occupies one character position on the screen),
5648symbol which occupies one character position on the screen), whose 5654whose appearance corresponds to the character itself. For example,
5649appearance corresponds to the character itself. For example, the 5655the character @samp{a} (character code 97) is displayed as @samp{a}.
5650character @samp{a} (character code 97) is displayed as @samp{a}. Some 5656Some characters, however, are displayed specially. For example, the
5651characters, however, are displayed specially. For example, the
5652formfeed character (character code 12) is usually displayed as a 5657formfeed character (character code 12) is usually displayed as a
5653sequence of two glyphs, @samp{^L}, while the newline character 5658sequence of two glyphs, @samp{^L}, while the newline character
5654(character code 10) starts a new screen line. 5659(character code 10) starts a new screen line.
5655 5660
5656 You can modify how each character is displayed by defining a 5661 You can modify how each character is displayed by defining a
5657@dfn{display table}, which maps each character code into a sequence of 5662@dfn{display table}, which maps each character code into a sequence of
5658glyphs. @xref{Display Tables}. A related feature, called the 5663glyphs. @xref{Display Tables}.
5659@dfn{glyph table}, allows you to control how each character is
5660displayed on a text terminal. @xref{Glyphs}.
5661
5662 5664
5663@menu 5665@menu
5664* Usual Display:: The usual conventions for displaying characters. 5666* Usual Display:: The usual conventions for displaying characters.
@@ -5671,8 +5673,8 @@ displayed on a text terminal. @xref{Glyphs}.
5671@node Usual Display 5673@node Usual Display
5672@subsection Usual Display Conventions 5674@subsection Usual Display Conventions
5673 5675
5674 Here are the usual conventions for display each character code (in 5676 Here are the conventions for displaying each character code (in the
5675the absence of a display table, which can override these 5677absence of a display table, which can override these
5676@iftex 5678@iftex
5677conventions). 5679conventions).
5678@end iftex 5680@end iftex
@@ -5685,8 +5687,7 @@ conventions; @pxref{Display Tables}).
5685@item 5687@item
5686The @dfn{printable @acronym{ASCII} characters}, character codes 32 5688The @dfn{printable @acronym{ASCII} characters}, character codes 32
5687through 126 (consisting of numerals, English letters, and symbols like 5689through 126 (consisting of numerals, English letters, and symbols like
5688@samp{#}) are displayed literally, i.e.@: they map onto glyph codes 32 5690@samp{#}) are displayed literally.
5689through 126.
5690 5691
5691@item 5692@item
5692The tab character (character code 9) displays as whitespace stretching 5693The tab character (character code 9) displays as whitespace stretching
@@ -5695,8 +5696,8 @@ Emacs Manual}. The variable @code{tab-width} controls the number of
5695spaces per tab stop (see below). 5696spaces per tab stop (see below).
5696 5697
5697@item 5698@item
5698The newline character (character code 10) has the effect of ending the 5699The newline character (character code 10) has a special effect: it
5699preceding line and starting a new line. 5700ends the preceding line and starts a new line.
5700 5701
5701@cindex ASCII control characters 5702@cindex ASCII control characters
5702@item 5703@item
@@ -5825,16 +5826,21 @@ when there are no scroll bars; if scroll bars are supported and in use,
5825a scroll bar separates the two windows. 5826a scroll bar separates the two windows.
5826@end table 5827@end table
5827 5828
5828 For example, here is how to construct a display table that mimics the 5829 For example, here is how to construct a display table that mimics
5829effect of setting @code{ctl-arrow} to a non-@code{nil} value: 5830the effect of setting @code{ctl-arrow} to a non-@code{nil} value
5831(@pxref{Glyphs}, for the function @code{make-glyph-code}):
5830 5832
5831@example 5833@example
5832(setq disptab (make-display-table)) 5834(setq disptab (make-display-table))
5833(dotimes (i 32) 5835(dotimes (i 32)
5834 (or (= i ?\t) 5836 (or (= i ?\t)
5835 (= i ?\n) 5837 (= i ?\n)
5836 (aset disptab i (vector ?^ (+ i 64))))) 5838 (aset disptab i
5837(aset disptab 127 (vector ?^ ??)) 5839 (vector (make-glyph-code ?^ 'escape-glyph)
5840 (make-glyph-code (+ i 64) 'escape-glyph)))))
5841(aset disptab 127
5842 (vector (make-glyph-code ?^ 'escape-glyph)
5843 (make-glyph-code ?? 'escape-glyph)))))
5838@end example 5844@end example
5839 5845
5840@defun display-table-slot display-table slot 5846@defun display-table-slot display-table slot
@@ -5906,122 +5912,82 @@ the standard display table.
5906 5912
5907@node Glyphs 5913@node Glyphs
5908@subsection Glyphs 5914@subsection Glyphs
5915@cindex glyph
5909 5916
5910 A @dfn{glyph} is a graphical symbol which occupies a single 5917 A @dfn{glyph} is a graphical symbol which occupies a single
5911character position on the screen. Each glyph is represented in Lisp 5918character position on the screen. Each glyph is represented in Lisp
5912as a @dfn{glyph code}. A glyph code can be @dfn{simple}, or it can be 5919as a @dfn{glyph code}, which specifies a character and optionally a
5913defined by the @dfn{glyph table}. A simple glyph code is just a way 5920face to display it in (@pxref{Faces}). The main use of glyph codes is
5914of specifying a character and a face to output it in. @xref{Faces}. 5921as the entries of display tables (@pxref{Display Tables}). The
5915 5922following functions are used to manipulate glyph codes:
5916 The following functions are used to manipulate simple glyph codes:
5917 5923
5918@defun make-glyph-code char &optional face 5924@defun make-glyph-code char &optional face
5919This function returns a simple glyph code representing char @var{char} 5925This function returns a glyph code representing char @var{char} with
5920with face @var{face}. 5926face @var{face}. If @var{face} is omitted or @code{nil}, the glyph
5927uses the default face; in that case, the glyph code is an integer. If
5928@var{face} is non-@code{nil}, the glyph code is not necessarily an
5929integer object.
5921@end defun 5930@end defun
5922 5931
5923@defun glyph-char glyph 5932@defun glyph-char glyph
5924This function returns the character of simple glyph code @var{glyph}. 5933This function returns the character of glyph code @var{glyph}.
5925@end defun 5934@end defun
5926 5935
5927@defun glyph-face glyph 5936@defun glyph-face glyph
5928This function returns face of simple glyph code @var{glyph}, or 5937This function returns face of glyph code @var{glyph}, or @code{nil} if
5929@code{nil} if @var{glyph} has the default face (face-id 0). 5938@var{glyph} uses the default face.
5930@xref{Face Functions}.
5931@end defun 5939@end defun
5932 5940
5933 On character terminals, you can set up a @dfn{glyph table} to define 5941@ifnottex
5934the meaning of glyph codes (represented as small integers). 5942 You can set up a @dfn{glyph table} to change how glyph codes are
5943actually displayed on text terminals. This feature is semi-obsolete;
5944use @code{glyphless-char-display} instead (@pxref{Glyphless Chars}).
5935 5945
5936@defvar glyph-table 5946@defvar glyph-table
5937The value of this variable is the current glyph table. It should be 5947The value of this variable, if non-@code{nil}, is the current glyph
5938@code{nil} or a vector whose @var{g}th element defines glyph code 5948table. It takes effect only on character terminals; on graphical
5939@var{g}. 5949displays, all glyphs are displayed literally. The glyph table should
5940 5950be a vector whose @var{g}th element specifies how to display glyph
5941If a glyph code is greater than or equal to the length of the glyph 5951code @var{g}, where @var{g} is the glyph code for a glyph whose face
5942table, that code is automatically simple. If @code{glyph-table} is 5952is unspecified. Each element should be one of the following:
5943@code{nil} then all glyph codes are simple.
5944
5945The glyph table is used only on character terminals. On graphical
5946displays, all glyph codes are simple.
5947@end defvar
5948
5949 Here are the meaningful types of elements in the glyph table:
5950 5953
5951@table @asis 5954@table @asis
5952@item @var{string}
5953Send the characters in @var{string} to the terminal to output
5954this glyph code.
5955
5956@item @var{code}
5957Define this glyph code as an alias for glyph code @var{code} created
5958by @code{make-glyph-code}. You can use such an alias to define a
5959small-numbered glyph code which specifies a character with a face.
5960
5961@item @code{nil} 5955@item @code{nil}
5962This glyph code is simple. 5956Display this glyph literally.
5963@end table
5964
5965@defun create-glyph string
5966This function returns a newly-allocated glyph code which is set up to
5967display by sending @var{string} to the terminal.
5968@end defun
5969
5970@node Beeping
5971@section Beeping
5972@c @cindex beeping "beep" is adjacent
5973@cindex bell
5974 5957
5975 This section describes how to make Emacs ring the bell (or blink the 5958@item a string
5976screen) to attract the user's attention. Be conservative about how 5959Display this glyph by sending the specified string to the terminal.
5977often you do this; frequent bells can become irritating. Also be
5978careful not to use just beeping when signaling an error is more
5979appropriate. (@xref{Errors}.)
5980 5960
5981@defun ding &optional do-not-terminate 5961@item a glyph code
5982@cindex keyboard macro termination 5962Display the specified glyph code instead.
5983This function beeps, or flashes the screen (see @code{visible-bell} below). 5963@end table
5984It also terminates any keyboard macro currently executing unless
5985@var{do-not-terminate} is non-@code{nil}.
5986@end defun
5987
5988@defun beep &optional do-not-terminate
5989This is a synonym for @code{ding}.
5990@end defun
5991
5992@defopt visible-bell
5993This variable determines whether Emacs should flash the screen to
5994represent a bell. Non-@code{nil} means yes, @code{nil} means no.
5995This is effective on graphical displays, and on text terminals
5996provided the terminal's Termcap entry defines the visible bell
5997capability (@samp{vb}).
5998@end defopt
5999 5964
6000@defvar ring-bell-function 5965Any integer glyph code greater than or equal to the length of the
6001If this is non-@code{nil}, it specifies how Emacs should ``ring the 5966glyph table is displayed literally.
6002bell.'' Its value should be a function of no arguments. If this is
6003non-@code{nil}, it takes precedence over the @code{visible-bell}
6004variable.
6005@end defvar 5967@end defvar
5968@end ifnottex
6006 5969
6007@node Glyphless Chars 5970@node Glyphless Chars
6008@subsection Glyphless Character Display 5971@subsection Glyphless Character Display
6009@cindex glyphless characters 5972@cindex glyphless characters
6010 5973
6011 @dfn{Glyphless characters} are not displayed in the usual way when 5974 @dfn{Glyphless characters} are characters which are displayed in a
6012they appear in a buffer, but in some special way (e.g. as a box 5975special way, e.g.@: as a box containing a hexadecimal code, instead of
6013containing a hexadecimal code). These include characters that cannot 5976being displayed literally. These include characters which are
6014be displayed with any available font (on a graphical display), or that 5977explicitly defined to be glyphless, as well as characters for which
6015cannot be encoded by the terminal's coding system (on a text 5978there is no available font (on a graphical display), and characters
6016terminal). Specific characters can also be defined to be glyphless. 5979which cannot be encoded by the terminal's coding system (on a text
5980terminal).
6017 5981
6018@defvar glyphless-char-display 5982@defvar glyphless-char-display
6019The value of this variable is a char-table that defines glyphless 5983The value of this variable is a char-table which defines glyphless
6020characters and how they are displayed. If an entry is @code{nil}, the 5984characters and how they are displayed. Each entry must be one of the
6021corresponding character is displayed in its usual way. Otherwise, an 5985following display methods:
6022entry should be one of the following display methods:
6023 5986
6024@table @asis 5987@table @asis
5988@item @code{nil}
5989Display the character in the usual way.
5990
6025@item @code{zero-width} 5991@item @code{zero-width}
6026Don't display the character. 5992Don't display the character.
6027 5993
@@ -6038,27 +6004,34 @@ hexadecimal notation.
6038 6004
6039@item an @acronym{ASCII} string 6005@item an @acronym{ASCII} string
6040Display a box containing that string. 6006Display a box containing that string.
6007
6008@item a cons cell @code{(@var{graphical} . @var{text})}
6009Display with @var{graphical} on graphical displays, and with
6010@var{text} on text terminals. Both @var{graphical} and @var{text}
6011must be one of the display methods described above.
6041@end table 6012@end table
6042 6013
6043@noindent 6014@noindent
6044Except for @code{zero-width}, these methods display using the 6015The @code{thin-space}, @code{empty-box}, @code{hex-code}, and
6016@acronym{ASCII} string display methods are drawn with the
6045@code{glyphless-char} face. 6017@code{glyphless-char} face.
6046 6018
6047An entry can also be a cons cell @code{(@var{graphical}
6048. @var{text})}, where @var{graphical} and @var{text} are the display
6049methods on graphical displays and text terminals respectively.
6050
6051The char-table has one extra slot, which determines how to display any 6019The char-table has one extra slot, which determines how to display any
6052character that cannot be displayed with any available font, or cannot 6020character that cannot be displayed with any available font, or cannot
6053be encoded by the terminal's coding system. Its value should be one 6021be encoded by the terminal's coding system. Its value should be one
6054of the above display methods, except @code{zero-width} or a cons cell. 6022of the above display methods, except @code{zero-width} or a cons cell.
6023
6024If a character has a non-@code{nil} entry in an active display table,
6025the display table takes effect; in this case, Emacs does not consult
6026@code{glyphless-char-display} at all.
6055@end defvar 6027@end defvar
6056 6028
6057@defopt glyphless-char-display-control 6029@defopt glyphless-char-display-control
6058This user option provides a convenient way to set 6030This user option provides a convenient way to set
6059@code{glyphless-char-display} for groups of similar characters. It 6031@code{glyphless-char-display} for groups of similar characters. Do
6060takes effect via a custom @code{:set} function (@pxref{Variable 6032not set its value directly from Lisp code; the value takes effect only
6061Definitions}), which update @code{glyphless-char-display}. 6033via a custom @code{:set} function (@pxref{Variable Definitions}),
6034which updates @code{glyphless-char-display}.
6062 6035
6063Its value should be an alist of elements @code{(@var{group} 6036Its value should be an alist of elements @code{(@var{group}
6064. @var{method})}, where @var{group} is a symbol specifying a group of 6037. @var{method})}, where @var{group} is a symbol specifying a group of
@@ -6097,6 +6070,42 @@ The @var{method} symbol should be one of @code{zero-width},
6097the same meanings as in @code{glyphless-char-display}, above. 6070the same meanings as in @code{glyphless-char-display}, above.
6098@end defopt 6071@end defopt
6099 6072
6073@node Beeping
6074@section Beeping
6075@cindex bell
6076
6077 This section describes how to make Emacs ring the bell (or blink the
6078screen) to attract the user's attention. Be conservative about how
6079often you do this; frequent bells can become irritating. Also be
6080careful not to use just beeping when signaling an error is more
6081appropriate (@pxref{Errors}).
6082
6083@defun ding &optional do-not-terminate
6084@cindex keyboard macro termination
6085This function beeps, or flashes the screen (see @code{visible-bell} below).
6086It also terminates any keyboard macro currently executing unless
6087@var{do-not-terminate} is non-@code{nil}.
6088@end defun
6089
6090@defun beep &optional do-not-terminate
6091This is a synonym for @code{ding}.
6092@end defun
6093
6094@defopt visible-bell
6095This variable determines whether Emacs should flash the screen to
6096represent a bell. Non-@code{nil} means yes, @code{nil} means no.
6097This is effective on graphical displays, and on text terminals
6098provided the terminal's Termcap entry defines the visible bell
6099capability (@samp{vb}).
6100@end defopt
6101
6102@defvar ring-bell-function
6103If this is non-@code{nil}, it specifies how Emacs should ``ring the
6104bell.'' Its value should be a function of no arguments. If this is
6105non-@code{nil}, it takes precedence over the @code{visible-bell}
6106variable.
6107@end defvar
6108
6100@node Window Systems 6109@node Window Systems
6101@section Window Systems 6110@section Window Systems
6102 6111
@@ -6166,61 +6175,56 @@ interfere with it.
6166@cindex right-to-left text 6175@cindex right-to-left text
6167 6176
6168 Emacs can display text written in scripts, such as Arabic, Farsi, 6177 Emacs can display text written in scripts, such as Arabic, Farsi,
6169and Hebrew, whose natural ordering of horizontal text for display is 6178and Hebrew, whose natural ordering for horizontal text display runs
6170from right to left. However, digits and Latin text embedded in these 6179from right to left. Furthermore, segments of Latin script and digits
6171scripts are still displayed left to right. It is also not uncommon to 6180embedded in right-to-left text are displayed left-to-right, while
6172have small portions of text in Arabic or Hebrew embedded in otherwise 6181segments of right-to-left script embedded in left-to-right text
6173Latin document, e.g., as comments and strings in a program source 6182(e.g.@: Arabic or Hebrew text in comments or strings in a program
6174file. Likewise, small portions of Latin text can be embedded in an 6183source file) are appropriately displayed right-to-left. We call such
6175Arabic or Farsi document. For these reasons, text that uses these 6184mixtures of left-to-right and right-to-left text @dfn{bidirectional
6176scripts is actually @dfn{bidirectional}: a mixture of runs of 6185text}. This section describes the facilities and options for editing
6177left-to-right and right-to-left characters. 6186and displaying bidirectional text.
6178
6179 This section describes the facilities and options provided by Emacs
6180for editing and displaying bidirectional text.
6181 6187
6182@cindex logical order 6188@cindex logical order
6183@cindex reading order 6189@cindex reading order
6184@cindex visual order 6190@cindex visual order
6185@cindex unicode bidirectional algorithm 6191@cindex unicode bidirectional algorithm
6186 Emacs stores right-to-left and bidirectional text in the so-called 6192@cindex bidirectional reordering
6187@dfn{logical} (or @dfn{reading}) order: the buffer or string position 6193 Text is stored in Emacs buffers and strings in @dfn{logical} (or
6188of the first character you read precedes that of the next character. 6194@dfn{reading}) order, i.e.@: the order in which a human would read
6189Reordering of bidirectional text into the @dfn{visual} order happens 6195each character. In right-to-left and bidirectional text, the order in
6190at display time. As result, character positions no longer increase 6196which characters are displayed on the screen (called @dfn{visual
6191monotonically with their positions on display. Emacs implements the 6197order}) is not the same as logical order; the characters' screen
6192Unicode Bidirectional Algorithm (a.k.a.@: @acronym{UBA}) described in 6198positions do not increase monotonically with string or buffer
6193the Unicode Standard Annex #9, for reordering of bidirectional text 6199position. In performing this @dfn{bidirectional reordering}, Emacs
6194for display. Reordering of bidirectional text for display in Emacs is 6200follows the Unicode Bidirectional Algorithm (a.k.a.@: @acronym{UBA}),
6195a ``Full bidirectionality'' class implementation of the @acronym{UBA}. 6201which is described in Annex #9 of the Unicode standard
6202(@url{http://www.unicode.org/reports/tr9/}). Emacs provides a ``Full
6203Bidirectionality'' class implementation of the @acronym{UBA}.
6196 6204
6197@defvar bidi-display-reordering 6205@defvar bidi-display-reordering
6198 This buffer-local variable controls whether text in the buffer is 6206If the value of this buffer-local variable is non-@code{nil} (the
6199reordered for display. If its value is non-@code{nil}, Emacs reorders 6207default), Emacs performs bidirectional reordering for display. The
6200characters that have right-to-left directionality when they are 6208reordering affects buffer text, as well as display strings and overlay
6201displayed. The default value is @code{t}. Text in overlay strings 6209strings from text and overlay properties in the buffer (@pxref{Overlay
6202(@pxref{Overlay Properties,,before-string}), display strings 6210Properties}, and @pxref{Display Property}). If the value is
6203(@pxref{Overlay Properties,,display}), and @code{display} text 6211@code{nil}, Emacs does not perform bidirectional reordering in the
6204properties (@pxref{Display Property}) is also reordered for display if 6212buffer.
6205the buffer whose text includes these strings is reordered. Turning 6213
6206off @code{bidi-display-reordering} for a buffer turns off reordering 6214The default value of @code{bidi-display-reordering} controls the
6207of all the overlay and display strings in that buffer. 6215reordering of strings which are not directly supplied by a buffer,
6208 6216including the text displayed in mode lines (@pxref{Mode Line Format})
6209 Reordering of strings that are unrelated to any buffer, such as text 6217and header lines (@pxref{Header Lines}).
6210displayed on the mode line (@pxref{Mode Line Format}) or header line
6211(@pxref{Header Lines}), is controlled by the default value of
6212@code{bidi-display-reordering}.
6213@end defvar 6218@end defvar
6214 6219
6215@cindex unibyte buffers, and bidi reordering 6220@cindex unibyte buffers, and bidi reordering
6216 Emacs does not reorder text in unibyte buffers, even if 6221 Emacs never reorders the text of a unibyte buffer, even if
6217@code{bidi-display-reordering} is non-@code{nil} in such a buffer. 6222@code{bidi-display-reordering} is non-@code{nil} in the buffer. This
6218This is because unibyte buffers contain raw bytes, not characters, and 6223is because unibyte buffers contain raw bytes, not characters, and thus
6219thus don't have bidirectional properties defined for them which are 6224lack the directionality properties required for reordering.
6220required for correct reordering. Therefore, to test whether text in a 6225Therefore, to test whether text in a buffer will be reordered for
6221buffer will be reordered for display, it is not enough to test the 6226display, it is not enough to test the value of
6222value of @code{bidi-display-reordering} alone. The correct test is 6227@code{bidi-display-reordering} alone. The correct test is this:
6223this:
6224 6228
6225@example 6229@example
6226 (if (and enable-multibyte-characters 6230 (if (and enable-multibyte-characters
@@ -6229,12 +6233,11 @@ this:
6229 ) 6233 )
6230@end example 6234@end example
6231 6235
6232 In contrast to unibyte buffers, unibyte display and overlay strings 6236 However, unibyte display and overlay strings @emph{are} reordered if
6233@emph{are} reordered, if their parent buffer is reordered. This is 6237their parent buffer is reordered. This is because plain-@sc{ascii}
6234because plain-@sc{ascii} strings are stored by Emacs as unibyte 6238strings are stored by Emacs as unibyte strings. If a unibyte display
6235strings. If a unibyte display or overlay string includes 6239or overlay string includes non-@sc{ascii} characters, these characters
6236non-@sc{ascii} characters, these characters are assumed to have 6240are assumed to have left-to-right direction.
6237left-to-right direction.
6238 6241
6239@cindex display properties, and bidi reordering of text 6242@cindex display properties, and bidi reordering of text
6240 Text covered by @code{display} text properties, by overlays with 6243 Text covered by @code{display} text properties, by overlays with
@@ -6242,7 +6245,7 @@ left-to-right direction.
6242properties that replace buffer text, is treated as a single unit when 6245properties that replace buffer text, is treated as a single unit when
6243it is reordered for display. That is, the entire chunk of text 6246it is reordered for display. That is, the entire chunk of text
6244covered by these properties is reordered together. Moreover, the 6247covered by these properties is reordered together. Moreover, the
6245bidirectional properties of the characters in this chunk of text are 6248bidirectional properties of the characters in such a chunk of text are
6246ignored, and Emacs reorders them as if they were replaced with a 6249ignored, and Emacs reorders them as if they were replaced with a
6247single character @code{U+FFFC}, known as the @dfn{Object Replacement 6250single character @code{U+FFFC}, known as the @dfn{Object Replacement
6248Character}. This means that placing a display property over a portion 6251Character}. This means that placing a display property over a portion
@@ -6252,36 +6255,34 @@ properties on text whose directionality is identical with text that
6252surrounds it. 6255surrounds it.
6253 6256
6254@cindex base direction of a paragraph 6257@cindex base direction of a paragraph
6255 Each paragraph of bidirectional text can have its own @dfn{base 6258 Each paragraph of bidirectional text has a @dfn{base direction},
6256direction}, either right-to-left or left-to-right. Text in 6259either right-to-left or left-to-right. Left-to-right paragraphs are
6257left-to-right paragraphs is displayed beginning at the left margin of 6260displayed beginning at the left margin of the window, and are
6258the window and is truncated or continued when it reaches the right 6261truncated or continued when the text reaches the right margin.
6259margin. By contrast, display of text in right-to-left paragraphs 6262Right-to-left paragraphs are displayed beginning at the right margin,
6260begins at the right margin and is continued or truncated at the left 6263and are continued or truncated at the left margin.
6261margin. 6264
6265 By default, Emacs determines the base direction of each paragraph by
6266looking at the text at its beginning. The precise method of
6267determining the base direction is specified by the @acronym{UBA}; in a
6268nutshell, the first character in a paragraph that has an explicit
6269directionality determines the base direction of the paragraph.
6270However, sometimes a buffer may need to force a certain base direction
6271for its paragraphs. For example, buffers containing program source
6272code should force all paragraphs to be displayed left-to-right. You
6273can use following variable to do this:
6262 6274
6263@defvar bidi-paragraph-direction 6275@defvar bidi-paragraph-direction
6264 By default, Emacs determines the base direction of each paragraph 6276If the value of this buffer-local variable is the symbol
6265dynamically, based on the text at the beginning of the paragraph. The 6277@code{right-to-left} or @code{left-to-right}, all paragraphs in the
6266precise method of determining the base direction is specified by the 6278buffer are assumed to have that specified direction. Any other value
6267@acronym{UBA}; in a nutshell, the first character in a paragraph that 6279is equivalent to @code{nil} (the default), which means to determine
6268has an explicit directionality determines the base direction of the 6280the base direction of each paragraph from its contents.
6269paragraph. However, sometimes a buffer may need to force a certain
6270base direction for its paragraphs. For example, a buffer that visits
6271a source code of a program should force all its paragraphs to be
6272displayed left to right. The variable
6273@code{bidi-paragraph-direction}, if non-@code{nil}, disables the
6274dynamic determination of the base direction, and instead forces all
6275paragraphs in the buffer to have the direction specified by its
6276buffer-local value. The value can be either @code{right-to-left} or
6277@code{left-to-right}. Any other value is interpreted as @code{nil}.
6278The default is @code{nil}.
6279 6281
6280@cindex @code{prog-mode}, and @code{bidi-paragraph-direction} 6282@cindex @code{prog-mode}, and @code{bidi-paragraph-direction}
6281Modes that are meant to display program source code should force a 6283Modes for program source code should set this to @code{left-to-right}.
6282@code{left-to-right} paragraph direction. The easiest way of doing so 6284Prog mode does this by default, so modes derived from Prog mode do not
6283is to derive the mode from Prog Mode, which already sets 6285need to set this explicitly (@pxref{Basic Major Modes}).
6284@code{bidi-paragraph-direction} to that value.
6285@end defvar 6286@end defvar
6286 6287
6287@defun current-bidi-paragraph-direction &optional buffer 6288@defun current-bidi-paragraph-direction &optional buffer
@@ -6300,22 +6301,18 @@ buffers, this function always returns @code{left-to-right}.
6300@cindex layout on display, and bidirectional text 6301@cindex layout on display, and bidirectional text
6301@cindex jumbled display of bidirectional text 6302@cindex jumbled display of bidirectional text
6302@cindex concatenating bidirectional strings 6303@cindex concatenating bidirectional strings
6303 Reordering of bidirectional text for display can have surprising and 6304 Bidirectional reordering can have surprising and unpleasant effects
6304unpleasant effects when two strings with bidirectional content are 6305when two strings with bidirectional content are juxtaposed in a
6305juxtaposed in a buffer, or otherwise programmatically concatenated 6306buffer, or otherwise programmatically concatenated into a string of
6306into a string of text. A typical example is a buffer whose lines are 6307text. A typical problematic case is when a buffer consists of
6307actually sequences of items, or fields, separated by whitespace or 6308sequences of text ``fields'' separated by whitespace or punctuation
6308punctuation characters. This is used in specialized modes such as 6309characters, like Buffer Menu mode or Rmail Summary Mode. Because the
6309Buffer-menu Mode or various email summary modes, like Rmail Summary 6310punctuation characters used as separators have @dfn{weak
6310Mode. Because these separator characters are @dfn{weak}, i.e.@: have 6311directionality}, they take on the directionality of surrounding text.
6311no strong directionality, they take on the directionality of 6312As result, a numeric field that follows a field with bidirectional
6312surrounding text. As result, a numeric field that follows a field 6313content can be displayed @emph{to the left} of the preceding field,
6313with bidirectional content can be displayed @emph{to the left} of the 6314messing up the expected layout. There are several ways to avoid this
6314preceding field, producing a jumbled display and messing up the 6315problem:
6315expected layout.
6316
6317 To countermand this, we recommend that you use one of the following
6318techniques for forcing correct order of fields on display:
6319 6316
6320@itemize @minus 6317@itemize @minus
6321@item 6318@item
@@ -6325,28 +6322,23 @@ content, or prepend it to the beginning of the following field. The
6325function @code{bidi-string-mark-left-to-right}, described below, comes 6322function @code{bidi-string-mark-left-to-right}, described below, comes
6326in handy for this purpose. (In a right-to-left paragraph, use 6323in handy for this purpose. (In a right-to-left paragraph, use
6327@code{U+200F}, RIGHT-TO-LEFT MARK, or @acronym{RLM}, instead.) This 6324@code{U+200F}, RIGHT-TO-LEFT MARK, or @acronym{RLM}, instead.) This
6328is one of the solutions recommended by 6325is one of the solutions recommended by the UBA.
6329@uref{http://www.unicode.org/reports/tr9/#Separators, the
6330@acronym{UBA}}.
6331 6326
6332@item 6327@item
6333Include the tab character in the field separator. The tab character 6328Include the tab character in the field separator. The tab character
6334plays the role of @dfn{segment separator} in the @acronym{UBA} 6329plays the role of @dfn{segment separator} in bidirectional reordering,
6335reordering, whose effect is to make each field a separate segment, and 6330causing the text on either side to be reordered separately.
6336thus reorder them separately.
6337 6331
6338@cindex @code{space} display spec, and bidirectional text 6332@cindex @code{space} display spec, and bidirectional text
6339@item 6333@item
6340Separate fields with a @code{display} property or overlay with the 6334Separate fields with a @code{display} property or overlay with a
6341property value of the form @code{(space . PROPS)} (@pxref{Specified 6335property value of the form @code{(space . PROPS)} (@pxref{Specified
6342Space}). This display specification is treated by Emacs as a 6336Space}). Emacs treats this display specification as a @dfn{paragraph
6343@dfn{paragraph separator}; the text before and after the separator is 6337separator}, and reorders the text on either side separately.
6344reordered separately, which avoids the influence of any field on its
6345neighboring fields.
6346@end itemize 6338@end itemize
6347 6339
6348@defun bidi-string-mark-left-to-right string 6340@defun bidi-string-mark-left-to-right string
6349This subroutine returns its argument @var{string}, possibly modified, 6341This function returns its argument @var{string}, possibly modified,
6350such that the result can be safely concatenated with another string, 6342such that the result can be safely concatenated with another string,
6351or juxtaposed with another string in a buffer, without disrupting the 6343or juxtaposed with another string in a buffer, without disrupting the
6352relative layout of this string and the next one on display. If the 6344relative layout of this string and the next one on display. If the
@@ -6356,7 +6348,8 @@ of the text that follows it. The function works by examining the
6356characters of its argument, and if any of those characters could cause 6348characters of its argument, and if any of those characters could cause
6357reordering on display, the function appends the @acronym{LRM} 6349reordering on display, the function appends the @acronym{LRM}
6358character to the string. The appended @acronym{LRM} character is made 6350character to the string. The appended @acronym{LRM} character is made
6359@emph{invisible} (@pxref{Invisible Text}), to hide it on display. 6351invisible by giving it an @code{invisible} text property of @code{t}
6352(@pxref{Invisible Text}).
6360@end defun 6353@end defun
6361 6354
6362 The reordering algorithm uses the bidirectional properties of the 6355 The reordering algorithm uses the bidirectional properties of the
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2a528033c9c..bb45d1d7112 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12012-03-30 Chong Yidong <cyd@gnu.org>
2
3 * image.el (imagemagick-types-inhibit)
4 (imagemagick-register-types): Doc fix.
5
12012-03-30 Agustín Martín Domingo <agustin.martin@hispalinux.es> 62012-03-30 Agustín Martín Domingo <agustin.martin@hispalinux.es>
2 7
3 * ispell.el (ispell-get-extended-character-mode): Disable 8 * ispell.el (ispell-get-extended-character-mode): Disable
diff --git a/lisp/image.el b/lisp/image.el
index 162cc8bb0ed..be1b1ef8f48 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -686,14 +686,13 @@ The minimum delay between successive frames is 0.01s."
686 686
687(defcustom imagemagick-types-inhibit 687(defcustom imagemagick-types-inhibit
688 '(C HTML HTM TXT PDF) 688 '(C HTML HTM TXT PDF)
689 "ImageMagick types that Emacs should not use ImageMagick to handle. 689 "ImageMagick types that should not be visited in Image mode.
690This should be a list of symbols, each of which has the same 690This should be a list of symbols, each of which should be one of
691name as one of the format tags used internally by ImageMagick; 691the ImageMagick types listed in `imagemagick-types'. These image
692see `imagemagick-types'. Entries in this list are excluded from 692types are not registered by `imagemagick-register-types'.
693being registered by `imagemagick-register-types', so if you change 693
694this variable you must do so before you call that function. 694If Emacs is compiled without ImageMagick support, this variable
695 695has no effect."
696If Emacs is compiled without ImageMagick, this variable has no effect."
697 :type '(choice (const :tag "Let ImageMagick handle all types it can" nil) 696 :type '(choice (const :tag "Let ImageMagick handle all types it can" nil)
698 (repeat symbol)) 697 (repeat symbol))
699 ;; Ideally, would have a :set function that checks if we already did 698 ;; Ideally, would have a :set function that checks if we already did
@@ -704,10 +703,13 @@ If Emacs is compiled without ImageMagick, this variable has no effect."
704;;;###autoload 703;;;###autoload
705(defun imagemagick-register-types () 704(defun imagemagick-register-types ()
706 "Register file types that can be handled by ImageMagick. 705 "Register file types that can be handled by ImageMagick.
707This adds the file types returned by `imagemagick-types' 706This registers the ImageMagick types listed in `imagemagick-types',
708\(excluding the ones in `imagemagick-types-inhibit') to 707excluding those listed in `imagemagick-types-inhibit'.
709`auto-mode-alist' and `image-type-file-name-regexps', so that 708
710Emacs visits them in Image mode. 709Registered image types are added to `auto-mode-alist', so that
710Emacs visits them in Image mode. They are also added to
711`image-type-file-name-regexps', so that the `image-type' function
712recognizes these files as having image type `imagemagick'.
711 713
712If Emacs is compiled without ImageMagick support, do nothing." 714If Emacs is compiled without ImageMagick support, do nothing."
713 (when (fboundp 'imagemagick-types) 715 (when (fboundp 'imagemagick-types)