emacs.rst
changeset 180 f6dc9574b69d
parent 179 e225b746945d
child 182 5e9ea846a8c3
equal deleted inserted replaced
176:5181378e42af 180:f6dc9574b69d
     1 -*- mode: outline -*-
     1 -*- mode: outline; coding: utf-8 -*-
     2 
     2 
     3 * Debugging.
     3 * Debugging.
     4 
     4 
     5 ** Using edebug.
     5 ** Using edebug.
     6 
     6 
     7 Execute ‘M-x edebug-defun’ (also on ‘C-u C-M-x’) on defun in source code to
     7 Execute 'M-x edebug-defun' (also on 'C-u C-M-x') on defun in source code to
     8 enable debugging for desired function. When next time this function invoked
     8 enable debugging for desired function. When next time this function invoked
     9 you entered to its debugging (jamped to its source code).
     9 you entered to its debugging (jamped to its source code).
    10 
    10 
    11 To start debug execute code which used debugged function.
    11 To start debug execute code which used debugged function.
    12 
    12 
    13 You can disable edebug on a function by evaluating the function again using
    13 You can disable edebug on a function by evaluating the function again using
    14 ‘C-M-x’.
    14 'C-M-x'.
    15 
    15 
    16 ** How debug func?
    16 ** How debug func?
    17 
    17 
    18 Use M-x debug-on-entry and M-x cancel-debug-on-entry to control
    18 Use M-x debug-on-entry and M-x cancel-debug-on-entry to control
    19 which functions will enter the debugger when called.
    19 which functions will enter the debugger when called.
    22 
    22 
    23 ** How debug ini file?
    23 ** How debug ini file?
    24 
    24 
    25 When your InitFile has a bug, or when you load external files that cause
    25 When your InitFile has a bug, or when you load external files that cause
    26 errors, the bug is often hard to find, because the Emacs Lisp reader does not
    26 errors, the bug is often hard to find, because the Emacs Lisp reader does not
    27 know about line numbers and files – it just knows an error happened, and
    27 know about line numbers and files - it just knows an error happened, and
    28 that’s it.
    28 that's it.
    29 
    29 
    30 *** Binary Search.
    30 *** Binary Search.
    31 
    31 
    32 Select half of the file in a region, and M-x eval-region. Depending on whether
    32 Select half of the file in a region, and M-x eval-region. Depending on whether
    33 that causes the error or not, split this half or the other half again, and
    33 that causes the error or not, split this half or the other half again, and
    44 
    44 
    45   $ emacs --no-init-file --no-site-file --debug-init
    45   $ emacs --no-init-file --no-site-file --debug-init
    46 
    46 
    47 *** Simplified Binary Search.
    47 *** Simplified Binary Search.
    48 
    48 
    49 Add (error “No error until here”) in the middle of your file. If you get the
    49 Add (error 'No error until here') in the middle of your file. If you get the
    50 error “No error until here” when reloading the file, move the expression
    50 error 'No error until here' when reloading the file, move the expression
    51 towards the back of the file, otherwise towards the front of the file.
    51 towards the back of the file, otherwise towards the front of the file.