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: feature/icomplete-vertical Date: Sun, 20 Sep 2020 11:55:52 +0100 Message-ID: References: <20200912133311.6ujtgczj6wyclufy@Ergus> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000087986205afbc94e4" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30329"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Gregory Heytings , Eli Zaretskii , Yuan Fu , emacs-devel To: Ergus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 20 12:58:20 2020 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 1kJx2x-0007lb-K2 for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Sep 2020 12:58:19 +0200 Original-Received: from localhost ([::1]:55462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJx2w-0006O6-L3 for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Sep 2020 06:58:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJx0q-0004o6-QP for emacs-devel@gnu.org; Sun, 20 Sep 2020 06:56:08 -0400 Original-Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]:36545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJx0o-0003OT-FQ; Sun, 20 Sep 2020 06:56:08 -0400 Original-Received: by mail-il1-x135.google.com with SMTP id t12so10965117ilh.3; Sun, 20 Sep 2020 03:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+qRByB5MAprY1T7/F/kKazLtaFyQ+4CFqi6zMH2vnfk=; b=KRtKrbK389qamqIrW2xcpWYOZXWF9BZYBGfRuTNtGG5HnxnrNUmZW5VDWXxJSznf1L RUoendqzJTnUFsDdu0SOHdwC6Or3uBBLSHQVqm4POWWj9amZrgUUFRWVZV4U5O8AcxDB Z3THRMBN3au9phpvkW/VpO/dRgPOo6WJ3DP4CmLHW2k+VYoeBnZxshIjKo+ukBdvc2rp wdbMY/UXjOwfsXExM6E1eOBHuaB3rOBIzDH+6wKm3Q1YYNTTZPX0qKYSlFSY6Qh+LZ1d aF49wpK3q/brTuCWTyT+pw4HkZCMiqwnjaIptlnCLH8ksxAPDxwvYT91yNi5boyenvip uTiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+qRByB5MAprY1T7/F/kKazLtaFyQ+4CFqi6zMH2vnfk=; b=FHqOv+Fsv9ksU1zlK+BKEbPMBsnuq9h/qfbOQwZdAbIJqWPWmnkrXsoBympLiVfcpA vNlFRYewMOwP/keHqXKlbt4xaGXFl7EXVydbfPzkzXV8ITf8tsJdtH992WsPqpqWDfox fgv9Aju/TndQSY50RAM4n1tz6bIt1LgbbxyRdlowVmI8q6ckKzF+OLD8YkBKXUtn5a+Y g7fsqyDUg+ddZEL1dfqgOsFymY2MlV0WCvDRFiv2EbwytDjTltb0WiVlUysiCID5Z7G2 Q+UN0qhbLxkGRd6Xts0NBVnSSBCmLDs3c7ohREMEzebqr/ut9q0525WBCQBo2zjkn1nE dItg== X-Gm-Message-State: AOAM533u2fnq13ztwGo83mDuNwCwwEEl7BOmkfp9CvP8va9GqDVefkYi beVy/ZHuvpJaBJIuS2YNsI6/CId2lDsoJXD7yIM= X-Google-Smtp-Source: ABdhPJydGLlwIR6/zBHEdFTESvZtondpMz89C9vzzQmNAa6TkJbs85fXaddUhqXo3QpUCaBZgUUAQnbc0hkVkB9LxcA= X-Received: by 2002:a92:bb0c:: with SMTP id w12mr1021363ili.199.1600599364178; Sun, 20 Sep 2020 03:56:04 -0700 (PDT) In-Reply-To: <20200912133311.6ujtgczj6wyclufy@Ergus> Received-SPF: pass client-ip=2607:f8b0:4864:20::135; envelope-from=joaotavora@gmail.com; helo=mail-il1-x135.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 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:256242 Archived-At: --00000000000087986205afbc94e4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I'm late to the party here, but I'd just like to add that Gregory's solution based on advice can easily be be integrated into icomplete-mode directly. I do like that it's such a simple solution, doesn't include new defcustoms, modes and such. I didn't have a in-depth look, but it looks like your solution Ergus, is quite a bit more complex. Why? What extras does it bring to the table? And are we sure we need those extras in the first version of this? Or am I missing something and is Gregory's solution fundamentally unusable? My 2c, Jo=C3=A3o On Sat, Sep 12, 2020 at 2:33 PM Ergus wrote: > On Sat, Sep 12, 2020 at 01:10:57PM +0000, Gregory Heytings wrote: > > > >> > >>>If there was a built-in vertical mode it would be better / more > >>>intuitive. > >> > >>Could you try the branch feature/icomplete-vertical? I need some > >>testers before adding it to master. > >> > > > >Alas no, I have been using the following to have icomplete-vertical > >for quite some time, it works perfectly well, so I don't see why a > >more complex implementation would be necessary. > > > >(setq icomplete-prospects-height 6) > >(setq icomplete-separator "\n") > >(defun icomplete-vertical-minibuffer-setup () > > (setq truncate-lines t) > > (setq-local completion-ignore-case t) > > (setq-local read-file-name-completion-ignore-case t) > > (setq-local read-buffer-completion-ignore-case t) > > (setq icomplete-hide-common-prefix nil)) > >(add-hook 'icomplete-minibuffer-setup-hook > #'icomplete-vertical-minibuffer-setup) > >(defun icomplete-vertical-reformat-completions (completions) > > (save-match-data > > (let ((cnp (substring-no-properties completions))) > > (if (string-match "^\\((.*)\\|\\[.+\\]\\)?{\\(\\(?:.\\|\n\\)+\\)}" > cnp) > > (format "%s \n%s" > > (or (match-string 1 cnp) "") > > (replace-regexp-in-string "^" (make-string > (current-column) ? ) (match-string 2 cnp))) > > cnp)))) > >(defun icomplete-vertical-adjust-minibuffer-height (completions) > > (let* ((comp (icomplete-vertical-reformat-completions completions)) > > (complen (length (split-string comp "\n")))) > > (if (> complen 1) (enlarge-window (- icomplete-prospects-height (1- > (window-height))))) > > comp)) > >(advice-add 'icomplete-completions :filter-return > #'icomplete-vertical-adjust-minibuffer-height) > > 1) Internal functionalities try not to use advises. > 2) The branch is not actually more complex, it just generates the > formatted vertical output form the beginning. > 3) It does more or less the same you are doing but with a simpler > config: > > (icomplete-mode t) > (icomplete-format 'vertical) > > 4) We add arrow bindings to move > 5) Add completion matching faces is also coming. > > --=20 Jo=C3=A3o T=C3=A1vora --00000000000087986205afbc94e4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'm late to the party here, but = I'd just like to add that
Gregory's solution based on adv= ice can easily be be integrated into
icomplete-mode directly.=C2= =A0 I do like that it's such a simple solution,
doesn't = include new defcustoms, modes and such.=C2=A0 I didn't have
a= in-depth look, but it looks like your solution Ergus, is quite a bit
<= /div>
more complex.=C2=A0 Why?=C2=A0 What extras does it bring to the t= able?=C2=A0
And are we sure we need those extras in the firs= t version of this?

Or am I missing something a= nd is Gregory's solution fundamentally
unusable?
My 2c,
Jo=C3=A3o

On Sat, Sep 12, 2020 at 2:= 33 PM Ergus <spaci= bba@aol.com> wrote:
On Sat, Sep 12, 2020 at 01:10:57PM +0000, Gregory Heytings wrote= :
>
>>
>>>If there was a built-in vertical mode it would be better / more=
>>>intuitive.
>>
>>Could you try the branch feature/icomplete-vertical? I need some >>testers before adding it to master.
>>
>
>Alas no, I have been using the following to have icomplete-vertical >for quite some time, it works perfectly well, so I don't see why a =
>more complex implementation would be necessary.
>
>(setq icomplete-prospects-height 6)
>(setq icomplete-separator "\n")
>(defun icomplete-vertical-minibuffer-setup ()
>=C2=A0 (setq truncate-lines t)
>=C2=A0 (setq-local completion-ignore-case t)
>=C2=A0 (setq-local read-file-name-completion-ignore-case t)
>=C2=A0 (setq-local read-buffer-completion-ignore-case t)
>=C2=A0 (setq icomplete-hide-common-prefix nil))
>(add-hook 'icomplete-minibuffer-setup-hook #'icomplete-vertical= -minibuffer-setup)
>(defun icomplete-vertical-reformat-completions (completions)
>=C2=A0 (save-match-data
>=C2=A0 =C2=A0 (let ((cnp (substring-no-properties completions)))
>=C2=A0 =C2=A0 =C2=A0 (if (string-match "^\\((.*)\\|\\[.+\\]\\)?{\\= (\\(?:.\\|\n\\)+\\)}" cnp)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (format "%s \n%s"
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or (mat= ch-string 1 cnp) "")
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (replace= -regexp-in-string "^" (make-string (current-column) ? ) (match-st= ring 2 cnp)))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 cnp))))
>(defun icomplete-vertical-adjust-minibuffer-height (completions)
>=C2=A0 (let* ((comp (icomplete-vertical-reformat-completions completion= s))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(complen (length (split-string comp &= quot;\n"))))
>=C2=A0 =C2=A0 (if (> complen 1) (enlarge-window (- icomplete-prospec= ts-height (1- (window-height)))))
>=C2=A0 =C2=A0 comp))
>(advice-add 'icomplete-completions :filter-return #'icomplete-v= ertical-adjust-minibuffer-height)

1) Internal functionalities try not to use advises.
2) The branch is not actually more complex, it just generates the
formatted vertical output form the beginning.
3) It does more or less the same you are doing but with a simpler
config:

(icomplete-mode t)
(icomplete-format 'vertical)

4) We add arrow bindings to move
5) Add completion matching faces is also coming.



--
Jo=C3=A3o = T=C3=A1vora
--00000000000087986205afbc94e4--