Function: cpp-make-button

cpp-make-button is a byte-compiled function defined in cpp.el.gz.

Signature

(cpp-make-button NAME CALLBACK &optional DATA FACE PADDING)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cpp.el.gz
;;; Buttons:

(defun cpp-make-button (name callback &optional data face padding)
  ;; Create a button at point.
  ;; NAME is the name of the button.
  ;; CALLBACK is the function to call when the button is pushed.
  ;; DATA will be made available to CALLBACK
  ;;in the free variable cpp-callback-data.
  ;; FACE means that NAME is the name of a face in `cpp-face-all-list'.
  ;; PADDING means NAME will be right justified at that length.
  (let ((name (format "%s" name))
	from to)
    (cond ((null padding)
	   (setq from (point))
	   (insert name))
	  ((> (length name) padding)
	   (setq from (point))
	   (insert (substring name 0 padding)))
	  (t
	   (insert (make-string (- padding (length name)) ? ))
	   (setq from (point))
	   (insert name)))
    (setq to (point))
    (setq face
	  (if face
	      (let ((check (cdr (assoc name cpp-face-all-list))))
		(if (memq check '(default invisible))
		    'bold
		  check))
	    'bold))
    (add-text-properties from to
			 (append (list 'face face)
				 '(mouse-face highlight)
				 '(help-echo "mouse-2: change/use this item")
				 (list 'cpp-callback callback)
				 (if data (list 'cpp-data data))))))