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
4044f853
Commit
4044f853
authored
Dec 14, 1998
by
Karl Heuer
Browse files
(comment-region): Handle comment-padding
separately for insertion and for deletion, in the right way for each.
parent
b78fba02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
lisp/simple.el
lisp/simple.el
+22
-15
No files found.
lisp/simple.el
View file @
4044f853
...
...
@@ -2772,8 +2772,10 @@ not end the comment. Blank lines do not get comments."
(
save-excursion
(
save-restriction
(
let
((
cs
comment-start
)
(
ce
comment-end
)
(
cp
(
when
comment-padding
(
make-string
comment-padding
?
)))
numarg
)
(
if
(
consp
arg
)
(
setq
numarg
t
)
(
if
(
consp
arg
)
(
setq
numarg
t
)
(
setq
numarg
(
prefix-numeric-value
arg
))
;; For positive arg > 1, replicate the comment delims now,
;; then insert the replicated strings just once.
...
...
@@ -2781,13 +2783,11 @@ not end the comment. Blank lines do not get comments."
(
setq
cs
(
concat
cs
comment-start
)
ce
(
concat
ce
comment-end
))
(
setq
numarg
(
1-
numarg
))))
(
when
comment-padding
(
setq
cs
(
concat
cs
(
make-string
comment-padding
?
))))
;; Loop over all lines from BEG to END.
(
narrow-to-region
beg
end
)
(
goto-char
beg
)
(
while
(
not
(
eobp
))
(
if
(
or
(
eq
numarg
t
)
(
<
numarg
0
))
(
narrow-to-region
beg
end
)
(
goto-char
beg
)
(
if
(
or
(
eq
numarg
t
)
(
<
numarg
0
))
(
while
(
not
(
eobp
))
(
progn
;; Delete comment start from beginning of line.
(
if
(
eq
numarg
t
)
...
...
@@ -2797,8 +2797,11 @@ not end the comment. Blank lines do not get comments."
(
while
(
and
(
>
1
(
setq
count
(
1+
count
)))
(
looking-at
(
regexp-quote
cs
)))
(
delete-char
(
length
cs
)))))
;; Delete comment padding from beginning of line
(
when
(
and
comment-padding
(
looking-at
(
regexp-quote
cp
)))
(
delete-char
comment-padding
))
;; Delete comment end from end of line.
(
if
(
string=
""
ce
)
(
if
(
string=
""
ce
)
nil
(
if
(
eq
numarg
t
)
(
progn
...
...
@@ -2823,14 +2826,18 @@ not end the comment. Blank lines do not get comments."
(
backward-char
(
length
ce
))
(
if
(
looking-at
(
regexp-quote
ce
))
(
delete-char
(
length
ce
)))))))))
(
forward-line
1
))
(
forward-line
1
)))
(
when
comment-padding
(
setq
cs
(
concat
cs
cp
)))
(
while
(
not
(
eobp
))
;; Insert at beginning and at end.
(
if
(
looking-at
"[ \t]*$"
)
()
(
insert
cs
)
(
if
(
string=
""
ce
)
()
(
end-of-line
)
(
insert
ce
)))
(
search-forward
"\n"
nil
'move
)))))))
(
if
(
looking-at
"[ \t]*$"
)
()
(
insert
cs
)
(
if
(
string=
""
ce
)
()
(
end-of-line
)
(
insert
ce
)))
(
search-forward
"\n"
nil
'move
)))))))
(
defun
backward-word
(
arg
)
"Move backward until encountering the end of a word.
...
...
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