emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text


From: Dmitry Gutov
Subject: Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'.
Date: Fri, 11 Mar 2016 02:26:25 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0

On 03/10/2016 11:20 PM, Richard Stallman wrote:

If you make a concrete proposal for the new behavior, we can think about it.

There's nothing particularly hard about it--we have beginning-of-defun-function's implemented for much more complex functions than Elisp.

Here's a quick sketch:

(defun elisp-beginning-of-defun (&optional count)
  (setq count (or count 1))
  (dotimes (i count)
    (while (and (re-search-backward "(\\(?:cl-\\)?def" nil t)
                (elisp--form-quoted-p (point))))))

It fails on forms such as (define-key ...), but it's easy to also check all positions in (nth 9 (syntax-ppss)), and only pick the outermost defun-looking form. We can also make the regexp stricter, to only accept [cl-]defun, defmacro, defvar and defconst.

Anyway, like Alan mentioned, this caching proposal is actually orthogonal to the use of open-paren-in-column-0-is-defun-start in beginning-of-defun in emacs-lisp-mode. We could still keep that application, if we so preferred.



reply via email to

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