aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmds.c
diff options
context:
space:
mode:
authorXue Fuqiao2013-09-04 08:39:34 +0800
committerXue Fuqiao2013-09-04 08:39:34 +0800
commitadf2fc4a01efe77d73cd52bc9173914ed56ff531 (patch)
treea5a280a5554a7bffeaf94fccae29fa3ac1a5d066 /src/cmds.c
parent63191d9f2043d2e67657e85a7b3842805dd1dad6 (diff)
parent38726039b77db432989fed106c88e9f1aa463281 (diff)
downloademacs-adf2fc4a01efe77d73cd52bc9173914ed56ff531.tar.gz
emacs-adf2fc4a01efe77d73cd52bc9173914ed56ff531.zip
Merge from mainline.
Diffstat (limited to 'src/cmds.c')
-rw-r--r--src/cmds.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/cmds.c b/src/cmds.c
index 3ebad50184a..ee3be79a0ab 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -86,6 +86,7 @@ DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "^p",
86 doc: /* Move point N characters forward (backward if N is negative). 86 doc: /* Move point N characters forward (backward if N is negative).
87On reaching end or beginning of buffer, stop and signal error. 87On reaching end or beginning of buffer, stop and signal error.
88Interactively, N is the numeric prefix argument. 88Interactively, N is the numeric prefix argument.
89If N is omitted or nil, move point 1 character forward.
89 90
90Depending on the bidirectional context, the movement may be to the 91Depending on the bidirectional context, the movement may be to the
91right or to the left on the screen. This is in contrast with 92right or to the left on the screen. This is in contrast with
@@ -99,6 +100,7 @@ DEFUN ("backward-char", Fbackward_char, Sbackward_char, 0, 1, "^p",
99 doc: /* Move point N characters backward (forward if N is negative). 100 doc: /* Move point N characters backward (forward if N is negative).
100On attempt to pass beginning or end of buffer, stop and signal error. 101On attempt to pass beginning or end of buffer, stop and signal error.
101Interactively, N is the numeric prefix argument. 102Interactively, N is the numeric prefix argument.
103If N is omitted or nil, move point 1 character backward.
102 104
103Depending on the bidirectional context, the movement may be to the 105Depending on the bidirectional context, the movement may be to the
104right or to the left on the screen. This is in contrast with 106right or to the left on the screen. This is in contrast with
@@ -119,9 +121,7 @@ With positive N, a non-empty line at the end counts as one line
119successfully moved (for the return value). */) 121successfully moved (for the return value). */)
120 (Lisp_Object n) 122 (Lisp_Object n)
121{ 123{
122 ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; 124 ptrdiff_t opoint = PT, pos, pos_byte, shortage, count;
123 ptrdiff_t pos, pos_byte;
124 EMACS_INT count, shortage;
125 125
126 if (NILP (n)) 126 if (NILP (n))
127 count = 1; 127 count = 1;
@@ -132,16 +132,12 @@ successfully moved (for the return value). */)
132 } 132 }
133 133
134 if (count <= 0) 134 if (count <= 0)
135 shortage = scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, count - 1, 1); 135 pos = find_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, count - 1,
136 &shortage, &pos_byte, 1);
136 else 137 else
137 shortage = scan_newline (PT, PT_BYTE, ZV, ZV_BYTE, count, 1); 138 pos = find_newline (PT, PT_BYTE, ZV, ZV_BYTE, count,
138 139 &shortage, &pos_byte, 1);
139 /* Since scan_newline does TEMP_SET_PT_BOTH, 140
140 and we want to set PT "for real",
141 go back to the old point and then come back here. */
142 pos = PT;
143 pos_byte = PT_BYTE;
144 TEMP_SET_PT_BOTH (opoint, opoint_byte);
145 SET_PT_BOTH (pos, pos_byte); 141 SET_PT_BOTH (pos, pos_byte);
146 142
147 if (shortage > 0 143 if (shortage > 0