Function: idlwave-shell-update-bp-overlays

idlwave-shell-update-bp-overlays is a byte-compiled function defined in idlw-shell.el.gz.

Signature

(idlwave-shell-update-bp-overlays)

Documentation

Update the overlays which mark breakpoints in the source code.

Existing overlays are recycled, in order to minimize consumption.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/idlw-shell.el.gz
(defun idlwave-shell-update-bp-overlays ()
  "Update the overlays which mark breakpoints in the source code.
Existing overlays are recycled, in order to minimize consumption."
  (when idlwave-shell-mark-breakpoints
    (let ((ov-alist (copy-alist idlwave-shell-bp-overlays))
	  (bp-list idlwave-shell-bp-alist)
	  (use-glyph (and (memq idlwave-shell-mark-breakpoints '(t glyph))
			  idlwave-shell-bp-glyph))
	  ov ov-list bp buf old-buffers)

      ;; Delete the old overlays from their buffers
      (if ov-alist
	  (while (setq ov-list (pop ov-alist))
	    (while (setq ov (pop (cdr ov-list)))
	      (cl-pushnew (overlay-buffer ov) old-buffers)
	      (delete-overlay ov))))

      (setq ov-alist idlwave-shell-bp-overlays
	    idlwave-shell-bp-overlays
	    (if idlwave-shell-bp-glyph
		(mapcar #'list (mapcar #'car idlwave-shell-bp-glyph))
	      (list (list 'bp))))
      (while (setq bp (pop bp-list))
	(save-excursion
	  (idlwave-shell-goto-frame (car bp))
          (let* ((end (line-end-position))
		 (beg (progn (beginning-of-line 1) (point)))
		 (condition (idlwave-shell-bp-get bp 'condition))
		 (count (idlwave-shell-bp-get bp 'count))
		 (disabled (idlwave-shell-bp-get bp 'disabled))
		 (type (if idlwave-shell-bp-glyph
			   (cond
			    (condition 'bp-cond )
			    (count
			     (cond
			      ((<= count 0) 'bp)
			      ((<= count 4)
			       (intern
				(concat "bp-" (number-to-string count))))
			      (t 'bp-n)))
			    (t 'bp))
			 'bp))
		 (help-list
		  (delq nil
			(list
			 (if count
			     (concat "after:" (int-to-string count)))
			 (if condition
			     (concat "condition:" condition))
			 (if disabled "disabled"))))
		 (help-text (concat
			     "BP "
			     (int-to-string (idlwave-shell-bp-get bp))
			     (if help-list
				 (concat
				  " - "
				  (mapconcat #'identity help-list ", ")))
			     (if (and (not count) (not condition))
				 " (use mouse-3 for breakpoint actions)")))
		 (full-type (if disabled
				(intern (concat (symbol-name type)
						"-disabled"))
			      type))
		 (ov-existing (assq full-type ov-alist))
		 (ov (or (and (cdr ov-existing)
			      (pop (cdr ov-existing)))
			 (idlwave-shell-make-new-bp-overlay type disabled)))
		 match)
	    (if idlwave-shell-breakpoint-popup-menu
		(overlay-put ov 'help-echo help-text))
	    (move-overlay ov beg end)
	    (if (setq match (assq full-type idlwave-shell-bp-overlays))
		(push ov (cdr match))
	      (nconc idlwave-shell-bp-overlays
		     (list (list full-type ov)))))
	  ;; Take care of margins if using a glyph
	  (when use-glyph
	    (if old-buffers
		(setq old-buffers (delq (current-buffer) old-buffers)))
            (if (< left-margin-width 2)
                (setq left-margin-width 2))
	    (let ((window (get-buffer-window (current-buffer) 0)))
	      (if window
		  (set-window-margins
		   window left-margin-width right-margin-width))))))
      (if use-glyph
	  (while (setq buf (pop old-buffers))
	    (with-current-buffer buf
              (setq left-margin-width 0)
	      (let ((window (get-buffer-window buf 0)))
		(if window
		    (set-window-margins
		     window left-margin-width right-margin-width)))))))))