3

I set break-point in function (add-hook 'c-mode-common-hook (function (lambda nil (if (or (string-match "llvm" buffer-file-name) (string-match "nvvm" buffer-file-name)) (progn (c-set-style "llvm.org")))))) I am unable to remove the break-point. This code fragment is in *scratch* buffer.

3
  • Reevaluate the form to remove the edebug-instrumentation. When debugging press u to delete a breakpoint previously set with b.
    – Tobias
    Commented Jan 20, 2016 at 8:18
  • Sorry pressing u gives message: No breakpoint here. Reevaluate the form to remove the edebug-instrumentation I am pressing C-x C-e to reevaluate. That didn't help either.
    – vmiheer
    Commented Jan 22, 2016 at 11:34
  • Sorry, I did misunderstand your actual question because you chose the wrong wording. You do not really set breakpoints with edebug-defun but you instrument a function or a form for debugging in this way. Setting breakpoints works with pressing b when you are in an edebug session. And breakpoints set with b can be deleted with u.
    – Tobias
    Commented Jan 22, 2016 at 11:52

1 Answer 1

1

It is not a good idea to add a lambda to a hook if you want to debug this lambda. edebug adds its own stuff so that you cannot easily remove or redefine the function. If you try you end up with two functions in the hook.

Rather define a function such as my-c-mode-common-hook-function and instrument that one.

(defun my-c-mode-common-hook-function ()
  "some useful documentation"
  (if (or (string-match "llvm" buffer-file-name)
             (string-match "nvvm" buffer-file-name))
         (progn
           (c-set-style "llvm.org"))))

(add-hook 'c-mode-common-hook #'my-c-mode-common-hook-function)

You can then easily instrument my-c-mode-common-hook-function for debugging.

1
  • So essentially don't instrument a lambda hook with edebug-defun? Thanks.
    – vmiheer
    Commented Jan 22, 2016 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.