From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: jixiuf Newsgroups: gmane.emacs.devel Subject: Re: feature/icomplete-vertical Date: Mon, 14 Sep 2020 14:44:59 +0800 Message-ID: <8BBE93B6-922E-44EF-B7A4-6A82C4F1DE3A@139.com> References: <20200912133311.6ujtgczj6wyclufy@Ergus> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_3EC19E5E-5EC5-4140-ADE6-13BDBA7139CE" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="759"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Ergus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 14 16:09:55 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 1kHpB5-000AZz-3H for ged-emacs-devel@m.gmane-mx.org; Mon, 14 Sep 2020 16:09:55 +0200 Original-Received: from localhost ([::1]:34220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kHpB4-0007LG-3R for ged-emacs-devel@m.gmane-mx.org; Mon, 14 Sep 2020 10:09:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kHiNi-00048X-AY for emacs-devel@gnu.org; Mon, 14 Sep 2020 02:54:30 -0400 Original-Received: from n9-26.mail.139.com ([221.176.9.26]:53776) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kHiNd-0007ce-0t for emacs-devel@gnu.org; Mon, 14 Sep 2020 02:54:30 -0400 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Original-Received: from [192.168.138.168] (unknown[114.255.108.162]) by rmsmtp-rmapp-07-12023 (RichMail) with SMTP id 2ef75f5f116b77a-27bb1; Mon, 14 Sep 2020 14:45:02 +0800 (CST) X-RM-TRANSID: 2ef75f5f116b77a-27bb1 In-Reply-To: <20200912133311.6ujtgczj6wyclufy@Ergus> X-Mailer: Apple Mail (2.3608.120.23.2.1) Received-SPF: pass client-ip=221.176.9.26; envelope-from=jixiuf@139.com; helo=n9-26.mail.139.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/14 02:45:03 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 14 Sep 2020 10:07:27 -0400 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:255642 Archived-At: --Apple-Mail=_3EC19E5E-5EC5-4140-ADE6-13BDBA7139CE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 2020=E5=B9=B49=E6=9C=8812=E6=97=A5 =E4=B8=8B=E5=8D=889:33=EF=BC=8CErgus = =E5=86=99=E9=81=93=EF=BC=9A >=20 > On Sat, Sep 12, 2020 at 01:10:57PM +0000, Gregory Heytings wrote: >>=20 >>>=20 >>>> If there was a built-in vertical mode it would be better / more = intuitive. >>>=20 >>> Could you try the branch feature/icomplete-vertical? I need some = testers before adding it to master. >>>=20 >>=20 >> 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. >>=20 >> (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) >=20 > 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: >=20 > (icomplete-mode t) > (icomplete-format 'vertical) >=20 > 4) We add arrow bindings to move > 5) Add completion matching faces is also coming. >=20 Some feedback about branch : feature/icomplete-vertical =20 I tried this branch with config: (icomplete-mode 1) (setq icomplete-format 'vertical) And found this bug still exists: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24293 https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D39379 Some related links about how to work around this bug: = https://www.reddit.com/r/emacs/comments/fswt7c/using_icomplete_vertically/= fm86m0q?utm_source=3Dshare&utm_medium=3Dweb2x&context=3D3 = https://www.reddit.com/r/emacs/comments/fswt7c/using_icomplete_vertically/= fm8z6h0?utm_source=3Dshare&utm_medium=3Dweb2x&context=3D3 Hope the problem of disappearing prompt and entered text problem can = be fixed in your branch.=20 --Apple-Mail=_3EC19E5E-5EC5-4140-ADE6-13BDBA7139CE Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

2020=E5=B9=B49=E6=9C=8812=E6=97=A5 =E4=B8=8B=E5=8D=889:33=EF=BC= =8CErgus <spacibba@aol.com> =E5=86=99=E9=81=93=EF=BC=9A

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"
=             &n= bsp;   (or (match-string 1 cnp) "")
=             &n= bsp;   (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.


Some feedback about  branch : = feature/icomplete-vertical  

I tried this = branch with config:

  (icomplete-mode 1)
  (setq icomplete-format 'vertical)



And found this bug still = exists:

=

Some= related links about how to work around this bug:

Hope the = problem of   disappearing prompt and entered text = problem can be fixed in your branch. 


= --Apple-Mail=_3EC19E5E-5EC5-4140-ADE6-13BDBA7139CE--