This commit is contained in:
Jean-Philippe Bernardy 2019-04-29 21:37:09 +02:00
parent 18f169c3b0
commit b88e19f077

View file

@ -98,19 +98,20 @@ This item is either the symbol at point, or, if this fails, the sexp at point."
(defun boon-select-n-copies (count thing)
"Return list of regions with COUNT copies of the THING."
(lambda() (save-mark-and-excursion
(let* ((bnds (bounds-of-thing-at-point thing))
(what (buffer-substring-no-properties (car bnds) (cdr bnds)))
(local-count count)
;; local-count variable necessary because the argument
;; is shared between all calls to this closure.
(result nil))
(goto-char (car bnds))
(while (and (> local-count 0) (search-forward what nil t))
(setq local-count (1- local-count))
(push (boon-mk-reg (match-beginning 0)
(match-end 0))
result))
result))))
(let ((bnds (bounds-of-thing-at-point thing)))
(unless bnds (error "No %s found at point" thing))
(let* ((what (buffer-substring-no-properties (car bnds) (cdr bnds)))
(local-count count)
;; local-count variable necessary because the argument
;; is shared between all calls to this closure.
(result nil))
(goto-char (car bnds))
(while (and (> local-count 0) (search-forward what nil t))
(setq local-count (1- local-count))
(push (boon-mk-reg (match-beginning 0)
(match-end 0))
result))
result)))))
(defun boon-select-document () (interactive) (lambda () (boon-regs-from-bounds (cons (point-min) (point-max)))))
(defun boon-select-paragraph (count) (interactive "p") (boon-select-n count 'paragraph))