Function: gnuplot-indent-line

gnuplot-indent-line is an interactive and natively compiled function defined in gnuplot.el.

Signature

(gnuplot-indent-line)

Documentation

Set indentation in gnuplot buffer.

For most lines, set indentation to previous level of indentation. Add additional indentation for continuation lines.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/xvcy7r1jiw71avhnh6kmin403kpqrdhc-emacs-packages-deps/share/emacs/site-lisp/elpa/gnuplot-20260623.1111/gnuplot.el
;; Adjust indentation for the line containing point
(defun gnuplot-indent-line ()
  "Set indentation in gnuplot buffer.
For most lines, set indentation to previous level of indentation.
Add additional indentation for continuation lines."
  (interactive nil gnuplot-mode)
  (let (indent)
    (if (gnuplot--in-string (line-beginning-position))
        ;; Continued strings begin at left margin
        (setq indent 0)
      (save-excursion
        (if (gnuplot--continuation-line-p)
            ;; This is a continuation line. Indent to the same level as
            ;; the second word on the line beginning this command (i.e.,
            ;; the first non-whitespace character after whitespace)
            (progn
              (gnuplot--beginning-of-continuation)
              (back-to-indentation)
              (re-search-forward "\\S-+\\s-+" (line-end-position) 'end-at-limit)
              (setq indent (current-column)))

          ;; Not a continuation line; indent according to block
          ;; nesting depth
          (save-excursion
            (condition-case nil
                (progn
                  (beginning-of-line)
                  (skip-syntax-forward "-" (line-end-position))
                  (if (looking-at "\\s)") (forward-char))
                  (backward-up-list)
                  (gnuplot--beginning-of-continuation)
                  (setq indent (+ gnuplot-basic-offset (current-indentation))))
              (error
               (setq indent 0)))))))

    ;; Set indentation
    (save-excursion
      (indent-line-to indent))

    ;; Move point after indentation when at beginning of line
    (when (< (current-column) indent)
      (move-to-column indent))))