[Top][All Lists]

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

Re: /srv/bzr/emacs/elpa r395: * company.el (company-capf): Add support f

From: Sebastian Wiesner
Subject: Re: /srv/bzr/emacs/elpa r395: * company.el (company-capf): Add support for `sorted' and `post-completion'.
Date: Sun, 5 May 2013 12:05:22 +0200

2013/5/5 Dmitry Gutov <address@hidden>:
> On 05.05.2013 10:32, Stefan Monnier wrote:
>>>> ;; (defun company-my-backend (command &optional arg &rest ignored)
>>>> -;;   (case command
>>>> -;;     (prefix (when (looking-back "foo\\>")
>>>> +;;   (pcase command
>>>> +;;     (`prefix (when (looking-back "foo\\>")
>>>> ;;               (match-string 0)))
>>>> -;;     (candidates (list "foobar" "foobaz" "foobarbaz"))
>>>> -;;     (meta (format "This value is named %s" arg))))
>>>> +;;     (`candidates (list "foobar" "foobaz" "foobarbaz"))
>>>> +;;     (`meta (format "This value is named %s" arg))))
> […]
> By the way, is there a reason to use backquotes here? I remember you
> removing quotes from all backends' `case' forms, and using unquoted symbols
> in `pcase' seems to work just as well:
> (pcase 'boo (boo 'bah)) => 'bah

This clause does **not** match the symbol 'boo.  It matches
**anything** and binds it to "boo". See

(pcase 'boo (foo foo) (boo 'bah)) => 'boo

compared to:

(pcase 'boo (`foo foo) (`boo 'bah)) => 'bah

So the backquote is actually mandatory here.

reply via email to

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