Function: erc-button-add-buttons

erc-button-add-buttons is an interactive and byte-compiled function defined in erc-button.el.gz.

Signature

(erc-button-add-buttons)

Documentation

Find external references in the current buffer and make buttons of them.

"External references" are things like URLs, as
specified by erc-button-alist.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-button.el.gz
(defun erc-button-add-buttons ()
  "Find external references in the current buffer and make buttons of them.
\"External references\" are things like URLs, as
specified by `erc-button-alist'."
  (interactive)
  (save-excursion
    (with-syntax-table erc-button-syntax-table
      (let ((buffer-read-only nil)
            (inhibit-field-text-motion t)
            (alist erc-button-alist)
            regexp)
        (erc-button-remove-old-buttons)
        (unless (or erc-button--has-nickname-entry
                    (not erc-button-buttonize-nicks)
                    (and (erc--memq-msg-prop 'erc--skip 'button)
                         (not (setq alist nil))))
          (erc-button-add-nickname-buttons
           `(_ _ erc-button--modify-nick-function
               ,erc-button-nickname-callback-function)))
        (dolist (entry alist)
          (if (or (eq (car entry) 'nicknames)
                  ;; Old form retained for backward compatibility.
                  (equal (car entry) (quote 'nicknames)))
              (erc-button-add-nickname-buttons entry)
            (progn
              (setq regexp (or (and (stringp (car entry)) (car entry))
                               (and (boundp (car entry))
                                    (symbol-value (car entry)))))
              (cond ((stringp regexp)
                     (erc-button-add-buttons-1 regexp entry))
                    ((and (listp regexp) (stringp (car regexp)))
                     (dolist (r regexp)
                       (erc-button-add-buttons-1
                        (concat "\\<" (regexp-quote r) "\\>")
                        entry)))
                    ((and (listp regexp) (listp (car regexp))
                          (stringp (caar regexp)))
                     (dolist (elem regexp)
                       (erc-button-add-buttons-1
                        (concat "\\<" (regexp-quote (car elem)) "\\>")
                        entry)))))))))))