Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
0f0a7f7c
Commit
0f0a7f7c
authored
Jan 18, 1998
by
Karl Heuer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(occur): If the matching line has no final newline,
insert one anyway. Compensate for that when inserting line nums.
parent
0c4b86da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
lisp/replace.el
lisp/replace.el
+17
-4
No files found.
lisp/replace.el
View file @
0f0a7f7c
...
...
@@ -491,6 +491,7 @@ the matching is case-sensitive."
(
tag
(
format
"%5d"
linenum
))
(
empty
(
make-string
(
length
tag
)
?\
))
tem
insertion-start
;; Number of lines of context to show for current match.
occur-marker
;; Marker pointing to end of match in source buffer.
...
...
@@ -515,7 +516,21 @@ the matching is case-sensitive."
;; Insert matching text including context lines from
;; source buffer into *Occur*
(
set-marker
text-beg
(
point
))
(
setq
insertion-start
(
point
))
(
insert-buffer-substring
buffer
start
end
)
(
or
(
and
(
/=
(
+
start
match-beg
)
end
)
(
with-current-buffer
buffer
(
eq
(
char-before
end
)
?\n
)))
(
insert
"\n"
))
(
set-marker
final-context-start
(
+
(
-
(
point
)
(
-
end
(
match-end
0
)))
(
if
(
save-excursion
(
set-buffer
buffer
)
(
save-excursion
(
goto-char
(
match-end
0
))
(
end-of-line
)
(
bolp
)))
1
0
)))
(
set-marker
text-end
(
point
))
;; Highlight text that was matched.
...
...
@@ -531,12 +546,10 @@ the matching is case-sensitive."
(
+
(
marker-position
text-beg
)
match-beg
match-len
)
(
+
(
marker-position
text-beg
)
match-beg
match-len
1
)
'occur-point
t
)
(
set-marker
final-context-start
(
-
(
point
)
(
-
end
(
match-end
0
))))
;; Now go back to the start of the matching text
;; adding the space and colon to the start of each line.
(
goto-char
(
-
(
point
)
(
-
end
start
)
))
(
goto-char
insertion-
start
)
;; Insert space and colon for lines of context before match.
(
setq
tem
(
if
(
<
linenum
nlines
)
(
-
nlines
linenum
)
...
...
@@ -556,7 +569,7 @@ the matching is case-sensitive."
(
forward-line
1
)
(
setq
tag
nil
)
(
setq
this-linenum
(
1+
this-linenum
)))
(
while
(
<=
(
point
)
final-context-start
)
(
while
(
and
(
not
(
eobp
))
(
<=
(
point
)
final-context-start
)
)
(
insert
empty
?:
)
(
forward-line
1
)
(
setq
this-linenum
(
1+
this-linenum
))))
...
...
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