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: Emacsclient --eval with command line arguments. Date: Thu, 5 May 2022 09:23:58 +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="16292"; 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 Thu May 05 03:25:37 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 1nmQFN-00041j-00 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 05 May 2022 03:25:37 +0200 Original-Received: from localhost ([::1]:46516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nmQFK-0003z8-7H for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 04 May 2022 21:25:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nmQE1-0003xT-UE for help-gnu-emacs@gnu.org; Wed, 04 May 2022 21:24:14 -0400 Original-Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:36482) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nmQDz-0000jo-Ul for help-gnu-emacs@gnu.org; Wed, 04 May 2022 21:24:13 -0400 Original-Received: by mail-ej1-x62b.google.com with SMTP id z2so4421511ejj.3 for ; Wed, 04 May 2022 18:24:11 -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=6cLCJ8eTBOht2aUrBv+i7fqNHAULDu27cS8qeqfC/rk=; b=hs4ZtaVRxsS2j6JYpPM7ad6IHEpfS/HoERlw82loZeWN/meyEtVSdH2628tSKZ4EW+ 1IEkl4nDMdO7ZAuPBmQKf26c3mswbrFnv7ua5ZrsV8BFMbxfZ+W8YMpLRfLEl3tkfZji l1UTaM+Npn54CpV8Cxg4TYnqpL06D21RO/xh60sKiP7xESeX9jL2Whe0Ww3zcoyNY2RK PsxsQnesni/XYlG19Ec/Yz4MkJnmI2/9+58VNoAEi6uJW6LKKJMCUTzYFbNOB1RsSE70 dAWN+dznkw6rcSSONvRtUOt1WwisFADflvvDCTcVo38zllxahVmmmvHVH7RQeR7Is4n2 j0NQ== 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=6cLCJ8eTBOht2aUrBv+i7fqNHAULDu27cS8qeqfC/rk=; b=jomMcNdeuXjsEDjw5TwMKUiC1Aw9tQPbxIiliWyq+verIrgGjfhSQ+KcAwnz1P2tHJ PkczLf7lJYUe2dL4vrxMcFOs2k2Y69qc2ehUdU44RY52M5Mspd6bexK8v76UEwy3n7Uf hC5O7u97L1g2sHX3NdSx/TRNASCwBglCxlj4uKwK8TL+etKvP1lZkoBXX1tP9FRPQz/d FSpso1ZDGsFEn65zOUwJA05uAZX31+9JicrL+uAjWw5VjU82/TbwAxF3rF3pAPLUiV/5 XHcLHA5pICpEV8jjOgrgWBwxUeRhSrxyRia9xjZeeV7+amkcvrZeIcYPd8+3yYmOiyOt ZjSw== X-Gm-Message-State: AOAM530Srdg962Pplgl4wqeUmFqybQyXza7wOyguTI+fVYmU+9YnW94f jBqfC/Tzaz8ambYTKj3CmO0N3UH9q7/oD/Q58V5eJc4R+DiJ32sOXzo= X-Google-Smtp-Source: ABdhPJwXvC7vqHU8oejg5C+66j8RUrSKyGl7+G0qRvmcQA02ak1K/4qooLqj2hqxX6SEKSL0L1fvO/gbjenG7141jhg= X-Received: by 2002:a17:906:99c5:b0:6df:8215:4ccd with SMTP id s5-20020a17090699c500b006df82154ccdmr23403996ejn.684.1651713849353; Wed, 04 May 2022 18:24:09 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=hongyi.zhao@gmail.com; helo=mail-ej1-x62b.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:137123 Archived-At: I want to call Emacsclient to format the gap script with the following steps: 1. Put the following code snippet in scratch buffer, and `C-x C-e` it: ```emacs-lisp (server-start) (defun my-gap-format-file (file) "Open file, format as GAP, and save." (with-current-buffer (find-file "test.gap") (gap-format-buffer) (save-buffer))) ``` 2. According to the comment here [1], I tried the following method but failed: ```shell $ time emacsclient -s read --eval '(my-gap-format-file (file-truename "'"$1"'"))' gap-test.g emacsclient: Should XDG_RUNTIME_DIR='/run/user/1000' be in the environment? emacsclient: (Be careful: XDG_RUNTIME_DIR is security-related.) emacsclient: can't find socket; have you started the server? emacsclient: To start the server in Emacs, type "M-x server-start". emacsclient: error accessing socket "read" real 0m0.012s user 0m0.009s sys 0m0.005s ``` How can I run `emacsclient --eval` with command line arguments in this situation? [1] https://www.reddit.com/r/emacs/comments/hhbcg7/emacsclient_eval_with_command_line_arguments/ 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