Function: Man-highlight-references0

Man-highlight-references0 is a byte-compiled function defined in man.el.gz.

Signature

(Man-highlight-references0 START-SECTION REGEXP BUTTON-POS TARGET TYPE)

Source Code

;; Defined in /usr/src/emacs/lisp/man.el.gz
(defun Man-highlight-references0 (start-section regexp button-pos target type)
  ;; Based on `Man-build-references-alist'
  (when (or (null start-section) ;; Search regardless of sections.
            ;; Section header is in this chunk.
            (Man-find-section start-section))
    (let ((end (if start-section
		   (progn
		     (forward-line 1)
		     (back-to-indentation)
		     (save-excursion
		       (Man-next-section 1)
		       (point)))
		 (goto-char (point-min))
		 nil)))
      (while (re-search-forward regexp end t)
        (let ((b (match-beginning button-pos))
              (e (match-end button-pos))
              (match (match-string button-pos)))
          ;; Some lists of references end with ", and ...".  Chop the
          ;; "and" bit off before making a button.
          (when (string-match "\\`and +" match)
            (setq b (+ b (- (match-end 0) (match-beginning 0)))))
	  ;; An overlay button is preferable because the underlying text
	  ;; may have text property highlights (Bug#7881).
	  (make-button
	   b e
	   'type type
	   'Man-target-string (cond
			       ((numberp target)
                                (match-string target))
			       ((functionp target)
                                target)
			       (t nil))))))))