diff options
| author | Kenichi Handa | 2012-11-23 23:36:24 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-11-23 23:36:24 +0900 |
| commit | 2aaec2d9be5cec44ea3b59cba476fd3e091f2fc9 (patch) | |
| tree | 3711b97807201b7eeaa066003b1c3a4ce929e5bb /doc/lispref | |
| parent | e1d276cbf9e18f13101328f56bed1a1c0a66e63a (diff) | |
| parent | e7d0e5ee247a155a268ffbf80bedbe25e15b5032 (diff) | |
| download | emacs-2aaec2d9be5cec44ea3b59cba476fd3e091f2fc9.tar.gz emacs-2aaec2d9be5cec44ea3b59cba476fd3e091f2fc9.zip | |
Diffstat (limited to 'doc/lispref')
| -rw-r--r-- | doc/lispref/ChangeLog | 22 | ||||
| -rw-r--r-- | doc/lispref/debugging.texi | 64 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 47 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 1 | ||||
| -rw-r--r-- | doc/lispref/os.texi | 4 | ||||
| -rw-r--r-- | doc/lispref/tips.texi | 14 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 3 |
7 files changed, 111 insertions, 44 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index a5295adc368..99e21bac469 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | 2012-11-21 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * display.texi (Attribute Functions): | ||
| 4 | Update for set-face-* name changes. | ||
| 5 | Add new "inherit" argument for face-bold-p etc. | ||
| 6 | Move description of this argument to a common section, like "frame". | ||
| 7 | |||
| 8 | * debugging.texi (Profiling): New section. | ||
| 9 | (Debugging): Mention profiling in the introduction. | ||
| 10 | * tips.texi (Compilation Tips): Move profiling to separate section. | ||
| 11 | * elisp.texi: Add Profiling to detailed menu. | ||
| 12 | |||
| 13 | 2012-11-21 Martin Rudalics <rudalics@gmx.at> | ||
| 14 | |||
| 15 | * windows.texi (Display Action Functions): Fix recently added | ||
| 16 | example. Suggested by Michael Heerdegen. | ||
| 17 | |||
| 18 | 2012-11-21 Paul Eggert <eggert@cs.ucla.edu> | ||
| 19 | |||
| 20 | Minor cleanup for times as lists of four integers. | ||
| 21 | * os.texi (Time Parsing): Time values can now be four integers. | ||
| 22 | |||
| 1 | 2012-11-18 Glenn Morris <rgm@gnu.org> | 23 | 2012-11-18 Glenn Morris <rgm@gnu.org> |
| 2 | 24 | ||
| 3 | * loading.texi (How Programs Do Loading): Add eager macro expansion. | 25 | * loading.texi (How Programs Do Loading): Add eager macro expansion. |
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 11532b19781..3439a8ae152 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi | |||
| @@ -32,6 +32,9 @@ program. | |||
| 32 | @item | 32 | @item |
| 33 | You can use the ERT package to write regression tests for the program. | 33 | You can use the ERT package to write regression tests for the program. |
| 34 | @xref{Top,the ERT manual,, ERT, ERT: Emacs Lisp Regression Testing}. | 34 | @xref{Top,the ERT manual,, ERT, ERT: Emacs Lisp Regression Testing}. |
| 35 | |||
| 36 | @item | ||
| 37 | You can profile the program to get hints about how to make it more efficient. | ||
| 35 | @end itemize | 38 | @end itemize |
| 36 | 39 | ||
| 37 | Other useful tools for debugging input and output problems are the | 40 | Other useful tools for debugging input and output problems are the |
| @@ -43,6 +46,7 @@ function (@pxref{Terminal Output}). | |||
| 43 | * Edebug:: A source-level Emacs Lisp debugger. | 46 | * Edebug:: A source-level Emacs Lisp debugger. |
| 44 | * Syntax Errors:: How to find syntax errors. | 47 | * Syntax Errors:: How to find syntax errors. |
| 45 | * Test Coverage:: Ensuring you have tested all branches in your code. | 48 | * Test Coverage:: Ensuring you have tested all branches in your code. |
| 49 | * Profiling:: Measuring the resources that your code uses. | ||
| 46 | @end menu | 50 | @end menu |
| 47 | 51 | ||
| 48 | @node Debugger | 52 | @node Debugger |
| @@ -809,3 +813,63 @@ never return. If it ever does return, you get a run-time error. | |||
| 809 | Edebug also has a coverage testing feature (@pxref{Coverage | 813 | Edebug also has a coverage testing feature (@pxref{Coverage |
| 810 | Testing}). These features partly duplicate each other, and it would | 814 | Testing}). These features partly duplicate each other, and it would |
| 811 | be cleaner to combine them. | 815 | be cleaner to combine them. |
| 816 | |||
| 817 | |||
| 818 | @node Profiling | ||
| 819 | @section Profiling | ||
| 820 | @cindex profiling | ||
| 821 | @cindex measuring resource usage | ||
| 822 | @cindex memory usage | ||
| 823 | |||
| 824 | If your program is working correctly, but you want to make it run more | ||
| 825 | quickly or efficiently, the first thing to do is @dfn{profile} your | ||
| 826 | code so that you know how it is using resources. If you find that one | ||
| 827 | particular function is responsible for a significant portion of the | ||
| 828 | runtime, you can start looking for ways to optimize that piece. | ||
| 829 | |||
| 830 | Emacs has built-in support for this. To begin profiling, type | ||
| 831 | @kbd{M-x profiler-start}. You can choose to profile by processor | ||
| 832 | usage, memory usage, or both. After doing some work, type | ||
| 833 | @kbd{M-x profiler-report} to display a summary buffer for each | ||
| 834 | resource that you chose to profile. The names of the report buffers | ||
| 835 | include the times at which the reports were generated, so you can | ||
| 836 | generate another report later on without erasing previous results. | ||
| 837 | When you have finished profiling, type @kbd{M-x profiler-stop} (there | ||
| 838 | is a small overhead associated with profiling). | ||
| 839 | |||
| 840 | The profiler report buffer shows, on each line, a function that was | ||
| 841 | called, followed by how much resource (processor or memory) it used in | ||
| 842 | absolute and percentage times since profiling started. If a given | ||
| 843 | line has a @samp{+} symbol at the left-hand side, you can expand that | ||
| 844 | line by typing @key{RET}, in order to see the function(s) called by | ||
| 845 | the higher-level function. Pressing @key{RET} again will collapse | ||
| 846 | back to the original state. | ||
| 847 | |||
| 848 | Press @kbd{j} or @kbd{mouse-2} to jump to the definition of a function. | ||
| 849 | Press @kbd{d} to view a function's documentation. | ||
| 850 | You can save a profile to a file using @kbd{C-x C-w}. | ||
| 851 | You can compare two profiles using @kbd{=}. | ||
| 852 | |||
| 853 | @c FIXME reversed calltree? | ||
| 854 | |||
| 855 | @cindex @file{elp.el} | ||
| 856 | @cindex timing programs | ||
| 857 | The @file{elp} library offers an alternative approach. See the file | ||
| 858 | @file{elp.el} for instructions. | ||
| 859 | |||
| 860 | @cindex @file{benchmark.el} | ||
| 861 | @cindex benchmarking | ||
| 862 | You can check the speed of individual Emacs Lisp forms using the | ||
| 863 | @file{benchmark} library. See the functions @code{benchmark-run} and | ||
| 864 | @code{benchmark-run-compiled} in @file{benchmark.el}. | ||
| 865 | |||
| 866 | @c Not worth putting in the printed manual. | ||
| 867 | @ifnottex | ||
| 868 | @cindex --enable-profiling option of configure | ||
| 869 | For low-level profiling of Emacs itself, you can build it using the | ||
| 870 | @option{--enable-profiling} option of @command{configure}. When Emacs | ||
| 871 | exits, it generates a file @file{gmon.out} that you can examine using | ||
| 872 | the @command{gprof} utility. This feature is mainly useful for | ||
| 873 | debugging Emacs. It actually stops the Lisp-level @kbd{M-x | ||
| 874 | profiler-@dots{}} commands described above from working. | ||
| 875 | @end ifnottex | ||
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 475a9550f99..5148c6ec22e 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -2425,12 +2425,12 @@ This sets the @code{:stipple} attribute of @var{face} to | |||
| 2425 | This sets the @code{:font} attribute of @var{face} to @var{font}. | 2425 | This sets the @code{:font} attribute of @var{face} to @var{font}. |
| 2426 | @end deffn | 2426 | @end deffn |
| 2427 | 2427 | ||
| 2428 | @defun set-face-bold-p face bold-p &optional frame | 2428 | @defun set-face-bold face bold-p &optional frame |
| 2429 | This sets the @code{:weight} attribute of @var{face} to @var{normal} | 2429 | This sets the @code{:weight} attribute of @var{face} to @var{normal} |
| 2430 | if @var{bold-p} is @code{nil}, and to @var{bold} otherwise. | 2430 | if @var{bold-p} is @code{nil}, and to @var{bold} otherwise. |
| 2431 | @end defun | 2431 | @end defun |
| 2432 | 2432 | ||
| 2433 | @defun set-face-italic-p face italic-p &optional frame | 2433 | @defun set-face-italic face italic-p &optional frame |
| 2434 | This sets the @code{:slant} attribute of @var{face} to @var{normal} if | 2434 | This sets the @code{:slant} attribute of @var{face} to @var{normal} if |
| 2435 | @var{italic-p} is @code{nil}, and to @var{italic} otherwise. | 2435 | @var{italic-p} is @code{nil}, and to @var{italic} otherwise. |
| 2436 | @end defun | 2436 | @end defun |
| @@ -2440,7 +2440,7 @@ This sets the @code{:underline} attribute of @var{face} to | |||
| 2440 | @var{underline}. | 2440 | @var{underline}. |
| 2441 | @end defun | 2441 | @end defun |
| 2442 | 2442 | ||
| 2443 | @defun set-face-inverse-video-p face inverse-video-p &optional frame | 2443 | @defun set-face-inverse-video face inverse-video-p &optional frame |
| 2444 | This sets the @code{:inverse-video} attribute of @var{face} to | 2444 | This sets the @code{:inverse-video} attribute of @var{face} to |
| 2445 | @var{inverse-video-p}. | 2445 | @var{inverse-video-p}. |
| 2446 | @end defun | 2446 | @end defun |
| @@ -2453,59 +2453,48 @@ This swaps the foreground and background colors of face @var{face}. | |||
| 2453 | don't specify @var{frame}, they refer to the selected frame; @code{t} | 2453 | don't specify @var{frame}, they refer to the selected frame; @code{t} |
| 2454 | refers to the default data for new frames. They return the symbol | 2454 | refers to the default data for new frames. They return the symbol |
| 2455 | @code{unspecified} if the face doesn't define any value for that | 2455 | @code{unspecified} if the face doesn't define any value for that |
| 2456 | attribute. | 2456 | attribute. If @var{inherit} is @code{nil}, only an attribute directly |
| 2457 | defined by the face is returned. If @var{inherit} is non-@code{nil}, | ||
| 2458 | any faces specified by its @code{:inherit} attribute are considered as | ||
| 2459 | well, and if @var{inherit} is a face or a list of faces, then they are | ||
| 2460 | also considered, until a specified attribute is found. To ensure that | ||
| 2461 | the return value is always specified, use a value of @code{default} for | ||
| 2462 | @var{inherit}. | ||
| 2463 | |||
| 2464 | @defun face-font face &optional frame | ||
| 2465 | This function returns the name of the font of face @var{face}. | ||
| 2466 | @end defun | ||
| 2457 | 2467 | ||
| 2458 | @defun face-foreground face &optional frame inherit | 2468 | @defun face-foreground face &optional frame inherit |
| 2459 | @defunx face-background face &optional frame inherit | 2469 | @defunx face-background face &optional frame inherit |
| 2460 | These functions return the foreground color (or background color, | 2470 | These functions return the foreground color (or background color, |
| 2461 | respectively) of face @var{face}, as a string. | 2471 | respectively) of face @var{face}, as a string. |
| 2462 | |||
| 2463 | If @var{inherit} is @code{nil}, only a color directly defined by the face is | ||
| 2464 | returned. If @var{inherit} is non-@code{nil}, any faces specified by its | ||
| 2465 | @code{:inherit} attribute are considered as well, and if @var{inherit} | ||
| 2466 | is a face or a list of faces, then they are also considered, until a | ||
| 2467 | specified color is found. To ensure that the return value is always | ||
| 2468 | specified, use a value of @code{default} for @var{inherit}. | ||
| 2469 | @end defun | 2472 | @end defun |
| 2470 | 2473 | ||
| 2471 | @defun face-stipple face &optional frame inherit | 2474 | @defun face-stipple face &optional frame inherit |
| 2472 | This function returns the name of the background stipple pattern of face | 2475 | This function returns the name of the background stipple pattern of face |
| 2473 | @var{face}, or @code{nil} if it doesn't have one. | 2476 | @var{face}, or @code{nil} if it doesn't have one. |
| 2474 | |||
| 2475 | If @var{inherit} is @code{nil}, only a stipple directly defined by the | ||
| 2476 | face is returned. If @var{inherit} is non-@code{nil}, any faces | ||
| 2477 | specified by its @code{:inherit} attribute are considered as well, and | ||
| 2478 | if @var{inherit} is a face or a list of faces, then they are also | ||
| 2479 | considered, until a specified stipple is found. To ensure that the | ||
| 2480 | return value is always specified, use a value of @code{default} for | ||
| 2481 | @var{inherit}. | ||
| 2482 | @end defun | ||
| 2483 | |||
| 2484 | @defun face-font face &optional frame | ||
| 2485 | This function returns the name of the font of face @var{face}. | ||
| 2486 | @end defun | 2477 | @end defun |
| 2487 | 2478 | ||
| 2488 | @defun face-bold-p face &optional frame | 2479 | @defun face-bold-p face &optional frame inherit |
| 2489 | This function returns a non-@code{nil} value if the @code{:weight} | 2480 | This function returns a non-@code{nil} value if the @code{:weight} |
| 2490 | attribute of @var{face} is bolder than normal (i.e., one of | 2481 | attribute of @var{face} is bolder than normal (i.e., one of |
| 2491 | @code{semi-bold}, @code{bold}, @code{extra-bold}, or | 2482 | @code{semi-bold}, @code{bold}, @code{extra-bold}, or |
| 2492 | @code{ultra-bold}). Otherwise, it returns @code{nil}. | 2483 | @code{ultra-bold}). Otherwise, it returns @code{nil}. |
| 2493 | @end defun | 2484 | @end defun |
| 2494 | 2485 | ||
| 2495 | @defun face-italic-p face &optional frame | 2486 | @defun face-italic-p face &optional frame inherit |
| 2496 | This function returns a non-@code{nil} value if the @code{:slant} | 2487 | This function returns a non-@code{nil} value if the @code{:slant} |
| 2497 | attribute of @var{face} is @code{italic} or @code{oblique}, and | 2488 | attribute of @var{face} is @code{italic} or @code{oblique}, and |
| 2498 | @code{nil} otherwise. | 2489 | @code{nil} otherwise. |
| 2499 | @end defun | 2490 | @end defun |
| 2500 | 2491 | ||
| 2501 | @c Note the weasel words. A face that inherits from an underlined | 2492 | @defun face-underline-p face &optional frame inherit |
| 2502 | @c face but does not specify :underline will return nil. | ||
| 2503 | @defun face-underline-p face &optional frame | ||
| 2504 | This function returns non-@code{nil} if face @var{face} specifies | 2493 | This function returns non-@code{nil} if face @var{face} specifies |
| 2505 | a non-@code{nil} @code{:underline} attribute. | 2494 | a non-@code{nil} @code{:underline} attribute. |
| 2506 | @end defun | 2495 | @end defun |
| 2507 | 2496 | ||
| 2508 | @defun face-inverse-video-p face &optional frame | 2497 | @defun face-inverse-video-p face &optional frame inherit |
| 2509 | This function returns non-@code{nil} if face @var{face} specifies | 2498 | This function returns non-@code{nil} if face @var{face} specifies |
| 2510 | a non-@code{nil} @code{:inverse-video} attribute. | 2499 | a non-@code{nil} @code{:inverse-video} attribute. |
| 2511 | @end defun | 2500 | @end defun |
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index a70558bf09f..cb00b5e9889 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi | |||
| @@ -617,6 +617,7 @@ Debugging Lisp Programs | |||
| 617 | * Edebug:: A source-level Emacs Lisp debugger. | 617 | * Edebug:: A source-level Emacs Lisp debugger. |
| 618 | * Syntax Errors:: How to find syntax errors. | 618 | * Syntax Errors:: How to find syntax errors. |
| 619 | * Test Coverage:: Ensuring you have tested all branches in your code. | 619 | * Test Coverage:: Ensuring you have tested all branches in your code. |
| 620 | * Profiling:: Measuring the resources that your code uses. | ||
| 620 | 621 | ||
| 621 | The Lisp Debugger | 622 | The Lisp Debugger |
| 622 | 623 | ||
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 2f06e207fc4..7552aaccc53 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -1373,8 +1373,8 @@ on others, years as early as 1901 do work. | |||
| 1373 | @node Time Parsing | 1373 | @node Time Parsing |
| 1374 | @section Parsing and Formatting Times | 1374 | @section Parsing and Formatting Times |
| 1375 | 1375 | ||
| 1376 | These functions convert time values (lists of two or three integers) | 1376 | These functions convert time values to text in a string, and vice versa. |
| 1377 | to text in a string, and vice versa. | 1377 | Time values are lists of two to four integers (@pxref{Time of Day}). |
| 1378 | 1378 | ||
| 1379 | @defun date-to-time string | 1379 | @defun date-to-time string |
| 1380 | This function parses the time-string @var{string} and returns the | 1380 | This function parses the time-string @var{string} and returns the |
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index 4336baa128f..bba416d5614 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi | |||
| @@ -460,18 +460,8 @@ Lisp programs. | |||
| 460 | 460 | ||
| 461 | @itemize @bullet | 461 | @itemize @bullet |
| 462 | @item | 462 | @item |
| 463 | @cindex profiling | 463 | Profile your program, to find out where the time is being spent. |
| 464 | @cindex timing programs | 464 | @xref{Profiling}. |
| 465 | @cindex @file{elp.el} | ||
| 466 | Profile your program with the @file{elp} library. See the file | ||
| 467 | @file{elp.el} for instructions. | ||
| 468 | |||
| 469 | @item | ||
| 470 | @cindex @file{benchmark.el} | ||
| 471 | @cindex benchmarking | ||
| 472 | Check the speed of individual Emacs Lisp forms using the | ||
| 473 | @file{benchmark} library. See the functions @code{benchmark-run} and | ||
| 474 | @code{benchmark-run-compiled} in @file{benchmark.el}. | ||
| 475 | 465 | ||
| 476 | @item | 466 | @item |
| 477 | Use iteration rather than recursion whenever possible. | 467 | Use iteration rather than recursion whenever possible. |
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index b8581b1cc62..e515b24db93 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi | |||
| @@ -2038,7 +2038,8 @@ Evaluating the form above will cause @code{display-buffer} to proceed as | |||
| 2038 | follows: If `*foo*' already appears on a visible or iconified frame, it | 2038 | follows: If `*foo*' already appears on a visible or iconified frame, it |
| 2039 | will reuse its window. Otherwise, it will try to pop up a new window | 2039 | will reuse its window. Otherwise, it will try to pop up a new window |
| 2040 | or, if that is impossible, a new frame. If all these steps fail, it | 2040 | or, if that is impossible, a new frame. If all these steps fail, it |
| 2041 | will try to use some existing window. | 2041 | will proceed using whatever @code{display-buffer-base-action} and |
| 2042 | @code{display-buffer-fallback-action} prescribe. | ||
| 2042 | 2043 | ||
| 2043 | Furthermore, @code{display-buffer} will try to adjust a reused window | 2044 | Furthermore, @code{display-buffer} will try to adjust a reused window |
| 2044 | (provided `*foo*' was put by @code{display-buffer} there before) or a | 2045 | (provided `*foo*' was put by @code{display-buffer} there before) or a |