|
188 | 188 | '(:with company-yasnippet))))
|
189 | 189 | (setq company-backends (mapcar #'company-mode/backend-with-yas company-backends))
|
190 | 190 |
|
191 |
| - ;; Add `company-elisp' backend for elisp, |
192 |
| - (add-hook 'emacs-lisp-mode-hook |
193 |
| - (lambda () |
194 |
| - (require 'company-elisp) |
195 |
| - (unless (memq 'company-elisp company-backends) |
196 |
| - (push 'company-elisp company-backends)))) |
197 |
| - |
198 |
| - |
199 | 191 | ;; set the backends for writing in text related mode
|
200 | 192 | (defun my-company-backends-text-mode-hook ()
|
201 | 193 | (setq-local company-backends '(
|
|
218 | 210 | )))
|
219 | 211 | (add-hook 'shell-mode-hook 'my-company-backends-shell-mode-hook)
|
220 | 212 |
|
221 |
| - ;; add `company-elisp' backend for elisp. |
222 |
| - ;; (add-hook 'emacs-lisp-mode-hook |
223 |
| - ;; #'(lambda () |
224 |
| - ;; (require 'company-elisp) |
225 |
| - ;; (push 'company-elisp company-backends))) |
226 |
| - ;; via https://github.com/manateelazycat/lazycat-emacs/blob/8f3dee8a6fe724ec52cd2b17155cfc2cefc8066b/site-lisp/config/init-company-mode.el |
227 |
| - |
228 |
| - |
229 |
| - |
230 |
| - |
231 |
| - ;; { START: company-candidates from abo-abo |
232 |
| - ;; if candidate list was ("var0" "var1" "var2"), then entering 1 means: |
233 |
| - ;; select the first candidate (i.e. "var0"), instead of: |
234 |
| - ;; insert "1", resulting in "var1", i.e. the second candidate |
235 |
| - ;; via, |
236 |
| - ;; - https://oremacs.com/2017/12/27/company-numbers/ |
237 |
| - (defun ora-company-number () |
238 |
| - "Forward to `company-complete-number'. |
239 |
| -Unless the number is potentially part of the candidate. |
240 |
| -In that case, insert the number." |
241 |
| - ;; via https://github.com/abo-abo/oremacs/blob/d217e22a3b8dc88d10f715b32a7d1facf1f7ae18/modes/ora-company.el#L22-L39 |
242 |
| - (interactive) |
243 |
| - (let* ((k (this-command-keys)) |
244 |
| - (re (concat "^" company-prefix k))) |
245 |
| - (if (or (cl-find-if (lambda (s) (string-match re s)) |
246 |
| - company-candidates) |
247 |
| - (> (string-to-number k) |
248 |
| - (length company-candidates)) |
249 |
| - (looking-back "[0-9]+\\.[0-9]*" (line-beginning-position))) |
250 |
| - (self-insert-command 1) |
251 |
| - (company-complete-number |
252 |
| - (if (equal k "0") |
253 |
| - 10 |
254 |
| - (string-to-number k)))))) |
255 |
| - |
256 |
| - (let ((map company-active-map)) |
257 |
| - ;; via https://github.com/abo-abo/oremacs/blob/d217e22a3b8dc88d10f715b32a7d1facf1f7ae18/modes/ora-company.el#L46-L53 |
258 |
| - (mapc (lambda (x) (define-key map (format "%d" x) 'ora-company-number)) |
259 |
| - (number-sequence 0 9)) |
260 |
| - (define-key map " " (lambda () |
261 |
| - (interactive) |
262 |
| - (company-abort) |
263 |
| - (self-insert-command 1))) |
264 |
| - (define-key map (kbd "<return>") nil)) |
265 |
| - ;; END: company-candidates from abo-abo } |
266 | 213 | )
|
267 | 214 |
|
268 | 215 |
|
|
0 commit comments