summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-defs.el
diff options
context:
space:
mode:
authorYuuki Harano <masm+github@masm11.me>2021-04-06 00:11:36 +0900
committerYuuki Harano <masm+github@masm11.me>2021-04-06 00:11:36 +0900
commit8c7453632e8f45ed65ce814eafc0a1af637774c1 (patch)
treea7248619441ffb6a77a81a7b76ade2b7294f7719 /lisp/progmodes/cc-defs.el
parent5d2f319eec33fea2cb29a02210952ee590b4b21b (diff)
parent0342354c155728f8d55005bd34a66e1ab3179cc7 (diff)
downloademacs-8c7453632e8f45ed65ce814eafc0a1af637774c1.tar.gz
emacs-8c7453632e8f45ed65ce814eafc0a1af637774c1.tar.bz2
emacs-8c7453632e8f45ed65ce814eafc0a1af637774c1.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'lisp/progmodes/cc-defs.el')
-rw-r--r--lisp/progmodes/cc-defs.el20
1 files changed, 12 insertions, 8 deletions
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 38fe23b0eaf..536e6766261 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -691,14 +691,16 @@ whitespace.
LIMIT sets an upper limit of the forward movement, if specified. If
LIMIT or the end of the buffer is reached inside a comment or
-preprocessor directive, the point will be left there.
+preprocessor directive, the point will be left there. If point starts
+on the wrong side of LIMIT, it stays unchanged.
Note that this function might do hidden buffer changes. See the
comment at the start of cc-engine.el for more info."
(if limit
- `(save-restriction
- (narrow-to-region (point-min) (or ,limit (point-max)))
- (c-forward-sws))
+ `(when (< (point) (or ,limit (point-max)))
+ (save-restriction
+ (narrow-to-region (point-min) (or ,limit (point-max)))
+ (c-forward-sws)))
'(c-forward-sws)))
(defmacro c-backward-syntactic-ws (&optional limit)
@@ -710,14 +712,16 @@ whitespace.
LIMIT sets a lower limit of the backward movement, if specified. If
LIMIT is reached inside a line comment or preprocessor directive then
-the point is moved into it past the whitespace at the end.
+the point is moved into it past the whitespace at the end. If point
+starts on the wrong side of LIMIT, it stays unchanged.
Note that this function might do hidden buffer changes. See the
comment at the start of cc-engine.el for more info."
(if limit
- `(save-restriction
- (narrow-to-region (or ,limit (point-min)) (point-max))
- (c-backward-sws))
+ `(when (> (point) (or ,limit (point-min)))
+ (save-restriction
+ (narrow-to-region (or ,limit (point-min)) (point-max))
+ (c-backward-sws)))
'(c-backward-sws)))
(defmacro c-forward-sexp (&optional count)