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.
Related
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
When using `org-export-as-html' in batch mode the html produced from code blocks has no syntax coloring.
How do I enable the syntax coloring in batch mode?
EDIT:
From the terminal I run emacs --script make.el.
In make.el I include org and org-html and eventually call (org-export-as-html 3)
The following will bold/underline keywords but still no color:
(add-to-list 'load-path "~/elisp/org/contrib/lisp")
(require 'htmlize)
(setq c-standard-font-lock-fontify-region-function 'font-lock-default-fontify-region) ;; fixes bug
(org-export-as-html 3)
EDIT 2:
A couple more things I've tried - they make no difference:
(setq org-src-fontify-natively t)
(org-babel-do-load-languages 'org-babel-load-languages '((java .t)))
I've also tried loaded my entire .emacs
I'm using GNU Emacs 24.3.1 and Org 7.9.2
Apparently, if you use the color-theme library, then (for occult reasons about which I have no clue yet) you can have colored outputs through htmlize when exporting in batch mode.
For example, evaluating the following code in an org buffer to export makes htmlize use colors defined by means of a theme, and that works when exporting both in batch mode and interactively (by creating a temporary frame and setting the appropriate color theme to avoid messing up the frame containing the org buffer to export):
(require 'cl) ;for `lexical-let'
(add-hook
;; This is for org 8.x (use `org-export-first-hook' for earlier versions).
(make-local-variable 'org-export-before-processing-hook)
(lambda (backend)
(add-to-list (make-local-variable 'load-path) (expand-file-name "./etc"))
(require 'color-theme)
(color-theme-initialize)
(when (display-graphic-p) ;Are we running in interactive mode?
;; If so, create a temporary frame to install the color theme used by
;; htmlize:
(lexical-let ((buff (switch-to-buffer-other-frame (current-buffer)))
(frame (selected-frame)))
(setq color-theme-is-global nil)
(make-frame-invisible frame)
;; Schedule deletion of temporary frame:
(add-to-list
;; The following is for org 8.x (earlier versions use other hooks like
;; `org-latex-final-hook').
(make-local-variable 'org-export-filter-final-output-functions)
(lambda (string backend info) (delete-frame frame)))))
;; Install color theme.
(color-theme-blippblopp)))
I just install auto-complete-mode, however everytime I start emacs I have to M-x auto-complete-mode. Is there anyway to have it loaded automatically ?
My .emacs is as follows:
;; auto-complete
(add-to-list 'load-path "~/.emacs.d/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
(ac-config-default)
Thanks
I think you can do it in various ways. To enable it globally you should use
(global-auto-complete-mode t)
But it uses auto-complete-mode-maybe, which turn AC on only those listed in ac-modes. You can add them manually just like this
(add-to-list 'ac-modes 'sql-mode)
You can make your own list if you wish AC be active only for few modes
(setq ac-modes '(c++-mode sql-mode))
Or rewrite it to have AC everywhere.
(defun auto-complete-mode-maybe ()
"No maybe for you. Only AC!"
(auto-complete-mode 1))
edited:
Autocomplete in minibuffer is bad. I think this will be better.
(defun auto-complete-mode-maybe ()
"No maybe for you. Only AC!"
(unless (minibufferp (current-buffer))
(auto-complete-mode 1)))
I just needed this:
(require 'auto-complete)
(global-auto-complete-mode t)
added to my .emacs.d/init.el file.
I installed auto-complete with the package manager. I'm using Emacs 24.
I use Aquamacs, and Aquamacs is pre-equipped with SLIME.
(setq inferior-lisp-program "/usr/local/bin/sbcl") #####!!!
(add-to-list 'load-path "/Library/Application Support/Aquamacs Emacs/SLIME/contrib")
(add-to-list 'load-path "/Library/Application Support/Aquamacs Emacs/SLIME")
(require 'slime)
(slime-setup)
As is asked in somewhere, I try to use Clojure by adding this code.
(add-to-list 'load-path "~/clojure/clojure-mode")
(setq inferior-lisp-program "/Users/smcho/bin/clj") ################
(require 'clojure-mode)
(setq auto-mode-alist
(cons '("\\.clj$ . clojure-mode")
auto-mode-alist))
(add-hook 'clojure-mode-hook
'(lambda ()
(define-key clojure-mode-map "\C-c\C-e" 'lisp-eval-last-sexp)))
)
I couldn't make it Clojure run with SLIME, but I'm satisfied with the current setting, the only problem is that because of the (setq inferior-lisp-program ...) code, I have to change the .emacs code depending on I use Clojure or SBCL.
Is there any way to solve this problem? Can I choose between multiple (inferior) Lisps?
Added
I could make Clojure run on Aquamacs. Please refer to Running Clojure with 'lein swank' on Aquamacs problem. Forget about the settings written above, if you want to run Aquamacs/Clojure. You need just one line, (slime-setup '(slime-repl)) and lein swank.
Sure, you can use C-u M-x slime instead of just M-x slime to have SLIME ask you for the name of the Lisp executable to be launched, with whatever is your default already filled in.
There's also a slime-lisp-implementations variable which I have configured like so:
(setq slime-lisp-implementations
`((clojure ,(swank-clojure-cmd) :init swank-clojure-init)
(sbcl ("sbcl") :coding-system utf-8-unix)))
I have to say that I just can't remember what this does for me anymore (if indeed it does anything)... Type C-h v slime-lisp-implementations to learn roughly what it's supposed to do. I seem to have to type sbcl if I want to start that, which is fine by me due to the high Clojure-to-SBCL ratio in my SLIME'ing.
Update:
I have just rediscovered M-- M-x slime (that first key is meta-minus for a negative argument), which prompts for one of the names of Lisp implementations in slime-lisp-implementations (with tab completion) and then starts the required Lisp. With the above example config, M-- M-x slime sbcl starts SBCL.
(I find this useful mostly because of how it allows one to configure more complex commands to start Lisp -- e.g. (sbcl-options ("sbcl" "--an-option" "--another-option") ...), (sbcl-clbuild ("/path/to/clbuild" "lisp") ...) -- and refer to them by name.)
I obtained a git clone of vimpulse and followed the instructions for installation. It basically says to put (require 'vimpulse) in my .emacs file - but this will start viper/vimpulse upon startup, so I tried to have vimpulse load only if I invoke viper-mode with (add-hook 'viper-mode-hook (lambda () (require 'vimpuse)). But when I do this visual mode does not work (tries to open file instead), so instead I now have something like (defun vimpulse-on () (interactive) (require 'vimpulse)). After that to toggle on and off I use C-z. Does that about sound right? So once vimpulse is loaded there's no equivalent of M-x viper-go-away and instead it's suspended until I hit C-z again... Also, any general tips with using viper/vimpulse would be appreciated! Thanks much in advance.
Edit: syntax error corrected. What I had tried was (add-hook 'viper-mode-hook (lambda () (require 'vimpulse)), which does not enable visual mode when viper-mode is started. v in normal-mode appears to be mapped to find-file (or ido-find-file).
(add-hook 'viper-load-hook
(lambda () (require 'vimpulse))
Just load vimpulse in the viper-load-hook.