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: electric-pair-mode vs paredit, was: Re: Adding support for xref jumping to headers/interfaces Date: Mon, 13 Nov 2023 01:53:24 +0000 Message-ID: References: <953056ea-9cfb-34ad-6515-9036633dfdbb@yandex.ru> <2d964697-2b4e-64c7-2f16-aae87e57def4@yandex.ru> <70b681ab-b827-01b4-d4f3-fe0b45cd698d@gutov.dev> <66d0c2b5-a3bb-5389-9642-c7800b21f968@gutov.dev> <9f0143b2-bc78-0946-dc87-9090a6f7e3cf@gutov.dev> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000024a7e80609fee540" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32198"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Spencer Baugh , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 13 02:51:14 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 1r2M6c-0008Df-LY for ged-emacs-devel@m.gmane-mx.org; Mon, 13 Nov 2023 02:51:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2M6A-0001G5-5F; Sun, 12 Nov 2023 20:50:46 -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 1r2M60-0001BF-Oe for emacs-devel@gnu.org; Sun, 12 Nov 2023 20:50:38 -0500 Original-Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2M5x-0002PY-W5 for emacs-devel@gnu.org; Sun, 12 Nov 2023 20:50:36 -0500 Original-Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5094cb3a036so5412983e87.2 for ; Sun, 12 Nov 2023 17:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699840231; x=1700445031; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2hNZBTEUebGT5Sv8V4yCQPzHM/rfGCo/s03dO7ubzCQ=; b=aPp/MSo+tK/crpGI8FMo2T+HZ5yJA6FCSQO/T2QSKlZ0g95BtAPhK1Uf5HokdBQ2AH DlK7suPR8mX/2GcZD1SvMSS+4zzisiZjDgxkfxGBd4O6PmOjTru2lZg26NSrfcr85Chd 0IWdnjGYDNarNNsxalAxBManGfHZmJFITctbHJEyS1v7xiTKcD3XzfcqgledSHQev6n3 bkMTJsCgqMq/GikPc/kWEhUUQqd5rv903NSzh1FwPdVdLSgbaUYdcrwSQ7OwcKxLwYy8 Seu450wa0y8+ZUtxCIqlSq6xSlTwu6VUK6g7fCqqvLX7X6vF7US+iFTqYL0cpXh5wLYF PYMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699840231; x=1700445031; h=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=2hNZBTEUebGT5Sv8V4yCQPzHM/rfGCo/s03dO7ubzCQ=; b=UffIe+qwYQD/6WysFcnhD786Cd0VQ78rp4cHdzspdAj6+D/MRKTk/Tu1fzVfecNY5X +lajzmnUn/SjaD1IuJNh/pzn9O3/vqecwfBcnhunHAjqmFONCNp7GFWqjxnOlF2+6l/j VLAHVATdrmoKTd90aFP7VVkSg6lU77c48wpYo8EI3aKDNNkVyXgJ+AfZuJrmlpmXMkxD S04BzRU6Ryg8U0DdPgzqlV7Sjko2AakvDAdQ5t+WU/wSF96Uu5UwWSQnioO+pDh8CTlT ZVq3/axMGpAJtv/JQLbQhQRJiqkBOukRvBg9TmOldvl1JejU3K+AGVKfT6P3Rd9uMgOl Amkg== X-Gm-Message-State: AOJu0Yyo1UebdghZuhQLBJBWvIpHYdm+WxREBwU7i4YVQ3ug7TwQrM6D e4GFnkbbnCF+p7G2rmAa3Sckl6Dffep2NG/X8HM= X-Google-Smtp-Source: AGHT+IGlSGTF9mzLVzDumIQAU4nPyvrEv/vUiG/wnaQ8RE/frQKHDAVM+wgfz768M5FBJc6bLD7pU+9ak18tiy6rpRw= X-Received: by 2002:a05:6512:3e0f:b0:507:9628:afb with SMTP id i15-20020a0565123e0f00b0050796280afbmr4522671lfv.68.1699840230990; Sun, 12 Nov 2023 17:50:30 -0800 (PST) In-Reply-To: <9f0143b2-bc78-0946-dc87-9090a6f7e3cf@gutov.dev> Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=joaotavora@gmail.com; helo=mail-lf1-x131.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, HTML_MESSAGE=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:312680 Archived-At: --00000000000024a7e80609fee540 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Nov 13, 2023 at 1:41=E2=80=AFAM Dmitry Gutov wro= te: > > On 13/11/2023 03:16, Jo=C3=A3o T=C3=A1vora wrote: > > On Mon, Nov 13, 2023 at 1:05=E2=80=AFAM Dmitry Gutov = wrote: > >> > >> On 13/11/2023 03:03, Jo=C3=A3o T=C3=A1vora wrote: > > > >> electric-pair-mode is necessary but not sufficient. > >> > >> I'm the structured editing kind of guy. With all the accompanying > >> slurping and barfing. > > > > I slurp. I barf. C-M-k,f,b,u mostly works. I have an extract-list > > function too. > > Perhaps I missed the addition of the slurping and barfing commands to > elec-pair? Sexp navigation works indeed. At least i didn't add anything. I just said that I use sexp stuff for doing those structural operations. Along with the command after my sig, which I've had for almost 20 years. > > But I would love that paredit.el would just supply the slurp/barf > > commands separate from the broken (IMHO) auto-pairing logic that I'm > > not interested in. > > But I like this one which keeps the code paired and makes sure C-k > doesn't kill too much. electric-pair-mode keeps the code paired. I like C-k killing whole lines, even in lisp. I hate those harnesses, I just put add a thumb on the alt key when I need to work with sexps. Of course to each his own. Doesn't seem you need e-p-m at all. Jo=C3=A3o (defun joaot/extract-list-or-region (arg) "Take the list after the point and remove the surrounding list. With argument ARG do it that many times." (interactive "p") (let* ((start (if mark-active (region-beginning) (point))) (end (if mark-active (region-end) (save-excursion (forward-sexp) (point)))) (extracted (buffer-substring start end)) (stop nil)) (backward-up-list (or arg 1)) (progn (delete-region start end) (condition-case err (kill-region (point) (save-excursion (forward-sexp) (point))) (error (goto-char start) (insert extracted) (message "ooops....") (setq stop t))) (unless stop (indent-region (point) (progn (save-excursion (insert extracted) (point)))))))) --00000000000024a7e80609fee540 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Nov 13, 2023 at 1:41=E2=80=AFAM Dmitry Gutov <<= a href=3D"mailto:dmitry@gutov.dev" target=3D"_blank">dmitry@gutov.dev&g= t; wrote:
>
> On 13/11/2023 03:16, Jo=C3=A3o T=C3=A1vora wrote:=
> > On Mon, Nov 13, 2023 at 1:05=E2=80=AFAM Dmitry Gutov <dmitry@gutov.dev> = wrote:
> >>
> >> On 13/11/2023 03:03, Jo=C3=A3o T= =C3=A1vora wrote:
> >
> >> electric-pair-mode is neces= sary but not sufficient.
> >>
> >> I'm the stru= ctured editing kind of guy. With all the accompanying
> >> slur= ping and barfing.
> >
> > I slurp.=C2=A0 I barf.=C2=A0 C-= M-k,f,b,u mostly works.=C2=A0 I have an extract-list
> > function = too.
>
> Perhaps I missed the addition of the slurping and barf= ing commands to
> elec-pair? Sexp navigation works indeed.
=

At least i didn't add anything.=C2=A0 I just said t= hat I use sexp stuff=C2=A0
for doing those structural operations.= =C2=A0 Along with the command
after my sig, which I've had fo= r almost 20 years.

> > But I would lov= e that paredit.el would just supply the slurp/barf
> > commands se= parate from the broken (IMHO) auto-pairing logic that I'm
> > = not interested in.
>
> But I like this one which keeps the code= paired and makes sure C-k
> doesn't kill too much.

electric-pair-mode keeps the code paired.=C2=A0 I like C-k= killing=C2=A0
whole lines, even in lisp.=C2=A0 I hate those harn= esses, I just put
add a thumb on the alt key when I need to work = with sexps.

Of course to each = his own.=C2=A0 Doesn't seem you need e-p-m at all.
=
Jo=C3=A3o

(defun joaot/extract-list= -or-region (arg)
=C2=A0 "Take the list after the point and remove t= he surrounding list.=C2=A0 With
argument ARG do it that many times."= ;
=C2=A0 (interactive "p")
=C2=A0 (let* ((start (if mark-ac= tive
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (region-beginning)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (point)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(end (if mark-= active
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (r= egion-end)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (save= -excursion
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (forward-sexp)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (point))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(extracted (buff= er-substring start end))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(stop nil))=C2=A0 =C2=A0 (backward-up-list (or arg 1))
=C2=A0 =C2=A0 (progn
= =C2=A0 =C2=A0 =C2=A0 (delete-region start end)
=C2=A0 =C2=A0 =C2=A0 (con= dition-case err
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (kill-region (point)<= br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(save-excursion
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(forward-sexp)
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(point)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (error (goto-char start)=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(insert extracte= d)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(message "= ;ooops....")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(setq stop t)))
=C2=A0 =C2=A0 =C2=A0 (unless stop
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 (indent-region
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(point)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(progn
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(save-excursion
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(insert extracted)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(point))))))))
--00000000000024a7e80609fee540--