Function: sgml-namify-char

sgml-namify-char is an interactive and byte-compiled function defined in sgml-mode.el.gz.

Signature

(sgml-namify-char)

Documentation

Change the char before point into its &name; equivalent.

Uses sgml-char-names.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/sgml-mode.el.gz
(defun sgml-namify-char ()
  "Change the char before point into its `&name;' equivalent.
Uses `sgml-char-names'."
  (interactive)
  (let* ((char (char-before))
	 (name
	  (cond
	   ((null char) (error "No char before point"))
	   ((< char 256) (or (aref sgml-char-names char) char))
	   ((aref sgml-char-names-table char))
	   ((encode-char char 'ucs)))))
    (if (not name)
	(error "Don't know the name of `%c'" char)
      (delete-char -1)
      (insert (format (if (numberp name) "&#%d;" "&%s;") name)))))