help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Try to understand the ora-company-number function again.


From: Emanuel Berg
Subject: Re: Try to understand the ora-company-number function again.
Date: Tue, 26 Oct 2021 09:00:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Hongyi Zhao wrote:

>     ("<tab>"    . hz-company-search-toggle)
>     ("<return>" . company-abort)

I write tab "\t" and return "\r" but I don't know what the
difference is, if any ...

>   :config
>   (setq company-tooltip-limit 10)
>  (defun hz-company-complete-number ()
>     "Convert the company-quick-access-keys to the candidates' row
> NUMBER visible on the tooltip,
>      and then feed it to `company-complete-number' to quickly select
> and insert company candidates.
>      If the currently entered character is belongs to

is/belongs to

> company-quick-access-keys and a part of the candidate simultaneously,
>      append it to the currently entered string to construct
>      new company-prefix."

a new

>     (company-complete-number
>      (cond
>       ((equal k "1") 1)
>       ((equal k "2") 2)
>       ((equal k "3") 3)
>       ((equal k "4") 4)
>       ((equal k "5") 5)
>       ((equal k "6") 6)
>       ((equal k "7") 7)
>       ((equal k "8") 8)
>       ((equal k "9") 9)
>       ((equal k "0") 10)

That doesn't look good to me, you can do
`string-to-number wither either
(string-to-number "9")
(string-to-number "0") I guess

>   (let ((c-a-map company-active-map)
>     (c-s-map company-search-map))
>     (mapc (lambda (x)
>         (define-key c-a-map (format "%s" x) #'hz-company-complete-number))
>       '(1 2 3 4 5 6 7 8 9 0))
>     (mapc (lambda (x)
>         (define-key c-s-map (format "%s" x) #'hz-company-complete-number))
>       '(1 2 3 4 5 6 7 8 9 0)))

Cl-loop for with i as an Iterator from 1 to 10 ...

Also put this in the `let' clause so can be reused by us

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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