From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Pierre Neidhardt Newsgroups: gmane.emacs.bugs Subject: bug#35018: 26.1; Use diff as en ert-explainer for string= Date: Tue, 02 Apr 2019 09:59:59 +0200 Message-ID: <874l7gon0g.fsf@ambrevar.xyz> References: <87a7hgpqlg.fsf@ambrevar.xyz> <87imvxgqte.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="236929"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35018@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 02 10:03:30 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBEOF-000zJe-G8 for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Apr 2019 10:03:27 +0200 Original-Received: from localhost ([127.0.0.1]:55693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBEOE-0006Rz-76 for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Apr 2019 04:03:26 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBEM8-0004jr-Qw for bug-gnu-emacs@gnu.org; Tue, 02 Apr 2019 04:01:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBEM3-0000l3-BV for bug-gnu-emacs@gnu.org; Tue, 02 Apr 2019 04:01:16 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54979) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hBELu-0000f9-0X for bug-gnu-emacs@gnu.org; Tue, 02 Apr 2019 04:01:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hBELt-0007JX-LW for bug-gnu-emacs@gnu.org; Tue, 02 Apr 2019 04:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pierre Neidhardt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Apr 2019 08:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35018 X-GNU-PR-Package: emacs Original-Received: via spool by 35018-submit@debbugs.gnu.org id=B35018.155419200828031 (code B ref 35018); Tue, 02 Apr 2019 08:01:01 +0000 Original-Received: (at 35018) by debbugs.gnu.org; 2 Apr 2019 08:00:08 +0000 Original-Received: from localhost ([127.0.0.1]:40290 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hBEL2-0007I3-8d for submit@debbugs.gnu.org; Tue, 02 Apr 2019 04:00:08 -0400 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:35247) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hBEKz-0007Gy-DL for 35018@debbugs.gnu.org; Tue, 02 Apr 2019 04:00:06 -0400 X-Originating-IP: 92.169.116.19 Original-Received: from bababa (lfbn-1-4117-19.w92-169.abo.wanadoo.fr [92.169.116.19]) (Authenticated sender: pierre@atlas.engineer) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 3667A20008; Tue, 2 Apr 2019 08:00:01 +0000 (UTC) In-Reply-To: <87imvxgqte.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:157078 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Thanks for the review! Noam Postavsky writes: >> (defun webfeeder--string=3D-explainer (string-a string-b) >> "Return the diff output of STRING-A and STRING-B" >> (unless (string=3D 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=3D 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! =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAlyjFn8ACgkQm9z0l6S7 zH/JLQf/TDfUaevD/ZntASBUWEXv5Ce3mMy+e1echzW9cVIrAcHugWLagIHeIQ1v JaehU7B+d3y059Snv2m0ZTEVFB/5F6zPYu9vAnj9evEEEW4EOHZ5G7Yal+bpSIkk 2OYxEf6JURQyBBS9cbRrHepdMlTrhcRN1K/4VSsMBBHDtIPZHnwASM/LicyeKn0F 8ealm+DP2Z4ltRqJGkK6mGyN0bzr1VXs0cdskRNMizvI51q9FRMtZ8qfdT7VZqF6 NXXGZ6M+pHgvChB/0TdkkZkRQYwY7reb0XnkBZgcebj4EDcsbgbkAddFLSt3c+Q8 B1klCvE2bHDEi9h/9dPDA4bupF+OmA== =CphO -----END PGP SIGNATURE----- --=-=-=--