mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 13:18:18 +00:00
Get current paragraph text when point at start of paragraph in khoj.el
Previously if cursor was at start of current paragraph, it would get text for the current and next paragraph, instead of just the current one
This commit is contained in:
@@ -417,10 +417,16 @@ Use `which-key` if available, else display simple message in echo area"
|
||||
;; trim trailing whitespaces from text
|
||||
(replace-regexp-in-string
|
||||
"[ \t\n]*$" ""
|
||||
;; get text of current entry
|
||||
(buffer-substring-no-properties
|
||||
(save-excursion (backward-paragraph) (point))
|
||||
(save-excursion (forward-paragraph) (point)))))))
|
||||
(cond
|
||||
;; when at beginning of a middle paragraph
|
||||
((and (looking-at paragraph-start) (not (equal (point) (point-min))))
|
||||
(buffer-substring-no-properties
|
||||
(save-excursion (backward-paragraph) (point))
|
||||
(point)))
|
||||
;; else
|
||||
(t (buffer-substring-no-properties
|
||||
(save-excursion (backward-paragraph) (point))
|
||||
(save-excursion (forward-paragraph) (point)))))))))
|
||||
|
||||
(defun khoj--find-similar (&optional content-type)
|
||||
"Find items of CONTENT-TYPE in khoj index similar to text surrounding point."
|
||||
|
||||
Reference in New Issue
Block a user