unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Minor feature idea
@ 2015-01-22 22:09 Richard Stallman
  2015-01-22 22:56 ` Daniel Colascione
  2015-01-22 23:12 ` Dmitry Gutov
  0 siblings, 2 replies; 16+ messages in thread
From: Richard Stallman @ 2015-01-22 22:09 UTC (permalink / raw)
  To: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

In the minibuffer reading a file name, C-a typed within the last
component could move to the start of that component.  The next time,
it could move to the beginning of the line.

If people think it is a good idea, I will write it if no one else
does.

Alternatively, C-M-b and C-M-f could move by filename component.
That is cleaner and does more, but those chars are harder to type
and users won't come across it in their editing.

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: Minor feature idea
       [not found] <<E1YEPwm-0004PK-Aw@fencepost.gnu.org>
@ 2015-01-22 22:42 ` Drew Adams
  0 siblings, 0 replies; 16+ messages in thread
From: Drew Adams @ 2015-01-22 22:42 UTC (permalink / raw)
  To: rms, emacs-devel

> In the minibuffer reading a file name, C-a typed within the last
> component could move to the start of that component.  The next time,
> it could move to the beginning of the line.
> 
> If people think it is a good idea, I will write it if no one else
> does.
> 
> Alternatively, C-M-b and C-M-f could move by filename component.
> That is cleaner and does more, but those chars are harder to type
> and users won't come across it in their editing.

It's certainly possible to do such things.  2 cents:

1. The minibuffer is an editing buffer.  The usual commands for
   doing things like this (moving over filename components) should
   apply there as well.

   If there is a lack of such features in general then they can be
   added for the general case, and they would then automatically
   apply to the minibuffer case as well.

2. It should not be assumed that minibuffer input is a single line.

   In my use, for example, there are lots of cases where I yank
   or otherwise retrieve and edit multiple-line text in the
   minibuffer.  Doing this is easier in my context, perhaps
   (Icicles), but it can and should be just as possible in Emacs.

   For my use, both in the minibuffer and outside of it, I bind
   `C-a' and `C-e' to repeatable commands that move to the start
   and end of the previous or next line.  E.g., `C-e' moves to
   the end of the line, repeating it moves to the end of the next
   line, etc.  This helps for multiple-line editing, IMO.

I would prefer that `C-a' and `C-e' remain based on line limits
and not try to move to other-thing limits based on the context.
If they were to be changed to do that, I would prefer that they
at least do so for things that are similar to or analogous to lines.

Similar arguments apply to `C-M-b'/`C-M-f'.  But there I think
you might have a point, in that input that involves filenames
is often distinct from input that involves symbols, and even
when they are both present (e.g. for Lisp sexp input) it is
generally not a problem to use the same keys for both symbols
and filename components.

To repeat what I said in #1: let's add commands/keys that move
forward/backward over filename components, if that is deemed not
easy enough currently.  Let's not co-opt `C-a'/`C-e' for that.

I might not object to `C-M-b'/`C-M-f', but again, why make the
behavior different for the minibuffer?  IOW, maybe they should
handle filename components the same way they handle symbols (?).
On the other hand, it can be handy to use these keys to move
past a whole file name.

[I assume that by "component" you mean whatever is between
(unescaped) `/' chars, or something similar.  I don't know of a
command that does that, but it could be useful.
(`forward-same-syntax' comes close, but it requires repetition
to get across each `/'.)]

Just one opinion, and liable to change.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-22 22:09 Minor feature idea Richard Stallman
@ 2015-01-22 22:56 ` Daniel Colascione
  2015-01-22 23:07   ` Drew Adams
                     ` (2 more replies)
  2015-01-22 23:12 ` Dmitry Gutov
  1 sibling, 3 replies; 16+ messages in thread
From: Daniel Colascione @ 2015-01-22 22:56 UTC (permalink / raw)
  To: rms, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 943 bytes --]

On 01/22/2015 02:09 PM, Richard Stallman wrote:
> In the minibuffer reading a file name, C-a typed within the last
> component could move to the start of that component.  The next time,
> it could move to the beginning of the line.
> 
> If people think it is a good idea, I will write it if no one else
> does.

I use C-a C-k too often to want to change the C-a binding.  The existing
movement function bindings are adequate if we want to use them.

> 
> Alternatively, C-M-b and C-M-f could move by filename component.
> That is cleaner and does more, but those chars are harder to type
> and users won't come across it in their editing.

backward-sexp and forward-sexp feel like a better fit for navigation by
path component. They're close enough already that I frequently use them
to edit paths.

Another option is to repurpose the word movement bindings. I don't know
what to think of that. Is a filename a "word"?


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: Minor feature idea
  2015-01-22 22:56 ` Daniel Colascione
@ 2015-01-22 23:07   ` Drew Adams
  2015-01-23  3:43   ` Richard Stallman
  2015-01-23  3:49   ` Stefan Monnier
  2 siblings, 0 replies; 16+ messages in thread
From: Drew Adams @ 2015-01-22 23:07 UTC (permalink / raw)
  To: Daniel Colascione, rms, emacs-devel

> Another option is to repurpose the word movement bindings. I don't know
> what to think of that. Is a filename a "word"?

But just as for the symbol-movement commands, word-movement commands
are useful *as such* with file names.  It is often handy to move across
"word" components when editing file names, including in the minibuffer:
/foo-bar-thetototata-baz.bof
    ^   ^           ^




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-22 22:09 Minor feature idea Richard Stallman
  2015-01-22 22:56 ` Daniel Colascione
@ 2015-01-22 23:12 ` Dmitry Gutov
  2015-01-23  3:44   ` Richard Stallman
  1 sibling, 1 reply; 16+ messages in thread
From: Dmitry Gutov @ 2015-01-22 23:12 UTC (permalink / raw)
  To: rms, emacs-devel

On 01/23/2015 12:09 AM, Richard Stallman wrote:

> In the minibuffer reading a file name, C-a typed within the last
> component could move to the start of that component.  The next time,
> it could move to the beginning of the line.

Do you specifically want to move?

If you're fine with deleting the last segment instead, that's what `C-l' 
in `helm-find-files' (a third-party package) does, as I've found out 
recently. Seems (maybe more) useful.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-22 22:56 ` Daniel Colascione
  2015-01-22 23:07   ` Drew Adams
@ 2015-01-23  3:43   ` Richard Stallman
  2015-01-23  3:49   ` Stefan Monnier
  2 siblings, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2015-01-23  3:43 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Another option is to repurpose the word movement bindings. I don't know
  > what to think of that. Is a filename a "word"?

I find word commands useful on file names -- hyphens separate words.

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-22 23:12 ` Dmitry Gutov
@ 2015-01-23  3:44   ` Richard Stallman
  2015-01-23 13:38     ` Andreas Schwab
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2015-01-23  3:44 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > If you're fine with deleting the last segment instead, that's what `C-l' 
  > in `helm-find-files' (a third-party package) does, as I've found out 
  > recently. Seems (maybe more) useful.

In fact, I usually do want to delete the last segment.
A command to do that would serve well for me.  However, motion commands
are more general and typing C-k after is not hard.

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-22 22:56 ` Daniel Colascione
  2015-01-22 23:07   ` Drew Adams
  2015-01-23  3:43   ` Richard Stallman
@ 2015-01-23  3:49   ` Stefan Monnier
  2015-01-23  9:37     ` David Kastrup
                       ` (2 more replies)
  2 siblings, 3 replies; 16+ messages in thread
From: Stefan Monnier @ 2015-01-23  3:49 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: rms, emacs-devel

> I use C-a C-k too often to want to change the C-a binding.  The existing
> movement function bindings are adequate if we want to use them.

Agreed.

> backward-sexp and forward-sexp feel like a better fit for navigation by
> path component. They're close enough already that I frequently use them
> to edit paths.

Agreed.

> Another option is to repurpose the word movement bindings. I don't know
> what to think of that. Is a filename a "word"?

No, words are smaller and have a well-defined meaning globally.
OTOH "sexp" navigation is meant to be adjusted based on the particular
syntax of the things being edited, so it fits very well with the idea of
moving by file-name component.


        Stefan



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-23  3:49   ` Stefan Monnier
@ 2015-01-23  9:37     ` David Kastrup
  2015-01-23 20:17       ` Stefan Monnier
  2015-01-23 16:41     ` Karl Fogel
  2015-01-23 17:45     ` Wolfgang Jenkner
  2 siblings, 1 reply; 16+ messages in thread
From: David Kastrup @ 2015-01-23  9:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Daniel Colascione, rms, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I use C-a C-k too often to want to change the C-a binding.  The existing
>> movement function bindings are adequate if we want to use them.
>
> Agreed.

If C-a does not move across a slash, C-a C-k followed by typing an
_absolute_ file name will have the same end result.  Of course, so does
just typing / C-k anywhere followed by an absolute file name.

-- 
David Kastrup



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-23  3:44   ` Richard Stallman
@ 2015-01-23 13:38     ` Andreas Schwab
  2015-01-24  1:10       ` Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: Andreas Schwab @ 2015-01-23 13:38 UTC (permalink / raw)
  To: Richard Stallman; +Cc: emacs-devel, Dmitry Gutov

Richard Stallman <rms@gnu.org> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > If you're fine with deleting the last segment instead, that's what `C-l' 
>   > in `helm-find-files' (a third-party package) does, as I've found out 
>   > recently. Seems (maybe more) useful.
>
> In fact, I usually do want to delete the last segment.

There is zap-to-char, which deletes backwards with a negative prefix
argument.  It will also remove the character to zap to, though, which
requires you to type it again when you want to stay in the same
directory.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-23  3:49   ` Stefan Monnier
  2015-01-23  9:37     ` David Kastrup
@ 2015-01-23 16:41     ` Karl Fogel
  2015-01-23 17:45     ` Wolfgang Jenkner
  2 siblings, 0 replies; 16+ messages in thread
From: Karl Fogel @ 2015-01-23 16:41 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Another option is to repurpose the word movement bindings. I don't know
>> what to think of that. Is a filename a "word"?
>
>No, words are smaller and have a well-defined meaning globally.
>OTOH "sexp" navigation is meant to be adjusted based on the particular
>syntax of the things being edited, so it fits very well with the idea of
>moving by file-name component.

Agreed -- this solution makes the most sense to me.

One doesn't see many files named "/home/jrandom/(cons foo bar)/qux" :-).

Using sexp motion to move by path component makes semantic sense, and anyway there is unlikely to be some other more useful interpretation of sexps in that context.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-23  3:49   ` Stefan Monnier
  2015-01-23  9:37     ` David Kastrup
  2015-01-23 16:41     ` Karl Fogel
@ 2015-01-23 17:45     ` Wolfgang Jenkner
  2 siblings, 0 replies; 16+ messages in thread
From: Wolfgang Jenkner @ 2015-01-23 17:45 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Daniel Colascione, rms, emacs-devel

On Thu, Jan 22 2015, Stefan Monnier wrote:

> [Daniel Colascione wrote:]
>> Another option is to repurpose the word movement bindings. I don't know
>> what to think of that. Is a filename a "word"?
>
> No, words are smaller and have a well-defined meaning globally.

There's the superword-mode buffer-local minor mode, though.

When I do C-x C-f in

emacs -Q --eval '(setq enable-recursive-minibuffers t)'

I find that the syntax categories in the minibuffer are already
perfectly set up for that, e.g., `/' has punctuation syntax and `.'  has
symbol syntax.

Wolfgang



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-23  9:37     ` David Kastrup
@ 2015-01-23 20:17       ` Stefan Monnier
  0 siblings, 0 replies; 16+ messages in thread
From: Stefan Monnier @ 2015-01-23 20:17 UTC (permalink / raw)
  To: David Kastrup; +Cc: Daniel Colascione, rms, emacs-devel

> If C-a does not move across a slash, C-a C-k followed by typing an
> _absolute_ file name will have the same end result.

Almost, but not quite.  Try

   C-x C-f http://foo/bar RET

for an example where it doesn't quite work currently.


        Stefan



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-23 13:38     ` Andreas Schwab
@ 2015-01-24  1:10       ` Richard Stallman
  2015-01-25  6:45         ` Thierry Volpiatto
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2015-01-24  1:10 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel, dgutov

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > There is zap-to-char, which deletes backwards with a negative prefix
  > argument.  It will also remove the character to zap to, though, which
  > requires you to type it again when you want to stay in the same
  > directory.

Indeed, that works.  I had never thought of using that.
C-a C-k would be more convenient and easier to remember.

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-24  1:10       ` Richard Stallman
@ 2015-01-25  6:45         ` Thierry Volpiatto
  2015-01-26  3:42           ` Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: Thierry Volpiatto @ 2015-01-25  6:45 UTC (permalink / raw)
  To: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > There is zap-to-char, which deletes backwards with a negative prefix
>   > argument.  It will also remove the character to zap to, though, which
>   > requires you to type it again when you want to stay in the same
>   > directory.
>
> Indeed, that works.  I had never thought of using that.
> C-a C-k would be more convenient and easier to remember.

Probably zap-to-char should start with arg = -1 when eobp, it is what
zop-to-char (an enhanced zap-to-char) does.

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Minor feature idea
  2015-01-25  6:45         ` Thierry Volpiatto
@ 2015-01-26  3:42           ` Richard Stallman
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2015-01-26  3:42 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Probably zap-to-char should start with arg = -1 when eobp, it is what
  > zop-to-char (an enhanced zap-to-char) does.

Good idea; I think that would make this marginally easy enough to be
worth using.

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-01-26  3:42 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22 22:09 Minor feature idea Richard Stallman
2015-01-22 22:56 ` Daniel Colascione
2015-01-22 23:07   ` Drew Adams
2015-01-23  3:43   ` Richard Stallman
2015-01-23  3:49   ` Stefan Monnier
2015-01-23  9:37     ` David Kastrup
2015-01-23 20:17       ` Stefan Monnier
2015-01-23 16:41     ` Karl Fogel
2015-01-23 17:45     ` Wolfgang Jenkner
2015-01-22 23:12 ` Dmitry Gutov
2015-01-23  3:44   ` Richard Stallman
2015-01-23 13:38     ` Andreas Schwab
2015-01-24  1:10       ` Richard Stallman
2015-01-25  6:45         ` Thierry Volpiatto
2015-01-26  3:42           ` Richard Stallman
     [not found] <<E1YEPwm-0004PK-Aw@fencepost.gnu.org>
2015-01-22 22:42 ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).