* always local shell?
@ 2022-04-24 0:36 Emanuel Berg via Users list for the GNU Emacs text editor
2022-04-24 1:28 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 4+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-04-24 0:36 UTC (permalink / raw)
To: help-gnu-emacs
(defun shell-local ()
(interactive)
(while (file-remote-p default-directory)
(bury-buffer) )
(shell) )
(defalias 'sh #'shell-local)
If not a single file is local, it'll be an endless loop!
But OTOH if you rely that exclusively on remote files ... why
ever would you like the shell to always be local?
Still ... one suspects one could do it better ...
stay tuned for the O(1) solution ...
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: always local shell?
2022-04-24 0:36 always local shell? Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-04-24 1:28 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-04-24 17:21 ` Thibaut Verron
0 siblings, 1 reply; 4+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-04-24 1:28 UTC (permalink / raw)
To: help-gnu-emacs
> stay tuned for the O(1) solution ...
(defun shell-local-2 ()
(interactive)
(let ((buf (get-buffer "*Messages*")))
(when (bufferp buf)
(set-buffer buf)
(shell) )))
(defalias 'sh #'shell-local-2)
?
PS. Why don't you stop delaying my messages?
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: always local shell?
2022-04-24 1:28 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-04-24 17:21 ` Thibaut Verron
2022-04-24 19:27 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 4+ messages in thread
From: Thibaut Verron @ 2022-04-24 17:21 UTC (permalink / raw)
To: Emanuel Berg, help-gnu-emacs
Isn't that essentially the same thing as
(with-current-buffer "*Messages*"
(shell))
?
I think something like
(let (default-directory user-emacs-directory)
(shell))
should also work.
Le dim. 24 avr. 2022 à 18:55, Emanuel Berg via Users list for the GNU Emacs
text editor <help-gnu-emacs@gnu.org> a écrit :
> > stay tuned for the O(1) solution ...
>
> (defun shell-local-2 ()
> (interactive)
> (let ((buf (get-buffer "*Messages*")))
> (when (bufferp buf)
> (set-buffer buf)
> (shell) )))
> (defalias 'sh #'shell-local-2)
>
> ?
>
> PS. Why don't you stop delaying my messages?
>
> --
> underground experts united
> https://dataswamp.org/~incal
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: always local shell?
2022-04-24 17:21 ` Thibaut Verron
@ 2022-04-24 19:27 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 0 replies; 4+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-04-24 19:27 UTC (permalink / raw)
To: help-gnu-emacs
Thibaut Verron wrote:
> Isn't that essentially the same thing as
>
> (with-current-buffer "*Messages*"
> (shell))
>
> ?
One can use `messages-buffer' if one don't want to hard-code
"*Messages*".
Only, that is hard-coded in messages-buffer! 3 times in
total 7 lines of code.
In /usr/local/share/emacs/29.0.50/lisp/simple.el.gz
lines 9804-9810.
Also, go to a remote file. Kill the messages buffer and do
(messages-buffer)
Go to *Messages* and then C-h v default-directory RET - you'll
see it is remote as well.
Don't know how often people kill the messages buffer tho ...
> I think something like
>
> (let (default-directory user-emacs-directory)
> (shell))
>
> should also work.
Not only does that not work but it also breaks shell so you
can't use it any other way either :)
But yes, this works:
(let ((default-directory user-emacs-directory))
(shell) )
Maybe that's the best one?
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-24 19:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-24 0:36 always local shell? Emanuel Berg via Users list for the GNU Emacs text editor
2022-04-24 1:28 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-04-24 17:21 ` Thibaut Verron
2022-04-24 19:27 ` Emanuel Berg via Users list for the GNU Emacs text editor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).