all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: Emacs Development <Emacs-devel@gnu.org>
Subject: Re: regexp linting run in Emacs tree
Date: Mon, 5 Aug 2019 23:18:11 +0200	[thread overview]
Message-ID: <642BA39E-FE1C-4345-8027-50445B64EA18@acm.org> (raw)
In-Reply-To: <1adc8c6d-7e82-6ee6-1ec5-12e387acecb1@cs.ucla.edu>

5 aug. 2019 kl. 19.17 skrev Paul Eggert <eggert@cs.ucla.edu>:
> 
> I'm afraid that'd still be more clutter than it's worth, at least to me.

Well, it's faster than the current code in the common case[*]. It also reflects the intended semantics better; the current code relies on the implicit tolerance for duplicates in skip-chars-forward.

> Instead, how about changing the delinter to omit this particular warning if the regexp was computed from a configurable variable (as opposed to an ordinary variable)?

That's a very ad-hoc rule which just happens to fit this very situation but isn't really causally connected to the false positive in a reasonable way. It could just as well have occurred in a different way, or resulted in a different warning. It just goes to show how hard it is to make an algorithm understand when a human programmer knowingly breaks the rules to achieve a certain effect.

As I see it, it's either the proposed memq change which makes the code faster and (arguably) clearer, a formal suppressive comment, or seeing this instance every time (and remembering to ignore it).

[*] Benchmarked:

(defun f (c) (string c ?\s ?\t))
(defun g (c) (if (memq c '(?\s ?\t)) " \t" (string c ?\s ?\t)))

g is about twice as fast as f for c=32; less allocation, and memq is a bytecode op while string isn't.




  reply	other threads:[~2019-08-05 21:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-04 17:49 regexp linting run in Emacs tree Mattias Engdegård
2019-08-04 18:46 ` Paul Eggert
2019-08-04 19:07   ` Mattias Engdegård
2019-08-04 22:57     ` Paul Eggert
2019-08-05 11:33       ` Mattias Engdegård
2019-08-05 17:17         ` Paul Eggert
2019-08-05 21:18           ` Mattias Engdegård [this message]
2019-08-08 11:01       ` Mattias Engdegård

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=642BA39E-FE1C-4345-8027-50445B64EA18@acm.org \
    --to=mattiase@acm.org \
    --cc=Emacs-devel@gnu.org \
    --cc=eggert@cs.ucla.edu \
    /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.