Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bug#43165: [PATCH] Add load this file lisp function.

0 views
Skip to first unread message

Lars Ingebrigtsen

unread,
Sep 2, 2020, 5:44:05 AM9/2/20
to Jen-Chieh Shen, 43...@debbugs.gnu.org
Jen-Chieh Shen <jcs0...@gmail.com> writes:

> I think `load-this-file` could be kind of handy.Is related to `kill-buffer` and
> `kill-this-buffer`, etc.
>
> What do you guys think?

[...]

> +(defun load-this-file ()
> + "Load current Lisp file."
> + (interactive)
> + (load-file (buffer-file-name)))

This doesn't really seem all that useful -- `M-x load-file RET M-n RET'
gives you the same result.

--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no



Lars Ingebrigtsen

unread,
Sep 2, 2020, 6:24:05 AM9/2/20
to Jen-Chieh Shen, 43...@debbugs.gnu.org
(Please keep the debbugs address in the Cc field when responding.)

Jen-Chieh Shen <jcs0...@gmail.com> writes:

> It’s fine, I am just an extreme lazy guy that doesn’t even want to
> type in the file I want to load. Imagine like type in, M-x load-file
> then type in the file path. It causes TWO steps! TWO steps! And if you
> do that a couple of times then this wouldn’t be fun at all. Lol

Like I said, you don't have to type in the file path. Just do:

Drew Adams

unread,
Sep 2, 2020, 11:52:06 AM9/2/20
to Lars Ingebrigtsen, Jen-Chieh Shen, 43...@debbugs.gnu.org
> Just do: `M-x load-file RET M-n RET'

I was going to say this yesterday, when I saw
the enhancement request.

Just do: `M-x load-file RET RET'. No need for
`M-n'. Of course, one needs to know this, to
do it. I've been doing it forever. Would I
want a key for it? Not I.

But it's true that we have `kill-this-buffer'.

The reason we have `kill-this-buffer', I believe,
is just for a menu item (`Close': `<menu-bar>
<file> <kill-buffer>'). It makes little sense
to bind it to a keyboard key. But someone could.

`load-file' is in the same boat, I think. There's
little use for a `load-this-file' command, in
terms of keyboard key bindings. But I suppose
it could serve (like `Close') as a menu item.

Actually, there's a difference from `kill-buffer':
the risk of killing something unintended versus
the risk of loading something unintended. Maybe
the same reason we show the default in the prompt,
for `kill-buffer'.

If you were to bind `kill-this-buffer' to a key,
and accidentally hit that key, bye-bye wrong
buffer, perhaps. In a menu that's less likely
to happen. For `load-this-file' there's less of
a "danger", if you accidentally try to load the
current file when you shouldn't.

I don't see a need for such a command, personally,
but about the same thing goes for `kill-this-buffer'.

Note, BTW, that we don't even bind `load-file'
by default. It's not really a command that users
use every 10 minutes.

Personally, I'd say we don't need a `load-this-file'.
Just one opinion.



0 new messages