mirror of
https://github.com/vale981/boon
synced 2025-03-05 09:31:43 -05:00
fix #53
This commit is contained in:
parent
18f169c3b0
commit
b88e19f077
1 changed files with 14 additions and 13 deletions
|
@ -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)
|
(defun boon-select-n-copies (count thing)
|
||||||
"Return list of regions with COUNT copies of the THING."
|
"Return list of regions with COUNT copies of the THING."
|
||||||
(lambda() (save-mark-and-excursion
|
(lambda() (save-mark-and-excursion
|
||||||
(let* ((bnds (bounds-of-thing-at-point thing))
|
(let ((bnds (bounds-of-thing-at-point thing)))
|
||||||
(what (buffer-substring-no-properties (car bnds) (cdr bnds)))
|
(unless bnds (error "No %s found at point" thing))
|
||||||
(local-count count)
|
(let* ((what (buffer-substring-no-properties (car bnds) (cdr bnds)))
|
||||||
;; local-count variable necessary because the argument
|
(local-count count)
|
||||||
;; is shared between all calls to this closure.
|
;; local-count variable necessary because the argument
|
||||||
(result nil))
|
;; is shared between all calls to this closure.
|
||||||
(goto-char (car bnds))
|
(result nil))
|
||||||
(while (and (> local-count 0) (search-forward what nil t))
|
(goto-char (car bnds))
|
||||||
(setq local-count (1- local-count))
|
(while (and (> local-count 0) (search-forward what nil t))
|
||||||
(push (boon-mk-reg (match-beginning 0)
|
(setq local-count (1- local-count))
|
||||||
(match-end 0))
|
(push (boon-mk-reg (match-beginning 0)
|
||||||
result))
|
(match-end 0))
|
||||||
result))))
|
result))
|
||||||
|
result)))))
|
||||||
|
|
||||||
(defun boon-select-document () (interactive) (lambda () (boon-regs-from-bounds (cons (point-min) (point-max)))))
|
(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))
|
(defun boon-select-paragraph (count) (interactive "p") (boon-select-n count 'paragraph))
|
||||||
|
|
Loading…
Add table
Reference in a new issue