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: Adding support for xref jumping to headers/interfaces Date: Tue, 28 Nov 2023 09:51:25 +0000 Message-ID: References: <87il697r5g.fsf@catern.com> <87r0kw8nxu.fsf@catern.com> <3fe5a8cd-b355-d7eb-10ad-8846aef3387b@gutov.dev> <878r6mx1xc.fsf@betli.tmit.bme.hu> <90e4b9a7-3b51-587d-e317-b89e5d5464d9@gutov.dev> <87sf4scxax.fsf@betli.tmit.bme.hu> <77500777-aea2-14db-4aab-7a5dff43443b@gutov.dev> 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="373"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Felician Nemeth , Spencer Baugh , emacs-devel@gnu.org, Eshel Yaron , John Yates , Ergus , Filipp Gunbin To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 28 10:49:21 2023 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 1r7uiT-000AMp-J5 for ged-emacs-devel@m.gmane-mx.org; Tue, 28 Nov 2023 10:49:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7uhi-0001Z3-SR; Tue, 28 Nov 2023 04:48:30 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r7uhh-0001Yv-Aq for emacs-devel@gnu.org; Tue, 28 Nov 2023 04:48:29 -0500 Original-Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7uhf-0003i1-Nn for emacs-devel@gnu.org; Tue, 28 Nov 2023 04:48:29 -0500 Original-Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-50bba1dd05fso605287e87.0 for ; Tue, 28 Nov 2023 01:48:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701164906; x=1701769706; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=79dN8TvfJfEskvRgp/6KdIuv+7GeG0ZLBoW8cUqneAA=; b=VuNkdZENpltE7+vT+Y3YGOESX9l203QAQSmg0HkslCGbXJfHNU8jr/KKJB8ISjnU96 Y4GsmeALcAS68DOF9pWZpIUpwSoowdVsx4xaMPDFdP1+aXrH6lClGiOIE6MqiQJ/KSbY 2/4gV7onixcPtVc4WlEr0/l8k6yRa1v7lpG5e1sHY7Dx6DS3VT9qQ27RJddAHi/4mcxw EKk3+vTdBTO6sWmbXIp8TmkWU7Q+jg8fJnasIgu2HQlKzLPBM2XsBKYPTHtPngcW46eZ feBe4wwAoY3mgHdxMa87q/8/6NipRtIJocVceq27zfu5GeEFbZQdeeQ2yd8oHKFEJxN1 owoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701164906; x=1701769706; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=79dN8TvfJfEskvRgp/6KdIuv+7GeG0ZLBoW8cUqneAA=; b=nWXELrTF9wZYjT2oogRMRnygkfc+66HR3P5lHArcwPYoJBG3iiLdciPlxp2d5xkUL5 pWkPLc4JAmMbn3SfHHVoeZTnx79T6ceizzQK1TQS5ATEbFPVKa3ZCBuElQVCkQB5Zu4A yyM4SYikpdLwUhEWb/nG7C831wU6WhZT3V+4WDTK0yEXrSD0tgpqNU9BSxJMWT75D/KW xFlRBLCxkIIpMOXjL4ed9mpU4LKKIM7QZlTmybyUULa8L4ChA+FQMiLlL2pR2+HiZQR6 o3Bi6K4Xw0kbN5K6zGO9FHsKiv9DLJEEGScbNoCCPk44oS/p0aF+lLe4CkL7aVfoM7jJ sk7A== X-Gm-Message-State: AOJu0YwEy9Oiq9DzR46E1Cy/T2fXp8iCTCY4PJAwj6LFWzwk6hFdo5jT fOt0b+/18cQ3bHRFZKhSBDLEudO97hg2bq2XAt0= X-Google-Smtp-Source: AGHT+IFEcJi48hpQthOuOVzxgvhPhpyNZFGXvvBfGMYF9bwiEKu0JWt59/50t95e7/smtfdJpEbLA6ctQhulu+HKzzA= X-Received: by 2002:ac2:4424:0:b0:507:9628:afb with SMTP id w4-20020ac24424000000b0050796280afbmr9291162lfl.68.1701164905678; Tue, 28 Nov 2023 01:48:25 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=joaotavora@gmail.com; helo=mail-lf1-x135.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:313311 Archived-At: On Tue, Nov 28, 2023 at 12:18=E2=80=AFAM Dmitry Gutov wr= ote: > > (defmacro eglot--code-action (name kind) > > "Define NAME to execute KIND code action." > > `(defun ,name (beg &optional end) > > ,(format "Execute `%s' code actions between BEG and END." kind) > > (interactive (eglot--code-action-bounds)) > > (eglot-code-actions beg end ,kind t))) > > > > And allows us to control exactly the 'interactive' spec of such > > commands to give us consistency among them. > > I'm wary of using macros as framework/library interface in Elisp because > unless they are very stable, they can cause versioning problems when > upgrading or reverting to an earlier version. You change a macro, but a > dependent package is already installed and byte-compiled, and there > won't be a recompilation until its next update. We might not even intend > to change them much, but then you don't always anticipate a bugfix. BTW, these tangents and distractions are possibly what Eli complained about when trying to follow this discussion about xref, but in the interest of Lisp programmers out there, what you describe is both a very real problem and a problem which is trivial to eradicate. Just expand to functions. Here's a general form of a command-defining macro suitable for a library interface. (defmacro mylib-define-command (name &rest margs) `(defun ,name (&rest args) (interactive (mylib--interactive ,@margs)) (apply #'mylib--doit args))) Then you can freely change the implementations of mylib--interactive and mylib--doit in mylib.el. And there are tricks to concoct the docstring at consultation time too (see 13.2.4 Documentation Strings of Functions) Jo=C3=A3o