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)))
Related
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?
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.
I need to add various packages to my emacs installation. It comes with tromey as the only repository. The variable package-archives is not defined (!). I am running GNU Emacs version 24.3.1 on Linux. I set up the following code in my .emacs file:
(when (>= emacs-major-version 24)
(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives '())
(package-initialize)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives
'("gnu" . "http://elpa.gnu.org/packages/"))
(add-to-list 'package-archives
'("marmalade" . "https://marmalade-repo.org/packages/"))
(add-to-list 'package-archives
'("org" . "http://orgmode.org/elpa/") t)
(add-to-list 'package-archives
'("tromey" . "http://tromey.com/elpa/") t)
)
By default, without this code, the variable package-archives isn't defined. After running this code, it is, and contains the right values, but doesn't seem to have any effect. I verified that this variable is not customized anywhere.
The problem is that I don't get to see any packages from the various archives I added; Only from tromey. Obviously I'm doing something wrong, but this code is supposed to work from emacs version 24 and higher.
Can someone suggest how to set up my repositories properly?
Everything worked well! What does that mean? That something in my .emacs file is conflicting with elpa?
That's exactly what it means.
Comment out half of your configuration (comment-dwim, bound to C-; by default, might be helpful here) and see if that fixes it. That will tell you which have contains the ELPA conflict. Repeat with the half that shows the problem to find which quarter is problematic, then again to find the eighth…
Pretty soon you'll find the cause, which might be a single sexp. Remove or adjust that, uncomment the rest of your config, and enjoy the plethora of packages that await.
I have successfully managed to install the predictive package for Emacs and am trying to accept the most likely correction with punctuation, which is mentioned in the manual:
http://www.dr-qubit.org/predictive/predictive-user-manual/html/Auto_002dCompletion-Mode.html
But I cannot for the life of me figure out how to set this up, I have tried the code snippet, among others (in my .Emacs):
(custom-set-variables
'(auto-completion-syntax-alist (quote (accept . word))))
And while Emacs does not complain, auto-completion-mode is off when he code is included.
When opening a file, I can see that it does not scan for auto-overlays, when the above code is in my .emacs file.
The rest of my predictive .emacs related file looks like this:
(add-to-list 'load-path "~/.emacs.d/predictive/")
;; dictionary locations
(add-to-list 'load-path "~/.emacs.d/predictive/latex/")
(add-to-list 'load-path "~/.emacs.d/predictive/texinfo/")
(add-to-list 'load-path "~/.emacs.d/predictive/html/")
;; load predictive package
(autoload 'predictive-mode "predictive.el" t)
(add-hook 'LaTeX-mode-hook 'predictive-mode)
(setq predictive-main-dict 'dict-english
predictive-predictive-use-buffer-local-dict t
predictive-auto-learn t
predictive-auto-add-to-dict t
predictive-dict-autosave t)
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.