Emacs Predictive - Accept with punctuation - emacs

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)

Related

Is there a way to use Rmarkdown in Spacemacs?

I know that Emacs has the polymode package that allows coding in RMarkdown. However, it seems that Spacemacs is still missing the equivalent of a polymode layer.
I have been trying to install it directly into Spacemacs, with no success. Therefore my question: is there a way to edit RMarkdown files in Spacemacs (not plain Emacs).
you can add packages to spacemacs by adding them to dotspacemacs-additional-packages in your .spacemacs:
dotspacemacs-additional-packages '(polymode poly-R poly-noweb poly-markdown)
after a restart the packages should get installed automatically, you probably want to set some other options in dotspacemacs/user-config () e.g. something like:
(add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))
(add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
Edit:
polymode got a rework.
There's no official polymode layer for Spacemacs, but I've found a couple of implementations in random configs on GitHub. Here's one that works for me:
;;; packages.el --- polymode layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Walmes Zeviani & Fernando Mayer
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; Layer retrieved from here:
;; https://github.com/MilesMcBain/spacemacs_cfg/blob/master/private/polymode/packages.el
;;
;;; Code:
(defconst polymode-packages
'(polymode
poly-R
poly-markdown))
(defun polymode/init-poly-R ())
(defun polymode/init-poly-markdown ())
(defun polymode/init-polymode ()
(use-package polymode
:mode (("\\.Rmd" . Rmd-mode))
:init
(progn
(defun Rmd-mode ()
"ESS Markdown mode for Rmd files"
(interactive)
(require 'poly-R)
(require 'poly-markdown)
(R-mode)
(poly-markdown+r-mode))
))
)
;;; packages.el ends here
There are a few ways to work with private custom layers like this, but one straightforward and easy way is to...
Save the code above as a file named packages.el in ~/.emacs.d/layers/private/polymode/.
Add polymode to your list of dotspacemacs/layers, e.g.
(defun dotspacemacs/layers ()
ess
polymode
python
...
Restart Emacs and the polymode package should install.
Using this, you shouldn't have to use (add-to-list 'auto-mode-alist... to declare the particular mode that .Rmd files should use since it's defined in the layer. I retrieved this particular layer from here. I tried one or two others as well, but they didn't work for me.

Having trouble getiting Tomorrow theme to work in Emacs

I have only recently started to use emacs. I have succesffully used a couple of different themes, but am having trouble getting Tomorrow to work.
Here's what I have done:
The .el files are in ~/.emacs.d/themes/
my-init.el:
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
(require 'color-theme-sanityinc-tomorrow)
(load-theme 'color-theme-sanityinc-tomorrow-night t)
I load this in .emacs by doing
(add-hook 'after-init-hook '(lambda ()
(load "~/.emacs.d/my-noexternals.el")
(load "~/.emacs.d/my-init.el") ))
When I reload emacs I see eval-buffer: Cannot open load file: no such file or directory, color-theme-sanityinc-tomorrow.
If color-theme-sanityinc-tomorrow.el is in ~/.emacs.d/themes/ you need to had:
(add-to-list 'load-path "~/.emacs.d/themes/")
before the require.
Regards

running `org-export-as-html' in emacs batch mode

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)))

emacs auto-complete don't work with jde

I want to develop java in emacs. I install ecb, jde and auto-complete extensions. Each one works well without starting others. But when i want to use them together, some problem happened.
auto-complete-mode doesn't auto start with jde, I need to start it by M-x auto-complete-mode. If without jde, auto-complete-mode will auto start
When I manually start the auto-complete-mode in jde, the auto complete is not work well. It just auto complete the word that is appeared.
Here is my .emacs content:
(global-linum-mode 1)
(setq linum-format "%2d| ")
(setq default-tab-width 4)
(setq debug-on-error t)
;;no backup file
(setq make-backup-files nil)
(setq debug-on-error t)
;;auto complete config
(add-to-list 'load-path "D:/emacs-24.1/custom_el/auto-complete-1.3.1")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "D:/emacs-24.1/custom_el/auto-complete-1.3.1/dict")
(ac-config-default)
(setq stack-trace-on-error t)
(add-to-list 'load-path (expand-file-name "D:/emacs-24.1/custom_el/jdee-2.4.0.1/lisp"))
(add-to-list 'load-path (expand-file-name "D:/emacs-24.1/custom_el/cedet-1.1/common"))
(add-to-list 'load-path (expand-file-name "D:/emacs-24.1/custom_el/elib-1.0"))
(add-to-list 'load-path' "d:/emacs-24.1/custom_el/ecb-2.40")
;; Initialize CEDET.
(load-file (expand-file-name "D:/emacs-24.1/custom_el/cedet-1.1/common/cedet.el"))
(load-file (expand-file-name "D:/emacs-24.1/custom_el/ecb-2.40/ecb.el"))
(require 'ecb)
(ecb-activate)
(ecb-byte-compile)
;; If you want Emacs to defer loading the JDE until you open a
;; Java file, edit the following line
(setq defer-loading-jde nil)
;; to read:
;;
;; (setq defer-loading-jde t)
;;
(if defer-loading-jde
(progn
(autoload 'jde-mode "jde" "JDE mode." t)
(setq auto-mode-alist
(append
'(("\\.java\\'" . jde-mode))
auto-mode-alist)))
(require 'jde))
;; Sets the basic indentation for Java source files
;; to two spaces.
(defun my-jde-mode-hook ()
(setq c-basic-offset 2))
(add-hook 'jde-mode-hook 'my-jde-mode-hook)
(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.
'(ecb-options-version "2.40")
'(ecb-primary-secondary-mouse-buttons (quote mouse-1--C-mouse-1)))
(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.
)
The version info is :
emacs : 24.1
auto complete : 1.3.1
ecb : 2.40
cedet : 1.1
elib : 1.0
jdee : 2.4.0.1
To auto-start auto-complete-mode with jde-mode, you need to add jde-mode to ac-modes:
(push 'jde-mode ac-modes)
Then you need to add a JDEE-specific source to ac-sources. I'm not sure of the extent of JDEE integration with Semantic, you may be able to use the pre-defined source for it:
(add-hook 'jde-mode-hook (lambda () (push 'ac-source-semantic ac-sources)))
If not, you may need to define a specialized source with ac-define-source. See auto-complete-config.el for examples.

Emacs auto-complete-mode at startup

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.