Company mode in Emacs - emacs

I'm new to Emacs (1 week or so) and I'm struggling with some config. Sorry if I sound newbie. I've tried many differents things for the two last days. Here what I want to setup:
Emacs with Melpa to install packages
company-mode to auto complete
company-irony to auto complete c/c++
company-c-headers to auto complete c headers
So, I installed these 3 packages with Melpa.
I then edited my ~/.emacs to:
; MELPA
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
; COMPANY
(add-hook 'after-init-hook 'global-company-mode)
; COMPANY HEADERS C
(add-to-list 'company-backends 'company-c-headers)
; COMPANY IRONY
(eval-after-load 'company
'(add-to-list 'company-backends 'company-irony))
But no matter what I try, I have no auto completion whatsoever! What's wrong?

Related

Flycheck installation: M-x package-install [No match]

I'm relatively new to Emacs (and Linux for that matter). I'm trying to install flycheck. Following the installation instructions, I added
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
to my .emacs file (then killed Emacs and restarted).
Then M-x package-install RET flycheck RET. But Emacs says [No match]. Any ideas what I'm doing wrong?
Platform: Emacs 24.3.1, Ubuntu 14.04 LTS 64bit running on VMware (Windows 10 host).
I'm also quite new to emacs, and I've had the same problem. What worked for me:
M-x package-list-packages RET
Find flycheck, mark it with an I
Use X to install marked package.
For reference, this is how I call package in my .emacs:
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)`

New to Emacs, issue with Melpa

I followed their guide on github and put the following in my init.el file:
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line
However when I go M-x package-list-packages I either get a Melpa not found error or a 'missing zlib library' error, and it only shows the gnu packages. I've also tried using stable Melpa, to no avail. I'm using windows 10 and set a HOME variable pointing to the directory with the 'init.el' file.

web-mode won't start automatically in Aquamacs

I can't seem to get the configuration to work properly, only if I create a new HTML it goes into web-mode, any other way it goes into de default html-mode.
I'm using Aquamacs 3.2 GNU Emacs 2.4.4.51.2
Though I have had this same problem with previous versions.
Here's my config file (Preferences.el):
;; This is the Aquamacs Preferences file.
;; Add Emacs-Lisp code here that should be executed whenever
;; you start Aquamacs Emacs. If errors occur, Aquamacs will stop
;; evaluating this file and print errors in the *Messags* buffer.
;; Use this file in place of ~/.emacs (which is loaded as well.)
;; Melpa
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[gj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
I know this has been asked here:
Emacs (Aquamacs) web-mode not automatically activating for HTML files
But there didn't seem to be a concrete answer.
Could anyone may point me to what I'm doing wrong?
Have you tried to put those lines at the end of your .emacs ?
I received a working answer at the mailing list, though it uses magic-mode-alist:
(setq magic-mode-alist '(("<!DOCTYPE html" . web-mode)))

Emacs does not see new installation of Org-Mode

I had installed org-mode version 8.2.1 from emacs list-packages.
I downloaded the latest version 8.2.4 and placed it in .emacs.d and added the following to my .emacs,
(add-to-list 'load-path "~/.emacs.d/org-8.2.4/lisp")
Emacs still reports org-mode version to be 8.2.1
Try removing old installation(s) of org-mode from the load-path first:
(require 'cl)
;; Org-mode that was shipped with Emacs
(setq load-path (remove-if (lambda (x) (string-match-p "org$" x)) load-path))
;; ELPA
(setq load-path (remove-if (lambda (x) (string-match-p "org-20" x)) load-path))
(setq custom-org-path "~/.emacs.d/org-8.2.4/lisp")
(add-to-list 'load-path custom-org-path)
Also make sure to do it as early as possible in your init.el - especially if you use org-mode-based system for your emacs configuration files.
Add the following to your init.el file.
(require 'package)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
From the org compact guide here.

Emacs ess auto-complete

I am a R user, I want to use R in emacs. But, I am in trouble with customizing ess in emacs. I have installed the auto-complete packages and the latest ess in my emacs. But when I run r in emacs, the auto-complete don't work well.
When I type app, I suppose to show like the image in (http://www.emacswiki.org/pics/static/ess-ac3) , but in my emacs neither of the auto-complete nor the yellow part shows.
My OS: ubuntu 12.04 amd64
my ~/.emacs file
;; Auto-complete
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/site-lisp/ac-dict")
(ac-config-default)
; ess-site
(add-to-list 'load-path "/usr/share/emacs/site-lisp/ess")
(require 'ess-site)
(setq ess-eval-visibly-p nil)
(setq ess-ask-for-ess-directory nil)
I recently started using ESS on Windows, and struggled with the same issue. I don't know all of the ins and outs but recent versions of ESS suggest using company-mode rather than auto-complete-mode. This minimal setup seems to have autocomplete working quite well for me on the following setup:
Windows 10 x64
R 3.4.3 x64
Emacs 25 x64 installed normally
MELPA repo enabled in init.el
package-install [RET] company
package-install [RET] ess
open a new R file in some directory
M-x company-mode to enable company-mode in the current buffer
`C-c C-z' to start an inferior R process
At this point, with the init.el file shown below, R completion is working, completing function calls, and package members. I think more configuration is needed to tailor it to your liking, but getting to this point took me long enough I consider it a success
init.el:
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
)
(package-initialize)
;; emacs controlled settings
(custom-set-variables
'(package-selected-packages (quote (company ess)))
'(show-paren-mode t)
'(tool-bar-mode nil))
(custom-set-faces
'(default ((t (:family "Consolas" :foundry "outline" :slant normal :weight normal :height 113 :width normal)))))
(require 'company)
Auto-complete works for me with this setting
(setq ess-use-auto-complete t)
I got the same problem and the following code worked for me:
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(package-initialize) ;load and activate packages, including auto-complete
(ac-config-default)
(setq ess-use-auto-complete 'script-only)
;;if not working, use the following instead of (setq ess-use-auto-complete 'script-only)
;;(global-auto-complete-mode t)