Function: ebrowse-toggle-mark-at-point

ebrowse-toggle-mark-at-point is an interactive and byte-compiled function defined in ebrowse.el.gz.

Signature

(ebrowse-toggle-mark-at-point &optional N-TIMES)

Documentation

Toggle mark for class cursor is on.

If given a numeric N-TIMES argument, mark that many classes.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/ebrowse.el.gz
;;; Marking classes in the tree buffer

(defun ebrowse-toggle-mark-at-point (&optional n-times)
  "Toggle mark for class cursor is on.
If given a numeric N-TIMES argument, mark that many classes."
  (interactive "p")
  (let (to-change)
    ;; Get the classes whose mark must be toggled. Note that
    ;; ebrowse-tree-at-point might issue an error.
    (ignore-errors
      (cl-loop repeat (or n-times 1)
               as tree = (ebrowse-tree-at-point)
               do (progn
                    (setf (ebrowse-ts-mark tree) (not (ebrowse-ts-mark tree)))
                    (forward-line 1)
                    (push tree to-change))))
    (save-excursion
      ;; For all these classes, reverse the mark char in the display
      ;; by a regexp replace over the whole buffer. The reason for this
      ;; is that classes might have multiple base classes. If this is
      ;; the case, they are displayed more than once in the tree.
      (with-silent-modifications
	(cl-loop
         for tree in to-change
         as regexp = (concat "^.*\\b"
                             (regexp-quote
                              (ebrowse-cs-name (ebrowse-ts-class tree)))
                             "\\b")
         do
         (goto-char (point-min))
         (while (re-search-forward regexp nil t)
           (goto-char (match-beginning 0))
           (delete-char 1)
           (insert-char (if (ebrowse-ts-mark tree) ?> ? ) 1)
           (ebrowse-set-mark-props (1- (point)) (point) tree)
           (goto-char (match-end 0))))))))