unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Sean Whitton <spwhitton@spwhitton.name>
Cc: emacs-devel@gnu.org
Subject: Re: [elpa] externals/literate-scratch c22a15e86a: * literate-scratch: Import version 1.0
Date: Fri, 21 Jun 2024 09:19:42 -0400	[thread overview]
Message-ID: <jwved8q308w.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20240621041534.89078C1FB45@vcs2.savannah.gnu.org> (Sean Whitton via's message of "Fri, 21 Jun 2024 00:15:34 -0400 (EDT)")

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




       reply	other threads:[~2024-06-21 13:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <171894333404.26226.10020929353059071988@vcs2.savannah.gnu.org>
     [not found] ` <20240621041534.89078C1FB45@vcs2.savannah.gnu.org>
2024-06-21 13:19   ` Stefan Monnier [this message]
2024-06-25  5:46     ` [elpa] externals/literate-scratch c22a15e86a: * literate-scratch: Import version 1.0 Sean Whitton via Emacs development discussions.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwved8q308w.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=spwhitton@spwhitton.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).