[FAQ.org] Make `BEGIN_` blocks uniform

This commit is contained in:
Fabien Dubosson 2016-01-31 20:53:55 +01:00
parent 125a553dae
commit 92a689a499
1 changed files with 64 additions and 64 deletions

View File

@ -112,10 +112,10 @@ conflict is to wrap your =org= config code in a =with-eval-after-load= block
like this:
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'org
;; here goes your Org config :)
;; ....
)
(with-eval-after-load 'org
;; here goes your Org config :)
;; ....
)
#+END_SRC
** Why is Spacemacs hanging on startup?
@ -127,27 +127,27 @@ Try using these settings in the ~user-init~ function in your ~.spacemacs~
configuration:
#+BEGIN_SRC emacs-lisp
(setq tramp-ssh-controlmaster-options
"-o ControlMaster=auto -o ControlPath='tramp.%%C' -o ControlPersist=no")
(setq tramp-ssh-controlmaster-options
"-o ControlMaster=auto -o ControlPath='tramp.%%C' -o ControlPersist=no")
#+END_SRC
See [[https://github.com/syl20bnr/spacemacs/issues/3422#issuecomment-148919047][issue #3422]] and [[https://github.com/emacs-helm/helm/issues/1000#issuecomment-119487649][helm issue #1000]] for details. If for any reason this code is
not working, you can try to put these settings directly in =~/.ssh/config=:
#+begin_SRC ssh
#+BEGIN_SRC ssh
Host *
ControlMaster auto
ControlPath ~/.ssh/master -%r@%h:%p
ControlPersist = no
#+end_SRC
#+END_SRC
** Why does =helm-M-x= (~SPC :~) not accept the prefix argument?
If you try to run =helm-M-x= with the prefix argument (i.e. ~SPC u SPC :~) it
will fail with this message:
#+begin_verse
#+BEGIN_VERSE
Error: Specifying a prefix arg before calling helm-M-x
#+end_verse
#+END_VERSE
Instead, call =helm-M-x= first, select the command you want to run, and press
~C-u~ before pressing ~RETURN~. For instance: ~SPC : org-reload C-u RET~
@ -184,18 +184,18 @@ To completely disable a package and effectively uninstalling it even if it is
part of your used layers, look for the variable =dotspacemacs-excluded-packages=
in your dotfile and add the package name to it:
#+begin_src emacs-lisp
(setq-default dotspacemacs-excluded-packages '(package1 package2 ...))
#+end_src
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-excluded-packages '(package1 package2 ...))
#+END_SRC
** Disable a package only for a specific major-mode?
This is done by removing the hook added by Spacemacs. For example to remove
=flycheck= support in python buffers, look for the function
=dotspacemacs/user-config= in your dotfile and add the following code:
#+begin_src emacs-lisp
(remove-hook 'python-mode-hook 'flycheck-mode)
#+end_src
#+BEGIN_SRC emacs-lisp
(remove-hook 'python-mode-hook 'flycheck-mode)
#+END_SRC
*Hint* to know the name of the major-mode of the current buffer press: ~SPC h d
v major-mode RET~
@ -206,9 +206,9 @@ It may be handy to disable =company= for a given mode if you plan on configuring
=spacemacs|disable-company= in the function =dotspacemacs/user-config= of your
dotfile. The following snippet disables company for =python-mode=:
#+begin_src emacs-lisp
(spacemacs|disable-company python-mode)
#+end_src
#+BEGIN_SRC emacs-lisp
(spacemacs|disable-company python-mode)
#+END_SRC
** Change special buffer rules?
To change the way spacemacs marks buffers as useless, you can customize
@ -217,58 +217,58 @@ useless. The variable =spacemacs-useful-buffers-regexp= marks buffers matching
the regexp as useful buffers. Both can be customized the same way.
Examples:
#+begin_src emacs-lisp
;; Only mark helm buffers as useless
(setq spacemacs-useless-buffers-regexp '("\\*helm\.\+\\*"))
#+BEGIN_SRC emacs-lisp
;; Only mark helm buffers as useless
(setq spacemacs-useless-buffers-regexp '("\\*helm\.\+\\*"))
;; Marking the *Messages* buffer as useful
(push "\\*Messages\\*" spacemacs-useful-buffers-regexp)
#+end_src
;; Marking the *Messages* buffer as useful
(push "\\*Messages\\*" spacemacs-useful-buffers-regexp)
#+END_SRC
** Enable navigation by visual lines?
Add the following snippet to your =dostpacemacs/config= function:
#+begin_src emacs-lisp
;; Make evil-mode up/down operate in screen lines instead of logical lines
(define-key evil-motion-state-map "j" 'evil-next-visual-line)
(define-key evil-motion-state-map "k" 'evil-previous-visual-line)
;; Also in visual mode
(define-key evil-visual-state-map "j" 'evil-next-visual-line)
(define-key evil-visual-state-map "k" 'evil-previous-visual-line)
#+end_src
#+BEGIN_SRC emacs-lisp
;; Make evil-mode up/down operate in screen lines instead of logical lines
(define-key evil-motion-state-map "j" 'evil-next-visual-line)
(define-key evil-motion-state-map "k" 'evil-previous-visual-line)
;; Also in visual mode
(define-key evil-visual-state-map "j" 'evil-next-visual-line)
(define-key evil-visual-state-map "k" 'evil-previous-visual-line)
#+END_SRC
** Disable evilification of a mode?
You can ensure a mode opens in emacs state by using =evil-set-initial-state=.
#+begin_src emacs-lisp
(evil-set-initial-state 'magit-status-mode 'emacs)
#+end_src
#+BEGIN_SRC emacs-lisp
(evil-set-initial-state 'magit-status-mode 'emacs)
#+END_SRC
You can also do this using buffer name regular expressions. E.g. for magit,
which has a number of different major modes, you can catch them all with
#+begin_src emacs-lisp
(push '("*magit" . emacs) evil-buffer-regexps)
#+end_src
#+BEGIN_SRC emacs-lisp
(push '("*magit" . emacs) evil-buffer-regexps)
#+END_SRC
This should make all original magit bindings work in the major modes in
question. To enable the leader key in this case, you may have to define a
binding in the mode's map, e.g. for =magit-status-mode=,
#+begin_src emacs-lisp
(with-eval-after-load 'magit
(define-key magit-status-mode-map
(kbd dotspacemacs-leader-key) spacemacs-default-map))
#+end_src
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'magit
(define-key magit-status-mode-map
(kbd dotspacemacs-leader-key) spacemacs-default-map))
#+END_SRC
** Include underscores in word motions?
You can modify the syntax table of the mode in question. For example, for Python
mode:
#+begin_src emacs-lisp
(with-eval-after-load 'python
(modify-syntax-entry ?_ "w" python-mode-syntax-table))
#+end_src
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'python
(modify-syntax-entry ?_ "w" python-mode-syntax-table))
#+END_SRC
** Setup =$PATH=?
Some layers require certain tools to be available on your =$PATH=. This means
@ -300,7 +300,7 @@ by calling =echo $PATH=. But you also should verify that =$PATH= is set properly
in your environment. To do so call following command in your terminal.
#+BEGIN_SRC sh
$ env | grep "PATH"
env | grep "PATH"
#+END_SRC
This is the value that will be used by Emacs. So it must contain =~/.local/bin=.
@ -323,32 +323,32 @@ It is possible to change a leader key by binding its keymap to another sequence.
For instance, if you want to switch ~SPC S~ (spelling) with ~SPC d~ (used by
dash) to make the former easier to reach, you can use:
#+begin_src emacs-lisp
#+BEGIN_SRC emacs-lisp
(defun dear-leader/swap-keys (key1 key2)
(let ((map1 (lookup-key spacemacs-default-map key1))
(map2 (lookup-key spacemacs-default-map key2)))
(spacemacs/set-leader-keys key1 map2 key2 map1)))
(dear-leader/swap-keys "S" "d")
#+end_src
#+END_SRC
If you want to define your own alias, like using ~SPC é~ (because it's a not
used key on your keyboard-layout for instance) for accessing ~SPC w~ (windows
management), you can use this:
#+begin_src emacs-lisp
#+BEGIN_SRC emacs-lisp
(defun dear-leader/alias-of (key1 key2)
(let ((map (lookup-key spacemacs-default-map key2)))
(spacemacs/set-leader-keys key1 map)))
(dear-leader/alias-of "é" "w")
#+end_src
#+END_SRC
** Restore the sentence delimiter to two spaces?
To restore the sentence delimiter to two spaces, add the following code to the
=dotspacemacs/user-init= function of your =.spacemacs=:
#+begin_src emacs-lisp
#+BEGIN_SRC emacs-lisp
(setq sentence-end-double-space t)
#+end_src
#+END_SRC
** Prevent the visual selection overriding my system clipboard?
On some operating systems, there is only one clipboard for both *copied* and
@ -358,19 +358,19 @@ clipboard, where normally goes the *copied* text. This can be corrected by
adding the following code to the =dotspacemacs/user-config= of your
=.spacemacs=:
#+begin_src emacs-lisp
#+BEGIN_SRC emacs-lisp
(fset 'evil-visual-update-x-selection 'ignore)
#+end_src
#+END_SRC
** Make spell-checking support curly quotes (or any other character)?
To have spell-checking support curly quotes (or any other character), you need
to add a new entry to =ispell-local-dictionary-alist=, by adding for example the
following code in the =dotspacemacs/user-config= of your =.spacemacs=:
#+begin_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(add-to-list 'ispell-local-dictionary-alist
(quote ("my_english" "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-d" "en_US") nil utf-8)))
#+end_SRC
#+END_SRC
You can then add any regular expression you want in the fourth argument (i.e.
add a symbol within =[']=) to make it supported. Consult the help of
@ -384,9 +384,9 @@ Spacemacs can be used as the =$EDITOR= (or =$GIT_EDITOR=) for editing git
commits messages. To enable this you have to add the following line to your
=dotspacemacs/user-config=:
#+begin_src emacs-lisp
#+BEGIN_SRC emacs-lisp
(global-git-commit-mode t)
#+end_src
#+END_SRC
** Try Spacemacs without modifying my existing Emacs configuration?
Emacs' ability to use any directory as the home for launching it allows us to
@ -394,7 +394,7 @@ try out Spacemacs (or any other Emacs configuration we desire) without having to
go through the trouble of backing up our =~/.emacs.d= directory and then cloning
the new configuration. This can be achieved easily using the following steps:
#+BEGIN_SRC shell
#+BEGIN_SRC sh
mkdir ~/spacemacs
git clone git@github.com:syl20bnr/spacemacs.git ~/spacemacs/.emacs.d
HOME=~/spacemacs emacs
@ -416,9 +416,9 @@ support included such as [[http://emacsbinw64.sourceforge.net/][this one]].
** Why are all packages unavailable?
Check if your Emacs has HTTPS capabilities by doing =M-:= and then:
#+begin_src emacs-lisp
#+BEGIN_SRC emacs-lisp
(gnutls-available-p)
#+end_src
#+END_SRC
If this returns =nil=, you need to install the GnuTLS DDL file in the same
directory as Emacs. See [[https://www.gnu.org/software/emacs/manual/html_mono/emacs-gnutls.html#Help-For-Users][here]] for instructions.