author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Tue, 01 Dec 2009 15:24:51 +0200 | |
changeset 239 | 661b792c6603 |
parent 225 | 0de8b66b6f49 |
child 268 | b99a51c4e605 |
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 |
|
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
11 |
or |
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
12 |
|
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
13 |
# Local variables: |
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
14 |
# variable: value |
a6a5839b7423
Set variables in emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
182
diff
changeset
|
15 |
# End: |
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 |