aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorKenichi Handa2012-11-23 23:36:24 +0900
committerKenichi Handa2012-11-23 23:36:24 +0900
commit2aaec2d9be5cec44ea3b59cba476fd3e091f2fc9 (patch)
tree3711b97807201b7eeaa066003b1c3a4ce929e5bb /doc/lispref
parente1d276cbf9e18f13101328f56bed1a1c0a66e63a (diff)
parente7d0e5ee247a155a268ffbf80bedbe25e15b5032 (diff)
downloademacs-2aaec2d9be5cec44ea3b59cba476fd3e091f2fc9.tar.gz
emacs-2aaec2d9be5cec44ea3b59cba476fd3e091f2fc9.zip
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/ChangeLog22
-rw-r--r--doc/lispref/debugging.texi64
-rw-r--r--doc/lispref/display.texi47
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/os.texi4
-rw-r--r--doc/lispref/tips.texi14
-rw-r--r--doc/lispref/windows.texi3
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 @@
12012-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
132012-11-21 Martin Rudalics <rudalics@gmx.at>
14
15 * windows.texi (Display Action Functions): Fix recently added
16 example. Suggested by Michael Heerdegen.
17
182012-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
12012-11-18 Glenn Morris <rgm@gnu.org> 232012-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
33You can use the ERT package to write regression tests for the program. 33You 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
37You 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
810Testing}). These features partly duplicate each other, and it would 814Testing}). These features partly duplicate each other, and it would
811be cleaner to combine them. 815be 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
824If your program is working correctly, but you want to make it run more
825quickly or efficiently, the first thing to do is @dfn{profile} your
826code so that you know how it is using resources. If you find that one
827particular function is responsible for a significant portion of the
828runtime, you can start looking for ways to optimize that piece.
829
830Emacs has built-in support for this. To begin profiling, type
831@kbd{M-x profiler-start}. You can choose to profile by processor
832usage, memory usage, or both. After doing some work, type
833@kbd{M-x profiler-report} to display a summary buffer for each
834resource that you chose to profile. The names of the report buffers
835include the times at which the reports were generated, so you can
836generate another report later on without erasing previous results.
837When you have finished profiling, type @kbd{M-x profiler-stop} (there
838is a small overhead associated with profiling).
839
840The profiler report buffer shows, on each line, a function that was
841called, followed by how much resource (processor or memory) it used in
842absolute and percentage times since profiling started. If a given
843line has a @samp{+} symbol at the left-hand side, you can expand that
844line by typing @key{RET}, in order to see the function(s) called by
845the higher-level function. Pressing @key{RET} again will collapse
846back to the original state.
847
848Press @kbd{j} or @kbd{mouse-2} to jump to the definition of a function.
849Press @kbd{d} to view a function's documentation.
850You can save a profile to a file using @kbd{C-x C-w}.
851You can compare two profiles using @kbd{=}.
852
853@c FIXME reversed calltree?
854
855@cindex @file{elp.el}
856@cindex timing programs
857The @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
862You 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
869For low-level profiling of Emacs itself, you can build it using the
870@option{--enable-profiling} option of @command{configure}. When Emacs
871exits, it generates a file @file{gmon.out} that you can examine using
872the @command{gprof} utility. This feature is mainly useful for
873debugging Emacs. It actually stops the Lisp-level @kbd{M-x
874profiler-@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
2425This sets the @code{:font} attribute of @var{face} to @var{font}. 2425This 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
2429This sets the @code{:weight} attribute of @var{face} to @var{normal} 2429This sets the @code{:weight} attribute of @var{face} to @var{normal}
2430if @var{bold-p} is @code{nil}, and to @var{bold} otherwise. 2430if @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
2434This sets the @code{:slant} attribute of @var{face} to @var{normal} if 2434This 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
2444This sets the @code{:inverse-video} attribute of @var{face} to 2444This 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}.
2453don't specify @var{frame}, they refer to the selected frame; @code{t} 2453don't specify @var{frame}, they refer to the selected frame; @code{t}
2454refers to the default data for new frames. They return the symbol 2454refers 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
2456attribute. 2456attribute. If @var{inherit} is @code{nil}, only an attribute directly
2457defined by the face is returned. If @var{inherit} is non-@code{nil},
2458any faces specified by its @code{:inherit} attribute are considered as
2459well, and if @var{inherit} is a face or a list of faces, then they are
2460also considered, until a specified attribute is found. To ensure that
2461the return value is always specified, use a value of @code{default} for
2462@var{inherit}.
2463
2464@defun face-font face &optional frame
2465This 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
2460These functions return the foreground color (or background color, 2470These functions return the foreground color (or background color,
2461respectively) of face @var{face}, as a string. 2471respectively) of face @var{face}, as a string.
2462
2463If @var{inherit} is @code{nil}, only a color directly defined by the face is
2464returned. If @var{inherit} is non-@code{nil}, any faces specified by its
2465@code{:inherit} attribute are considered as well, and if @var{inherit}
2466is a face or a list of faces, then they are also considered, until a
2467specified color is found. To ensure that the return value is always
2468specified, 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
2472This function returns the name of the background stipple pattern of face 2475This 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
2475If @var{inherit} is @code{nil}, only a stipple directly defined by the
2476face is returned. If @var{inherit} is non-@code{nil}, any faces
2477specified by its @code{:inherit} attribute are considered as well, and
2478if @var{inherit} is a face or a list of faces, then they are also
2479considered, until a specified stipple is found. To ensure that the
2480return 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
2485This 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
2489This function returns a non-@code{nil} value if the @code{:weight} 2480This function returns a non-@code{nil} value if the @code{:weight}
2490attribute of @var{face} is bolder than normal (i.e., one of 2481attribute 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
2496This function returns a non-@code{nil} value if the @code{:slant} 2487This function returns a non-@code{nil} value if the @code{:slant}
2497attribute of @var{face} is @code{italic} or @code{oblique}, and 2488attribute 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
2504This function returns non-@code{nil} if face @var{face} specifies 2493This function returns non-@code{nil} if face @var{face} specifies
2505a non-@code{nil} @code{:underline} attribute. 2494a 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
2509This function returns non-@code{nil} if face @var{face} specifies 2498This function returns non-@code{nil} if face @var{face} specifies
2510a non-@code{nil} @code{:inverse-video} attribute. 2499a 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
621The Lisp Debugger 622The 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.
1377to text in a string, and vice versa. 1377Time 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
1380This function parses the time-string @var{string} and returns the 1380This 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 463Profile your program, to find out where the time is being spent.
464@cindex timing programs 464@xref{Profiling}.
465@cindex @file{elp.el}
466Profile 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
472Check 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
477Use iteration rather than recursion whenever possible. 467Use 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
2038follows: If `*foo*' already appears on a visible or iconified frame, it 2038follows: If `*foo*' already appears on a visible or iconified frame, it
2039will reuse its window. Otherwise, it will try to pop up a new window 2039will reuse its window. Otherwise, it will try to pop up a new window
2040or, if that is impossible, a new frame. If all these steps fail, it 2040or, if that is impossible, a new frame. If all these steps fail, it
2041will try to use some existing window. 2041will 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