Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
5ef470be
Commit
5ef470be
authored
Mar 30, 1994
by
Karl Heuer
Browse files
(calculate-c-indent): Don't loop forever at bobp.
(calculate-c-indent, indent-c-exp): Test char against 0, not nil.
parent
7772e660
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
lisp/progmodes/c-mode.el
lisp/progmodes/c-mode.el
+12
-7
No files found.
lisp/progmodes/c-mode.el
View file @
5ef470be
...
@@ -766,23 +766,28 @@ Returns nil if line starts inside a string, t if in a comment."
...
@@ -766,23 +766,28 @@ Returns nil if line starts inside a string, t if in a comment."
(beginning-of-line)
(beginning-of-line)
(c-backward-to-noncomment containing-sexp))
(c-backward-to-noncomment containing-sexp))
;; Check for a preprocessor statement or its continuation lines.
;; Check for a preprocessor statement or its continuation lines.
;; Move back to end of previous non-preprocessor line.
;; Move back to end of previous non-preprocessor line,
;; or possibly beginning of buffer.
(let ((found (point)) stop)
(let ((found (point)) stop)
(while (not stop)
(while (not stop)
(cond ((save-excursion (end-of-line 0)
(beginning-of-line)
(cond ((bobp)
(setq found (point)
stop t))
((save-excursion (forward-char -1)
(= (preceding-char) ?\\))
(= (preceding-char) ?\\))
(
end-of-line 0
))
(
forward-char -1
))
;; This line is not preceded by a backslash.
;; This line is not preceded by a backslash.
;; So either it starts a preprocessor command
;; So either it starts a preprocessor command
;; or any following continuation lines
;; or any following continuation lines
;; should not be skipped.
;; should not be skipped.
(
(progn (beginning-of-line)
(= (following-char) ?#)
)
((= (following-char) ?#)
(
end-of-line 0
)
(
forward-char -1
)
(setq found (point)))
(setq found (point)))
(t (setq stop t))))
(t (setq stop t))))
(goto-char found))
(goto-char found))
;; Now we get the answer.
;; Now we get the answer.
(if (and (not (memq (preceding-char) '(
nil
?\, ?\; ?\} ?\{)))
(if (and (not (memq (preceding-char) '(
0
?\, ?\; ?\} ?\{)))
;; But don't treat a line with a close-brace
;; But don't treat a line with a close-brace
;; as a continuation. It is probably the
;; as a continuation. It is probably the
;; end of an enum type declaration.
;; end of an enum type declaration.
...
@@ -1177,7 +1182,7 @@ If within a string or comment, move by sentences instead of statements."
...
@@ -1177,7 +1182,7 @@ If within a string or comment, move by sentences instead of statements."
(
if
(
=
(
following-char
)
?}
)
(
if
(
=
(
following-char
)
?}
)
(
setq
this-indent
(
car
indent-stack
))
(
setq
this-indent
(
car
indent-stack
))
(
c-backward-to-noncomment
opoint
)
(
c-backward-to-noncomment
opoint
)
(
if
(
not
(
memq
(
preceding-char
)
'
(
nil
?\,
?\;
?}
?:
?{
)))
(
if
(
not
(
memq
(
preceding-char
)
'
(
0
?\,
?\;
?}
?:
?{
)))
;; Preceding line did not end in comma or semi;
;; Preceding line did not end in comma or semi;
;; indent this line c-continued-statement-offset
;; indent this line c-continued-statement-offset
;; more than previous.
;; more than previous.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment