Function: css-lookup-symbol

css-lookup-symbol is an autoloaded, interactive and byte-compiled function defined in css-mode.el.gz.

Signature

(css-lookup-symbol SYMBOL)

Documentation

Display the CSS documentation for SYMBOL, as found on MDN.

When this command is used interactively, it picks a default symbol based on the CSS text before point -- either an @-keyword, a property name, a pseudo-class, or a pseudo-element, depending on what is seen near point.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/css-mode.el.gz
;;;###autoload
(defun css-lookup-symbol (symbol)
  "Display the CSS documentation for SYMBOL, as found on MDN.
When this command is used interactively, it picks a default
symbol based on the CSS text before point -- either an @-keyword,
a property name, a pseudo-class, or a pseudo-element, depending
on what is seen near point."
  (interactive
   (list
    (let* ((sym (css--mdn-find-symbol))
	   (enable-recursive-minibuffers t)
	   (value (completing-read (format-prompt "Describe CSS symbol" sym)
                                   css--mdn-completion-list nil nil nil
                                   'css--mdn-lookup-history sym)))
      (if (equal value "") sym value))))
  (when symbol
    ;; If we see a single-colon pseudo-element like ":after", turn it
    ;; into "::after".
    (when (and (eq (aref symbol 0) ?:)
	       (member (substring symbol 1) css-pseudo-element-ids))
      (setq symbol (concat ":" symbol)))
    (let ((url (format css-lookup-url-format symbol))
          (buffer (get-buffer-create "*MDN CSS*")))
      ;; Make sure to display the buffer before calling `eww', as that
      ;; calls `pop-to-buffer-same-window'.
      (switch-to-buffer-other-window buffer)
      (with-current-buffer buffer
        (eww-mode)
        (add-hook 'eww-after-render-hook #'css--mdn-after-render nil t)
        (eww url)))))