[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Control of fan-speed on Lenovo Thinkpads
From: |
Michael Albinus |
Subject: |
Re: Control of fan-speed on Lenovo Thinkpads |
Date: |
Tue, 30 Mar 2021 12:13:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Jean Louis <bugs@gnu.support> 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.
- Control of fan-speed on Lenovo Thinkpads, Jean Louis, 2021/03/29
- Re: Control of fan-speed on Lenovo Thinkpads, Michael Albinus, 2021/03/30
- Re: Control of fan-speed on Lenovo Thinkpads, Jean Louis, 2021/03/30
- Re: Control of fan-speed on Lenovo Thinkpads, Jean Louis, 2021/03/30
- Re: Control of fan-speed on Lenovo Thinkpads,
Michael Albinus <=
- Finding simpler better sudo for Emacs, Jean Louis, 2021/03/30
- Re: Finding simpler better sudo for Emacs, Michael Albinus, 2021/03/30
- Re: Finding simpler better sudo for Emacs, Jean Louis, 2021/03/30
- Re: Finding simpler better sudo for Emacs, Michael Albinus, 2021/03/30
- Re: Finding simpler better sudo for Emacs, Jean Louis, 2021/03/30
- Re: Finding simpler better sudo for Emacs, Michael Albinus, 2021/03/30
- Re: Finding simpler better sudo for Emacs, Jean Louis, 2021/03/30
Re: Control of fan-speed on Lenovo Thinkpads, Stefan Monnier, 2021/03/30