Function: texinfo-format-kbd

texinfo-format-kbd is a byte-compiled function defined in texinfmt.el.gz.

Signature

(texinfo-format-kbd)

Documentation

Place single quote marks around arg, except in @example and similar.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/texinfmt.el.gz
(defun texinfo-format-kbd ()
  "Place single quote marks around arg, except in @example and similar."
  ;; Search forward for @end example closer than an @example.
  ;; Can stop search at nearest @node or texinfo-section-types-regexp
  (let* ((stop
          (save-excursion
            (re-search-forward
             (concat "^@node\\|\\(" texinfo-section-types-regexp "\\)")
             nil
             'move-to-end)    ; if necessary, return point at end of buffer
            (point)))
         (example-location
          (save-excursion
            (re-search-forward texinfo-format-kbd-regexp stop 'move-to-end)
            (point)))
         (end-example-location
          (save-excursion
            (re-search-forward texinfo-format-kbd-end-regexp stop 'move-to-end)
            (point))))
    ;; If inside @example, @end example will be closer than @example
    ;; or end of search i.e., end-example-location less than example-location
    (if (>= end-example-location example-location)
        ;; outside an @example or equivalent
        (insert "`" (texinfo-parse-arg-discard) "'")
    ;; else, in @example; do not surround with `...'
      (insert (texinfo-parse-arg-discard)))
    (goto-char texinfo-command-start)))