unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [elpa] externals/literate-scratch c22a15e86a: * literate-scratch: Import version 1.0
       [not found] ` <20240621041534.89078C1FB45@vcs2.savannah.gnu.org>
@ 2024-06-21 13:19   ` Stefan Monnier
  2024-06-25  5:46     ` Sean Whitton via Emacs development discussions.
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2024-06-21 13:19 UTC (permalink / raw)
  To: Sean Whitton; +Cc: emacs-devel

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [elpa] externals/literate-scratch c22a15e86a: * literate-scratch: Import version 1.0
  2024-06-21 13:19   ` [elpa] externals/literate-scratch c22a15e86a: * literate-scratch: Import version 1.0 Stefan Monnier
@ 2024-06-25  5:46     ` Sean Whitton via Emacs development discussions.
  0 siblings, 0 replies; 2+ messages in thread
From: Sean Whitton via Emacs development discussions. @ 2024-06-25  5:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Hello,

Thanks, I'll look into this at some point.

-- 
Sean Whitton



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-25  5:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <171894333404.26226.10020929353059071988@vcs2.savannah.gnu.org>
     [not found] ` <20240621041534.89078C1FB45@vcs2.savannah.gnu.org>
2024-06-21 13:19   ` [elpa] externals/literate-scratch c22a15e86a: * literate-scratch: Import version 1.0 Stefan Monnier
2024-06-25  5:46     ` Sean Whitton via Emacs development discussions.

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).