From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eduardo Ochs Newsgroups: gmane.emacs.help Subject: Bypassing the prompts in M-x sql-sqlite Date: Sat, 29 Oct 2022 10:38:00 -0300 Message-ID: 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="29679"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 29 15:38:59 2022 Return-path: Envelope-to: geh-help-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 1oom39-0007XP-JU for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 29 Oct 2022 15:38:59 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oom2W-0008VO-JU; Sat, 29 Oct 2022 09:38:20 -0400 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 1oom2S-0008VF-Ql for help-gnu-emacs@gnu.org; Sat, 29 Oct 2022 09:38:16 -0400 Original-Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oom2Q-0006CP-Iw for help-gnu-emacs@gnu.org; Sat, 29 Oct 2022 09:38:16 -0400 Original-Received: by mail-io1-xd34.google.com with SMTP id n191so6631078iod.13 for ; Sat, 29 Oct 2022 06:38:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vyMZPxseYZByzMJu0e8VOcq+kuEn5Hs6WXQ1JyBessk=; b=lV8/4OTkBY6o1oCT1866BlxJ5l9ZhPBQ5SD6a4VYJIuElxEnLJiP2TP5PGynFiRjL0 JhyDF+7Pu21Ank43d6H+1LpYqC8Q6K91DNaKsuPMLtBtMYYZOAIIhRbrRHYl5PihQRJT rxb1n2LDmc8sH1/LK+VKYvZPi8bQ4SNbxsY4dGJJq5q8Alhq/0GmciTwcOq5HgnkyXkm 1Z2yNymw8BmOhUPZP5GJ2QGbvEemSsdHDCT3gpfMGrGqIQ1/cp61sJB9lZROOZtb9oRS KF0Q9OpW442/TDbkJcGuoFPBSHciiYsA//e5cnls0kj/NmyCm3OSxz0aaGO8SG2Zq86Q Lj+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vyMZPxseYZByzMJu0e8VOcq+kuEn5Hs6WXQ1JyBessk=; b=h+wW3NwvTqKo8h5yecUvM8p9wFD8GkNXt3dp7C9X+HG3PzC8mG57/ueGTJ6M9Zb9Ls 9OwmIXlecOreNb2e39uZ7wMy02AjnnZ3EnCMVwe8oxgtKrEu2ndTJhPEPDGzZF7aAzZI AyQyJ2LbMljWqXTSQ4+COleOfdtx9LveOTpZtLBzeNe5m21ATfzSyh+HGnH4JNg6Oqxf apME3whxdxxWjooti0iGECHTObSQyQ+hKYGo4WubLrlTNuyt5uKTTD4Ctimpf54oE/Vd S44DKE5QVsYhqbZDOf9e8BeNv7C9eWMCfMvJTS0Q5A2ks6zOOg0ca4KbtZq//5VrVsIS 8l+A== X-Gm-Message-State: ACrzQf1CZg34DRKXsL8Ws4ej7g7BRs8Pi/8DmenCH4ShIO9/RzUpUrMm pno+gs+ktL+6BQReIsZ3yN1f/3q3EdBcGNzVv/gFwHcsJ5Q= X-Google-Smtp-Source: AMsMyM4ci73h//xK4WAD1Dw39xnZiyRvD9h4NMJhqs+SeTv8ug2eznfP55yqUEz+WRU9AmCTBh84FVQUWUcoQNi6WQc= X-Received: by 2002:a6b:ba85:0:b0:6bd:1f64:2d25 with SMTP id k127-20020a6bba85000000b006bd1f642d25mr2123877iof.188.1667050692618; Sat, 29 Oct 2022 06:38:12 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::d34; envelope-from=eduardoochs@gmail.com; helo=mail-io1-xd34.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: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "help-gnu-emacs" Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:140493 Archived-At: Hi all, this is - or should be - a very basic question about sql.el... Let me start by some context. 1. Some context =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D A person who has never used SQL in her life, but who knows this, http://angg.twu.net/eepitch.html can have a very quick introduction to how to use sqlite - in a very primitive way - by just running this, by typing on each line: =E2=80=A2 (eepitch-shell) =E2=80=A2 (eepitch-kill) =E2=80=A2 (eepitch-shell) rm -v /tmp/music.sqlitedb sqlite3 /tmp/music.sqlitedb create table albums ( artist text, album text ); .dump albums insert into albums (artist, album) values("Hugo Largo", "Drum"); insert into albums (artist, album) values("Medicine","Her Highness"); insert into albums (artist, album) values("Pink Industry","Retrospective"); insert into albums (artist, album) values("David Bowie", "Low"); .dump albums .quit The next step is to show her how to use sql.el. This M-x sql-sqlite RET /tmp/music.sqlitedb RET creates a buffer called "*SQL: SQLite*" in sql-interactive-mode mode. The comments at the top of sql.el say: This file provides a sql-mode and a sql-interactive-mode. The original goals were two simple modes providing syntactic highlighting. The interactive mode had to provide a command-line history; the other mode had to provide "send region/buffer to SQL interpreter" functions. "simple" in this context means easy to use, easy to maintain and little or no bells and whistles. This has changed somewhat as experience with the mode has accumulated. It should be possible to have both methods of sending commands to "*SQL: SQLite*" available at the same time - eepitch-line and sql-send-{paragraph,region}... 2. The question =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D How do I write a sexp that does the same as M-x sql-sqlite RET /tmp/music.sqlitedb RET when the SQL buffer doesn't exist, and the same as M-x sql-sqlite RET when the SQL buffer already exists? I am probably misreading the code in sql.el and, ahem, mislooking some important things, because all my attempts to write code that bypasses the prompts have failed... Thanks in advance! =3D) Eduardo Ochs http://angg.twu.net/eepitch.html#other-targets