From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: john muhl Newsgroups: gmane.emacs.bugs Subject: bug#74235: [PATCH] ; Remove 'nil' from some 'lua-ts-mode' options Date: Sat, 09 Nov 2024 14:54:47 -0600 Message-ID: <87ikswi0vc.fsf@pub.pink> References: <8734k4xdon.fsf@pub.pink> <87ses4vyzp.fsf@pub.pink> <86y11vr3e5.fsf@gnu.org> <87ldxtn57i.fsf@pub.pink> <86ses1oijv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11324"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.12.1; emacs 31.0.50 Cc: 74235@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 09 21:55:26 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1t9sUN-0002kg-6O for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Nov 2024 21:55:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t9sU5-0007Me-V5; Sat, 09 Nov 2024 15:55:05 -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 1t9sU4-0007Lc-RF for bug-gnu-emacs@gnu.org; Sat, 09 Nov 2024 15:55:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t9sU4-0003qw-IL for bug-gnu-emacs@gnu.org; Sat, 09 Nov 2024 15:55:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=T0HZjnT+R3rAoLIlW6WU2igFuZHYksVYBmEciFK2PyY=; b=C2k6r2s1ti8mL6k0dbG54FfkrDu44NAdqYOCmjES57bWWfAegOTQ03d9+Cd/fO6xiqAWAMFc0VcQ4cQWJ2o3uc5t+nQFrptakb6WW1efxoXSXugC+v2dLBog2HMwLmxmwGlNeT4gKrdSMA6wj6PwXd6b47vAQGYKMzItQmZINGmSFoMo2ADtefPRU8OZ86GQT5ZJHh5kItiRsPNZ0DTFlDQ7SZqLPcHBsEysrojLy2jkw5EYXH2Z6wMR6fIlDmDqKb1V/qJ3hfyD8uhREjc5JAoctRIW8jQuL/tsdT7eg0bc9+V5G3UGiiExVIzXEmktLZ82MQCAWhcBMjtlK8QByQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t9sU2-0007Eh-CJ for bug-gnu-emacs@gnu.org; Sat, 09 Nov 2024 15:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: john muhl Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Nov 2024 20:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74235-submit@debbugs.gnu.org id=B74235.173118569827800 (code B ref 74235); Sat, 09 Nov 2024 20:55:02 +0000 Original-Received: (at 74235) by debbugs.gnu.org; 9 Nov 2024 20:54:58 +0000 Original-Received: from localhost ([127.0.0.1]:54620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t9sTx-0007EK-VR for submit@debbugs.gnu.org; Sat, 09 Nov 2024 15:54:58 -0500 Original-Received: from fhigh-b8-smtp.messagingengine.com ([202.12.124.159]:51807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t9sTu-0007Dz-Lk for 74235@debbugs.gnu.org; Sat, 09 Nov 2024 15:54:56 -0500 Original-Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.stl.internal (Postfix) with ESMTP id DBC1C254014E; Sat, 9 Nov 2024 15:54:48 -0500 (EST) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Sat, 09 Nov 2024 15:54:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1731185688; x=1731272088; bh=T0HZjnT+R3 rAoLIlW6WU2igFuZHYksVYBmEciFK2PyY=; b=FN570z/jPOO1rVoZdTgCg/R91A J69E+3+2IFxsg7S20jlJfDu17w6KekICghyv/TLIwSlbe5Dq0+Y1mvqRqE6R1Fkt HkcZbKnxxaTnlzkk+LV/JmUQQexo0QVkCmgXl1oAcISJol7Z8r6CQz1fqXtR6Vvh lFxowyNsPW8m29VfgzEcU7slWhZxFK0OlOeW612iZnwAypj/tCUHpNPsbAkiv2aG 99Y4qtlyJ74YOvSLVAQzjDBVrlllMBC+H23LNuC7/vHGrJExhk+n3tRQ1I17Le2G DpNmNi9aOtFJCDliAzFSfXX9QjW7uzyao2VbPJi8ib8zvZGJ5ah3Q8KtcP4Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1731185688; x=1731272088; bh=T0HZjnT+R3rAoLIlW6WU2igFuZHYksVYBmE ciFK2PyY=; b=f5AgAQJinZyuocpvRuwU2KLKQDS4G+/mIq45l4Ahy5DHmieTBLe txMYfsxaThQCsT+e5kMxYZCBo0edlEyMrWWjkRWBAhp22xrRQPy35J1nMm2iznme gXnjySZoBDC9GrzNP8yMDstQWwv1JkvX8+ENwFMNHuOGe7373tIfV1GorawAHsI7 uqpBXUtPOpbfNzv3VFLRiXRlm/f+R5iG0ioJderZjByrPJkh4F8a95l9zJiAMMvg 90yotPbjRrUABbG3fpTsA0PExGlvl2835MaIQXwzLyiD59Fqi32+ENZLItqvmnGp 5tZiR3LQlV4lsD0XDs4pclPcOcOUJ+QpBCg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrtdekgddugedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffgffkfggtgesmhdtreertderjeen ucfhrhhomhepjhhohhhnuchmuhhhlhcuoehjmhesphhusgdrphhinhhkqeenucggtffrrg htthgvrhhnpeehkeeiudffvefhieelueduleelvddtjeevtdetgefgieelhfehieekleef ffffteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hjmhesphhusgdrphhinhhkpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopeejgedvfeehseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpth htohepvghlihiisehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i74194916:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 Nov 2024 15:54:48 -0500 (EST) In-Reply-To: <86ses1oijv.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 08 Nov 2024 17:24:04 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295157 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: john muhl >> Cc: 74235@debbugs.gnu.org >> Date: Fri, 08 Nov 2024 08:57:37 -0600 >>=20 >> Eli Zaretskii writes: >>=20 >> >> From: john muhl >> >> Date: Wed, 06 Nov 2024 15:22:34 -0600 >> >>=20 >> >> * lisp/progmodes/lua-ts-mode.el (lua-ts-luacheck-program): >> >> (lua-ts-inferior-program): Remove 'nil' as it is never a valid >> >> choice. (Bug#74235) >> > >> > IMO, the use of these options in the code is not clean: if these >> > programs are not installed, the commands which reference these options >> > will signal errors whose diagnostic might not clearly indicate the >> > root cause. I would like to see a cleaner handling of such >> > contingencies by this mode. Does this make sense, and if so, would >> > you like to suggest changes to that effect? >>=20 >> The only idea I=E2=80=99ve come up with so far is showing a warning that >> mentions the incorrectly set option. Does that sound like what you >> have in mind? If not I=E2=80=99d appreciate some more explicit guidance. > > How about signaling user-error from the commands that invoke those > programs, when they are missing? Agree that=E2=80=99s better than a warning. It seems flymake already handles the case where it can=E2=80=99t find the requested program so I left that part as is. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-some-lua-ts-mode-options-Bug-74235.patch >From 3e49aa1086f2498ccbad396cf8c799c57919847e Mon Sep 17 00:00:00 2001 From: john muhl Date: Sat, 9 Nov 2024 11:01:45 -0600 Subject: [PATCH] ; Fix some 'lua-ts-mode' options (Bug#74235) * lisp/progmodes/lua-ts-mode.el (lua-ts-luacheck-program): (lua-ts-inferior-program): Switch to 'file' type and remove 'nil' as a choice. (lua-ts-inferior-lua): Ensure 'lua-ts-inferior-program' is a valid executable. --- lisp/progmodes/lua-ts-mode.el | 85 ++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 4ea453c9b65..2323461ed4c 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -72,7 +72,7 @@ lua-ts-indent-offset (defcustom lua-ts-luacheck-program "luacheck" "Location of the Luacheck program." - :type '(choice (const :tag "None" nil) string) + :type 'file :version "30.1") (defcustom lua-ts-inferior-buffer "*Lua*" @@ -83,7 +83,7 @@ lua-ts-inferior-buffer (defcustom lua-ts-inferior-program "lua" "Program to run in the inferior Lua process." - :type '(choice (const :tag "None" nil) string) + :type 'file :version "30.1") (defcustom lua-ts-inferior-options '("-i") @@ -632,47 +632,50 @@ lua-ts-flymake-luacheck (defun lua-ts-inferior-lua () "Run a Lua interpreter in an inferior process." (interactive) - (unless (comint-check-proc lua-ts-inferior-buffer) - (apply #'make-comint-in-buffer - (string-replace "*" "" lua-ts-inferior-buffer) - lua-ts-inferior-buffer - lua-ts-inferior-program - lua-ts-inferior-startfile - lua-ts-inferior-options) - (when lua-ts-inferior-history + (if (or (not lua-ts-inferior-program) + (not (executable-find lua-ts-inferior-program))) + (user-error "You must set `lua-ts-inferior-program' to use this command") + (unless (comint-check-proc lua-ts-inferior-buffer) + (apply #'make-comint-in-buffer + (string-replace "*" "" lua-ts-inferior-buffer) + lua-ts-inferior-buffer + lua-ts-inferior-program + lua-ts-inferior-startfile + lua-ts-inferior-options) + (when lua-ts-inferior-history (set-process-sentinel (get-buffer-process lua-ts-inferior-buffer) 'lua-ts-inferior--write-history)) - (with-current-buffer lua-ts-inferior-buffer - (setq-local comint-input-ignoredups t - comint-input-ring-file-name lua-ts-inferior-history - comint-prompt-read-only t - comint-prompt-regexp (rx-to-string `(: bol - ,lua-ts-inferior-prompt - (1+ space)))) - (comint-read-input-ring t) - (add-hook 'comint-preoutput-filter-functions - (lambda (string) - (if (equal string (concat lua-ts-inferior-prompt-continue " ")) - string - (concat - ;; Filter out the extra prompt characters that - ;; accumulate in the output when sending regions - ;; to the inferior process. - (replace-regexp-in-string (rx-to-string - `(: bol - (* ,lua-ts-inferior-prompt - (? ,lua-ts-inferior-prompt) - (1+ space)) - (group (* nonl)))) - "\\1" string) - ;; Re-add the prompt for the next line. - lua-ts-inferior-prompt " "))) - nil t))) - (select-window (display-buffer lua-ts-inferior-buffer - '((display-buffer-reuse-window - display-buffer-pop-up-window) - (reusable-frames . t)))) - (get-buffer-process (current-buffer))) + (with-current-buffer lua-ts-inferior-buffer + (setq-local comint-input-ignoredups t + comint-input-ring-file-name lua-ts-inferior-history + comint-prompt-read-only t + comint-prompt-regexp (rx-to-string `(: bol + ,lua-ts-inferior-prompt + (1+ space)))) + (comint-read-input-ring t) + (add-hook 'comint-preoutput-filter-functions + (lambda (string) + (if (equal string (concat lua-ts-inferior-prompt-continue " ")) + string + (concat + ;; Filter out the extra prompt characters that + ;; accumulate in the output when sending regions + ;; to the inferior process. + (replace-regexp-in-string + (rx-to-string `(: bol + (* ,lua-ts-inferior-prompt + (? ,lua-ts-inferior-prompt) + (1+ space)) + (group (* nonl)))) + "\\1" string) + ;; Re-add the prompt for the next line. + lua-ts-inferior-prompt " "))) + nil t))) + (select-window (display-buffer lua-ts-inferior-buffer + '((display-buffer-reuse-window + display-buffer-pop-up-window) + (reusable-frames . t)))) + (get-buffer-process (current-buffer)))) (defun lua-ts-send-buffer () "Send current buffer to the inferior Lua process." -- 2.47.0 --=-=-=--