Function: xdg-desktop-read-file

xdg-desktop-read-file is a byte-compiled function defined in xdg.el.gz.

Signature

(xdg-desktop-read-file FILENAME &optional GROUP)

Documentation

Return group contents of desktop file FILENAME as a hash table.

Optional argument GROUP defaults to the string "Desktop Entry".

Source Code

;; Defined in /usr/src/emacs/lisp/xdg.el.gz
(defun xdg-desktop-read-file (filename &optional group)
  "Return group contents of desktop file FILENAME as a hash table.
Optional argument GROUP defaults to the string \"Desktop Entry\"."
  (with-temp-buffer
    (insert-file-contents-literally filename)
    (goto-char (point-min))
    (while (and (skip-chars-forward "[:blank:]" (line-end-position))
                (or (eolp) (= (following-char) ?#)))
      (forward-line))
    (unless (looking-at xdg-desktop-group-regexp)
      (error "Expected group name!  Instead saw: %s"
             (buffer-substring (point) (line-end-position))))
    (when group
      (while (and (re-search-forward xdg-desktop-group-regexp nil t)
                  (not (equal (match-string 1) group)))))
    (forward-line)
    (xdg-desktop-read-group)))