From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?B?SmFyb3PFgmF3IFJ6ZXN6w7N0a28=?= Newsgroups: gmane.emacs.devel Subject: Re: Rename, delete and move current buffer and file Date: Mon, 7 May 2018 18:20:53 +0200 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000c94797056ba00d24" X-Trace: blaine.gmane.org 1525710069 27396 195.159.176.226 (7 May 2018 16:21:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 7 May 2018 16:21:09 +0000 (UTC) To: "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 07 18:21:05 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFisq-0006zB-HZ for ged-emacs-devel@m.gmane.org; Mon, 07 May 2018 18:21:04 +0200 Original-Received: from localhost ([::1]:47098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFiuw-0003a0-1f for ged-emacs-devel@m.gmane.org; Mon, 07 May 2018 12:23:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFisi-0002SB-Jo for emacs-devel@gnu.org; Mon, 07 May 2018 12:20:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFisg-0006nN-Nr for emacs-devel@gnu.org; Mon, 07 May 2018 12:20:56 -0400 Original-Received: from mail-yw0-x22e.google.com ([2607:f8b0:4002:c05::22e]:43846) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fFisg-0006nB-G0 for emacs-devel@gnu.org; Mon, 07 May 2018 12:20:54 -0400 Original-Received: by mail-yw0-x22e.google.com with SMTP id r202-v6so8772662ywg.10 for ; Mon, 07 May 2018 09:20:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=V1QCR66ms4JAZSWm2BzW4jfuZpS8p36MzZsEbdlraU4=; b=l0bR9fUeBomgS2XSVNsojkz0G9t8UuNyG3awKJkvQrRtIokwL39SvPHa8l1wY1YGre 5ygu2b+anQBiO6cqmcdoXkHBgHkI4REFZr3X84t2Z6grjC5yJMUNGJ/d1CFrRLb50AeB 3NX/7Ie8Nwit4hRFQRDwi4QFL+j2V0I8XOiu1KmMcKBIp09AQnzgB2OKUCEqGYFlsjbB 9VMI074toUNPNuKCkJY/Jer0oD91TzJ73yAdKXagxbeeb+pNOfL01zogfxyqHemY9kOa rFp4nov2DCI2yAcBiU9UEpT2C/QEjw4oKMGDOmUinwUz73viNs3vWZuIPwARMmh9U3si Qclw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=V1QCR66ms4JAZSWm2BzW4jfuZpS8p36MzZsEbdlraU4=; b=bUvhIsNbCOR7TGzNuYHUmNwyvI+JB2863CDACed+I/32v+OF4wQPb3faP1zwVX9eeo 1ozfO8KNL7ie/F/vET9bd8U1KW0rC4lXGVOG8F7NV6cT29tTZXpHLI1tBYu9tL9f1y8a DwQuO+kCufY6D8UbretSAnd7XS3H3Q0fuAMT9yB9jLrqdKv6gq4DERpZmoMoas33G3A8 2civ8/J6Lrznva4/quUpmcCVft+Ktj5U09PMbKlEFykBS0fIsmrDg9BcyWJIURPzCyi+ 3MdluHo03riem6laDoUt30xwv0LWWv/9QOoYRiPItl+xrU46ZqS3sKmOWhmtBRilVvhG DGag== X-Gm-Message-State: ALQs6tCjXz6O1X/AhjR6a5YtFxdjpURGkJRBfeBJSdLK12MNgJD0SiNt fPkmeIhr2o2FzBDbjCt93RGkUYCgKLvPUX0UmS0tyA== X-Google-Smtp-Source: AB8JxZpYqFv3xCw2qkEb6hFaj/Zwct0gyUd1jedZlFYWgH2viimMSlbNkCsLxyXpgOrcebf/9inLyyoPuDch6d7KQLU= X-Received: by 2002:a0d:ed06:: with SMTP id w6-v6mr19794768ywe.467.1525710053786; Mon, 07 May 2018 09:20:53 -0700 (PDT) Original-Received: by 2002:a5b:b08:0:0:0:0:0 with HTTP; Mon, 7 May 2018 09:20:53 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4002:c05::22e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225120 Archived-At: --000000000000c94797056ba00d24 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, May 7, 2018 at 5:28 PM, Yuri Khan wrote: > On Mon, May 7, 2018 at 8:59 PM Jaros=C5=82aw Rzesz=C3=B3tko > wrote: > > > It is surprisingly hard to do this in Emacs [=E2=80=A6] > > You can use dired, but I personally find it to be a distraction for thi= s > use case. > > Why? > I personally most often want this when working on a programming project, I have a bunch of files open and I am in the middle of a planned sequence of changes, popping up a new buffer and dealing with dired which I do not otherwise use much breaks my concentration. It is hard to explain this fully rationally, but judging by how many .emacs, libraries, wiki pages etc. I have seen that have rename-file-and-buffer in them I am not the only one. Note that an interactive delete-file function already exists, but it doesn't kill the associated buffer. That's why I consider it a gap in the Emacs set of functions. There are three sets of operations: file operations (rename-file, delete-file), buffer operations (rename-buffer, kill-buffer) and some file+buffer operations (set-visited-file-name). It would be nice if there was some unity among the three sets, so that it would be possible to do the common operations in all three ways (file/buffer/file+buffer), and that the naming is reasonably consistent. Of course backwards compatibility is an issue as always. > [...] > > A very similar related pain point is that it is hard to get the path an= d > directory of the current buffers visited file. > > Your favorite binding of =E2=80=98find-file=E2=80=99, followed by your pr= eferred method to > get the current line to clipboard. (This breaks if you =E2=80=98cd=E2=80= =99 to a different > directory while editing a file.) > This is not that easy if you use a completion system like ivy or ido. It's also not nice from an elisp standpoint, that for the two strongly related things, one is accessible only as a variable and the other either as a command or function. > > > Finally, while we are discussing functions everyone re-implements in > their .emacs, please lets make transpose-windows happen as an Emacs built= in > :) > > You mean the windcycle library? > I mean: https://github.com/bbatsov/crux/blob/master/crux.el#L471 https://www.emacswiki.org/emacs/TransposeWindows Sure there are packages to do this, it just seems strange among the many built-in window functions there is no transpose. Again, you will easily find very many .emacs on the web implementing a function like this, which for me looks like a bit of gap in what is provided out-of-the-box. Cheers, Jaros=C5=82aw Rzesz=C3=B3tko On Mon, May 7, 2018 at 5:28 PM, Yuri Khan wrote: > On Mon, May 7, 2018 at 8:59 PM Jaros=C5=82aw Rzesz=C3=B3tko > wrote: > > > It is surprisingly hard to do this in Emacs [=E2=80=A6] > > You can use dired, but I personally find it to be a distraction for thi= s > use case. > > Why? > > I think of deleting, renaming and moving as operations on the file as a > whole and not on its content, so saving the file and going =E2=80=9Coutsi= de=E2=80=9D it is > the intuitive first step for me. =E2=80=98dired-jump=E2=80=99 takes me to= the Dired buffer > of the enclosing directory and puts point on the file. It=E2=80=99s on C-= x C-j by > default, but I bind it on so my fingers think going =E2=80=9Cout= side=E2=80=9D is a > single spatial movement. > > If I want to delete the file, I press D and confirm. To rename, I press R > and enter the new name; the buffer is renamed automatically. > > When copying or moving files, I prefer to see the target directory before= I > do it. So, I split the window, switch there, navigate to the target > directory, switch back, R (or C to copy), RET (because with > =E2=80=98dired-dwim-target=E2=80=99 set to non-nil the target directory i= s automatically > suggested as the default), then deal with any changes to the window > configuration. > > Note here the DWIM behavior: R suggests the directory in the other window= , > but if there is no other window, then the current directory. > > > A very similar related pain point is that it is hard to get the path an= d > directory of the current buffers visited file. > > Your favorite binding of =E2=80=98find-file=E2=80=99, followed by your pr= eferred method to > get the current line to clipboard. (This breaks if you =E2=80=98cd=E2=80= =99 to a different > directory while editing a file.) > > > Finally, while we are discussing functions everyone re-implements in > their .emacs, please lets make transpose-windows happen as an Emacs built= in > :) > > You mean the windcycle library? > --000000000000c94797056ba00d24 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, May 7, 2018 at 5:28 PM= , Yuri Khan=C2=A0<yurivkhan@= gmail.com>=C2=A0wrote:
On Mon, May 7, 2018 at 8:59 PM Jaros=C5=82aw Rz= esz=C3=B3tko <jrzeszotko@gmail.com>
wrote:
> It is surprisingly hard to do this in Emacs [=E2=80=A6]
> You can use dired, but I pers= onally find it to be a distraction for this
use case.

Why?=

I personally most often want th= is when working on a programming project, I have a bunch of files open and = I am in the middle of a planned sequence of changes, popping up a new buffe= r and dealing with dired which I do not otherwise use much breaks my concen= tration. It is hard to explain this fully rationally, but judging by how ma= ny .emacs, libraries, wiki pages etc. I have seen that have rename-file-and= -buffer in them I am not the only one.

Note that a= n interactive delete-file function already exists, but it doesn't kill = the associated buffer. That's why I consider it a gap in the Emacs set = of functions. There are three sets of operations: file operations (rename-f= ile, delete-file), buffer operations (rename-buffer, kill-buffer) and some = file+buffer operations (set-visited-file-name). It would be nice if there w= as some unity among the three sets, so that it would be possible to do the = common operations in all three ways (file/buffer/file+buffer), and that the= naming is reasonably consistent. Of course backwards compatibility is an i= ssue as always.
=C2=A0
[...]

> A very similar related pain poi= nt is that it is hard to get the path and
directory of the current buffe= rs visited file.

Your favorite binding of =E2=80=98find-file= =E2=80=99, followed by your preferred method to
get the current line to = clipboard. (This breaks if you =E2=80=98cd=E2=80=99 to a different
direc= tory while editing a file.)

This= is not that easy if you use a completion system like ivy or ido. It's = also not nice from an elisp standpoint, that for the two strongly related t= hings, one is accessible only as a variable and the other either as a comma= nd or function.=C2=A0
=C2=A0

> Finally, while= we are discussing functions everyone re-implements in
their .emacs, ple= ase lets make transpose-windows happen as an Emacs builtin
:)

You mean the windcycle library?

<= div>I mean:

https://github.com/bbatsov/crux/blob/master/crux.el#L471

Sure there are packages = to do this, it just seems strange among the many built-in window functions = there is no transpose. Again, you will easily find very many .emacs on the = web implementing a function like this, which for me looks like a bit of gap= in what is provided out-of-the-box.

Cheers,
Jaros=C5=82aw Rzesz=C3=B3tko
<= br>

On Mon, = May 7, 2018 at 5:28 PM, Yuri Khan <yurivkhan@gmail.com> wr= ote:
On Mon, May 7, 2018 at 8:59 PM Jaros= =C5=82aw Rzesz=C3=B3tko <jrzeszo= tko@gmail.com>
wrote:

> It is surprisingly hard to do this in Emacs [=E2=80=A6]
> You can use dired, but I personally find it to be a d= istraction for this
use case.

Why?

I think of deleting, renaming and moving as operations on the file as a
whole and not on its content, so saving the file and going =E2=80=9Coutside= =E2=80=9D it is
the intuitive first step for me. =E2=80=98dired-jump=E2=80=99 takes me to t= he Dired buffer
of the enclosing directory and puts point on the file. It=E2=80=99s on C-x = C-j by
default, but I bind it on <M-S-up> so my fingers think going =E2=80= =9Coutside=E2=80=9D is a
single spatial movement.

If I want to delete the file, I press D and confirm. To rename, I press R and enter the new name; the buffer is renamed automatically.

When copying or moving files, I prefer to see the target directory before I=
do it. So, I split the window, switch there, navigate to the target
directory, switch back, R (or C to copy), RET (because with
=E2=80=98dired-dwim-target=E2=80=99 set to non-nil the target directory is = automatically
suggested as the default), then deal with any changes to the window
configuration.

Note here the DWIM behavior: R suggests the directory in the other window,<= br> but if there is no other window, then the current directory.

> A very similar related pain point is that it is hard to get the path a= nd
directory of the current buffers visited file.

Your favorite binding of =E2=80=98find-file=E2=80=99, followed by yo= ur preferred method to
get the current line to clipboard. (This breaks if you =E2=80=98cd=E2=80=99= to a different
directory while editing a file.)

> Finally, while we are discussing functions everyone re-implements in their .emacs, please lets make transpose-windows happen as an Emacs builtin=
:)

You mean the windcycle library?

--000000000000c94797056ba00d24--