Function: def-gdb-auto-update-handler

def-gdb-auto-update-handler is a macro defined in gdb-mi.el.gz.

Signature

(def-gdb-auto-update-handler HANDLER-NAME CUSTOM-DEFUN &optional NOPRESERVE)

Documentation

Define a handler HANDLER-NAME calling CUSTOM-DEFUN.

Handlers are normally called from the buffers they put output in.

Erase current buffer and evaluate CUSTOM-DEFUN. Then call gdb-update-buffer-name.

If NOPRESERVE is non-nil, window point is not restored after CUSTOM-DEFUN.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/gdb-mi.el.gz
;; Used by disassembly buffer only, the rest use
;; def-gdb-trigger-and-handler
(defmacro def-gdb-auto-update-handler (handler-name custom-defun
                                                    &optional nopreserve)
  "Define a handler HANDLER-NAME calling CUSTOM-DEFUN.

Handlers are normally called from the buffers they put output in.

Erase current buffer and evaluate CUSTOM-DEFUN.
Then call `gdb-update-buffer-name'.

If NOPRESERVE is non-nil, window point is not restored after CUSTOM-DEFUN."
  (declare (indent defun))
  `(defun ,handler-name ()
     (let* ((inhibit-read-only t)
            ,@(unless nopreserve
                '((window (get-buffer-window (current-buffer) 0))
                  (start (window-start window))
                  (p (window-point window)))))
       (erase-buffer)
       (,custom-defun)
       (gdb-update-buffer-name)
       ,@(when (not nopreserve)
          '((set-window-start window start t)
            (set-window-point window p))))))