emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 2bf3790f374: desktop.el: Janitorial cleanup


From: Stefan Monnier
Subject: Re: master 2bf3790f374: desktop.el: Janitorial cleanup
Date: Wed, 23 Apr 2025 18:26:51 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

> For a long time I used these settings without differences
> with plain `outline-regexp`:
>
>   (setq-default
>    outline-search-function
>    (lambda (&optional bound move backward looking-at)
>      (cond
>       (looking-at (looking-at outline-regexp))
>       (backward
>        (re-search-backward
>         (concat "^\\(?:" outline-regexp "\\).*")
>         bound (if move 'move t)))
>       (t
>        (re-search-forward
>         (concat "^\\(?:" outline-regexp "\\).*")
>         bound (if move 'move t)))))

Nice, didn't know about that one.
Any reason why you added a new var instead of extending the set of
values accepted for the old var?
Maybe we should use that as default value of the variable instead of nil?

> What would be the right place to add `syntax-ppss` here?

You could try

    (lambda (...)
      (and (cond ...)
           (save-excursion (not (nth 8 (syntax-ppss (match-beginning 0)))))))

>    outline-level
>    (lambda () (looking-at outline-regexp) (outline-level)))

The doc of `outline-level` says that the function can presume that the
match-data is already set so you can skip the `looking-at` and report
bugs if it makes a difference.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]