Function: elisp-refs--containing-lines
elisp-refs--containing-lines is a byte-compiled function defined in
elisp-refs.el.
Signature
(elisp-refs--containing-lines BUFFER START-POS END-POS)
Documentation
Return a string, all the lines in BUFFER that are between START-POS and END-POS (inclusive).
For the characters that are between START-POS and END-POS, propertize them.
Source Code
;; Defined in ~/.emacs.d/elpa/elisp-refs-20230920.201/elisp-refs.el
(defun elisp-refs--containing-lines (buffer start-pos end-pos)
"Return a string, all the lines in BUFFER that are between
START-POS and END-POS (inclusive).
For the characters that are between START-POS and END-POS,
propertize them."
(let (expanded-start-pos expanded-end-pos)
(with-current-buffer buffer
;; Expand START-POS and END-POS to line boundaries.
(goto-char start-pos)
(beginning-of-line)
(setq expanded-start-pos (point))
(goto-char end-pos)
(end-of-line)
(setq expanded-end-pos (point))
;; Extract the rest of the line before and after the section we're interested in.
(let* ((before-match (buffer-substring expanded-start-pos start-pos))
(after-match (buffer-substring end-pos expanded-end-pos))
;; Concat the extra text with the actual match, ensuring we
;; highlight the match as code, but highlight the rest as as
;; comments.
(text (concat
(propertize before-match
'face 'font-lock-comment-face)
(elisp-refs--syntax-highlight (buffer-substring start-pos end-pos))
(propertize after-match
'face 'font-lock-comment-face))))
(-> text
(elisp-refs--replace-tabs)
(elisp-refs--unindent-rigidly)
(propertize 'elisp-refs-start-pos expanded-start-pos
'elisp-refs-path elisp-refs--path))))))