author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Wed, 31 Mar 2010 18:16:15 +0300 | |
changeset 360 | ddf042e3a518 |
parent 296 | a1447ce5751b |
child 382 | 1f499471d603 |
permissions | -rw-r--r-- |
179 | 1 |
-*- mode: outline; coding: utf-8 -*- |
18 | 2 |
|
219
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
3 |
* Variables. |
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
4 |
|
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
5 |
Select one of: |
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
6 |
|
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
7 |
(set 'variable value) |
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
8 |
(setq variable value) |
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
9 |
(defvar variable value "documentation") |
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
10 |
|
268
b99a51c4e605
Emacs treat text as local variable definition, escape text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
225
diff
changeset
|
11 |
or (replace <colon> with :) |
219
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
12 |
|
268
b99a51c4e605
Emacs treat text as local variable definition, escape text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
225
diff
changeset
|
13 |
# Local variables<colon> |
b99a51c4e605
Emacs treat text as local variable definition, escape text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
225
diff
changeset
|
14 |
# variable<colon> value |
b99a51c4e605
Emacs treat text as local variable definition, escape text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
225
diff
changeset
|
15 |
# End<colon> |
219
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
16 |
|
171
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
17 |
* Debugging. |
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
18 |
|
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
19 |
** Using edebug. |
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
20 |
|
177
02b79b857ee1
Use plain ascii chars instead of UTF-8.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
171
diff
changeset
|
21 |
Execute 'M-x edebug-defun' (also on 'C-u C-M-x') on defun in source code to |
171
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
22 |
enable debugging for desired function. When next time this function invoked |
213 | 23 |
you entered to its debugging (jumped to its source code). |
171
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
24 |
|
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
25 |
To start debug execute code which used debugged function. |
18 | 26 |
|
171
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
27 |
You can disable edebug on a function by evaluating the function again using |
177
02b79b857ee1
Use plain ascii chars instead of UTF-8.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
171
diff
changeset
|
28 |
'C-M-x'. |
171
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
29 |
|
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
30 |
** How debug func? |
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
31 |
|
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
32 |
Use M-x debug-on-entry and M-x cancel-debug-on-entry to control |
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
33 |
which functions will enter the debugger when called. |
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
34 |
|
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
35 |
When next time that function called automatically loaded debug-mode. |
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
36 |
|
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
37 |
** How debug ini file? |
18 | 38 |
|
213 | 39 |
When your ini has a bug, or when you load external files that cause |
18 | 40 |
errors, the bug is often hard to find, because the Emacs Lisp reader does not |
179 | 41 |
know about line numbers and files - it just knows an error happened, and |
42 |
that's it. |
|
18 | 43 |
|
171
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
44 |
*** Binary Search. |
18 | 45 |
|
86
72175e4fc069
Reformat and add CLI switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
44
diff
changeset
|
46 |
Select half of the file in a region, and M-x eval-region. Depending on whether |
72175e4fc069
Reformat and add CLI switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
44
diff
changeset
|
47 |
that causes the error or not, split this half or the other half again, and |
72175e4fc069
Reformat and add CLI switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
44
diff
changeset
|
48 |
repeat. |
72175e4fc069
Reformat and add CLI switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
44
diff
changeset
|
49 |
|
171
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
50 |
*** Elisp. |
18 | 51 |
|
86
72175e4fc069
Reformat and add CLI switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
44
diff
changeset
|
52 |
- Use a keyboard macro that moves forward one expression (sexp) and evaluates |
72175e4fc069
Reformat and add CLI switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
44
diff
changeset
|
53 |
it. |
72175e4fc069
Reformat and add CLI switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
44
diff
changeset
|
54 |
- Try C-x check-parens. |
72175e4fc069
Reformat and add CLI switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
44
diff
changeset
|
55 |
- Set (setq debug-on-error t). |
72175e4fc069
Reformat and add CLI switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
44
diff
changeset
|
56 |
|
171
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
57 |
*** CLI. |
18 | 58 |
|
86
72175e4fc069
Reformat and add CLI switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
44
diff
changeset
|
59 |
$ emacs --no-init-file --no-site-file --debug-init |
72175e4fc069
Reformat and add CLI switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
44
diff
changeset
|
60 |
|
171
8e806cddee36
Debugging emacs (about edebug).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
61 |
*** Simplified Binary Search. |
19 | 62 |
|
177
02b79b857ee1
Use plain ascii chars instead of UTF-8.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
171
diff
changeset
|
63 |
Add (error 'No error until here') in the middle of your file. If you get the |
02b79b857ee1
Use plain ascii chars instead of UTF-8.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
171
diff
changeset
|
64 |
error 'No error until here' when reloading the file, move the expression |
86
72175e4fc069
Reformat and add CLI switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
44
diff
changeset
|
65 |
towards the back of the file, otherwise towards the front of the file. |
181
4202927c15ac
Text based WWW browser for emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
66 |
|
223 | 67 |
** Call tree. |
68 |
||
69 |
Before byte compiling file execute |
|
70 |
||
71 |
(setq byte-compile-generate-call-tree t) |
|
72 |
||
181
4202927c15ac
Text based WWW browser for emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
73 |
* WWW. |
4202927c15ac
Text based WWW browser for emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
74 |
|
4202927c15ac
Text based WWW browser for emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
75 |
** Text based WWW browser. |
4202927c15ac
Text based WWW browser for emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
76 |
|
4202927c15ac
Text based WWW browser for emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
77 |
http://en.wikipedia.org/wiki/W3m |
4202927c15ac
Text based WWW browser for emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
78 |
http://emacs-w3m.namazu.org/ |
4202927c15ac
Text based WWW browser for emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
86
diff
changeset
|
79 |
http://www.gnu.org/software/w3/ |
212
5715a5193fd4
Sort and uniquify lines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
80 |
|
5715a5193fd4
Sort and uniquify lines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
81 |
* Tricks. |
5715a5193fd4
Sort and uniquify lines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
82 |
|
5715a5193fd4
Sort and uniquify lines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
83 |
** Sort and uniquify lines. |
5715a5193fd4
Sort and uniquify lines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
84 |
|
5715a5193fd4
Sort and uniquify lines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
85 |
Select region, type C-u M-| sort -u RET. |
5715a5193fd4
Sort and uniquify lines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
86 |
|
5715a5193fd4
Sort and uniquify lines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
87 |
With transient-mark-mode and delete-selection-mode enabled: select region, |
5715a5193fd4
Sort and uniquify lines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
88 |
type M-| sort -u RET to replace selection with sorted and uniquified lines. |
5715a5193fd4
Sort and uniquify lines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
89 |
|
269
77c8799aa8de
Finding emacs packages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
90 |
* Finding emacs packages. |
77c8799aa8de
Finding emacs packages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
91 |
|
77c8799aa8de
Finding emacs packages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
92 |
See |
77c8799aa8de
Finding emacs packages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
93 |
|
77c8799aa8de
Finding emacs packages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
94 |
http://anc.ed.ac.uk/~stephen/emacs/ell.html |
77c8799aa8de
Finding emacs packages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
95 |
http://www.emacswiki.org/emacs/WikifiedEmacsLispList |
296 | 96 |
http://tromey.com/elpa/index.html |
97 |
Emacs Lisp Package Archive |
|
98 |
||
99 |
** ELPA. |
|
100 |
||
101 |
ELPA goal is to make it simple to install, use, and upgrade Emacs Lisp |
|
102 |
packages. |
|
103 |
||
104 |
http://tromey.com/elpa/upload.html |
|
105 |
how to contribute |
|
270 | 106 |
|
107 |
* Compiling emacs. |
|
108 |
||
109 |
** Windows. |
|
110 |
||
111 |
Get MSYS for POSIX shell and utilities . Get MinGW for GCC. Get Gnuwin32 for |
|
112 |
jpeg, ungif, tiff, xpm, png, zlib libraries. |
|
113 |
||
114 |
Read emacs/nt/INSTALL. |
|
115 |
||
116 |
$ cmd |
|
117 |
$ cd emacs\nt |
|
275
3b1d21da03e3
Correct configure.bat options.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
270
diff
changeset
|
118 |
$ configure.bat --prefix %INST_ROOT% --with-gcc --cflags -I%GNUWIN32_ROOT%/include --ldflags -L%GNUWIN32_ROOT%/lib --ldflags -lregex |
270 | 119 |
$ make bootstrap |
120 |
$ make info |
|
121 |
$ make install |
|
280 | 122 |
|
123 |
* Documentation. |
|
124 |
||
125 |
** Elisp documentation. |
|
126 |
||
283
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
127 |
;;; <file-name>.el --- <one-line-description> |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
128 |
|
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
129 |
;; Copyright (C) <years> <person> |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
130 |
|
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
131 |
;; Author: <person> <mail> |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
132 |
;; Maintainer: <person> <mail> |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
133 |
;; Created: <date> |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
134 |
;; Version: <version> |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
135 |
;; Keywords: <look for 'finder-by-keyword' output, separate by comma> |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
136 |
;; URL: <file-location> |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
137 |
|
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
138 |
;;; Commentary: |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
139 |
<bla-bla-bla> |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
140 |
;;; Code: |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
141 |
<lisp-code> |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
142 |
;;; <file-name> ends here |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
143 |
|
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
144 |
See |
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
145 |
|
74036be9b6f9
Elisp documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
146 |
http://www.gnu.org/software/emacs/elisp-manual/html_node/Library-Headers.html |
280 | 147 |
http://www.emacswiki.org/cgi-bin/wiki/ElispAreaConventions |
148 |
||
149 |
*** CheckDoc. |
|
150 |
||
151 |
CheckDoc checks your EmacsLisp code for errors in documentation and style. |
|
152 |
||
153 |
http://cedet.sourceforge.net/checkdoc.shtml |
|
154 |
home page before including it into GNU Emacs |
|
155 |
http://www.emacswiki.org/emacs/CheckDoc |