Tag Archive for 'lisp'

How to compile all files in directory with Emacs

1
C-u 0 M-x byte-recompile-directory

will compile all the .el files in the directory and in all subdirectories below.

The C-u 0 part is to make it not ask about every .el file that does not have a .elc counterpart.

Emacs PHP 数组缩进问题解决

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(add-hook 'php-mode-hook
          (lambda ()
            (c-set-style "bsd")
            (setq c-indent-level 4)
            (setq c-continued-statement-offset 4)
            (setq c-brace-offset -4)
            (setq c-argdecl-indent 0)
            (setq c-label-offset -4)
            (setq c-basic-offset 4)
            (setq tab-width 4)
            (setq indent-tabs-mode nil)
            (c-set-offset 'case-label '+)
            (c-set-offset 'arglist-close 'c-lineup-arglist-operators)
            (c-set-offset 'arglist-intro '+)
            (c-set-offset 'arglist-cont-nonempty 'c-lineup-math)))

Emacs skeleton-pair Funcionality

> I have enabled skeleton-pair funcionality with what I have found in here:
> http://littlechina.org/~cmarcelo/paren-experiment.el
> It works in most modes, but in C++ mode it only works for [ and not for (,{
> or “.

Try:

1
2
(define-key c-mode-base-map (kbd "(") #'skeleton-pair-insert-maybe)
;; same for the other keys here...

or

1
2
3
4
5
(add-hook 'c-mode-common-hook
#'(lambda ()
(local-set-key (kbd "(") #'skeleton-pair-insert-maybe)
;; same for the other keys here...
))

If you don’t like the way skeleton decides whether to insert a pair or
not but to insert a pair always use `insert-pair‘ instead of
`skeleton-pair-insert-maybe‘.

Some thing others.