[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [elpa] externals/literate-scratch c22a15e86a: * literate-scratch: Im
From: |
Stefan Monnier |
Subject: |
Re: [elpa] externals/literate-scratch c22a15e86a: * literate-scratch: Import version 1.0 |
Date: |
Fri, 21 Jun 2024 09:19:42 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hi Sean,
> +(defun literate-scratch--extend (start end)
> + (save-excursion
> + (let ((res1
> + (and (goto-char start)
> + (not (looking-at paragraph-separate))
> + (and-let* ((new (car (bounds-of-thing-at-point 'paragraph))))
> + (and (< new start)
> + (setq start new)))))
> + (res2
> + (and (goto-char end)
> + (not (looking-at paragraph-separate))
> + (and-let* ((new (cdr (bounds-of-thing-at-point 'paragraph))))
> + (and (> new end)
> + (setq end new))))))
> + (and (or res1 res2)
> + (cons start end)))))
I think you can extend a lot less. Or even not at all. Just look at
the previous line:
- if it's empty, you're at the beginning of a paragraph and you set the
`syntax-table` property of the current line's first char according to
whether it's a ;([# or something else.
- If the previous line is not empty, just copy the `syntax-table`
property you find on the first char of the previous line.
Stefan
- Re: [elpa] externals/literate-scratch c22a15e86a: * literate-scratch: Import version 1.0,
Stefan Monnier <=