diff options
| author | Stefan Monnier | 2015-03-25 09:47:12 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-03-25 09:47:12 -0400 |
| commit | 599ca626d760215b090012c69c749d391cfd6fbe (patch) | |
| tree | 6cc2d4c57d53e317d33bfc7fb2012908c14316c2 /doc/lispref | |
| parent | 76040ddd8a4142e2933f1c24940d9e20c206ee6f (diff) | |
| download | emacs-599ca626d760215b090012c69c749d391cfd6fbe.tar.gz emacs-599ca626d760215b090012c69c749d391cfd6fbe.zip | |
`save-excursion' does not save&restore the mark any more
* src/editfns.c (save_excursion_save): Don't save the mark.
(save_excursion_restore): Don't restore the mark.
(Fsave_excursion): Fix docstring accordingly.
* doc/lispintro/emacs-lisp-intro.texi:
* doc/lispref/positions.texi (Excursions, Narrowing): `save-excursion' does
not save&restore the mark any more.
Diffstat (limited to 'doc/lispref')
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/positions.texi | 21 |
2 files changed, 13 insertions, 13 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 9b1bbb357a5..9e1b7b074e2 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2015-03-25 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * positions.texi (Excursions, Narrowing): `save-excursion' does not | ||
| 4 | save&restore the mark any more. | ||
| 5 | |||
| 1 | 2015-03-24 Paul Eggert <eggert@cs.ucla.edu> | 6 | 2015-03-24 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 7 | ||
| 3 | * numbers.texi (Float Basics): Improve ldexp documentation. | 8 | * numbers.texi (Float Basics): Improve ldexp documentation. |
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index b74116ebf1d..103161c7ae2 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi | |||
| @@ -825,8 +825,8 @@ is zero or less. | |||
| 825 | It is often useful to move point ``temporarily'' within a localized | 825 | It is often useful to move point ``temporarily'' within a localized |
| 826 | portion of the program. This is called an @dfn{excursion}, and it is | 826 | portion of the program. This is called an @dfn{excursion}, and it is |
| 827 | done with the @code{save-excursion} special form. This construct | 827 | done with the @code{save-excursion} special form. This construct |
| 828 | remembers the initial identity of the current buffer, and its values | 828 | remembers the initial identity of the current buffer, and its value |
| 829 | of point and the mark, and restores them after the excursion | 829 | of point, and restores them after the excursion |
| 830 | completes. It is the standard way to move point within one part of a | 830 | completes. It is the standard way to move point within one part of a |
| 831 | program and avoid affecting the rest of the program, and is used | 831 | program and avoid affecting the rest of the program, and is used |
| 832 | thousands of times in the Lisp sources of Emacs. | 832 | thousands of times in the Lisp sources of Emacs. |
| @@ -841,18 +841,18 @@ Configurations} and in @ref{Frame Configurations}. @c frameset? | |||
| 841 | @cindex mark excursion | 841 | @cindex mark excursion |
| 842 | @cindex point excursion | 842 | @cindex point excursion |
| 843 | This special form saves the identity of the current buffer and the | 843 | This special form saves the identity of the current buffer and the |
| 844 | values of point and the mark in it, evaluates @var{body}, and finally | 844 | value of point in it, evaluates @var{body}, and finally |
| 845 | restores the buffer and its saved values of point and the mark. All | 845 | restores the buffer and its saved value of point. both saved values are |
| 846 | three saved values are restored even in case of an abnormal exit via | 846 | restored even in case of an abnormal exit via |
| 847 | @code{throw} or error (@pxref{Nonlocal Exits}). | 847 | @code{throw} or error (@pxref{Nonlocal Exits}). |
| 848 | 848 | ||
| 849 | The value returned by @code{save-excursion} is the result of the last | 849 | The value returned by @code{save-excursion} is the result of the last |
| 850 | form in @var{body}, or @code{nil} if no body forms were given. | 850 | form in @var{body}, or @code{nil} if no body forms were given. |
| 851 | @end defspec | 851 | @end defspec |
| 852 | 852 | ||
| 853 | Because @code{save-excursion} only saves point and mark for the | 853 | Because @code{save-excursion} only saves point for the |
| 854 | buffer that was current at the start of the excursion, any changes | 854 | buffer that was current at the start of the excursion, any changes |
| 855 | made to point and/or mark in other buffers, during the excursion, will | 855 | made to point in other buffers, during the excursion, will |
| 856 | remain in effect afterward. This frequently leads to unintended | 856 | remain in effect afterward. This frequently leads to unintended |
| 857 | consequences, so the byte compiler warns if you call @code{set-buffer} | 857 | consequences, so the byte compiler warns if you call @code{set-buffer} |
| 858 | during an excursion: | 858 | during an excursion: |
| @@ -888,11 +888,6 @@ type @code{nil}. @xref{Marker Insertion Types}. Therefore, when the | |||
| 888 | saved point value is restored, it normally comes before the inserted | 888 | saved point value is restored, it normally comes before the inserted |
| 889 | text. | 889 | text. |
| 890 | 890 | ||
| 891 | Although @code{save-excursion} saves the location of the mark, it does | ||
| 892 | not prevent functions which modify the buffer from setting | ||
| 893 | @code{deactivate-mark}, and thus causing the deactivation of the mark | ||
| 894 | after the command finishes. @xref{The Mark}. | ||
| 895 | |||
| 896 | @node Narrowing | 891 | @node Narrowing |
| 897 | @section Narrowing | 892 | @section Narrowing |
| 898 | @cindex narrowing | 893 | @cindex narrowing |
| @@ -980,7 +975,7 @@ restores the restrictions on the original buffer (the buffer whose | |||
| 980 | restrictions it saved from), but it does not restore the identity of the | 975 | restrictions it saved from), but it does not restore the identity of the |
| 981 | current buffer. | 976 | current buffer. |
| 982 | 977 | ||
| 983 | @code{save-restriction} does @emph{not} restore point and the mark; use | 978 | @code{save-restriction} does @emph{not} restore point; use |
| 984 | @code{save-excursion} for that. If you use both @code{save-restriction} | 979 | @code{save-excursion} for that. If you use both @code{save-restriction} |
| 985 | and @code{save-excursion} together, @code{save-excursion} should come | 980 | and @code{save-excursion} together, @code{save-excursion} should come |
| 986 | first (on the outside). Otherwise, the old point value would be | 981 | first (on the outside). Otherwise, the old point value would be |