Function: gdb-get-buffer-create

gdb-get-buffer-create is a byte-compiled function defined in gdb-mi.el.gz.

Signature

(gdb-get-buffer-create BUFFER-TYPE &optional THREAD)

Documentation

Create a new GDB buffer of the type specified by BUFFER-TYPE.

The buffer-type should be one of the cars in gdb-buffer-rules.

If THREAD is non-nil, it is assigned to gdb-thread-number buffer-local variable of the new buffer.

Buffer mode and name are selected according to buffer type.

If buffer has trigger associated with it in gdb-buffer-rules, this trigger is subscribed to gdb-buf-publisher and called with
'update argument.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/gdb-mi.el.gz
(defun gdb-get-buffer-create (buffer-type &optional thread)
  "Create a new GDB buffer of the type specified by BUFFER-TYPE.
The buffer-type should be one of the cars in `gdb-buffer-rules'.

If THREAD is non-nil, it is assigned to `gdb-thread-number'
buffer-local variable of the new buffer.

Buffer mode and name are selected according to buffer type.

If buffer has trigger associated with it in `gdb-buffer-rules',
this trigger is subscribed to `gdb-buf-publisher' and called with
'update argument."
  (or (gdb-get-buffer buffer-type thread)
      (let ((rules (assoc buffer-type gdb-buffer-rules))
            (new (generate-new-buffer "limbo")))
	(with-current-buffer new
	  (let ((mode (gdb-rules-buffer-mode rules))
                (trigger (gdb-rules-update-trigger rules)))
	    (when mode (funcall mode))
	    (setq gdb-buffer-type buffer-type)
            (when thread
              (setq-local gdb-thread-number thread))
            (setq-local gud-minor-mode
                        (buffer-local-value 'gud-minor-mode gud-comint-buffer))
            (setq-local tool-bar-map gud-tool-bar-map)
            (rename-buffer (funcall (gdb-rules-name-maker rules)))
	    (when trigger
              (gdb-add-subscriber gdb-buf-publisher
                                  (cons (current-buffer)
                                        (gdb-bind-function-to-buffer
                                         trigger (current-buffer))))
              (funcall trigger 'start))
            (current-buffer))))))