From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.help Subject: Re: Control of fan-speed on Lenovo Thinkpads Date: Tue, 30 Mar 2021 12:13:26 +0200 Message-ID: <877dlp3q61.fsf@gmx.de> References: <87blb13vr8.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8570"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: Help GNU Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 30 12:14:07 2021 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 1lRBNv-00027o-5c for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 30 Mar 2021 12:14:07 +0200 Original-Received: from localhost ([::1]:40760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRBNu-0003fy-5u for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 30 Mar 2021 06:14:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRBNP-0003ex-60 for help-gnu-emacs@gnu.org; Tue, 30 Mar 2021 06:13:35 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:41393) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRBNK-0001rp-50 for help-gnu-emacs@gnu.org; Tue, 30 Mar 2021 06:13:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1617099208; bh=XFwzOUyq9xtGaVbfW9wFVs4RzQva0o2fVnHs9j+7/6Q=; h=X-UI-Sender-Class:From:To:Subject:References:Date:In-Reply-To; b=ecICSkVIXnXg2aIacM5zhWKvO6UkFnWnz85bTeJ8w9kurnGsIq4oaFTehaiZ98WI3 +gRXjakXy/7mWYtPnubjyfItD4ZfiPXtVqPpbH2Dz2GwyMzp/TBTXKsnCyf/1eMGZn /FgAECytCseIkIIsKdP5cYPvtT8v0vQsc6ZDE5+g= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([212.86.60.94]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MVeMG-1l1mjr31lM-00RXjL for ; Tue, 30 Mar 2021 12:13:27 +0200 In-Reply-To: (Jean Louis's message of "Tue, 30 Mar 2021 12:44:49 +0300") X-Provags-ID: V03:K1:kFN8yvX1jrzwiXbDuawpRu6AqRjyMUg/2/2RTn/WpuLxfiVBYkt 1FKthNybR846VTrE+evhC8YYQXbIAMqRga1WQ5frY4AnXVJAFQby5jo4HWsJ/usL4wdKkkR COs9hmdrH6w0OxjYxb1BOsb5B3H+osVDRo83KvPCPbAyHjJFwicIG7FnqwgDZxBKW+IcQTu Px0VmAsb29saM45EMakdg== X-UI-Out-Filterresults: notjunk:1;V03:K0:dKvWlguvsqc=:mKJ3r4EM+EtrinJaXexgYY 7R1Yg983/TWNx2m8kWQHgk83wHTCM5dspHc3CMcCW8eZfBPpoR4iyH5uaH3FgJscBHOLKYV5E QN0IPdbl/9kYUvq06aokjab7wqnpNDPy/wLv0W+enUooAUybZZ/WVj9jNri8lMNgPfkUMP7X1 yI4/JjLURkSBI12oV8XDmNhXIbOuA0m+JUba2+mXVPTBHhKZt7LdhV6YFWDFN/pdGLA1q5xpL 4/FIW7uK9PjT/lc2avo3DtmD589su/DpSfE4P4HUz+XJmvpqOhMlInEecRFJLnYo/4BilZr94 QbxtkG2Nz1h+5mzSsD14ahxsi1mIykdC2SmDz8/Pla+JsJ2RRyTL+NEqU9cFTR14Dba+3QJff xPk2p/1MR5dwQ+9LqIP69LFuedReLmEvWrXxxV7f8nAu6WgsdVYVjB5sXXCTM76rSXCPFs5QJ YJyYmkLxNSvEfnqRi1ZJvDdxYiS7HqwZZmpGf83o3DfZ/I5RgvLR8LcEWqpS2PhAph0WV9479 JsmrnsxIEZ6S3i05j5wLOdMmTkm66y5Bl2Wlc6Z/mCRclU4NvBmqFWdGHKuvoWWe9C76yAhUE 2eiVEQcxOUHMEnOd322PuiRifOJD/Qr+4EJR3vYzTv60svXVdBeJUU08KdBcnkwdhXrnvbfif jsSgLKDKZbhI7Iz9xNKIw/2jZmysa7plPFqBbNEBd4BZMhJbM38od3Yo1MWqws+I9jPziBX6Z NEl8GLCTwMvd7M++2GNuM7HcvohmD2hEE+vk2tVP3XeI00I8KMfezMHehBDRSpoRBtkZMriY Received-SPF: pass client-ip=212.227.17.22; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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:128757 Archived-At: Jean Louis writes: Hi Jean, > (defun sudo (&rest arguments) > "Executes list ARGUMENTS with system command `sudo'." > (let ((original-directory default-directory) > (default-directory "/sudo::") > (return (shell-command-to-string (string-join arguments " ")))) > (setq default-directory original-directory) > return)) There's no need to keep and set original-directory, this is done by the let wrapper. And setting default-directory doesn't do anything, you would need let* in your approach. With my adapted code snippet, you could do the following in order to keep the current directory: (defun sudo (&rest arguments) "Executes list ARGUMENTS with system command `sudo'." (let ((default-directory (concat "/sudo::" (file-local-name default-directory)))) (shell-command-to-string (string-join arguments " ")))) Best regards, Michael.