Skip to content

Commit

Permalink
Merge branch 'develop' (v0.7.0 pre-release)
Browse files Browse the repository at this point in the history
syl20bnr committed Nov 9, 2014
2 parents 3c5349a + 0eb35a0 commit 22bfd42
Showing 12 changed files with 364 additions and 50 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ eproject.lst
.smex-items
\#*
.places
.cache
eshell/history
.emacs.desktop
.emacs.desktop.lock
77 changes: 45 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -63,7 +63,6 @@ for contribution guidelines_
- [Minor Modes](#minor-modes)
- [Base packages](#base-packages)
- [Evil plugins](#evil-plugins)
- [Helm extensions](#helm-extensions)
- [Commands](#commands)
- [Return to normal mode](#return-to-normal-mode)
- [Executing Vim, Emacs and shell commands](#executing-vim-emacs-and-shell-commands)
@@ -78,6 +77,7 @@ for contribution guidelines_
- [Bookmarks](#bookmarks)
- [Searching](#searching)
- [Persistent highlighting](#persistent-highlighting)
- [Stacking highlights](#stacking-highlights)
- [Auto-highlight symbols](#auto-highlight-symbols)
- [Visual Star](#visual-star)
- [Listing symbols by semantic](#listing-symbols-by-semantic)
@@ -121,7 +121,7 @@ for contribution guidelines_
- [Tips](#tips)
- [Tips for Emacs users](#tips-for-emacs-users)
- [Tips for Spacemacs advanced users](#tips-for-spacemacs-advanced-users)
- [TODO list](#todo-list)
- [Contributors Achievements](#contributors-achievements)
- [Thank you](#thank-you)

<!-- markdown-toc end -->
@@ -738,23 +738,6 @@ They are both extended with various packages to build on their foundations.
[evil-numbers][] | like C-a/C-x in vim
[NeoTree][neotree] | mimic [NERD Tree][nerdtree]

### Helm extensions

`Spacemacs` tries to use [helm][helm] as much as possible.
[helm][helm] is coupled to [popwin][popwin] so `helm` window always appears in
a new temporary window at the bottom.

The following `helm` modes are installed with `Spacemacs`:

Key Binding | Mode | Description
------------|-----------------------------------------|------------------------
`<SPC> h s` | [helm-swoop][hswoop] | search for occurrences within a file and edit the result
`<SPC> h y` | [helm-c-yasnippet][hyas] | select snippets
`<SPC> h t` | [helm-themes][hthemes] | select a theme
`<SPC> p f` | [helm-projectile][projectile] | select files within a projectile project
`<SPC> ?` | [helm-descbinds][hdescbinds] | show key bindings
`<SPC> s c` | [cofi/helm-flyspell-correct][hflyspell] | choose a corrected word

## Commands

Every sequences must be performed in `normal` mode.
@@ -821,10 +804,12 @@ in a buffer containing some text:

Key Binding | Description
--------------|------------------------------------------------------------------
`<SPC> <SPC>` | initiate ace jump char mode
`<SPC> <SPC>` | initiate ace jump word mode
`<SPC> l` | initiate ace jump line mode
``<SPC> ``` | go back to the previous location (before the jump)

Hint: you may change to char mode by `C-c C-c` in word mode.

#### Window manipulation

Every window has a number displayed at the start of the mode-line and can
@@ -979,7 +964,20 @@ To save a new bookmark, just type the name of the bookmark and press `RET`.

`Spacemacs` uses `evil-search-highlight-persist` to keep the searched expression
highlighted until the next search. It is also possible to clear the
highlighting by pressing `<SPC> s c`.
highlighting by pressing `<SPC> s c` or executing the ex command `:noh`.

#### Stacking highlights

With [hl-anything][] it is possible to highlight all occurrences of the word
under point. The highlights can be stacked.

Key Binding | Description
--------------|----------------------------------------------------------------
`<SPC> h c` | clear the current highlightings
`<SPC> h h` | highlight all occurrence of the word at point
`<SPC> h n` | next highlighted occurrence
`<SPC> h N` | previous highlighted occurrence
`<SPC> h p` | toggle auto-highlight of the enclosing parenthesis

#### Auto-highlight symbols

@@ -1197,13 +1195,17 @@ Comments are handled by [evil-nerd-commenter][], it's bound to the following key

Key Binding | Description
------------------|------------------------------------------------------------
`<SPC> n c l` | comment lines
`<SPC> n c t` | comment to line
`<SPC> n c y` | comment and yank
`<SPC> n c p` | comment paragraphs
`<SPC> n c r` | comment region
`<SPC> n c i` | comment invert
`<SPC> n c c` | comment operator
`<SPC> ;` | comment operator
`<SPC> c i` | comment invert
`<SPC> c l` | comment lines
`<SPC> c p` | comment paragraphs
`<SPC> c r` | comment region
`<SPC> c t` | comment to line
`<SPC> c y` | comment and yank

**Tips:** To comment efficiently a block of line use the combo:

<SPC> ; <SPC> l

#### Editing Lisp code

@@ -1694,15 +1696,22 @@ your `~/.spacemacs` the following snippet:
(add-hook 'emacs-lisp-mode-hook 'evil-lisp-state))
```

## TODO list
## Contributors Achievements

- Add support for [multiple-cursors][multiple-cursors] mode.
Achievements | Contributors
-----------------------------------------------------|------------------------
[First contribution][1st-contrib] | trishume
[First contribution layer][1st-clayer] | trishume
[First blog article on Spacemacs][1st-arctile] | Wolfy87
[100th issue (PR)][100th-issue] | danielwuz

## Thank you

[Jokes aside](#contributions), thank you Richard for this great piece of software.
[Jokes aside](#contributions), thank you Richard for this great piece of
software.

Thank you to the whole Emacs community from core developers to elisp hackers!
Thank you to all the contributors and the whole Emacs community from core
developers to elisp hackers!

[evil]: https://gitorious.org/evil/pages/Home
[evil-leader]: https://github.com/cofi/evil-leader
@@ -1777,3 +1786,7 @@ Thank you to the whole Emacs community from core developers to elisp hackers!
[neotree]: https://github.com/jaypei/emacs-neotree
[nerdtree]: https://github.com/scrooloose/nerdtree
[evil-numbers]: https://github.com/cofi/evil-numbers
[1st-contrib]: https://github.com/syl20bnr/spacemacs/pull/19
[1st-clayer]: https://github.com/syl20bnr/spacemacs/commit/e802027d75d0c0aed55539b0da2dfa0df94dfd39
[1st-arctile]: http://oli.me.uk/2014/11/06/spacemacs-emacs-vim/
[100th-issue]: https://github.com/syl20bnr/spacemacs/pull/100
25 changes: 25 additions & 0 deletions contrib/company-mode/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Company Mode

In order to use this you should disable the default `auto-complete` package plus everything that depends on it:

```elisp
(setq-default dotspacemacs-excluded-packages
'(auto-complete ac-ispell tern-auto-complete auto-complete-clang enslime edts))
```

## Clang Fanciness

In `funcs.el` there are some fancy improvements to `company-clang`.
It includes a hook to load a projects `.clang_complete` file, which is just a text
file with one clang flag per line, a format also used by other text editor clang plugins.

Not only does this allow proper autocomplete on projects with extra includes and flags,
but I also hooked it into flycheck so that the error messages don't complain about missing
header files and skip the actual problems.

Basically, Spacemacs now has better Clang/C++ than any other Emacs config.

## Maintainer

This contrib layer was written by and should be maintained by @trishume, everyone else is
welcome to contribute.
83 changes: 83 additions & 0 deletions contrib/company-mode/funcs.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
; .clang_complete file loading
; Sets the arguments for company-clang based on a project-specific text file.

; START Based on the Sarcasm/irony-mode compilation database code.

(defun company-mode/find-clang-complete-file ()
(when buffer-file-name
(let ((dir (locate-dominating-file buffer-file-name ".clang_complete")))
(when dir
(concat (file-name-as-directory dir) ".clang_complete")))))

(defun company-mode/load-clang-complete-file (cc-file)
"Load the flags from CC-FILE, one flag per line."
(let ((invocation-dir (expand-file-name (file-name-directory cc-file)))
(case-fold-search nil)
compile-flags)
(with-temp-buffer
(insert-file-contents cc-file)
; Replace relative paths with absolute paths (by @trishume)
;(goto-char (point-min))
(while (re-search-forward "\\(-I\\|-isystem\n\\)\\(\\S-\\)" nil t)
(replace-match (format "%s%s" (match-string 1) (expand-file-name (match-string 2) invocation-dir))))
; Turn lines into a list
(setq compile-flags
;; remove whitespaces at the end of each line, if any
(mapcar #'(lambda (line)
(if (string-match "[ \t]+$" line)
(replace-match "" t t line)
line))
(split-string (buffer-string) "\n" t))))
compile-flags))

; END Back to things written by @trishume

(defun company-mode/more-than-prefix-guesser ()
(unless company-clang-arguments
(let* ((cc-file (company-mode/find-clang-complete-file))
(flags (when cc-file (company-mode/load-clang-complete-file cc-file))))
(when flags (setq-local company-clang-arguments flags))))
(company-clang-guess-prefix))

; START Based on the built in flycheck-clang c++ checker
(eval-after-load 'flycheck
'(progn
(flycheck-define-checker c/c++-company
"A C/C++ syntax checker using parameters from clang-complete"
:command ("clang"
"-fsyntax-only"
"-fno-color-diagnostics" ; Do not include color codes in output
"-fno-caret-diagnostics" ; Do not visually indicate the source
; location
"-fno-diagnostics-show-option" ; Do not show the corresponding
; warning group
"-x" (eval
(pcase major-mode
(`c++-mode "c++")
(`c-mode "c")))
(option-list "" company-clang-arguments concat)
source)
:error-patterns
((error line-start
(message "In file included from") " " (file-name) ":" line ":"
line-end)
(info line-start (file-name) ":" line ":" column
": note: " (optional (message)) line-end)
(warning line-start (file-name) ":" line ":" column
": warning: " (optional (message)) line-end)
(error line-start (file-name) ":" line ":" column
": " (or "fatal error" "error") ": " (optional (message)) line-end))
:error-filter
(lambda (errors)
(let ((errors (flycheck-sanitize-errors errors)))
(dolist (err errors)
;; Clang will output empty messages for #error/#warning pragmas without
;; messages. We fill these empty errors with a dummy message to get
;; them past our error filtering
(setf (flycheck-error-message err)
(or (flycheck-error-message err) "no message")))
(flycheck-fold-include-errors errors "In file included from")))
:modes (c-mode c++-mode)
:next-checkers ((warning . c/c++-cppcheck)))
(add-to-list 'flycheck-checkers 'c/c++-company)))
; END
41 changes: 41 additions & 0 deletions contrib/company-mode/packages.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
(defvar company-mode-packages
'(
company
company-tern
))

(defun company-mode/init-company ()
(use-package company
:config
(progn
(setq company-idle-delay 0.0
company-minimum-prefix-length 2
company-require-match nil
company-transformers '(company-sort-by-occurrence)
company-dabbrev-ignore-case nil
company-dabbrev-downcase nil
company-tooltip-flip-when-above t
company-frontends '(company-pseudo-tooltip-frontend)
company-clang-prefix-guesser 'company-mode/more-than-prefix-guesser)

(global-company-mode 1)

; Fix integration of company and yasnippet
(define-key company-active-map (kbd "TAB") nil)
(define-key company-active-map (kbd "<tab>") nil)
(define-key company-active-map [tab] nil)

(add-hook 'markdown-mode-hook '(lambda () (company-mode -1)))

; The default common face is a really ugly underlined thing with a different background.
(custom-set-faces
'(company-tooltip-common ((t (:inherit company-tooltip :weight bold :underline nil))))
'(company-tooltip-common-selection ((t (:inherit company-tooltip-selection :weight bold :underline nil)))))

(spacemacs//diminish company-mode ""))))

(defun company-mode/init-company-tern ()
(use-package company-tern
:defer t
:config
(add-to-list 'company-backends 'company-tern)))
14 changes: 14 additions & 0 deletions contrib/trishume/Readme.md
Original file line number Diff line number Diff line change
@@ -4,3 +4,17 @@ Mostly consists of support for additional languages including:
LaTeX, Idris, OpenSCAD, Julia, Arduino, QML, Lua

Also adds smooth scrolling and Helm Ag support.

## Company Auctex

Along with other things this layer includes company-auctex, it's only enabled if you also enable my other contrib layer `company-mode`.
The autocompletion it offers is great and almost works, unlike auto-complete-auctex which lags so hard it's worthless.

The problem is the almost. There are a few issues that need to be fixed for it to be nice:

- https://github.com/capitaomorte/yasnippet/issues/537 To allow you to delete expanded macro braces, this will need to be merged.
- https://github.com/alexeyr/company-auctex/pull/3 For completing environments like `align*` properly, this will need to be merged.
- https://github.com/alexeyr/company-auctex/issues/4

Currently I've manually applied both of these patches to the folders in my `elpa` directory, which isn't a good solution.
If the patches aren't merged in a reasonable amount of time I'll add the patched forks/branches as extension submodules.
8 changes: 8 additions & 0 deletions contrib/trishume/packages.el
Original file line number Diff line number Diff line change
@@ -15,6 +15,9 @@
ag
))

(when (member 'trishume dotspacemacs-configuration-layers)
(add-to-list 'trishume-packages 'company-auctex))

(defun trishume/init-auctex ()
(defun load-auctex-on-demand ()
(interactive)
@@ -24,6 +27,10 @@
(use-package smartparens
:config (require 'smartparens-latex))

(when (member 'company-mode dotspacemacs-configuration-layers)
(use-package company-auctex
:init (company-auctex-init)))

(defun build-view ()
(interactive)
(if (buffer-modified-p)
@@ -42,6 +49,7 @@
(add-hook 'LaTeX-mode-hook '(lambda () (local-set-key (kbd "H-r") 'build-view)))
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'spacemacs/load-yasnippet)

(evil-leader/set-key
"oe" 'LaTeX-environment
8 changes: 8 additions & 0 deletions init.el
Original file line number Diff line number Diff line change
@@ -15,9 +15,17 @@
(defconst user-home-directory
(expand-file-name (concat user-emacs-directory "../"))
"User home directory (~/).")
(defconst spacemacs-directory
(expand-file-name (concat user-emacs-directory "spacemacs/"))
"Spacemacs base directory.")
(defconst spacemacs-contrib-config-directory
(expand-file-name (concat user-emacs-directory "contrib/"))
"Spacemacs contribution layers base directory.")
(defconst spacemacs-cache-directory
(expand-file-name (concat user-emacs-directory ".cache/"))
"Spacemacs storage area for persistent files.")
(if (not (file-exists-p spacemacs-cache-directory))
(make-directory spacemacs-cache-directory))
(defconst user-dropbox-directory
(expand-file-name (concat user-home-directory "Dropbox/"))
"Dropbox directory.")
Loading

0 comments on commit 22bfd42

Please sign in to comment.