Automatically load c++ mode for HPP and CPP files - emacs

I found this thread, but the accepted solution does not work for me. I still need to manually load c++-mode for indentation (!) (not syntax highlighting, however. But that worked before anyway) to be set to c++-mode. In my init I have this code:
(setq
c-default-style "stroustrup"
)
(add-to-list 'auto-mode-alist '("\\.cpp\\'" . c++-mode))
(add-to-list 'auto-mode-alist '("\\.hpp\\'" . c++-mode))
(defun my-c++-mode-hook ()
(setq c-basic-offset 4)
(c-set-offset 'substatement-open 0))
(add-hook 'c++-mode-hook 'my-c++-mode-hook)
and my entire init looks like this:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(setq gc-cons-threshold 100000000)
(setq inhibit-startup-message t)
(defalias 'yes-or-no-p 'y-or-n-p)
(defconst demo-packages
'(anzu
company
duplicate-thing
;; ggtags
;; helm
;; helm-gtags
;; helm-projectile
;; helm-swoop
;; function-args
clean-aindent-mode
comment-dwim-2
;; dtrt-indent
ws-butler
;; iedit
yasnippet
smartparens
;; projectile
;; volatile-highlights
;; undo-tree
zygospore))
(defun install-packages ()
"Install all required packages."
(interactive)
(unless package-archive-contents
(package-refresh-contents))
(dolist (package demo-packages)
(unless (package-installed-p package)
(package-install package))))
(install-packages)
;; this variables must be set before load helm-gtags
;; you can change to any prefix key of your choice
;; (setq helm-gtags-prefix-key "\C-cg")
(add-to-list 'load-path "~/.emacs.d/custom")
;; (require 'setup-helm)
;; (require 'setup-helm-gtags)
;; (require 'setup-ggtags)
(require 'setup-cedet)
(require 'setup-editing)
(windmove-default-keybindings)
;; function-args
;; (require 'function-args)
;; (fa-config-default)
;; (define-key c-mode-map [(tab)] 'company-complete)
;; (define-key c++-mode-map [(tab)] 'company-complete)
;; company
(require 'company)
(add-hook 'after-init-hook 'global-company-mode)
(delete 'company-semantic company-backends)
;; (define-key c-mode-map [(tab)] 'company-complete)
;; (define-key c++-mode-map [(tab)] 'company-complete)
;; (define-key c-mode-map [(control tab)] 'company-complete)
(define-key c++-mode-map [(control tab)] 'company-complete)
;; company-c-headers
(add-to-list 'company-backends 'company-c-headers)
;; hs-minor-mode for folding source code
(add-hook 'c-mode-common-hook 'hs-minor-mode)
;; Available C style:
;; “gnu”: The default style for GNU projects
;; “k&r”: What Kernighan and Ritchie, the authors of C used in their book
;; “bsd”: What BSD developers use, aka “Allman style” after Eric Allman.
;; “whitesmith”: Popularized by the examples that came with Whitesmiths C, an early commercial C compiler.
;; “stroustrup”: What Stroustrup, the author of C++ used in his book
;; “ellemtel”: Popular C++ coding standards as defined by “Programming in C++, Rules and Recommendations,” Erik Nyquist and Mats Henricson, Ellemtel
;; “linux”: What the Linux developers use for kernel development
;; “python”: What Python developers use for extension modules
;; “java”: The default style for java-mode (see below)
;; “user”: When you want to define your own style
(setq
c-default-style "stroustrup"
)
(add-to-list 'auto-mode-alist '("\\.cpp\\'" . c++-mode))
(add-to-list 'auto-mode-alist '("\\.hpp\\'" . c++-mode))
(defun my-c++-mode-hook ()
(setq c-basic-offset 4)
(c-set-offset 'substatement-open 0))
(add-hook 'c++-mode-hook 'my-c++-mode-hook)
(global-set-key (kbd "RET") 'newline-and-indent) ; automatically indent when press RET
;; activate whitespace-mode to view all whitespace characters
(global-set-key (kbd "C-c w") 'whitespace-mode)
;; show unncessary whitespace that can mess up your diff
(add-hook 'prog-mode-hook (lambda () (interactive) (setq show-trailing-whitespace 1)))
;; use space to indent by default
(setq-default indent-tabs-mode nil)
;; set appearance of a tab that is represented by 4 spaces
(setq-default tab-width 4)
;; Compilation
(global-set-key (kbd "<f5>") (lambda ()
(interactive)
(setq-local compilation-read-command nil)
(call-interactively 'compile)))
;; setup GDB
(setq
;; use gdb-many-windows by default
gdb-many-windows t
;; Non-nil means display source file containing the main routine at startup
gdb-show-main t
)
;; Package: clean-aindent-mode
(require 'clean-aindent-mode)
(add-hook 'prog-mode-hook 'clean-aindent-mode)
;; Package: dtrt-indent
(require 'dtrt-indent)
(dtrt-indent-mode 1)
;; Package: ws-butler
(require 'ws-butler)
(add-hook 'prog-mode-hook 'ws-butler-mode)
;; Package: yasnippet
(require 'yasnippet)
(yas-global-mode 1)
;; Package: smartparens
(require 'smartparens-config)
(setq sp-base-key-bindings 'paredit)
(setq sp-autoskip-closing-pair 'always)
(setq sp-hybrid-kill-entire-symbol nil)
(sp-use-paredit-bindings)
(show-smartparens-global-mode +1)
(smartparens-global-mode 1)
;; Package: projejctile
(require 'projectile)
(projectile-global-mode)
(setq projectile-enable-caching t)
;; (require 'helm-projectile)
;; (helm-projectile-on)
;; (setq projectile-completion-system 'helm)
;; (setq projectile-indexing-method 'alien)
;; Package zygospore
(global-set-key (kbd "C-x 1") 'zygospore-toggle-delete-other-windows)
(require 'ggtags)
(add-hook 'c-mode-common-hook
(lambda ()
(when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode)
(ggtags-mode 1))))
(define-key ggtags-mode-map (kbd "C-c g s") 'ggtags-find-other-symbol)
(define-key ggtags-mode-map (kbd "C-c g h") 'ggtags-view-tag-history)
(define-key ggtags-mode-map (kbd "C-c g r") 'ggtags-find-reference)
(define-key ggtags-mode-map (kbd "C-c g f") 'ggtags-find-file)
(define-key ggtags-mode-map (kbd "C-c g c") 'ggtags-create-tags)
(define-key ggtags-mode-map (kbd "C-c g u") 'ggtags-update-tags)
(define-key ggtags-mode-map (kbd "M-,") 'pop-tag-mark)
I got it from here: http://tuhdo.github.io/c-ide.html
And currently I am altering it to fit my needs better.
Any idea what might be conflicting here, causing
(add-to-list 'auto-mode-alist '("\\.cpp\\'" . c++-mode))
(add-to-list 'auto-mode-alist '("\\.hpp\\'" . c++-mode))
not to work?

No idea why but commenting out
(require 'dtrt-indent)
(dtrt-indent-mode 1)
and
(require 'setup-editing)
fixed it.

Related

Emacs Lisp error at init (file-error "Cannot open load file" "/home/user/a-m")

I've recently made a few changes in my init emacs file, and I've noticed with --debug-init that some load files seem to be missing. Here is the output from the debugger
Debugger entered--Lisp error: (file-error "Cannot open load file" "/home/andre/a-m")
load("/home/andre/a-m" nil nil t)
load-file("a-m")
eval-buffer(#<buffer *load*> nil "/usr/local/share/emacs/site-lisp/default.el" nil t) ; Reading at buffer position 269
load-with-code-conversion("/usr/local/share/emacs/site-lisp/default.el" "/usr/local/share/emacs/site-lisp/default.el" t t)
load("default" t t)
#[0 "\205\262
command-line()
normal-top-level()
I've searched for what the a-m file stands for online, and how to correct these errors but without success. Thanks for any help!
Best
Andre
Edit: Here is the init file. I've just changed some info on jabber (email) but other than that the file is unchanged
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; File name: ` ~/.emacs '
;; ---------------------
;; If you need your own personal ~/.emacs
;; please make a copy of this file
;; an placein your changes and/or extension.
;; Copyright (c) 1997-2002 SuSE Gmbh Nuernberg, Germany.
;; Author: Werner Fink, <feedback#suse.de> 1997,98,99,2002
;; Test of Emacs derivates
;; -----------------------
(load-library "url-handlers")
;; Always use PDFLaTeX
(setq TeX-PDF-mode t)
;; TeXcount setup for AUCTeX
(require 'tex)
(add-to-list 'TeX-command-list
(list "TeXcount" "texcount %s.tex" 'TeX-run-command nil t))
(load "auctex.el" nil t t)`
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
;; MELPA
(when (>= emacs-major-version 24)
(require 'package)
(add-to-list
'package-archives
'("melpa" . "http://melpa.org/packages/")
t)
(package-initialize))
;; YASNIPPETS
(add-to-list 'load-path
"~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
(setq yas-snippet-dirs
'("~/.emacs.d/snippets" ;; personal snippets
"~/.emacs.d/plugins/yasnippet/snippets/" ;; the default collection
))
(yas-global-mode 1) ;; or M-x yas-reload-all if you've started YASnippet already.
;; Timestamp controls
(add-hook 'before-save-hook 'time-stamp)
(setq time-stamp-pattern nil)
;; Controls for calendar
(setq european-calendar-style t)
(set-default 'truncate-lines t)
;; Controls for jabber
(require 'jabber)
;;;;;;;;;;;;;;;
;; TRAMP mode
;;;;;;;;;;;;;;;
(setq tramp-default-method "ssh")
;;;;;;;;;;;
;;ORG mode
;;;;;;;;;;;
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(setq org-agenda-files (list "~/org/NOTES.org"))
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "firefox")
(setq org-support-shift-select 't)
(setq org-agenda-include-diary t)
(setq org-src-fontify-natively t)
;;;;;;;;;;;
;;G-CODE
;;;;;;;;;;;
(require 'generic-x)
(define-generic-mode gcode-generic-mode
'(("(" . ")"))
(apply 'append
(mapcar #'(lambda (s) (list (upcase s) (downcase s) (capitalize s)))
'("sub" "endsub" "if" "do" "while" "endwhile" "call" "endif"
"sqrt" "return" "mod" "eq" "ne" "gt" "ge" "lt" "le" "and"
"or" "xor" "atan" "abs" "acos" "asin" "cos" "exp"
"fix" "fup" "round" "ln" "sin" "tan" "repeat" "endrepeat")))
'(("\\(#<_?[A-Za-z0-9_]+>\\)" (1 font-lock-type-face))
("\\([NnGgMmFfSsTtOo]\\)" (1 font-lock-function-name-face))
("\\([XxYyZzAaBbCcUuVvWwIiJjKkPpQqRr]\\)" (1 font-lock-string-face))
("\\([\-+]?[0-9]*\\.[0-9]+\\)" (1 font-lock-constant-face))
("\\(#[0-9]+\\)" (1 font-lock-type-face))
("\\([0-9]+\\)" (1 font-lock-constant-face)))
'("\\.gcode\\'")
nil
"Generic mode for g-code files.")
;;;;;;;;;;;
;;OpenSCAD
;;;;;;;;;;;
(add-to-list 'load-path
"/usr/local/share/emacs/site-lisp/")
(autoload 'scad-mode "scad-mode" "Activate OpenSCAD mode." 'interactive)
(add-to-list 'auto-mode-alist '("\\.scad\\'" . scad-mode))
;;;;;;;;
;;ANSYS
;;;;;;;;
(add-to-list 'load-path
"/usr/local/share/emacs/site-lisp/")
(autoload 'ansys-mode "ansys-mode" "Activate Ansys mode." 'interactive)
(add-to-list 'auto-mode-alist '("\\.txt\\'" . ansys-mode))
(add-to-list 'auto-mode-alist '("\\.db\\'" . ansys-mode))
; (add-to-list 'auto-mode-alist '("\\.dat\\'" . ansys-mode))
; (add-to-list 'auto-mode-alist '("\\.inp\\'" . ansys-mode))
;;;;;;;;;;;
;;LS-DYNA
;;;;;;;;;;;
(add-to-list 'load-path
"/usr/local/share/emacs/site-lisp/")
(autoload 'lsdyna-mode "lsdyna" "Enter ls-dyna mode." t)
(setq auto-mode-alist (cons '("\\.k\\'" . lsdyna-mode) auto-mode-alist))
;;;;;;;;;;;
;;ABAQUS
;;;;;;;;;;;
;; ;; setup files ending in “.inp” to open in python-mode
;; (add-to-list 'auto-mode-alist '("\\.inp\\'" . python-mode))
(add-to-list 'load-path
"/usr/local/share/emacs/site-lisp/")
(autoload 'abaqus-mode "abaqus" "Enter abaqus mode." t)
(setq auto-mode-alist (cons '("\\.inp\\'" . abaqus-mode) auto-mode-alist))
;;;;;;;;;;;;;;;;;;;;;;
;; PDF-LATEX+INKSCAPE
;;;;;;;;;;;;;;;;;;;;;;
(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.
'(LaTeX-command-style (quote (("" "%(PDF)%(latex) -shell-escape %S%(PDFout)"))))
'(ansys-current-ansys-version "140")
'(jabber-account-list (quote (("myemail.com"))))
'(org-agenda-files (quote ("~/org/NOTES.org")))
'(send-mail-function (quote smtpmail-send-it))
'(smtpmail-smtp-server "smtp.googlemail.com")
'(smtpmail-smtp-service 587))
(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.
)
;; ;;;;;;;;;;;
;; ;;GNUPLOT
;; ;;;;;;;;;;;
;; (add-to-list 'Info-default-directory-list "/usr/info")
;; ;; load the file
;; (require 'gnuplot)
;; ;; specify the gnuplot executable (if other than /usr/bin/gnuplot)
;; (setq gnuplot-program "/usr/bin/gnuplot")
;; ;; automatically open files ending with .gp or .gnuplot in gnuplot mode
;; (setq auto-mode-alist
;; (append '(("\\.\\(gp\\|gnuplot\\|p\\)$" . gnuplot-mode)) auto-mode-alist))
; GIT controls
(add-to-list 'load-path ".../git/contrib/emacs")
(require 'git)
(require 'git-blame)
(require 'vc-git)
;; OCTAVE
(autoload 'run-octave "octave-inf" nil t)
(put 'upcase-region 'disabled nil)
;; PHP
(autoload 'php-mode "php-mode" "Major mode for editing php code." t)
(add-to-list 'auto-mode-alist '("\\.php$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.inc$" . php-mode))
;; Command for automatic alignment of comments
(defun align-comment (beg end)
(interactive "r")
(align-regexp beg end (concat "\\(\\s-*\\)" comment-start))
)
(global-set-key "\C-c\C-a" 'align-comment )
;; Flyspell mode binding to F6 key
(global-set-key [f6] 'flyspell-mode) ; F6
;; Command for automatic auto-fill
(add-hook 'text-mode-hook 'turn-on-auto-fill)
Thanks for your help. I didn't read the new ansys-mode https://github.com/dieter-wilhelm/ansys-mode documentation properly. Here is the issue:
Please have a look at the accompanying default.el’ customisation example. It can be used as a configuration file (after moving it e. g. to/usr/share/emacs/site-lisp’ or c:\EMACS_INSTALLDIR\site-lisp’, hint: The directory site-lisp/ in the Emacs installation tree is in its default load-path). Yetdefault.el’ is loaded AFTER your personal Emacs configuration file (if there is any) ~/.emacs’ (or~/.emacs.d/init.el’)! If you intend to change the following settings with Emacs’ customisation system or changing them directly in your personal configuration file, you must either set the variable inhibit-default-init’ tot’ “(setq inhibit-default-init t)” in your personal configuration file or remove `default.el’ otherwise your settings might be overwritten!
So I just added (setq inhibit-default-init t) to the init file.
Thanks again!
Note that with Git 2.18 (Q2 2018), the scripts in contrib/emacs/ have outlived their usefulness and have been replaced with a stub that errors out and tells the user there are replacements.
So the init error message might not apply anymore in 2018.
See commit 6d5ed48 (11 Apr 2018) by Ævar Arnfjörð Bjarmason (avar).
(Merged by Junio C Hamano -- gitster -- in commit 7d7d051, 08 May 2018)
git{,-blame}.el: remove old bitrotting Emacs code
The git-blame.el mode has been superseded by Emacs's own
vc-annotate
(invoked by C-x v g).
Users of the git.el mode are now much better off using either Magit or the Git backend for Emacs's own VC mode.
These modes were added over 10 years ago when Emacs's own Git support
was much less mature, and there weren't other mature modes in the wild
or shipped with Emacs itself.
These days these modes have few if any users, and users of git aren't
well served by us shipping these (some OS's install them alongside git
by default, which is confusing and leads users astray).
[...] rather than receive a cryptic load error when they upgrade,
existing users will get an error directing them to the README file, or
to just stop requiring these modes
See "git/contrib/emacs/README" for more.

Slow emacs startup

My emacs takes a few seconds to start up every time, which is slower than I'd expect. During that time, it says "contacting host: " marmalade-repo and melpa.
Is my current config a reasonable one? Is there a way I can speed it up, while still being able to install packages when I need them?
;; init.el --- Emacs configuration
;; INSTALL PACKAGES
;; --------------------------------------
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/"))
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
(defvar myPackages
'(better-defaults
paredit
idle-highlight-mode
ido-ubiquitous
find-file-in-project
smex
scpaste
ein
elpy
flycheck
material-theme
py-autopep8))
(package-refresh-contents)
(mapc #'(lambda (package)
(unless (package-installed-p package)
(package-install package)))
myPackages)
;; BASIC CUSTOMIZATION
;; --------------------------------------
(setq inhibit-startup-message t) ;; hide the startup message
(load-theme 'material t) ;; load material theme
(global-linum-mode t) ;; enable line numbers globally
;; PYTHON CONFIGURATION
;; --------------------------------------
(elpy-enable)
(elpy-use-ipython)
;; use flycheck not flymake with elpy
(when (require 'flycheck nil t)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))
;; enable autopep8 formatting on save
(require 'py-autopep8)
(add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
;; enable electric pair minor mode
(defun electric-pair ()
"If at end of line, insert character pair without surrounding spaces.
Otherwise, just insert the typed character."
(interactive)
(if (eolp) (let (parens-require-spaces) (insert-pair)) (self-insert-command 1)))
(add-hook 'python-mode-hook
(lambda ()
(define-key python-mode-map "\"" 'electric-pair)
(define-key python-mode-map "\'" 'electric-pair)
(define-key python-mode-map "(" 'electric-pair)
(define-key python-mode-map "[" 'electric-pair)
(define-key python-mode-map "{" 'electric-pair)))
;; Send line from code buffer
;; http://stackoverflow.com/questions/27777133/change-the-emacs-send-code-to-interpreter-c-c-c-r-command-in-ipython-mode/30774439#30774439
(defun my-python-line ()
(interactive)
(save-excursion
(setq the_script_buffer (format (buffer-name)))
(end-of-line)
(kill-region (point) (progn (back-to-indentation) (point)))
(if (get-buffer "*Python*")
(message "")
(run-python "ipython" nil nil))
;; (setq the_py_buffer (format "*Python[%s]*" (buffer-file-name)))
(setq the_py_buffer "*Python*")
(switch-to-buffer-other-window the_py_buffer)
(goto-char (buffer-end 1))
(yank)
(comint-send-input)
(switch-to-buffer-other-window the_script_buffer)
(yank))
(end-of-line)
(next-line)
)
(add-hook 'python-mode-hook
(lambda ()
(define-key python-mode-map "\C-cn" 'my-python-line)))
Recently, loading packages from MELPA has been really slow, I'm not so sure why. What you can do to get around this (or at least make sure it only happens once) is to run Emacs in daemon mode, and then connect to it whenever you want to edit a file. It means that the cost of loading is only incurred once. It's as simple as running emacs --daemon at startup. Then you connect via emacsclient.

How to access to MELPA packages?

I've tried to install colour themes that can be found on MELPA, but when I use "M-x install-package", they are not found.
I restart emacs after each modification of the init.el file, and refresh the list of packages before each try.
Here is my init.el file :
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
(require 'ggtags)
(add-hook 'c-mode-common-hook
(lambda ()
(when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode)
(ggtags-mode 1))))
(define-key ggtags-mode-map (kbd "C-c g s") 'ggtags-find-other-symbol)
(define-key ggtags-mode-map (kbd "C-c g h") 'ggtags-view-tag-history)
(define-key ggtags-mode-map (kbd "C-c g r") 'ggtags-find-reference)
(define-key ggtags-mode-map (kbd "C-c g f") 'ggtags-find-file)
(define-key ggtags-mode-map (kbd "C-c g c") 'ggtags-create-tags)
(define-key ggtags-mode-map (kbd "C-c g u") 'ggtags-update-tags)
(define-key ggtags-mode-map (kbd "M-,") 'pop-tag-mark)
I've installed ggtags and ahundry, but not zenburn or solarized-theme for example.
So can someone please tell me what could be wrong, because I have no idea.

Filter auto complete drop down search results

I have setup cedet+auto complete and got the recommendation system to work. However whenever the drop down menu of recommendations is shown, I expect the results to be filtered as I enter characters.
This is the screenshot:
So as I type pu I expect the drop down menu to contain results like push_back. How do I get that?
This is my .emacs file(relevant portions):
;;; yasnippet
;;; should be loaded before auto complete so that they can work together
(require 'yasnippet)
(yas-global-mode 1)
(defun my:ac-c-header-init ()
(require 'auto-complete-c-headers)
(add-to-list 'ac-sources 'ac-source-c-headers)
(add-to-list 'achead:include-directories '"/usr/include/c++/4.8"))
(add-hook 'c++-mode-hook 'my:ac-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)
(add-to-list 'load-path "~/.emacs.d/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(require 'auto-complete)
(ac-config-default)
(setq ac-auto-show-menu t)
(ac-flyspell-workaround)
;;cedet configuration
(semantic-mode 1)
(defun my:add-semantic-to-autocomplete ()
(add-to-list 'ac-sources 'ac-source-semantic))
(add-hook 'c-mode-common-hook 'my:add-semantic-to-autocomplete)
(global-ede-mode 1)
(global-semantic-idle-scheduler-mode 1)
(add-hook 'c-mode-hook 'my:add-semantic-to-autocomplete)
(add-hook 'c++-mode-hook 'my:add-semantic-to-autocomplete)
;; (defun my-semantic-hook ()
;; (imenu-add-to-menubar "TAGS"))
;; (add-hook 'semantic-init-hooks 'my-semantic-hook)
;(require 'semantic/ia)
;(require 'semantic/bovine/gcc)
(defun my-c-mode-cedet-hook ()
(add-to-list 'ac-sources 'ac-source-gtags)
(add-to-list 'ac-sources 'ac-source-semantic))
(add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook)
(add-hook 'c++-mode-common-hook 'my-c-mode-cedet-hook)
(semanticdb-enable-gnu-global-databases 'c-mode t)
(semanticdb-enable-gnu-global-databases 'c++-mode t)
I suppose you can use ac-isearch. You can invoke it by C-s when completion tooltip is popuped.
popup completion tooltip(M-x auto-complete or auto start)
invoke ac-isearch(C-s)
filtering completions

How to stop add content_flymake.xml to odt exports

When I try to export a org-mode file to odf I end up with a corrupt output file. I narrowed the problem down to that the odt-file (which in fact is a zip file) contained a file named content_flymake.xml. If I remove that file, I can open the it without a problem.
Now I'm stucked. I don't know what to do next.
A grep of flymake in my config files:
nine#nine-laptop:~/.emacs.d/configfile$ grep -A 5 -B 5 -R "flymake" *
blocks/python.el-
blocks/python.el-(add-to-list 'load-path "~/.emacs.d/vendor")
blocks/python.el-
blocks/python.el-; Make Flymake work with python
blocks/python.el-(add-to-list 'load-path "~/.emacs.d/plugins")
blocks/python.el:(add-hook 'find-file-hook 'flymake-find-file-hook)
blocks/python.el-
blocks/python.el:(when (load "flymake" t)
blocks/python.el: (defun flymake-pyflakes-init ()
blocks/python.el: (let* ((temp-file (flymake-init-create-temp-buffer-copy
blocks/python.el: 'flymake-create-temp-inplace))
blocks/python.el- (local-file (file-relative-name
blocks/python.el- temp-file
blocks/python.el- (file-name-directory buffer-file-name))))
blocks/python.el- (list "pycheckers" (list local-file))))
blocks/python.el: (add-to-list 'flymake-allowed-file-name-masks
blocks/python.el: '("\\.py\\'" flymake-pyflakes-init)))
blocks/python.el:(load-library "flymake-cursor")
blocks/python.el:(global-set-key [f10] 'flymake-goto-prev-error)
blocks/python.el:(global-set-key [f11] 'flymake-goto-next-error)
blocks/python.el-
blocks/python.el-(require 'ipython)
blocks/python.el-
blocks/python.el-;(define-key py-mode-map (kbd "M-TAB") 'anything-ipython-complete)
blocks/python.el-;(define-key py-shell-map (kbd "M-TAB") 'anything-ipython-complete)
--
emacs- ;; If you edit it by hand, you could mess it up, so be careful.
emacs- ;; Your init file should contain only one such instance.
emacs- ;; If there is more than one, they won't work right.
emacs- )
emacs-
emacs:; Workaround for broken flymake configuration (Might be fixed in future versions)
emacs:(defun flymake-xml-init ()
emacs: (list "xmlstarlet" (list "val" "-e" (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace))))
emacs-
emacs-;;;;;;;;;;;;;;;;;;
emacs-; Mutt mail-mode ;
emacs-;;;;;;;;;;;;;;;;;;
emacs-(add-to-list 'auto-mode-alist '(".*mutt.*" . message-mode))
And my org-mode configuration
nine#nine-laptop:~/.emacs.d/configfile$ cat blocks/orgmode.el
;; Org mode
(add-to-list 'load-path "~/.emacs.d/plugins/org-mode/lisp/")
;; odt-support
(require 'ox-odt)
;(require 'org-mode)
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(add-hook 'org-mode-hook 'turn-on-font-lock) ; not needed when global-font-lock-mode is on
(setq org-agenda-files (list "~/Dokument/org/arbete.org"
"~/Dokument/org/calendar.org"))
(setq org-startup-indented t)
;; Default ODF style
;(setq org-export-odt-styles-file "~/.emacs.d/org-mode-odtconv/predikan-style.xml")
;(setq org-default-notes-file (concat org-directory "/anteckningar.org"))
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
;; Automatic Org mode pull and push
;(add-hook 'after-init-hook 'org-mobile-pull)
;(add-hook 'kill-emacs-hook 'org-mobile-push)
One possibility is to disable the flymake-find-file-hook while running org-export-as-odt. The following lines may work:
(defadvice org-export-as-odt (around remove-flymake-hook first act)
(let ((find-file-hook find-file-hook))
(remove-hook 'find-file-hook 'flymake-find-file-hook)
ad-do-it))
You can also try to customize flymake-allowed-file-name-masks and remove the .xml binding there. But this means that no xml file would run under flymake by default anymore.