I am setting up a new .emacs environment. But with my last setup, the yasnippet menu showed the keybinding. But now it doesn't. It seems very strange. I believe I have the latest version of yasnippet. If I try expanding via a keybinding I already now (like do a "def TAB" in a python buffer) really shows that the keybinding works. But it isn't shown.
This is what I've added to my .emacs file:
; Add Yasnippets
(add-to-list 'load-path
"~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas/global-mode 1)
And a screenshot:
I am not sure, I have this one also in my .emacs
(yas/initialize)
Related
I would like to use Julia with Emacs and have installed julia-mode, julia-repl and lsp-julia. I am using Julia 1.7.3.
I have added the following to my init.el
(require 'lsp-mode)
(add-hook 'julia-mode-hook #'lsp)
(require 'lsp-ui)
(require 'julia-mode)
(require 'julia-repl)
(require 'lsp-julia)
(julia-repl-set-terminal-backend 'vterm)
(add-hook 'julia-mode-hook 'julia-repl-mode) ;; Always use minor mode
(require 'vterm)
However, when I have the (add-hook 'julia-mode-hook #'lsp) line enabled the keyboard shortcuts don't work (e.g., C-Enter is not found). All I want to do is set up julia in Emacs in a similar way using LSP with keyboard shortcuts to how I have it in VSCode.
What have I done wrong in my init.el?
I am using Aquamacs on OS X 10.9.4. I have the following lines in my Preferences.el file
(which is similar to the .emacs init file):
(add-to-list 'load-path "~/.emacs.d/")
(require 'fill-column-indicator)
(setq-default fci-mode t)
I use M-x fci-mode to manually toggle the column indicator.
How can fci-mode be enabled on startup using Aquamacs?
Don't put ~/.emacs.d itself in your load-path. Always use a sub-directory.
e.g.: use ~/.emacs.d/lisp/fill-column-indicator.el and:
(add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp"))
(require 'fill-column-indicator)
This library doesn't provide a global minor mode, but you can make one yourself like so:
(define-globalized-minor-mode my-global-fci-mode fci-mode turn-on-fci-mode)
(my-global-fci-mode 1)
or toggle it interactively with M-x my-global-fci-mode RET
You should remove (setq-default fci-mode t).
fci-mode is not global, so you could use a mode hook. If, for example, your opening document on startup is emacs-lisp-mode, you could place something like this inside your Preferences.el file.
(add-hook 'emacs-lisp-mode-hook (lambda ()
(fci-mode 1)
))
You will need to use a mode hook for each major mode; or, you will need to modify fci-mode by adding a global setting.
For anyone who is interested in looking at the source-code, here is the link to the Github repository: https://github.com/alpaker/Fill-Column-Indicator
With Emacs 27 comes the display-fill-column-indicator-mode minor mode, which obsoletes the fill-column-indicator package. You can add:
(add-hook 'prog-mode-hook (lambda ()
(display-fill-column-indicator-mode)))
to ~/.emacs to enable it for prog-mode buffers, or:
(global-display-fill-column-indicator-mode)
to enable it globally. To toggle it, use M-x display-fill-column-indicator-mode.
I'm fairly new to emacs. In fact I'm learning the editor and trying to setup something that will replicate "go to a file inside the project" feature known from Code::Blocks or certain plugins of notepad++.
'projectile' fulfills this need, and I installed it through MELPA. Package installed properly, as I can start it with M-x projectile-global-mode and C-c p commands are recognized.
However, if I put it into my .emacs file, Emacs starts with an error:
Symbol's function definition is void: projectile-global-mode
Contents of my .emacs file are as follows:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(global-whitespace-mode 1)
(global-linum-mode 1)
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(projectile-global-mode 1)
When I try to (require 'projectile) first, I only end up with another error:
'File error: Cannot open load file, projectile'
I'm using Emacs 24.3.1.
How do I put this on autostart properly?
By default, Emacs initializes packages after evaluated init.el. Hence, in a standard setup, packages are not yet available while init is evaluated.
Use (add-hook 'after-init-hook #'projectile-global-mode) to enable Projectile only after packages are initialized, or explicitly initialize packages at the beginning of your init.el with the following code:
(require 'package)
(setq package-enable-at-startup nil) ; To avoid initializing twice
(package-initialize)
You have to load projectile first, e.g. by using this:
(require 'projectile)
(projectile-global-mode)
you can add
'(initial-major-mode (quote projectile-global-mode))
to your .emacs(or init.el or whatever your file is called) file in the custom-set-variable section.
Alternatively, in newer versions of emacs, the menu Options | Customize Emacs | Specific Option you can type 'initial-major-mode' and this will take you to an interface where emacs can customize itself with that setting. just remember to apply and save
I installed auto-complete using the marmalade repo. Everything installed correctly and after moving stuff around I managed to start up and run auto-correct without any errors with the following code in my init.el:
;; auto-complete
(add-to-list 'load-path "~/.emacs.d/elpa/auto-complete")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/elpa/auto-complete/dict")
(ac-config-default)
Now I can use auto-complete with no hick-ups with Emacs Lisp but whenever I use any other mode, like, Java, C, or C++ it doesn't work at all.
I have yasnippet installed too (it works perfectly), not sure if that might have anything to do with it. Here's the relevant code in my init.el:
;;yasnippet
(add-to-list 'load-path
"~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
I am in the process of learning Emacs and currently I'm still a noob. I've been looking all over the documentation and SO but haven't found anything. I'd really appreciate any help whatsoever on this.
You may need to add completion sources. Here's what's in my config:
(set-default 'ac-sources
'(ac-source-abbrev
ac-source-dictionary
ac-source-yasnippet
ac-source-words-in-buffer
ac-source-words-in-same-mode-buffers
ac-source-semantic))
Update: ac-config-default should cover this, but if autocomplete isn't activating for those modes, try putting the following in your init.el:
(dolist (m '(c-mode c++-mode java-mode))
(add-to-list 'ac-modes m))
(global-auto-complete-mode t)
Update2: I've posted a gist that adapts your init.el to pull autocomplete using package-install.
I can't tell what version of auto-complete you were referencing, but the latest is working fine for me.
I have exact same issue as you. Emacs-Lisp works perfect with auto-complete but C, C++ doesn't work. After trying with various combination, I find out that commenting out yasnippet from .emacs solve my issue. Hope this could help you. My auto-complete version is 1.3.1.
I can't get 'remember' to work in org-mode of emacs.
I'm on snow leopard.
I added
(global-set-key (kbd "C-M-r") 'org-remember)
to my .emacs file but when I try to use that shortcut it says:
Wrong type argument: commandp, remember
So I added
(org-remember-insinuate)
and when I start emacs it says:
symbol's function definition is void org-remember-insinuate
Ideas?
GNU Emacs 22.1.1
Checking the obvious stuff...
Have you ensured that org-remember was loaded? i.e. by adding this to your .emacs:
(require 'org-remember)
And, while you're at it, have you ensured that remember can load properly also?
(require 'remember)
remember is a separate package from org, which you'll have to download. Check out the wiki page.
You'll want to ensure that the org and remember packages are in your load path before you require the libraries, with something like:
(add-to-list 'load-path "/path/to/orgdir/lisp")
(add-to-list 'load-path "/path/to/remember")
(require 'remember)
(require 'org-remember)
Note: Emacs 22 comes with org-mode, but not a recent version. You need the more recent version in order to get the org-remember package.