Singular Manual: Editing SINGULAR input files with Emacs

| ### 3.2.5 Editing SINGULAR input files with Emacs Since SINGULAR's programming language is similar to C, you should use the Emacs C/C++-mode to edit SINGULAR input files and SINGULAR libraries. Among others, this Emacs mode provides automatic indentation, line-breaking and keyword highlighting. When running `ESingular`, the C/C++-mode is automatically turned on whenever a file with the suffix `.sing`, or `.lib` is loaded. For Emacs sessions which were not started by `ESingular`, you should add the following to your `.emacs` file:
    ;; turn on c++-mode for files ending in ".sing" and ".lib"
    (setq auto-mode-alist (cons '("\\.sing\\'" . c++-mode) auto-mode-alist))
    (setq auto-mode-alist (cons '("\\.lib\\'" .  c++-mode) auto-mode-alist))
    ;; turn-on fontification for c++-mode
    (add-hook 'c++-mode-hook
             (function (lambda () (font-lock-mode 1))))
    ;; turn on aut-new line and hungry-delete
    (add-hook 'c++-mode-hook
              (function (lambda () (c-toggle-auto-hungry-state 1))))
    ;; a handy function for customization
    (defun customize-face-at-point ()
      "Customize face which point is at."
      (interactive)
      (let ((face (get-text-property (point) 'face)))
        (if face
            (customize-face face)
          (message "No face defined at point"))))
Notice that you can change the default settings for source-code highlighting (colors, fonts, etc.) by customizing the respective faces using the `Customize` feature of Emacs. For doing this, you might find handy the above given function `customize-face-at-point`, which lets you customize the face of the current position of point (this function is automatically defined if you run `ESingular`).

User manual for Singular version 4.4.1, 2025, generated by texi2html.