help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Run `gap-format-buffer` on specified gap script file without starting Em


From: Hongyi Zhao
Subject: Run `gap-format-buffer` on specified gap script file without starting Emacs.
Date: Sun, 1 May 2022 16:53:28 +0800

I've installed the gap-mode with the following command:

```
(use-package gap-mode
  ;; https://gitlab.com/gvol/gap-mode#configuration
  :config
  (setq
   gap-executable "~/.local/bin/gap"
   ;; gap-start-options (list "-l" "~/Public/repo/github.com/gap-system/gap.git"
   ;;                         "-m" "2m")
   gap-start-options (list "-f" "-m" "2m" "-E")
   )
  )
```

And it defined the following command to format gap script file:

```
gap-format-buffer is an interactive and compiled function defined in
gap-mode.el.

Signature
(gap-format-buffer)

Documentation
Call gap-format-region on entire buffer.

Key Bindings
gap-mode-map C-M-q

References
gap-format-buffer is unused in gap-mode.el.

Find all references Functions used by gap-format-buffer

Debugging
Enable edebug Enable tracing
Disassemble Forget

Source Code
;; Defined in ~/.emacs.d/straight/build/gap-mode/gap-mode.el
(defun gap-format-buffer ()
  "Call `gap-format-region' on entire buffer."
  (interactive)
  (set-mark (point-max))
  (goto-char (point-min))
  (gap-format-region))

Symbol Properties
event-symbol-element-mask
  (gap-format-buffer 0)
event-symbol-elements
  (gap-format-buffer)
modifier-cache
  ((0 . gap-format-buffer))
```

In normal way, the command should be used as follows:

1. Open a gap script file;
2. M-x gap-format-buffer RET

But now I want to write a code formatter by warping the above logic,
so that I can format the gap script file without starting Emacs.

Are there any clues to achieving this goal?

Regards
-- 
Assoc. Prof. Hongsheng Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province



reply via email to

[Prev in Thread] Current Thread [Next in Thread]