From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Run `gap-format-buffer` on specified gap script file without starting Emacs. Date: Sun, 1 May 2022 16:53:28 +0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33114"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 01 10:54:16 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nl5LM-0008Pl-CH for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 01 May 2022 10:54:16 +0200 Original-Received: from localhost ([::1]:36070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nl5LL-0005Bd-4v for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 01 May 2022 04:54:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nl5Kp-0005BT-JL for help-gnu-emacs@gnu.org; Sun, 01 May 2022 04:53:43 -0400 Original-Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:45835) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nl5Kn-0007rd-Pv for help-gnu-emacs@gnu.org; Sun, 01 May 2022 04:53:43 -0400 Original-Received: by mail-ed1-x535.google.com with SMTP id be20so13544110edb.12 for ; Sun, 01 May 2022 01:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=55+dS7CrKOCDnjpZukTCHXiX50cPoJKo8Xpj2zh6U50=; b=OGPYnIDBhW2+Ke14J0EB0HVzHA1tfu6De+tKvRSw/uwFZDlbU8m9Ny3VRmYApf7ikd EljpMgGyMNrqDyphJsLxePe0RKsP9XZQfTreovhwHm+V0YJC83uFNrpEOGuN3fwa7Wwa ocEGctvChy/3+SGOZ3Vy6xG8GskEX/mm6yIZm6mIX6kB7wLvBZdr1zpAVGlcT9f8/eMh QJbCD9wGZyKPT4WpQP+vO2sbLtKsZHmKkwP65amn4P4w1pzuOhbxk5Tmeo549bckbkHq 3FwECk1OYdgmxLPcxq/pMrYdEL5KW6k+aL6wZjTEzduEGohy7E3cX0A3ZB2yGG+pOuJz BN8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=55+dS7CrKOCDnjpZukTCHXiX50cPoJKo8Xpj2zh6U50=; b=WNGWYqcwOcy+xqRFm74WbL+e6BB+I4//kXvmfbb66ga9Do3Qsh5znmOpajrI9mJqdA qV/VsNcvDPGXNOMCyCl3cryEsTZjZZevMR0UKdBvu/RdVt5wlstTJ3Kp74q9Lk86l0CS HxISO7pWBF3RfqbFJF1WhMjy9lCLkiEEB8nyCFd8QmfnKDov9R1fAX75iNSlzJnDLuZa SsBYx2HrsAhYJHsFhEYa+B+pwJgBG0mlFroCBLZLNgl7VzBtaqlaDPTJrRrYVLLmxvE2 dwW2DwgVnICTop4g5/bJjkUo2d1fmKVqYj7h/aSvsC/PbbEeYCNhfBLJSzeoEqwslsbm FbXw== X-Gm-Message-State: AOAM533YM9h5N6icTeY0FpNg0UKSOXBc+EH4c5EslvfkxsKgRa4JPmoJ ZdeSUu5nTgQaPSKI/cfBO3gKOzBrIAga/cmA+Xwd/LL5xCbTINzVbo0= X-Google-Smtp-Source: ABdhPJwhJJff4GLfZ2oyu7DzNA4ui0PemIMBREZXGh0l43pIm2NTyi9VzgIy+K9H93vGgVVnfmwnNDr17Q9G0lwZosI= X-Received: by 2002:aa7:d8d2:0:b0:425:e22b:35c0 with SMTP id k18-20020aa7d8d2000000b00425e22b35c0mr7963019eds.181.1651395219320; Sun, 01 May 2022 01:53:39 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=hongyi.zhao@gmail.com; helo=mail-ed1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:137102 Archived-At: 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 Theory and Simulation of Materials Hebei Vocational University of Technology and Engineering No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province