unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Pierre Neidhardt <mail@ambrevar.xyz>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 35018@debbugs.gnu.org
Subject: bug#35018: 26.1; Use diff as en ert-explainer for string=
Date: Tue, 02 Apr 2019 09:59:59 +0200	[thread overview]
Message-ID: <874l7gon0g.fsf@ambrevar.xyz> (raw)
In-Reply-To: <87imvxgqte.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]

Thanks for the review!

Noam Postavsky <npostavs@gmail.com> writes:

>> (defun webfeeder--string=-explainer (string-a string-b)
>>   "Return the diff output of STRING-A and STRING-B"
>>   (unless (string= string-a string-b)
>
> I guess a diff won't help so much for single line strings, so maybe the
> condition should check for that? e.g.
>
>     (or (string= string-a string-b)
>         (not (string-match-p "\n" string-a))
>         (not (string-match-p "\n" string-b))

Yes, this is very nice!

>>     (let (file-a file-b)
>>       (unwind-protect
>>           (let (result)
>>             (setq file-a (make-temp-file "webfeeder")
>>                   file-b (make-temp-file "webfeeder"))
>>             (with-temp-file file-a
>>               (insert string-a))
>>             (with-temp-file file-b
>>               (insert string-b))
>>             (setq result
>>                   (with-temp-buffer
>>                     ;; The following generates a *Diff* buffer which is
>>                     ;; convenient for coloration.
>>                     (diff file-a file-b nil 'no-async)
>>                     (diff-no-select file-a file-b nil 'no-async (current-buffer))
>
> Isn't the diff-no-select redudant, since diff already calls it?

The first diff is a typo.  It should be diff-no-select only.

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

  reply	other threads:[~2019-04-02  7:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27 10:19 bug#35018: 26.1; Use diff as en ert-explainer for string= Pierre Neidhardt
2019-04-02  1:05 ` Noam Postavsky
2019-04-02  7:59   ` Pierre Neidhardt [this message]
2021-06-23 13:42 ` Lars Ingebrigtsen
2021-06-24  7:06   ` Pierre Neidhardt
2021-06-24 14:52     ` Lars Ingebrigtsen
2021-06-24 15:59       ` Pierre Neidhardt
2021-10-12 15:33         ` Lars Ingebrigtsen
2021-10-12 17:23           ` Pierre Neidhardt
2021-10-13 11:21             ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=874l7gon0g.fsf@ambrevar.xyz \
    --to=mail@ambrevar.xyz \
    --cc=35018@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).