diff options
Diffstat (limited to 'lispref')
| -rw-r--r-- | lispref/ChangeLog | 18 | ||||
| -rw-r--r-- | lispref/display.texi | 104 | ||||
| -rw-r--r-- | lispref/searching.texi | 46 | ||||
| -rw-r--r-- | lispref/text.texi | 4 |
4 files changed, 147 insertions, 25 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog index b568e99fb58..c33e49ca773 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | 2004-10-09 Luc Teirlinck <teirllm@auburn.edu> | ||
| 2 | |||
| 3 | * text.texi (Filling): Add anchor for definition of | ||
| 4 | `sentence-end-double-space'. | ||
| 5 | |||
| 6 | * searching.texi (Regexp Example): Update description of how | ||
| 7 | Emacs currently recognizes the end of a sentence. | ||
| 8 | (Standard Regexps): Update definition of the variable | ||
| 9 | `sentence-end'. Add definition of the function `sentence-end'. | ||
| 10 | |||
| 11 | 2004-10-08 Paul Pogonyshev <pogonyshev@gmx.net> | ||
| 12 | |||
| 13 | * display.texi (Progress): New node. | ||
| 14 | |||
| 15 | 2004-10-05 Kim F. Storm <storm@cua.dk> | ||
| 16 | |||
| 17 | * display.texi (Fringe Bitmaps): Update fringe-bitmaps-at-pos. | ||
| 18 | |||
| 1 | 2004-09-29 Kim F. Storm <storm@cua.dk> | 19 | 2004-09-29 Kim F. Storm <storm@cua.dk> |
| 2 | 20 | ||
| 3 | * display.texi (Fringe Bitmaps): Use symbols rather than numbers | 21 | * display.texi (Fringe Bitmaps): Use symbols rather than numbers |
diff --git a/lispref/display.texi b/lispref/display.texi index 00b91fe1fd8..d7e1303abad 100644 --- a/lispref/display.texi +++ b/lispref/display.texi | |||
| @@ -16,6 +16,7 @@ that Emacs presents to the user. | |||
| 16 | * Truncation:: Folding or wrapping long text lines. | 16 | * Truncation:: Folding or wrapping long text lines. |
| 17 | * The Echo Area:: Where messages are displayed. | 17 | * The Echo Area:: Where messages are displayed. |
| 18 | * Warnings:: Displaying warning messages for the user. | 18 | * Warnings:: Displaying warning messages for the user. |
| 19 | * Progress:: Informing user about progress of a long operation. | ||
| 19 | * Invisible Text:: Hiding part of the buffer text. | 20 | * Invisible Text:: Hiding part of the buffer text. |
| 20 | * Selective Display:: Hiding part of the buffer text (the old way). | 21 | * Selective Display:: Hiding part of the buffer text (the old way). |
| 21 | * Overlay Arrow:: Display of an arrow to indicate position. | 22 | * Overlay Arrow:: Display of an arrow to indicate position. |
| @@ -533,6 +534,104 @@ symbols. If it matches the first few elements in a warning type, then | |||
| 533 | that warning is not logged. | 534 | that warning is not logged. |
| 534 | @end defopt | 535 | @end defopt |
| 535 | 536 | ||
| 537 | @node Progress | ||
| 538 | @section Reporting Operation Progress | ||
| 539 | @cindex progress reporting | ||
| 540 | |||
| 541 | When an operation can take a while to finish, you should inform the | ||
| 542 | user about the progress it makes. This way the user can estimate | ||
| 543 | remaining time and clearly see that Emacs is busy working, not hung. | ||
| 544 | |||
| 545 | Functions listed in this section provide simple and efficient way of | ||
| 546 | reporting operation progress. Here is a working example that does | ||
| 547 | nothing useful: | ||
| 548 | |||
| 549 | @example | ||
| 550 | (let ((progress-reporter | ||
| 551 | (make-progress-reporter "Collecting some mana for Emacs..." | ||
| 552 | 0 500))) | ||
| 553 | (dotimes (k 500) | ||
| 554 | (sit-for 0.01) | ||
| 555 | (progress-reporter-update progress-reporter k)) | ||
| 556 | (progress-reporter-done progress-reporter)) | ||
| 557 | @end example | ||
| 558 | |||
| 559 | @defun make-progress-reporter message min-value max-value &optional current-value min-change min-time | ||
| 560 | This function creates a progress reporter---the object you will use as | ||
| 561 | an argument for all other functions listed here. The idea is to | ||
| 562 | precompute as much data as possible to make progress reporting very | ||
| 563 | fast. | ||
| 564 | |||
| 565 | The @var{message} will be displayed in the echo area, followed by | ||
| 566 | progress percentage. @var{message} is treated as a simple string. If | ||
| 567 | you need it to depend on a filename, for instance, use @code{format} | ||
| 568 | before calling this function. | ||
| 569 | |||
| 570 | @var{min-value} and @var{max-value} arguments stand for starting and | ||
| 571 | final states of your operation. For instance, if you scan a buffer, | ||
| 572 | they should be the results of @code{point-min} and @code{point-max} | ||
| 573 | correspondingly. It is required that @var{max-value} is greater than | ||
| 574 | @var{min-value}. If you create progress reporter when some part of | ||
| 575 | the operation has already been completed, then specify | ||
| 576 | @var{current-value} argument. But normally you should omit it or set | ||
| 577 | it to @code{nil}---it will default to @var{min-value} then. | ||
| 578 | |||
| 579 | Remaining arguments control the rate of echo area updates. Progress | ||
| 580 | reporter will wait for at least @var{min-change} more percents of the | ||
| 581 | operation to be completed before printing next message. | ||
| 582 | @var{min-time} specifies the minimum time in seconds to pass between | ||
| 583 | successive prints. It can be fractional. Depending on Emacs and | ||
| 584 | system capabilities, progress reporter may or may not respect this | ||
| 585 | last argument or do it with varying precision. Default value for | ||
| 586 | @var{min-change} is 1 (one percent), for @var{min-time}---0.2 | ||
| 587 | (seconds.) | ||
| 588 | |||
| 589 | This function calls @code{progress-reporter-update}, so the first | ||
| 590 | message is printed immediately. | ||
| 591 | @end defun | ||
| 592 | |||
| 593 | @defun progress-reporter-update reporter value | ||
| 594 | This function does the main work of reporting progress of your | ||
| 595 | operation. It print the message of @var{reporter} followed by | ||
| 596 | progress percentage determined by @var{value}. If percentage is zero, | ||
| 597 | then it is not printed at all. | ||
| 598 | |||
| 599 | @var{reporter} must be the result of a call to | ||
| 600 | @code{make-progress-reporter}. @var{value} specifies the current | ||
| 601 | state of your operation and must be between @var{min-value} and | ||
| 602 | @var{max-value} (inclusive) as passed to | ||
| 603 | @code{make-progress-reporter}. For instance, if you scan a buffer, | ||
| 604 | then @var{value} should be the result of a call to @code{point}. | ||
| 605 | |||
| 606 | This function respects @var{min-change} and @var{min-time} as passed | ||
| 607 | to @code{make-progress-reporter} and so does not output new messages | ||
| 608 | on every invocation. It is thus very fast and normally you should not | ||
| 609 | try to reduce the number of calls to it: resulting overhead will most | ||
| 610 | likely negate your effort. | ||
| 611 | @end defun | ||
| 612 | |||
| 613 | @defun progress-reporter-force-update reporter value &optional new-message | ||
| 614 | This function is similar to @code{progress-reporter-update} except | ||
| 615 | that it prints a message in the echo area unconditionally. | ||
| 616 | |||
| 617 | The first two arguments have the same meaning as for | ||
| 618 | @code{progress-reporter-update}. Optional @var{new-message} allows | ||
| 619 | you to change the message of the @var{reporter}. Since this functions | ||
| 620 | always updates the echo area, such a change will be immediately | ||
| 621 | presented to the user. | ||
| 622 | @end defun | ||
| 623 | |||
| 624 | @defun progress-reporter-done reporter | ||
| 625 | This function should be called when the operation is finished. It | ||
| 626 | prints the message of @var{reporter} followed by word ``done'' in the | ||
| 627 | echo area. | ||
| 628 | |||
| 629 | You should always call this function and not hope for | ||
| 630 | @code{progress-reporter-update} to print ``100%.'' Firstly, it may | ||
| 631 | never print it, there are many good reasons for this not to happen. | ||
| 632 | Secondly, ``done'' is more explicit. | ||
| 633 | @end defun | ||
| 634 | |||
| 536 | @node Invisible Text | 635 | @node Invisible Text |
| 537 | @section Invisible Text | 636 | @section Invisible Text |
| 538 | 637 | ||
| @@ -2655,9 +2754,10 @@ symbols have their own name space. | |||
| 2655 | @defun fringe-bitmaps-at-pos &optional pos window | 2754 | @defun fringe-bitmaps-at-pos &optional pos window |
| 2656 | This function returns the fringe bitmaps of the display line | 2755 | This function returns the fringe bitmaps of the display line |
| 2657 | containing position @var{pos} in window @var{window}. The return | 2756 | containing position @var{pos} in window @var{window}. The return |
| 2658 | value has the form @code{(@var{left} . @var{right})}, where @var{left} | 2757 | value has the form @code{(@var{left} @var{right} @var{ov})}, where @var{left} |
| 2659 | is the symbol for the fringe bitmap in the left fringe (or @code{nil} | 2758 | is the symbol for the fringe bitmap in the left fringe (or @code{nil} |
| 2660 | if no bitmap), and @var{right} is similar for the right fringe. | 2759 | if no bitmap), @var{right} is similar for the right fringe, and @var{ov} |
| 2760 | is non-@code{nil} if there is an overlay arrow in the left fringe. | ||
| 2661 | 2761 | ||
| 2662 | The value is @code{nil} if @var{pos} is not visible in @var{window}. | 2762 | The value is @code{nil} if @var{pos} is not visible in @var{window}. |
| 2663 | If @var{window} is @code{nil}, that stands for the selected window. | 2763 | If @var{window} is @code{nil}, that stands for the selected window. |
diff --git a/lispref/searching.texi b/lispref/searching.texi index 93a152fbbe1..ee6cb06b1e1 100644 --- a/lispref/searching.texi +++ b/lispref/searching.texi | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | @c -*-texinfo-*- | 1 | @c -*-texinfo-*- |
| 2 | @c This is part of the GNU Emacs Lisp Reference Manual. | 2 | @c This is part of the GNU Emacs Lisp Reference Manual. |
| 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 | 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2004 |
| 4 | @c Free Software Foundation, Inc. | 4 | @c Free Software Foundation, Inc. |
| 5 | @c See the file elisp.texi for copying conditions. | 5 | @c See the file elisp.texi for copying conditions. |
| 6 | @setfilename ../info/searching | 6 | @setfilename ../info/searching |
| @@ -694,9 +694,9 @@ an @code{invalid-regexp} error is signaled. | |||
| 694 | 694 | ||
| 695 | Here is a complicated regexp which was formerly used by Emacs to | 695 | Here is a complicated regexp which was formerly used by Emacs to |
| 696 | recognize the end of a sentence together with any whitespace that | 696 | recognize the end of a sentence together with any whitespace that |
| 697 | follows. It was used as the variable @code{sentence-end}. (Its value | 697 | follows. (Nowadays Emacs uses a similar but more complex default |
| 698 | nowadays contains alternatives for @samp{.}, @samp{?} and @samp{!} in | 698 | regexp constructed by the function @code{sentence-end}. |
| 699 | other character sets.) | 699 | @xref{Standard Regexps}.) |
| 700 | 700 | ||
| 701 | First, we show the regexp as a string in Lisp syntax to distinguish | 701 | First, we show the regexp as a string in Lisp syntax to distinguish |
| 702 | spaces from tab characters. The string constant begins and ends with a | 702 | spaces from tab characters. The string constant begins and ends with a |
| @@ -730,9 +730,9 @@ deciphered as follows: | |||
| 730 | The first part of the pattern is a character alternative that matches | 730 | The first part of the pattern is a character alternative that matches |
| 731 | any one of three characters: period, question mark, and exclamation | 731 | any one of three characters: period, question mark, and exclamation |
| 732 | mark. The match must begin with one of these three characters. (This | 732 | mark. The match must begin with one of these three characters. (This |
| 733 | is the one point where the new value of @code{sentence-end} differs | 733 | is one point where the new default regexp used by Emacs differs from |
| 734 | from the old. The new value also lists sentence ending | 734 | the old. The new value also allows some non-@acronym{ASCII} |
| 735 | non-@acronym{ASCII} characters.) | 735 | characters that end a sentence without any following whitespace.) |
| 736 | 736 | ||
| 737 | @item []\"')@}]* | 737 | @item []\"')@}]* |
| 738 | The second part of the pattern matches any closing braces and quotation | 738 | The second part of the pattern matches any closing braces and quotation |
| @@ -1698,23 +1698,25 @@ whitespace or starting with a form feed (after its left margin). | |||
| 1698 | @end defvar | 1698 | @end defvar |
| 1699 | 1699 | ||
| 1700 | @defvar sentence-end | 1700 | @defvar sentence-end |
| 1701 | This is the regular expression describing the end of a sentence. (All | 1701 | If non-@code{nil}, the value should be a regular expression describing |
| 1702 | paragraph boundaries also end sentences, regardless.) The (slightly | 1702 | the end of a sentence, including the whitespace following the |
| 1703 | simplified) default value is: | 1703 | sentence. (All paragraph boundaries also end sentences, regardless.) |
| 1704 | 1704 | ||
| 1705 | @example | 1705 | If the value is @code{nil}, the default, then the function |
| 1706 | "[.?!][]\"')@}]*\\($\\| $\\|\t\\|@ @ \\)[ \t\n]*" | 1706 | @code{sentence-end} has to construct the regexp. That is why you |
| 1707 | @end example | 1707 | should always call the function @code{sentence-end} to obtain the |
| 1708 | 1708 | regexp to be used to recognize the end of a sentence. | |
| 1709 | This means a period, question mark or exclamation mark (the actual | ||
| 1710 | default value also lists their alternatives in other character sets), | ||
| 1711 | followed optionally by closing parenthetical characters, followed by | ||
| 1712 | tabs, spaces or new lines. | ||
| 1713 | |||
| 1714 | For a detailed explanation of this regular expression, see @ref{Regexp | ||
| 1715 | Example}. | ||
| 1716 | @end defvar | 1709 | @end defvar |
| 1717 | 1710 | ||
| 1711 | @defun sentence-end | ||
| 1712 | This function returns the value of the variable @code{sentence-end}, | ||
| 1713 | if non-@code{nil}. Otherwise it returns a default value based on the | ||
| 1714 | values of the variables @code{sentence-end-double-space} | ||
| 1715 | (@pxref{Definition of sentence-end-double-space}), | ||
| 1716 | @code{sentence-end-without-period} and | ||
| 1717 | @code{sentence-end-without-space}. | ||
| 1718 | @end defun | ||
| 1719 | |||
| 1718 | @ignore | 1720 | @ignore |
| 1719 | arch-tag: c2573ca2-18aa-4839-93b8-924043ef831f | 1721 | arch-tag: c2573ca2-18aa-4839-93b8-924043ef831f |
| 1720 | @end ignore | 1722 | @end ignore |
diff --git a/lispref/text.texi b/lispref/text.texi index caa3f21b7b1..00aa235f513 100644 --- a/lispref/text.texi +++ b/lispref/text.texi | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | @c -*-texinfo-*- | 1 | @c -*-texinfo-*- |
| 2 | @c This is part of the GNU Emacs Lisp Reference Manual. | 2 | @c This is part of the GNU Emacs Lisp Reference Manual. |
| 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001 | 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, |
| 4 | @c 2000, 2001, 2004 | ||
| 4 | @c Free Software Foundation, Inc. | 5 | @c Free Software Foundation, Inc. |
| 5 | @c See the file elisp.texi for copying conditions. | 6 | @c See the file elisp.texi for copying conditions. |
| 6 | @setfilename ../info/text | 7 | @setfilename ../info/text |
| @@ -1448,6 +1449,7 @@ the text around point. | |||
| 1448 | @end defun | 1449 | @end defun |
| 1449 | 1450 | ||
| 1450 | @defopt sentence-end-double-space | 1451 | @defopt sentence-end-double-space |
| 1452 | @anchor{Definition of sentence-end-double-space} | ||
| 1451 | If this variable is non-@code{nil}, a period followed by just one space | 1453 | If this variable is non-@code{nil}, a period followed by just one space |
| 1452 | does not count as the end of a sentence, and the filling functions | 1454 | does not count as the end of a sentence, and the filling functions |
| 1453 | avoid breaking the line at such a place. | 1455 | avoid breaking the line at such a place. |