10

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?

lawlist
  • 13,099
  • 3
  • 49
  • 158
user3854447
  • 324
  • 3
  • 15

3 Answers3

17

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

phils
  • 71,335
  • 11
  • 153
  • 198
  • Great! thank you very much! You are right, I was being messy with my directory scheme, but I fixed it now. In the end I will probably take a mix of lawlist's and yours - I just don't want the fci-mode to be on when editing latex, but I can define that with a separate statement. – user3854447 Aug 07 '14 at 20:34
  • You can replace `turn-on-fci-mode` in that global mode definition with your own custom function which determines whether or not to enable the mode for the current buffer (it's evaluated for every buffer to decide whether to enable `fci-mode` in that buffer). – phils Aug 07 '14 at 22:06
8

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

lawlist
  • 13,099
  • 3
  • 49
  • 158
2

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.

x-yuri
  • 16,722
  • 15
  • 114
  • 161