From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: A read-based grep-like for symbols (el-search?) (was Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master)) Date: Fri, 1 Oct 2021 17:05:49 +0100 Message-ID: References: <25d8d72022b571db5291@heytings.org> <87h7e2xsl5.fsf@gmail.com> <25d8d72022e1ea7ed022@heytings.org> <87fstl7lzw.fsf@web.de> <87a6jt7ilx.fsf@web.de> <87fstlzlaq.fsf@gmail.com> <20211001070242.GC16352@tuxteam.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14177"; mail-complaints-to="usenet@ciao.gmane.io" Cc: tomas@tuxteam.de, emacs-devel To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 01 18:10:58 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mWL7h-0003WZ-MR for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Oct 2021 18:10:57 +0200 Original-Received: from localhost ([::1]:48654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWL7g-0005R6-Mx for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Oct 2021 12:10:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWL32-0000Vv-KZ for emacs-devel@gnu.org; Fri, 01 Oct 2021 12:06:10 -0400 Original-Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:35370) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWL2y-0000a2-3v for emacs-devel@gnu.org; Fri, 01 Oct 2021 12:06:08 -0400 Original-Received: by mail-pj1-x1029.google.com with SMTP id d13-20020a17090ad3cd00b0019e746f7bd4so9668320pjw.0 for ; Fri, 01 Oct 2021 09:06:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=sWm+TeaAj3VXHutDVs7jCEvUtLyLoxcsxHX9SAj+0dw=; b=UtvAfDblAatsWIVrDQ8FZ1y0GuHKIHdGyjqawTiwS7pdAWufZ8iUG+/3AAXPUdRAn1 /SAG9ONxzJ5YFOPpVBADBtAX/TOuHE12X4VxP5VydCoS8QylLIbCh4p9Hil7WQpRoDDh qlqal7o33OhYm2ZhsQ0CHnSsrtZ/714ObOpoOwW8/raQ80QtPrad2rkXu5nDsd0K/kV5 AXDZ4r2fGDdVy2JnYS02jm2JhtX2KDSEqqpfyOa3KjDdMbfuwhQaWR9kSXlspqzVOlTJ pJVDAf8j/2USzAZsMTZJVLIElFe3MfCGVpP+xwLdNhcq3fX5kPV1miK1dcA7/pItHtjN OCFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=sWm+TeaAj3VXHutDVs7jCEvUtLyLoxcsxHX9SAj+0dw=; b=gqdacgmKtNf6dUenZsV3e3gbnMc+GncXa0jYkKJPRHz3F5TS37Mvn+fXMPiqVJeAvc e9jBQl6+6weFQScy58CSRbm5bzPFVUXYYeEf9TxT4yETVGiRvqs5qgbsHS1uUwfKswNh MAYDsY507DALifut87qbjJtyegfLDe/arH4ZJfsE3n1EDs9mmc9NUOIimUmYcY0C4JR1 xaFUfprpWi9xlDHjjfaSvFb8Y+N9r9rwcftO0IoM6PFLELtI+qcvoGXldGZ5JQndu0KI 2+CFOq17FktKdPq85bUU14Iyttp7XwEujihe5xRoCc4MscK8HfyS4DEY4Cw00gPURpEZ CQBQ== X-Gm-Message-State: AOAM531J9ViBdvsPcV/duHtFt900g/N7TIvkE7rMgu4oBDIAjHJiXQYB DD2GbkWwNpeNDtBXdfU0NupfAh16QeUCt8nrIy/LfUZ/ X-Google-Smtp-Source: ABdhPJwK8uDnCt2oS6hHc/01EiHAGO5geLdgMXE4CJGo2pZ1WJcqIMCebtdsJTR4xOuRsdjCywKImJMcjr8DL5n8lAA= X-Received: by 2002:a17:902:bcc6:b0:138:d3ca:c356 with SMTP id o6-20020a170902bcc600b00138d3cac356mr10092628pls.6.1633104360521; Fri, 01 Oct 2021 09:06:00 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=joaotavora@gmail.com; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:275991 Archived-At: On Fri, Oct 1, 2021 at 4:48 PM Dmitry Gutov wrote: > > On 01.10.2021 17:40, Jo=C3=A3o T=C3=A1vora wrote: > > >> Certain language designers intentionally limit the language's power du= e > >> to usability considerations, keeping in mind their audience. > > > > What languages, what evidence for this? Anyway, many more limit the po= wer > > due to performance considerations. Counts as "usability"? I guess. IME > > language audiences that are interested in performance usually don't > > care so much > > about ergonomics and vice versa. > > Go would be one example. The reasoning lies largely in the field of > usability. Their understanding of it, at least. Yes Go, I see what you mean. But it's been growing with new features, like generic functions. And has namespaces. They didn't design it around grep, that's for sure. That's what I meant. > Taking the example from the manual, the clients would be able to write > ;; elisp-shorthands: (("snu" . "some-nice-string-utils")) > but not > ;; elisp-shorthands: (("sn" . "some-nice")) > and that doesn't sound like a terrible limitation. I agree. We could make it a recommendation, i.e. issue a (stern) warning when we detect this. Or not allow shorthands of other forms in Emacs code, ELPA, e= tc. > > But > > possible, yes. Would you like to work on that `thing-at-pt.el` front? > > thing-at-pt? I'm not sure which particular task you are referring to. thingatpt.el, sorry. The library used by other Elisp programs when they want to pick some text from the buffer, at point, that represents a symbol, a string, a list. We could have some kind of "symbol-prefix" "symbol-suffi= x" or "symbol-part" for eventually telling grep to go search only for that par= t. > > That's not the approach I was thinking of, but I hope to present a work= ing > > prototype soon, which is a better way to present ideas. > Looking forward to it. Just realized the default xref-backend-references uses semantic and ede... Also realized that you do some kind of (intern (format ""...)) there. Grep heresy! > Simply doing > > (benchmark 1 '(dolist (dir load-path) > (when (file-exists-p dir) > (let ((files (directory-files dir t "\\.el\\'"))) > (dolist (file files) > (unless (file-directory-p file) > (with-temp-buffer > (insert-file file) > (read-from-string (buffer-string))))))))) > > Reports 2.5 seconds here. OK, thanks, gonna start with that snippet. Love a good snippet. Are these Emacs's files? You can read from the buffer directly. And you could reuse buffers. Dunno if it makes a difference. But even before I do, a good way to solve this is the good old speed-for-sp= ace. aka cache. No point in reading a file that we've read and hasn't changed since last time right? mtime caches look plausible, and we could even make it so that visited files' buffers are also read. My first challenge will be to check if the reader does source tracking, or is somehow pluggable to call a function when it reads a symbol. Jo=C3=A3o