7

How to have multiple columns/have non-searchable entries · Discussion #2493 · em...

 2 years ago
source link: https://github.com/emacs-helm/helm/discussions/2493
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Replies

1 suggested answer
Nselm ***@***.***> writes:

1. ( ) text/plain (*) text/html

How can you do multiple columns in a helm source? For example, helm-mini shows file size,name, absolute path etc., all in different columns.

You can use a cons cell => (DISPLAY . REAL) where DISPLAY is the candidate displayed with columns, colors, whatever... and REAL the real value of the candidate e.g. a buffer in your example.

Here an example with numbers:

(helm :sources (helm-build-sync-source "helm test" :candidates '(("Un" . 1) ("Deux" . 2) ("Trois" . 3) ("Quatre" . 4) ("Cinq" . 5)) :action (lambda (_c) (let ((mkd (helm-marked-candidates))) (apply #'+ mkd)))) :buffer "*helm test*")

How can you show something, but not make it searchable.

There is several ways to do this.

1) Use a display property to display what you want to show. 2) Use the match-on-real attribute to match on the REAL part of candidate instead of DISPLAY. 3) Use the match-part attribute.

Perhaps others I have not in mind yet.

Say I have a special source for various user-defined commands, and I want to provide not only the name, but also a short description of it, or its keybindings etc, without including them in the filtering, like helm-M-x does.

Here an example with :match-part:

(helm :sources (helm-build-sync-source "helm test" :candidates '("deux un" "trois un" "un trois" "un deux") :match-part (lambda (candidate) (car (split-string candidate)))) :buffer "*helm test*")

If you type "un" only two candidates will be shown.

IIRC I used a display property to show bindings in helm-M-x.

0 replies

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK