|
1 .. -*- coding: utf-8; -*- |
|
2 |
|
3 ======== |
|
4 Emacs. |
|
5 ======== |
|
6 .. contents:: |
|
7 |
|
8 About. |
|
9 ====== |
|
10 |
|
11 http://elpa.gnu.org/ |
|
12 Packages for Emacs. This requires Emacs version 24.1 or |
|
13 higher. |
|
14 |
|
15 Getting help. |
|
16 ============= |
|
17 |
|
18 * http://news.gmane.org/gmane.emacs.help |
|
19 * http://news.gmane.org/gmane.emacs.announce |
|
20 * http://news.gmane.org/gmane.emacs.auctex.announce |
|
21 |
|
22 Installing Emacs. |
|
23 ================= |
|
24 |
|
25 http://ftp.gnu.org/gnu/emacs/windows/ |
|
26 Clean GNU Emacs for 32-bit Windows |
|
27 http://emacsformacosx.com/ |
|
28 Clean GNU Emacs for Mac OS X |
|
29 |
|
30 Variables. |
|
31 ========== |
|
32 |
|
33 Select one of:: |
|
34 |
|
35 (set 'variable value) |
|
36 (setq variable value) |
|
37 (defvar variable value "documentation") |
|
38 |
|
39 or (replace <colon> with:: |
|
40 |
|
41 # Local variables<colon> |
|
42 # variable<colon> value |
|
43 # End<colon> |
|
44 |
|
45 Debugging. |
|
46 ========== |
|
47 |
|
48 Evaluating elisp expression on the fly. |
|
49 --------------------------------------- |
|
50 |
|
51 Type M-: than lisp expression than type RET. |
|
52 |
|
53 Or in any buffer place point at the end of lisp expression and type C-x C-e. |
|
54 |
|
55 Or invoke elisp "shell" by M-x ielm. |
|
56 |
|
57 What functions and variables Emacs load and from which files? |
|
58 ------------------------------------------------------------- |
|
59 |
|
60 See value of variable ``load-history`` (by C-h v load-history RET). |
|
61 |
|
62 Using edebug. |
|
63 ------------- |
|
64 |
|
65 Execute ``M-x edebug-defun`` (also on ``C-u C-M-x``) on defun in source code to |
|
66 enable debugging for desired function. When next time this function invoked |
|
67 you entered to its debugging (jumped to its source code). |
|
68 |
|
69 To start debug execute code which used debugged function. |
|
70 |
|
71 You can disable edebug on a function by evaluating the function again using |
|
72 ``C-M-x``. |
|
73 |
|
74 How debug func? |
|
75 --------------- |
|
76 |
|
77 Use M-x debug-on-entry and M-x cancel-debug-on-entry to control |
|
78 which functions will enter the debugger when called. |
|
79 |
|
80 When next time that function called automatically loaded debug-mode. |
|
81 |
|
82 How debug ini file? |
|
83 ------------------- |
|
84 |
|
85 When your ini has a bug, or when you load external files that cause |
|
86 errors, the bug is often hard to find, because the Emacs Lisp reader does not |
|
87 know about line numbers and files - it just knows an error happened, and |
|
88 that's it. |
|
89 |
|
90 Try run Emacs with ``--debug-init`` to see backtrace. |
|
91 |
|
92 How debug long running command? |
|
93 ------------------------------- |
|
94 |
|
95 M-x debug-on-quit RET`` and then just hit `C-g`` next time it gets ``stuck`` |
|
96 somewhere. |
|
97 |
|
98 Check if bug in ini file not in Emacs itself. |
|
99 --------------------------------------------- |
|
100 |
|
101 First run Emacs without loading anything:: |
|
102 |
|
103 $ emacs --no-init-file --no-site-file |
|
104 |
|
105 or more shortly (as ``-Q`` imply ``-q``, ``--no-site-file``, and ``--no-splash`` |
|
106 together):: |
|
107 |
|
108 $ emacs -Q |
|
109 |
|
110 If bug not reproduced bug lies in ini files! |
|
111 |
|
112 Debug by binary search. |
|
113 ----------------------- |
|
114 |
|
115 Select half of the file in a region, and M-x eval-region. Depending on whether |
|
116 that causes the error or not, split this half or the other half again, and |
|
117 repeat. |
|
118 |
|
119 Simplified Binary Search. |
|
120 ~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
121 |
|
122 Add (error ``No error until here``) in the middle of your file. If you get the |
|
123 error ``No error until here`` when reloading the file, move the expression |
|
124 towards the back of the file, otherwise towards the front of the file. |
|
125 |
|
126 Elisp debug tips. |
|
127 ----------------- |
|
128 |
|
129 - Use a keyboard macro that moves forward one expression (sexp) and evaluates |
|
130 it. |
|
131 - Try C-x check-parens. |
|
132 |
|
133 Enable debug mode (also on loading). |
|
134 ------------------------------------ |
|
135 |
|
136 Set in source:: |
|
137 |
|
138 (setq debug-on-error t) |
|
139 |
|
140 or invoke Emacs like:: |
|
141 |
|
142 $ emacs --debug-init |
|
143 |
|
144 where ``--debug-init`` binds ``debug-on-error`` to ``t`` while loading the init |
|
145 file, and bypasses the ``condition-case`` which normally catches errors in the |
|
146 init file. |
|
147 |
|
148 Call tree. |
|
149 ---------- |
|
150 |
|
151 Before byte compiling file execute:: |
|
152 |
|
153 (setq byte-compile-generate-call-tree t) |
|
154 |
|
155 Veiw buffer local variables. |
|
156 ---------------------------- |
|
157 :: |
|
158 |
|
159 (pp (buffer-local-variables)) |
|
160 |
|
161 Emacs profiling. |
|
162 ================ |
|
163 |
|
164 benchmark.el. |
|
165 ------------- |
|
166 :: |
|
167 |
|
168 (benchmark-run 1 (revert-buffer)) |
|
169 |
|
170 elp.el. |
|
171 ------- |
|
172 |
|
173 Enter a prefix for ``M-x elp-instrument-package``, perform action and see result |
|
174 by ``M-x elp-results``. To perform new measurement don't forget to run |
|
175 ``M-x elp-reset-all``. |
|
176 |
|
177 WWW. |
|
178 ==== |
|
179 |
|
180 Text based WWW browser. |
|
181 ----------------------- |
|
182 |
|
183 http://en.wikipedia.org/wiki/W3m |
|
184 http://emacs-w3m.namazu.org/ |
|
185 http://www.gnu.org/software/w3/ |
|
186 |
|
187 Tricks. |
|
188 ======= |
|
189 |
|
190 Sort and uniquify lines. |
|
191 ------------------------ |
|
192 |
|
193 Select region, type ``C-u M-| sort -u RET``. |
|
194 |
|
195 With transient-mark-mode and delete-selection-mode enabled: select region, |
|
196 type M-| sort -u RET to replace selection with sorted and uniquified lines. |
|
197 |
|
198 Determining running environment/platform. |
|
199 ========================================= |
|
200 |
|
201 Check variables:: |
|
202 |
|
203 emacs-major-version |
|
204 emacs-minor-version |
|
205 window-system - ``nil`` if in terminal, ``w32`` if native Windows build, ``x`` if under X Window |
|
206 window-system-version - for windows only |
|
207 window-size-fixed |
|
208 operating-system-release - release of the operating system Emacs is running on |
|
209 system-configuration - like configuration triplet: cpu-manufacturer-os |
|
210 system-configuration-options |
|
211 system-name - host name of the machine you are running on |
|
212 system-time-locale |
|
213 system-type - indicating the type of operating system you are using: |
|
214 ``gnu`` (GNU Hurd), |
|
215 ``gnu/linux``, |
|
216 ``gnu/kfreebsd``, ``berkeley-unix`` for (FreeBSD), |
|
217 ``darwin`` (GNU-Darwin, Mac OS X), |
|
218 ``ms-dos``, |
|
219 ``windows-nt``, |
|
220 ``cygwin`` |
|
221 system-uses-terminfo |
|
222 dynamic-library-alist or deprecated image-library-alist |
|
223 - alist of image types vs external libraries needed to display them |
|
224 |
|
225 and check functions:: |
|
226 |
|
227 (fboundp ...) - return t if SYMBOL's function definition is not void |
|
228 (featurep ...) - returns t if FEATURE is present in this Emacs |
|
229 (display-graphic-p) - return non-nil if DISPLAY is a graphic display; graphical |
|
230 displays are those which are capable of displaying several |
|
231 frames and several different fonts at once |
|
232 (display-multi-font-p) - same as ``display-graphic-p`` |
|
233 (display-multi-frame-p) - same as ``display-graphic-p`` |
|
234 (display-color-p) - return t if DISPLAY supports color |
|
235 (display-images-p) - return non-nil if DISPLAY can display images |
|
236 (display-grayscale-p) - return non-nil if frames on DISPLAY can display shades of gray |
|
237 (display-mouse-p) - return non-nil if DISPLAY has a mouse available |
|
238 (display-popup-menus-p) - return non-nil if popup menus are supported on DISPLAY |
|
239 (display-selections-p) - return non-nil if DISPLAY supports selections |
|
240 |
|
241 Run those checks as below:: |
|
242 |
|
243 (when window-system ...) |
|
244 (when (eq window-system 'x) ...) |
|
245 (when (>= emacs-major-version 22) ...) |
|
246 (when (fboundp '...) ...) |
|
247 (when (featurep '...) ...) |
|
248 |
|
249 Compiling emacs. |
|
250 ================ |
|
251 |
|
252 Windows. |
|
253 -------- |
|
254 |
|
255 Get MSYS for POSIX shell and utilities . Get MinGW for GCC. Get Gnuwin32 for |
|
256 jpeg, ungif, tiff, xpm, png, zlib libraries. |
|
257 |
|
258 Read emacs/nt/INSTALL:: |
|
259 |
|
260 $ cmd |
|
261 $ cd emacs\nt |
|
262 $ configure.bat --prefix %INST_ROOT% --with-gcc --cflags -I%GNUWIN32_ROOT%/include --ldflags -L%GNUWIN32_ROOT%/lib --ldflags -lregex |
|
263 $ make bootstrap |
|
264 $ make info |
|
265 $ make install |
|
266 |
|
267 Documentation. |
|
268 ============== |
|
269 |
|
270 Elisp documentation. |
|
271 -------------------- |
|
272 :: |
|
273 |
|
274 ;;; <file-name>.el --- <one-line-description> |
|
275 |
|
276 ;; Copyright (C) <years> <person> |
|
277 |
|
278 ;; Author: <person> <mail> |
|
279 ;; Maintainer: <person> <mail> |
|
280 ;; Created: <date> |
|
281 ;; Version: <version> |
|
282 ;; Keywords: <look for ``finder-by-keyword`` output, separate by comma> |
|
283 ;; URL: <file-location> |
|
284 |
|
285 ;;; Commentary: |
|
286 <bla-bla-bla> |
|
287 ;;; Code: |
|
288 <lisp-code> |
|
289 ;;; <file-name> ends here |
|
290 |
|
291 See |
|
292 |
|
293 * http://www.gnu.org/software/emacs/elisp-manual/html_node/Library-Headers.html |
|
294 * http://www.emacswiki.org/cgi-bin/wiki/ElispAreaConventions |
|
295 |
|
296 CheckDoc. |
|
297 --------- |
|
298 |
|
299 CheckDoc checks your EmacsLisp code for errors in documentation and style. |
|
300 |
|
301 http://cedet.sourceforge.net/checkdoc.shtml |
|
302 home page before including it into GNU Emacs |
|
303 http://www.emacswiki.org/emacs/CheckDoc |
|
304 CheckDoc |
|
305 |
|
306 Installing Emacs. |
|
307 ================= |
|
308 |
|
309 From sources. |
|
310 ------------- |
|
311 |
|
312 http://ftp.gnu.org/pub/gnu/emacs |
|
313 |
|
314 Windows. |
|
315 -------- |
|
316 |
|
317 http://ftp.gnu.org/pub/gnu/emacs/windows |
|
318 Releases for Windows. |
|
319 http://alpha.gnu.org/gnu/emacs/windows |
|
320 Beta releases for Windows. |
|
321 |
|
322 Debian. |
|
323 ------- |
|
324 :: |
|
325 |
|
326 $ apt-get install emacs |
|
327 |
|
328 Emacs paths. |
|
329 ============ |
|
330 :: |
|
331 |
|
332 source-directory data-directory doc-directory exec-directory |
|
333 invocation-directory trash-directory tutorial-directory user-emacs-directory |
|
334 widget-image-directory |
|
335 |
|
336 Emacs games. |
|
337 ============ |
|
338 :: |
|
339 |
|
340 hanoi hanoi-unix life pong tetris gomoku |
|
341 |
|
342 Long lines. |
|
343 =========== |
|
344 |
|
345 (setq longlines-show-hard-newlines t) |
|
346 (setq longlines-wrap-follows-window-size t) |
|
347 (longlines-mode 1) |
|
348 |
|
349 Printing Emacs structures. |
|
350 ========================== |
|
351 |
|
352 (message "%S" '(a b 123 "hello" 'set)) |
|
353 (pp '(a b 123 "hello" 'set)) |
|
354 (prin1-to-string '(1 2)) |
|
355 |
|
356 (symbol-name 'f) |
|
357 (symbol-value 'f) |
|
358 (symbol-function 'f) |
|
359 (symbol-plist 'f) |
|
360 |
|
361 (local-variable-p var buffer) |
|
362 |
|
363 File manager. |
|
364 ============= |
|
365 |
|
366 http://www.emacswiki.org/emacs/Sunrise_Commander |
|
367 |
|
368 Semantic. |
|
369 ========= |
|
370 |
|
371 semantic-lex-spp-describe |
|
372 Describe the current list of spp macros. |
|
373 semantic-lex-c-preprocessor-symbol-file |
|
374 List of C/C++ files that contain preprocessor macros for the C lexer. |
|
375 |
|
376 Debugging C code. |
|
377 ================= |
|
378 |
|
379 -*- mode: grep; mode: auto-revert-tail; default-directory: "~/devel/proj" -*- |
|
380 |
|
381 XML modes. |
|
382 ========== |
|
383 |
|
384 XSLT-process. |
|
385 ------------- |
|
386 |
|
387 XSLT-process is a minor mode for GNU Emacs/XEmacs which transforms it into a powerful editor with |
|
388 XSLT processing and debugging capabilities. |
|
389 |
|
390 The mode currently supports two Java XSLT processors: |
|
391 |
|
392 * Saxon - fully supported, including debugging capabilities. |
|
393 * Xalan - fully supported, including debugging capabilities. |
|
394 |
|
395 http://xslt-process.sourceforge.net/ |
|
396 home page |
|
397 |
|
398 Useful program logging. |
|
399 ======================= |
|
400 |
|
401 Put first line to your log file, you must replace ``default-directory`` to dir where you build |
|
402 program:: |
|
403 |
|
404 -*- mode: compilation-minor; mode: auto-revert-tail; default-directory: "~/devel/proj" -*- |
|
405 |
|
406 Program must use one of supported by ``compilation-minor-mode`` (see |
|
407 ``compilation-error-regexp-alist``), like:: |
|
408 |
|
409 printf(__FILE__ ":%d: %s\n", __LINE__, msg); /* msg - user defined string */ |
|
410 |
|
411 or in second form (in this case line number included in format string, so easy searchable in |
|
412 debugger):: |
|
413 |
|
414 #define NUM2STR(x) STR(x) |
|
415 #define STR(x) #x |
|
416 |
|
417 printf(__FILE__ ":" NUM2STR(__LINE__) ": %s\n", msg); |
|
418 |
|
419 Or some faster use ``grep-mode``, but you restricted with GNU like error format:: |
|
420 |
|
421 -*- mode: grep; mode: auto-revert-tail; default-directory: "~/devel/proj" -*- |
|
422 |
|
423 Edit HTML. |
|
424 ========== |
|
425 |
|
426 * psgml-mode |
|
427 * nxml-mode |
|
428 * sgml-mode |
|
429 |
|
430 html-helper-mode. |
|
431 ----------------- |
|
432 |
|
433 Highlighting, autocompletion, and auto-insertion of closing tags. |
|
434 |
|
435 http://www.emacswiki.org/emacs/HtmlHelperMode |
|
436 http://savannah.nongnu.org/projects/baol-hth/ |
|
437 http://www.nongnu.org/baol-hth/ |
|
438 |
|
439 Source. |
|
440 ======= |
|
441 |
|
442 Get main development sources:: |
|
443 |
|
444 $ bzr init-repo --2a emacs |
|
445 $ cd emacs |
|
446 $ bzr branch http://bzr.savannah.gnu.org/r/emacs/trunk trunk |
|
447 $ cd trunk |
|
448 $ bzr bind http://bzr.savannah.gnu.org/r/emacs/trunk |
|
449 |
|
450 To update with latest changes:: |
|
451 |
|
452 $ cd emacs/trunk |
|
453 $ bzr update |
|
454 |
|
455 See: |
|
456 |
|
457 http://www.emacswiki.org/emacs/BzrForEmacsDevs |
|
458 |
|
459 Emacs Git mirror. |
|
460 ----------------- |
|
461 |
|
462 http://www.emacswiki.org/emacs/EmacsFromGit |
|
463 |
|
464 Patch. |
|
465 ====== |
|
466 |
|
467 http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5719 |
|
468 [patch] fix bat-generic-mode highlighting pattern for CLI |
|
469 switch. |
|
470 |
|
471 How report bug. |
|
472 =============== |
|
473 |
|
474 Visit http://debbugs.gnu.org or M-x report-emacs-bug. |
|
475 |
|
476 |
|
477 Finding emacs packages. |
|
478 ======================= |
|
479 |
|
480 * http://anc.ed.ac.uk/~stephen/emacs/ell.html |
|
481 * http://www.emacswiki.org/emacs/WikifiedEmacsLispList |
|
482 * http://www.emacswiki.org/emacs/RationalElispPackaging |
|
483 |
|
484 http://tromey.com/elpa/index.html |
|
485 Emacs Lisp Package Archive |
|
486 |
|
487 |
|
488 EPLA. |
|
489 ----- |
|
490 |
|
491 ELPA goal is to make it simple to install, use, and upgrade Emacs Lisp packages. |
|
492 |
|
493 |
|
494 |
|
495 Currently (2011-02-15) available such sources:: |
|
496 |
|
497 (setq package-archives '(("ELPA" . "http://tromey.com/elpa/") |
|
498 ("gnu" . "http://elpa.gnu.org/packages/") |
|
499 ("marmalade" . "http://marmalade-repo.org/packages/") |
|
500 )) |
|
501 |
|
502 * http://www.emacswiki.org/emacs/ELPA |
|
503 * http://marmalade-repo.org/ |
|
504 |
|
505 http://elpa.gnu.org/ |
|
506 official GNU Emacs Lisp Package Archive |
|
507 http://tromey.com/elpa/ |
|
508 old Emacs Lisp Package Archive home page |
|
509 http://tromey.com/elpa/upload.html |
|
510 how to contribute |
|
511 |
|
512 Emacswiki. |
|
513 ---------- |
|
514 |
|
515 http://www.emacswiki.org/emacs/ElispArea |
|
516 http://www.emacswiki.org/emacs/WikifiedEmacsLispList |
|
517 |
|
518 emacsmirror. |
|
519 ------------ |
|
520 |
|
521 https://github.com/emacsmirror/p/wiki |
|
522 http://www.emacsmirror.org/ |
|
523 http://www.emacswiki.org/emacs/Emacsmirror |
|
524 |
|
525 Funny Emacs modes. |
|
526 ================== |
|
527 |
|
528 glasses |
|
529 Minor mode for making identifiers likeThis readable. |
|
530 |
|
531 Useful commands. |
|
532 ================ |
|
533 :: |
|
534 |
|
535 flush-lines keep-lines |
|
536 align-regexp |
|
537 C-x C-o |
|
538 M-PageUp/M-PageDown |
|
539 command-history |
|
540 M-= |
|
541 C-x l |
|
542 locate-library find-library |
|
543 features load-history |
|
544 |