A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

New answers tagged

1

In order to know that a buffer represents a remote connection, you can use file-remote-p. You can read about this function Here For example, in a shell buffer, (file-remote-p default-directory) will allow you to differentiate between a local shell and a remote shell. In order to toggle company-mode, you can call the company-mode function with a parameter ...


0

Doom has its own function set-company-backend! to set the backends: (defun set-company-backend! (modes &rest backends) "Prepends BACKENDS (in order) to `company-backends' in MODES. MODES should be one symbol or a list of them, representing major or minor modes. This will overwrite backends for MODES on consecutive uses. If the car of BACKENDS is nil,...


0

I suppose you use company's backend company-ispell to input plain words, Insert below code into your ~/.emacs.d/init.el, (defvar my-ispell-words '("helle1" "helle2" "word1" "word2")) (defadvice ispell-lookup-words (after ispell-lookup-words-after-hack activate) (let* ((word (car (ad-get-args 0))) (my-words (all-completions word my-...


0

This is a modified version of @chen-bin's answer which uses a wrapper function instead of using advice (avoids interfering with other uses). It also generalizes the syntax checking to allow checking for other kinds of syntax. (defun company-complete-common-use-context () (interactive) (let ( (faces-found (face-at-point nil t)) (faces-...


1

Insert below code into ~/.emacs to enable company-ispell in comment, (defun my-in-comment-p (pos) "Check whether the code at POS is comment by comparing font face." (let* ((fontfaces (get-text-property pos 'face))) (if (not (listp fontfaces)) (setq fontfaces (list fontfaces))) (delq nil (mapcar #'(lambda (f) ...


1

It turns out the word list needs to be sorted (case insensitive), at least sorting it makes it work for me. Assuming you use company mode and have a shortcut to activate it. (use-package company :commands (company-complete-common)) (global-set-key (kbd "C-SPC") 'company-complete-common) ;; Dictionary for completion. (setq ispell-complete-word-dict (...


0

You can use hippie-expand: (setq hippie-expand-try-functions-list '(try-expand-line)) (global-set-key (kbd "C-;") 'hippie-expand) Now C-; should expand to the closest matching line. Repeating the command will get you all the matches. Finally, if you want a popup menu with the choices listed there are some hacky ways of plugging hippie-expand into company-...


0

I had the same problem and found out that company-begin-commands was screwed by some configuration I copied from sombody else. The value defines when company completion should be triggered. The default for the value is: '(self-insert-command org-self-insert-command orgtbl-self-insert-command c-scope-operator c-electric-colon c-electric-lt-gt c-...


2

abbrev can abbreviate text. Use a numeric argument to say how many words before point should be taken as the expansion. For example, to abbreviate the sentence "The cat and the mooon." as x, put the point at the end and do C-u 5 C-x a g x <RET> The emacs manual (info) for Abbrevs gives the details.


0

(defconst sample-completions '(("a" "a" "ɑ" "æ" "ɐ" "ɑ̃") ("f" "o" "r"))) (defun company-sample-backend (command &optional arg &rest ignored) (interactive (list 'interactive)) (case command (interactive (company-begin-backend 'company-sample-backend)) (prefix (and (eq major-mode 'fundamental-mode) (company-grab-symbol))) (...


Top 50 recent answers are included