[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: |
Alan Mackenzie |
Subject: |
Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'. |
Date: |
Fri, 11 Mar 2016 12:22:09 +0000 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
Hello Dmitry.
On Fri, Mar 11, 2016 at 02:26:25AM +0200, Dmitry Gutov wrote:
> 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.
Please don't think of using (nth 9 (snytax-ppss)) in such a high level
function. It's strictly internal stuff used for continuing a parse in
the middle of something. If you do really want to use it, we should
consider making that element fully defined at the user level (and
possibly stating any further elements are "internal").
I think a better way to do this would be to search for "containing
functions", such as `eval-when-compile' at the top level, and designate
everything inside them as "top level".
> 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.
Indeed.
--
Alan Mackenzie (Nuremberg, Germany).
Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Richard Stallman, 2016/03/09
- Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Dmitry Gutov, 2016/03/09
- Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Richard Stallman, 2016/03/10
- Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Dmitry Gutov, 2016/03/10
- Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'.,
Alan Mackenzie <=
- Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Stefan Monnier, 2016/03/11
- RE: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Drew Adams, 2016/03/11
Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Alan Mackenzie, 2016/03/09
Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., martin rudalics, 2016/03/09
Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Eli Zaretskii, 2016/03/09
Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., John Wiegley, 2016/03/09
Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Daniel Colascione, 2016/03/13
Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Stefan Monnier, 2016/03/13
Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Eli Zaretskii, 2016/03/13
Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Daniel Colascione, 2016/03/13