Function: texinfo-format-ifeq

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

Signature

(texinfo-format-ifeq)

Documentation

If ARG1 and ARG2 caselessly string compare to same string, perform COMMAND.

Otherwise produces no output.

Thus:
        @ifeq{ arg1 , arg1 , @code{foo}} bar

        ==> foo bar.
but
        @ifeq{ arg1 , arg2 , @code{foo}} bar

        ==> bar

Note that the Texinfo command and its arguments must be arguments to the @ifeq command.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/texinfmt.el.gz
(defun texinfo-format-ifeq ()
  "If ARG1 and ARG2 caselessly string compare to same string, perform COMMAND.
Otherwise produces no output.

Thus:
        @ifeq{ arg1 , arg1 , @code{foo}} bar

        ==> `foo' bar.
but
        @ifeq{ arg1 , arg2 , @code{foo}} bar

        ==> bar

Note that the Texinfo command and its arguments must be arguments to
the @ifeq command."
  ;; compare-buffer-substrings does not exist in version 18; don't use
  (goto-char texinfo-command-end)
  (let* ((case-fold-search t)
         (stop (save-excursion (forward-sexp 1) (point)))
        start ;; end
        ;; @ifeq{arg1, arg2, @command{optional-args}}
        (arg1
         (progn
           (forward-char 1)
           (skip-chars-forward " ")
           (setq start (point))
           (search-forward "," stop t)
           (skip-chars-backward ", ")
           (buffer-substring-no-properties start (point))))
        (arg2
         (progn
           (search-forward "," stop t)
           (skip-chars-forward " ")
           (setq start (point))
           (search-forward "," stop t)
           (skip-chars-backward ", ")
           (buffer-substring-no-properties start (point))))
        (texinfo-command
         (progn
           (search-forward "," stop t)
           (skip-chars-forward " ")
           (setq start (point))
           (goto-char (1- stop))
           (skip-chars-backward " ")
           (buffer-substring-no-properties start (point)))))
    (delete-region texinfo-command-start stop)
    (if (equal arg1 arg2)
        (insert texinfo-command))
    (goto-char texinfo-command-start)))