bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#21072: Brave new mark-defun (and a testing tool)


From: Marcin Borkowski
Subject: bug#21072: Brave new mark-defun (and a testing tool)
Date: Tue, 25 Apr 2017 13:43:38 +0200
User-agent: mu4e 0.9.19; emacs 26.0.50

On 2017-04-24, at 14:52, address@hidden wrote:

> Marcin Borkowski <address@hidden> writes:
>
>> On 2017-04-22, at 20:05, address@hidden wrote:
>>
>>>> Still not there - I tried first on Elisp, like this:
>>>>
>>>> ;; A comment
>>>> (defun ...)
>>>>
>>>> and it left the point at the end of the "A comment" line instead of at
>>>> the beginning...
>>>
>>> Hmm, I don't get that, although I did miss an inf loop when the comment
>>> is at beginning of buffer.  Here is a fixed version:
>>
>> Still the same here, also in emacs -Q.
>
> Hmm, I was testing before now just by evaluating the changed functions
> after startup, I must have messed something up.  I think this one might
> be okay.
>
>     (defun beginning-of-defun-comments (&optional arg)
>       "Move to the beginning of ARGth defun, including comments."
>       (interactive "^p")
>       (unless arg (setq arg 1))
>       (beginning-of-defun arg)
>       (while (let ((pt (line-beginning-position))
>                    (ppss (and (zerop (forward-line -1)) (syntax-ppss))))
>                (cond ((nth 4 ppss) (goto-char (nth 8 ppss)))
>                      ((and ppss
>                            (parse-partial-sexp
>                             (point) (line-end-position) nil t ppss)
>                            (not (bolp)) (eolp)))
>                      (t (goto-char pt) nil)))))

Quick tests show that you are right.  I'd like to understand the code,
too - that will take me a while.

>>> Looks good to me (apart from the commit messages).
>
> Actually, now that I've applied this thing properly, I notice 2 test
> failures in batch mode:
>
> 2 unexpected results:
>    FAILED  mark-defun-arg-region-active
>    FAILED  mark-defun-no-arg-region-active
>
> They pass when run in interactive mode (I haven't looked into why).

That seems strange - all tests pass here with M-x ert.  What do you mean
by "batch mode"?

>> What should they look like, then?  Should I make all of them into the
>> ChangeLog format, or just rebase/squash all of them so that there are
>> two of them only (one for the testing tool and one for the
>> beginning-of-defun)?
>
> Yeah, I would go ahead and squash them, since you need to rebase to fix
> commit messages anyway.

Will do.

Thanks,

-- 
Marcin Borkowski





reply via email to

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