all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: Eli Zaretskii <eliz@gnu.org>, 74090@debbugs.gnu.org
Subject: bug#74090: 31.0.50; Problems with dabbrev-expand
Date: Mon, 02 Dec 2024 13:15:23 +0100	[thread overview]
Message-ID: <87ttbmxov8.fsf@gmx.net> (raw)
In-Reply-To: <87ttbmim48.fsf@mail.linkov.net> (Juri Linkov's message of "Mon,  02 Dec 2024 09:33:51 +0200")

On Mon, 02 Dec 2024 09:33:51 +0200 Juri Linkov <juri@linkov.net> wrote:

>> I've added a test but I'm somewhat dissatisfied with it.  I wanted to
>> essentially reproduce the behavior I see with the patch, described
>> above.  However, after killing buffer "foo", the message about no
>> further expansion is from a user-error in dabbrev-expand, and on hitting
>> this in the test run, the test immediately finishes.  So I used
>> should-error with :type 'user-error and the test succeeds, but I cannot
>> test for the final buffer content nor the message displayed by
>> user-error.  If anyone has an idea how to do that or otherwise improve
>> the test, please chime in.
>
> Probably 'condition-case' could help to catch a user-error.
> Or maybe better to set a buffer-local or let-bind 'command-error-function'
> like e.g. in 'minibuffer-error-initialize'.
>
> Then you can let-bind 'set-message-function' to catch a message
> to check it (but I don't remember if the error calls the message function).
>
> OTOH, I don't understand why the test immediately finishes after 'should-error'?
> There are many tests that call 'should-error' sequentially like:
>
>   (ert-deftest abbrev-table-empty-p-test ()
>     (should-error (abbrev-table-empty-p 42))
>     (should-error (abbrev-table-empty-p "aoeu"))
>     (should-error (abbrev-table-empty-p '()))
>     (should-error (abbrev-table-empty-p []))
>
> And indeed implementation of 'should-error' already has 'condition-case'.

Thanks very much for the feedback.  I was wrong about the test
immediately finishing after `should-error'; I guess I misread or
misunderstood the output of the batch run.  Additionally, there was a
typo in the test of the final buffer content, which caused it to fail,
and that probably confused me further.  As for testing the error
message, I overlooked that `should-error' returns an error description
containing the message, so that seems the simplest way to do it.  With
these changes the test succeeds in batch runs and I think now better
reflects the user experience with manual input, so I went ahead and
pushed the fix (commit 6bca138d60e to emacs-30).  If you agree, feel
free to close the bug again (assuming it needs to be reclosed, since you
unarchived it); otherwise, if you see other problems with the test,
please let me know.

Steve Berman





  reply	other threads:[~2024-12-02 12:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-29 17:06 bug#74090: 31.0.50; Problems with dabbrev-expand Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-29 18:17 ` Juri Linkov
2024-10-29 18:57   ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-30  7:32     ` Juri Linkov
2024-10-31 10:01       ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-30 13:03 ` Eli Zaretskii
2024-10-31 10:00   ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-31 10:09     ` Eli Zaretskii
2024-10-31 10:20       ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-31 10:39         ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-31 10:47           ` Eli Zaretskii
2024-10-31 11:17             ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]     ` <87ttbq7eie.fsf@mail.linkov.net>
2024-11-29  7:51       ` Juri Linkov
2024-11-29 15:38         ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 17:51           ` Juri Linkov
2024-11-30 20:07             ` Eli Zaretskii
2024-11-30 22:30               ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-02  7:33                 ` Juri Linkov
2024-12-02 12:15                   ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-12-03  7:35                     ` Juri Linkov
2024-12-03  9:39                       ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

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

  git send-email \
    --in-reply-to=87ttbmxov8.fsf@gmx.net \
    --to=bug-gnu-emacs@gnu.org \
    --cc=74090@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    --cc=stephen.berman@gmx.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.