emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature branches review please (ivy hello)


From: Jean Louis
Subject: Re: Feature branches review please (ivy hello)
Date: Fri, 6 Nov 2020 13:51:48 +0300
User-agent: Mutt/+ (1036f0e) (2020-10-18)

* Gregory Heytings <ghe@sdf.org> [2020-11-06 12:19]:
> > I am looking for preferrably built-in system that will have narrowing
> > vertical incremental search, like built-in ivy or helm. Something that
> > ido or icomplete could become. Until then I keep ivy as most simplest
> > solution as I prefer package from GNU ELPA.

> Again I'm not sure I understand what you want, but I think you should try
> (setq completion-styles (cons 'flex completion-styles)).  With that setting
> you can narrow the candidates list with any character, you do not need to
> type the first characters.

Sounds like you do not know ivy or helm? Try using helm functions, you
may understand what is "narrowing incremental search". I may express
myself badly so I may need help to express me very nice.

> > You may see how dmenu which is separate program works under X Window
> > system to launch files:
> > 
> > 1.8M demo of dmenu program:
> > https://gnu.support/images/2020/11/2020-11-05/2020-11-06-01:38:29.ogv

Now the first demo works, click above to see. Click here below to see
the comparison between completion frameworks, others but icomplete (as
it is not complete yet).

https://gnu.support/images/2020/11/2020-11-06/2020-11-06-13:22:39.ogv

Here is demonstration of completions with helm, ivy, ido, and dmenu
(outside command): https://tools.suckless.org/dmenu/

1. Helm mode, can move up and down freely, have actions and multi
   selection possibility with highlighting. It can select by using
   reverse words. It is outside package with many contributors now
   hard to enter main Emacs.

2. Ivy mode is good candidate to enter main Emacs as it is on GNU ELPA
   already and author is willing. IT LACKS reverse word search. It has
   multiple action capability, highlighting and looks saner than
   Helm. This is my current choice.

3. dmenu is external program with beautiful user interface. User can
   move up and down and may use reverse words to come to selection.

4. ido-mode is built-in, I do not know how to get selection by using
   reverse order of words. For now I did not find if it has multiple
   choices option.

P.S. I am including author of Ivy Oleh Krehel with hope and proposal
to improve ivy with reverse order of words selections and hopefully to
include it in GNU Emacs.

You may test features to understand it by evaluating one by one here
below.

;; This is what Emacs needs as a built-in function what I name for now
;; "dynamic narrowing incremental search"

;; It would be very useful to have built-in Ivy or Ivy-like completion:
;;
;; 0. Function (YOU-NAME-THE-MODE-completing-read PROMPT COLLECTION &OPTIONAL 
...)
;;    and possibility to automatically replace the built-in function named
;;    `completing-read' when `YOU-NAME-THE-MODE-mode' is turned on
;;
;; 1. It should get selection by using words in reverse order, for
;;    example to select "AMERICAN SAMOA" when one writes "SAMOA
;;    AMERICAN"
;;
;; 2. Highlighting like in Ivy or Helm or Dmenu
;;
;; 3. Capability to choose other actions, not only the default action,
;;    like M-o in Ivy or TAB in Helm.
;;
;; 4. Capability to choose multiple items, like marking of the item
;;    with C-c SPC in Helm and conducting actions on multiple items

(setq collection '("2 Ă…LAND ISLANDS" "30 BOUVET ISLAND" "41 CAYMAN ISLANDS" "46 
CHRISTMAS ISLAND" "47 COCOS (KEELING) ISLANDS" "52 COOK ISLANDS" "70 FALKLAND 
ISLANDS (MALVINAS)" "71 FAROE ISLANDS" "94 HEARD ISLAND AND MCDONALD ISLANDS" 
"134 MARSHALL ISLANDS" "160 NORFOLK ISLAND" "161 NORTHERN MARIANA ISLANDS"))

;; Normal built-in Emacs completion for: ISLAND CAYMAN
(helm-mode 1)
(completing-read "Country: " collection)

;; ivy completion from GNU ELPA: for ISLAND CAYMAN
(ivy-completing-read "Country: " collection)

;; ido completion
(ido-completing-read "Country: " collection)

;; dmenu is a dynamic menu for X, originally designed for dwm. It
;; manages large numbers of user-defined menu items efficiently
;; if somebody has better function to input let me know
(defun dmenu-completing-read (prompt collection)
  ;; &optional predicate require-match initial-input history def 
inherit-input-method)
  "Uses external `dmenu' command for Emacs completions."
  (let* ((collection (concat (string-join collection "\n") "\n"))
         (file (string-to-file-force collection "/dev/shm/collection"))
         (dmenu "dmenu"))
    (with-temp-buffer
      (call-process dmenu file (current-buffer) nil "-fn" "DejaVu:pixelsize=30" 
"-l" "10" "-i" "-b" "-p" prompt "-nb" "dark goldenrod" "-nb" "black")
      (string-trim (buffer-string)))))

(dmenu-completing-read "Country: " collection)
(dmenu-completing-read "Recent files: " (recentf-elements 10))

;; HELM completion, good example how it should look like in Emacs with
;; built-in function. There is some bug that says `eval-last-sexp'
;; which I did not put choose.

(helm-mode 1)
(completing-read "Country: " collection)

Only Helm mode and Dmenu show that reverse order of words can be
selected. Ivy need to improve.

Jean



reply via email to

[Prev in Thread] Current Thread [Next in Thread]