Function: shorthands-of-symbol

shorthands-of-symbol is a byte-compiled function defined in shorthands.el.gz.

Signature

(shorthands-of-symbol S)

Documentation

Return a list of shorthand alternative spellings of S.

S can be either a string or a symbol. The returned shorthands are strings, in the order they are found in read-symbol-shorthands.

View in manual

Probably introduced at or before Emacs version 32.1.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/shorthands.el.gz
(defun shorthands-of-symbol (s)
  "Return a list of shorthand alternative spellings of S.
S can be either a string or a symbol.  The returned shorthands are strings,
in the order they are found in `read-symbol-shorthands'."
  (let ((retval ())
        (full-name (if (symbolp s) (symbol-name s) s)))
    (dolist (mapping read-symbol-shorthands)
      (let ((shorthand (car mapping))
            (longhand (cdr mapping)))
        (when (string-prefix-p longhand full-name)
          (push (concat shorthand
                        (substring full-name (length longhand)))
                retval))))
    (nreverse retval)))