mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +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:
parent
a0b03c8bb1
commit
07e9e4ecc3
1 changed files with 10 additions and 4 deletions
|
@ -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."
|
||||
|
|
Loading…
Add table
Reference in a new issue