Search code examples
debuggingemacsbreakpoints

Emacs: How to enable highlighting breakpoints in a text terminal (emacs -nw)


Emacs doesn't show breakpoints in text mode. I tried integrating the suggestions here and here, but failed (I am not a lisp programmer).

I tried:

(require 'gdb-mi)
(setq default-text-properties '(foo 1111))

(defun set_breakpt_cmds ()
  "set breakpoint and indicate on editor"
  (interactive)
  (gud-break)
  (gdb-put-breakpoint-icon "false" (get-text-property 1 'foo)))

(global-set-key (kbd "<f12>") 'set_breakpt_cmds)

The resulting error is

Wrong number of arguments: (lambda (arg) "Set breakpoint at current line." (interactive "p") (if (not gud-running) (gud-call "dbstop \ at %l in %f" arg))), 0

Note: A similar issue is this (following this). However the solution there doesn't fit me because I would like to be able to call the fix from .emacs file. This way it is easier to duplicate my emacs configuration when I setup a new linux box.

Thanks


Solution

  • The error you get comes from the fact that gud-break expects an argument (which isn't used), so just use (gud-break 1).

    The message reads as follow:

    • the error is of kind wrong number of arguments
    • when calling (lambda (arg) ...) (where we see that exactly one argument is expected)
    • and it was called with 0 arguments.