Function: eudc-display-records

eudc-display-records is a byte-compiled function defined in eudc.el.gz.

Signature

(eudc-display-records RECORDS &optional RAW-ATTR-NAMES)

Documentation

Display the record list RECORDS in a formatted buffer.

If RAW-ATTR-NAMES is non-nil, the raw attribute names are displayed otherwise they are formatted according to eudc-user-attribute-names-alist.

Source Code

;; Defined in /usr/src/emacs/lisp/net/eudc.el.gz
(defun eudc-display-records (records &optional raw-attr-names)
  "Display the record list RECORDS in a formatted buffer.
If RAW-ATTR-NAMES is non-nil, the raw attribute names are displayed
otherwise they are formatted according to `eudc-user-attribute-names-alist'."
  (let (inhibit-read-only
	precords
	(width 0)
	beg
	first-record
	attribute-name)
    (with-output-to-temp-buffer "*Directory Query Results*"
      (with-current-buffer standard-output
	(setq buffer-read-only t)
	(setq inhibit-read-only t)
	(erase-buffer)
	(insert "Directory Query Result\n")
	(insert "======================\n\n\n")
	(if (null records)
	    (insert "No match found.\n"
		    (if eudc-strict-return-matches
			"Try setting `eudc-strict-return-matches' to nil or change `eudc-default-return-attributes'.\n"
		      ""))
	  ;; Replace field names with user names, compute max width
	  (setq precords
		(mapcar
                 (lambda (record)
                   (mapcar
                    (lambda (field)
                      (setq attribute-name
                            (if raw-attr-names
                                (symbol-name (car field))
                              (eudc-format-attribute-name-for-display (car field))))
                      (if (> (length attribute-name) width)
                          (setq width (length attribute-name)))
                      (cons attribute-name (cdr field)))
                    record))
		 records))
	  ;; Display the records
	  (setq first-record (point))
	  (mapc
           (lambda (record)
             (setq beg (point))
             ;; Map over the record fields to print the attribute/value pairs
             (mapc (lambda (field)
                     (eudc-print-record-field field width))
                   record)
             ;; Store the record internal format in some convenient place
             (overlay-put (make-overlay beg (point))
                          'eudc-record
                          (car records))
             (setq records (cdr records))
             (insert "\n"))
	   precords))
	(insert "\n")
	(widget-create 'push-button
		       :notify (lambda (&rest _ignore)
				 (eudc-query-form))
		       "New query")
	(widget-insert " ")
	(widget-create 'push-button
		       :notify (lambda (&rest _ignore)
				 (kill-this-buffer))
		       "Quit")
	(eudc-mode)
	(widget-setup)
	(if first-record
	    (goto-char first-record))))))