0

I'm extremely new to emacs (started using it yesterday), I use the latest version of emacs.

The problem is, The modes I have enabled such as auto-complete-mode and org-bullets-mode seem to be enabled at launch. But i don't see their effect on screen unless I turn them off and on again (I'm not sure if the tex global pdf mode has activated either).

Since, I'm a beginner . I'm pretty sure this is horrible code writing on my part. So, A bit of insight into what went wrong and few resources into how to set it up would be a lot more helpful than just correcting my code.

This is my init.el (Ignore the line numbers they come because i copied from vim in terminal)

;Installing Repos
  1 (require 'package)
  2 
  3 (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
  4 (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
  5 (add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
  6 (setq package-enable-at-startup nil)
  7 (package-initialize)
  8 ; Use evil mode
  9 (require 'evil)
 10 (evil-mode t)
 11 
 12 ;For Tex
 13 (require 'tex)
 14 (TeX-global-PDF-mode t)
 15 (latex-mode)
 16 (setq auto-complete-mode t)
 17 (auto-complete)
 18 
 19 ;For Org
 20 (require 'org-bullets)
 21 (org-mode)
 22 (setq org-bullets-mode t)
 23 (org-bullets-mode)
 24 ;Window Size
 25  (if (window-system)
 26   (set-frame-size (selected-frame) 100 200))
 27 
 28 
 29 (custom-set-variables
 30  ;; custom-set-variables was added by Custom.
 31  ;; If you edit it by hand, you could mess it up, so be careful.
 32  ;; Your init file should contain only one such instance.
 33  ;; If there is more than one, they won't work right.
 34  '(custom-enabled-themes (quote (misterioso)))
 35  '(inhibit-startup-screen t)
 36 )

Edit: Even simpler things like

(set-cursor-color "#ffffff")

Isn't working on startup. What am I doing wrong? Is my installation botched?

0

Some variables in Emacs are buffer-local. This means that when you set them they apply only to the current buffer. Many minor modes are buffer-local. So running (org-bullets 1) enables org-bullets only in the current buffer.

To enable org-bullets in every org-mode buffer we use a hook that runs every time you open a new org-mode buffer.

(add-hook 'org-mode-hook
  (defun org-bullets-mode-enable ()
    (org-bullets-mode 1)))

Some minor modes can be enabled globally, usually by calling a function like (global-auto-complete-mode 1) which will enable auto-complete-mode in all buffers.

The problem you are having with set-cursor-color is that the misterioso theme is overriding your settings. I suggest you use customize-face to change your cursor color.

(require 'package)

(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
(setq package-enable-at-startup nil)
(package-initialize)
; Use evil mode
(require 'evil)
(evil-mode t)

;For Tex
(require 'tex)
(TeX-global-PDF-mode t)
(global-auto-complete-mode 1)

;For Org
(require 'org-bullets)
(add-hook 'org-mode-hook
  (defun org-bullets-mode-enable ()
    (org-bullets-mode 1)))
;Window Size
(if (window-system)
  (set-frame-size (selected-frame) 100 200))

(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-enabled-themes (quote (misterioso)))
  '(inhibit-startup-screen t)
)
  • Thanks a lot for explaining the Buffer-local thing. I made it work using hooks. But never really understood until now. – Panch93 Sep 27 '17 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.