librelist archives

« back to archive

refactor-completers

refactor-completers

From:
John J. Foerch
Date:
2013-12-20 @ 15:54
Hi all,

I have been working on a branch called refactor-completers — I had started
it a year or so ago, then shelved it to focus on other things, and
recently got back to finish it up.  It's getting close to the point where
it can be merged into master, so I thought that an announcement and a call
for testing and review would be in order.

This branch is a refactoring of the minibuffer completions system, to make
it easier to understand and more flexible.  One major bug is fixed, but
for the most part, this branch is groundwork for future features.

The bug that was fixed is that in filename completion, a directory
separator is inserted after directories instead of a space.
<http://bugs.conkeror.org/issue77>

One newly added feature made possible by this branch is the ability to
delete entries from history and bookmarks while in the url prompt,
analogous to how you can kill a buffer with C-k in the switch-to-buffer
prompt.

If you use any completers in your rc, there are two breaking changes that
you will need to update your rc for:

 - The first is that completers are now instantiated with the 'new'
   keyword, so "prefix_completer(...)" becomes "new
   prefix_completer(...)", etc.

 - Second, the symbol '$match_required' was changed to '$require_match'
   wherever it appears.

This second point is something that I wanted to do for consistency with
Emacs naming conventions, and as the whole completions system is changing,
it seemed like a good moment to make this change as well.

If you have defined any completers of your own in your rc, those will need
to be updated as well, though the changes are a little more involved so
email me or see me in the irc channel for help with that.

I would appreciate any testing that anybody can do before we merge this
change — it's a big patch and I want to be as sure as possible that I
haven't overlooked anything.

Thanks all, and happy holidays,

-- 
John Foerch

Re: [conkeror] refactor-completers

From:
Joren Van Onder
Date:
2013-12-21 @ 08:02
On Fri, Dec 20, 2013 at 04:54, jjfoerch@earthlink.net wrote:
> I would appreciate any testing that anybody can do before we merge this
> change — it's a big patch and I want to be as sure as possible that I
> haven't overlooked anything.
>
> Thanks all, and happy holidays,

Been testing it since yesterday and the new filename completion is
great. The only thing I've noticed is that C-k can not be used for
killing text anymore, probably because it is now used to delete entries
From history and bookmarks. It's not that big of a deal, but sometimes I
used it to kill parts of a url or even a whole url. There are obviously
a lot of other ways available to kill text, but just making sure you're
aware of this.

--
        Joren

Re: [conkeror] refactor-completers

From:
John J. Foerch
Date:
2013-12-21 @ 14:20
On Sat, Dec 21, 2013 at 09:02:15AM +0100, Joren Van Onder wrote:
> 
> On Fri, Dec 20, 2013 at 04:54, jjfoerch@earthlink.net wrote:
> > I would appreciate any testing that anybody can do before we merge this
> > change — it's a big patch and I want to be as sure as possible that I
> > haven't overlooked anything.
> >
> > Thanks all, and happy holidays,
> 
> Been testing it since yesterday and the new filename completion is
> great. The only thing I've noticed is that C-k can not be used for
> killing text anymore, probably because it is now used to delete entries
> >From history and bookmarks. It's not that big of a deal, but sometimes I
> used it to kill parts of a url or even a whole url. There are obviously
> a lot of other ways available to kill text, but just making sure you're
> aware of this.
> 
> --
>         Joren

Hmm, we should probably use a different key to avoid this conflict.
Whatever key we choose, we can then add to the switch-to-buffer case as
well, so that the UI will not be totally inconsistent.

My first thought is 'C-x C-k', but Emacs should be consulted to find the
right combo.

-- 
John Foerch

Re: [conkeror] refactor-completers

From:
Kinley Dorji
Date:
2013-12-21 @ 16:26
We already have C-x k to kill a buffer, like Emacs, as well as C-x b
to switch buffers, so we probably don't need a command to kill buffers
while in switch-buffer selection mode.

Killing a url in bookmarks or history however is possible only when in
selection mode (B or H), so having either C-x k or C-k as the kill
command would be consistent, imho. My $0.02. Ideally, C-k should work
whether in text mode or in url selection mode, though I'm not sure if
it is possible in Conkeror.

One other comment: After I kill a bookmark, Conkeror loses whatever
filter was in effect and I have to reenter it if I want delete more
urls in that region. Would it be possible, without too much trouble,
to remember the filter in effect and return me there automatically?

On Sat, Dec 21, 2013 at 8:20 PM, John J. Foerch <jjfoerch@earthlink.net> wrote:
> On Sat, Dec 21, 2013 at 09:02:15AM +0100, Joren Van Onder wrote:
>>
>> On Fri, Dec 20, 2013 at 04:54, jjfoerch@earthlink.net wrote:
>> > I would appreciate any testing that anybody can do before we merge this
>> > change — it's a big patch and I want to be as sure as possible that I
>> > haven't overlooked anything.
>> >
>> > Thanks all, and happy holidays,
>>
>> Been testing it since yesterday and the new filename completion is
>> great. The only thing I've noticed is that C-k can not be used for
>> killing text anymore, probably because it is now used to delete entries
>> >From history and bookmarks. It's not that big of a deal, but sometimes I
>> used it to kill parts of a url or even a whole url. There are obviously
>> a lot of other ways available to kill text, but just making sure you're
>> aware of this.
>>
>> --
>>         Joren
>
> Hmm, we should probably use a different key to avoid this conflict.
> Whatever key we choose, we can then add to the switch-to-buffer case as
> well, so that the UI will not be totally inconsistent.
>
> My first thought is 'C-x C-k', but Emacs should be consulted to find the
> right combo.
>
> --
> John Foerch

Re: [conkeror] refactor-completers

From:
Kinley Dorji
Date:
2013-12-21 @ 16:39
Sorry, I meant to refer to C-u g, g, C-u h, h and not B, H for the
various ways url bookmarks or history are accessible.

On Sat, Dec 21, 2013 at 10:26 PM, Kinley Dorji <kinleyd@gmail.com> wrote:
> We already have C-x k to kill a buffer, like Emacs, as well as C-x b
> to switch buffers, so we probably don't need a command to kill buffers
> while in switch-buffer selection mode.
>
> Killing a url in bookmarks or history however is possible only when in
> selection mode (B or H), so having either C-x k or C-k as the kill
> command would be consistent, imho. My $0.02. Ideally, C-k should work
> whether in text mode or in url selection mode, though I'm not sure if
> it is possible in Conkeror.
>
> One other comment: After I kill a bookmark, Conkeror loses whatever
> filter was in effect and I have to reenter it if I want delete more
> urls in that region. Would it be possible, without too much trouble,
> to remember the filter in effect and return me there automatically?
>
> On Sat, Dec 21, 2013 at 8:20 PM, John J. Foerch <jjfoerch@earthlink.net> wrote:
>> On Sat, Dec 21, 2013 at 09:02:15AM +0100, Joren Van Onder wrote:
>>>
>>> On Fri, Dec 20, 2013 at 04:54, jjfoerch@earthlink.net wrote:
>>> > I would appreciate any testing that anybody can do before we merge this
>>> > change — it's a big patch and I want to be as sure as possible that I
>>> > haven't overlooked anything.
>>> >
>>> > Thanks all, and happy holidays,
>>>
>>> Been testing it since yesterday and the new filename completion is
>>> great. The only thing I've noticed is that C-k can not be used for
>>> killing text anymore, probably because it is now used to delete entries
>>> >From history and bookmarks. It's not that big of a deal, but sometimes I
>>> used it to kill parts of a url or even a whole url. There are obviously
>>> a lot of other ways available to kill text, but just making sure you're
>>> aware of this.
>>>
>>> --
>>>         Joren
>>
>> Hmm, we should probably use a different key to avoid this conflict.
>> Whatever key we choose, we can then add to the switch-to-buffer case as
>> well, so that the UI will not be totally inconsistent.
>>
>> My first thought is 'C-x C-k', but Emacs should be consulted to find the
>> right combo.
>>
>> --
>> John Foerch

Re: [conkeror] refactor-completers

From:
John J. Foerch
Date:
2013-12-21 @ 16:45
On Sat, Dec 21, 2013 at 10:26:50PM +0600, Kinley Dorji wrote:
> We already have C-x k to kill a buffer, like Emacs, as well as C-x b
> to switch buffers, so we probably don't need a command to kill buffers
> while in switch-buffer selection mode.

Uh.. that feature has been there for quite some time, and a lot of people
use it.. it's not being considered for removal.

> 
> Killing a url in bookmarks or history however is possible only when in
> selection mode (B or H), so having either C-x k or C-k as the kill
> command would be consistent, imho. My $0.02. Ideally, C-k should work
> whether in text mode or in url selection mode, though I'm not sure if
> it is possible in Conkeror.

"selection mode (B or H)"?

> 
> One other comment: After I kill a bookmark, Conkeror loses whatever
> filter was in effect and I have to reenter it if I want delete more
> urls in that region. Would it be possible, without too much trouble,
> to remember the filter in effect and return me there automatically?
> 

I would like to do something like that, yes.  It will be such a sick hack
though. :-(

-- 
John Foerch

Re: [conkeror] refactor-completers

From:
Raimon Grau
Date:
2013-12-21 @ 17:06
I haven't tried the new conkeror branch and I don't use emacs bookmarks a
lot but here's my take:

What about using c-x r l (which is emacs' bookmark-list) and then show
something similar to c-x b, pressing RET would go to the bookmark location
and c-k would delete the bookmark, the same way as c-k kills a buffer when
c-x b.




On Sat, Dec 21, 2013 at 5:45 PM, John J. Foerch <jjfoerch@earthlink.net>wrote:

> On Sat, Dec 21, 2013 at 10:26:50PM +0600, Kinley Dorji wrote:
> > We already have C-x k to kill a buffer, like Emacs, as well as C-x b
> > to switch buffers, so we probably don't need a command to kill buffers
> > while in switch-buffer selection mode.
>
> Uh.. that feature has been there for quite some time, and a lot of people
> use it.. it's not being considered for removal.
>
> >
> > Killing a url in bookmarks or history however is possible only when in
> > selection mode (B or H), so having either C-x k or C-k as the kill
> > command would be consistent, imho. My $0.02. Ideally, C-k should work
> > whether in text mode or in url selection mode, though I'm not sure if
> > it is possible in Conkeror.
>
> "selection mode (B or H)"?
>
> >
> > One other comment: After I kill a bookmark, Conkeror loses whatever
> > filter was in effect and I have to reenter it if I want delete more
> > urls in that region. Would it be possible, without too much trouble,
> > to remember the filter in effect and return me there automatically?
> >
>
> I would like to do something like that, yes.  It will be such a sick hack
> though. :-(
>
> --
> John Foerch
>



-- 
"Emacs saves you time when you work, and takes it back when you play with
it"
blog -> http://puntoblogspot.blogspot.com

Re: [conkeror] refactor-completers

From:
John J. Foerch
Date:
2013-12-21 @ 18:45
On Sat, Dec 21, 2013 at 06:06:36PM +0100, Raimon Grau wrote:
> I haven't tried the new conkeror branch and I don't use emacs bookmarks a lot
> but here's my take:
> 
> What about using c-x r l (which is emacs' bookmark-list) and then show
> something similar to c-x b, pressing RET would go to the bookmark location and
> c-k would delete the bookmark, the same way as c-k kills a buffer when c-x b.

Bear in mind that we're talking about history as well, not just bookmarks.
So this command that you describe would be almost exactly the same thing
as find-url, minus the ability to edit the url.

The way I'm currently leaning is to bind read-url-kill-item to 'C-x C-k',
so that it would be available, but not in conflict with the normal binding
for kill-line.

This need not be viewed as the primary interface for managing history and
bookmarks.  It's meant more as a convenience.

-- 
John Foerch

Re: [conkeror] refactor-completers

From:
John J. Foerch
Date:
2013-12-21 @ 20:27
On Sat, Dec 21, 2013 at 01:45:20PM -0500, John J. Foerch wrote:
> The way I'm currently leaning is to bind read-url-kill-item to 'C-x C-k',
> so that it would be available, but not in conflict with the normal binding
> for kill-line.

I've pushed a patch with this change, so if we don't come up with a better
idea, that's how it will be.  :-)

-- 
John Foerch

Re: [conkeror] refactor-completers

From:
John J. Foerch
Date:
2013-12-21 @ 22:13
On Sat, Dec 21, 2013 at 03:27:17PM -0500, John J. Foerch wrote:
> On Sat, Dec 21, 2013 at 01:45:20PM -0500, John J. Foerch wrote:
> > The way I'm currently leaning is to bind read-url-kill-item to 'C-x C-k',
> > so that it would be available, but not in conflict with the normal binding
> > for kill-line.
> 
> I've pushed a patch with this change, so if we don't come up with a better
> idea, that's how it will be.  :-)

I'm exploring a better idea.  I'm not 100% sure it will work, but it seems
reasonable so far.  Here is the gist:

  Editing and Completing can be viewed as the two modes of minibuffer
interaction that a user switches between.  Completing-mode is entered by
calling minibuffer-complete or minibuffer-complete-previous (or clicking
on a completion with the mouse).  Editing mode is entered by doing
anything else - typing, moving point, pasting, etc.

  As long as there is this clear delineation between what is editing and
what is completing, we could have a special keymap engaged only when
completing, and this keymap would bind 'C-k' to a generic command called
"kill-completion-item" or such.  Different types of items (buffers,
bookmarks, history items) would all have their own methods for deletion,
so the generic command could kill any of them.

-- 
John Foerch

Re: [conkeror] refactor-completers

From:
Bruce Connor
Date:
2013-12-21 @ 19:29
> The way I'm currently leaning is to bind read-url-kill-item to 'C-x C-k',
> so that it would be available, but not in conflict with the normal binding
> for kill-line.

I agree with that proposition,
could we also bind it to C-x k without interfering with the global keybind
for that?
I think it would feel natural, since that key is globally used to kill
buffer.

We also make C-k only perform read-url-kill-item if the cursor is at the
end of the input line, otherwise it would kill line as usual. C-d could
also be used like that.

Artur

Re: [conkeror] refactor-completers

From:
John J. Foerch
Date:
2013-12-21 @ 20:13
On Sat, Dec 21, 2013 at 07:29:56PM +0000, Bruce Connor wrote:
> 
> > The way I'm currently leaning is to bind read-url-kill-item to 'C-x C-k',
> > so that it would be available, but not in conflict with the normal binding
> > for kill-line.
> 
> I agree with that proposition,
> could we also bind it to C-x k without interfering with the global keybind for
> that?
> I think it would feel natural, since that key is globally used to kill buffer.
> 

I would rather have one canonical key and leave alternatives for users to
do in their rc.  My emacs instinct is favoring 'C-x C-k' over 'C-x k'.

> We also make C-k only perform read-url-kill-item if the cursor is at the end of
> the input line, otherwise it would kill line as usual. C-d could also be used
> like that.
> 
> Artur
> 

I was thinking along these lines myself, for a bit — trying to finesse the
conflict as you suggest, or for example, only have C-k
kill-completion-item after selecting a completion (with tab, S-tab, etc).
However, I think that such extra rules would only lead to confusing
surprises.

  "I want to kill that history item — oh yeah, I have to put the point at
  the end of the input first"

Better keep it simple.

-- 
John Foerch

Re: [conkeror] refactor-completers

From:
Bruce Connor
Date:
2013-12-22 @ 01:39
On 21 Dec 2013 18:13, "John J. Foerch" <jjfoerch@earthlink.net> wrote:
> My emacs instinct is favoring 'C-x C-k' over 'C-x k'.
I agree with your other points, but I wanted to mention something.
Are your sure this instinct is part of default emacs?
I've also configured C-x C-k to kill-buffer, but I'm fairly sure its
default behaviour is a prefix for keyboard macro stuff. Not sure if it
would be an intuitive buffer-killer for other people.

Re: [conkeror] refactor-completers

From:
John J. Foerch
Date:
2013-12-22 @ 01:58
On Sun, Dec 22, 2013 at 01:39:12AM +0000, Bruce Connor wrote:
> 
> On 21 Dec 2013 18:13, "John J. Foerch" <jjfoerch@earthlink.net> wrote:
> > My emacs instinct is favoring 'C-x C-k' over 'C-x k'.
> I agree with your other points, but I wanted to mention something.
> Are your sure this instinct is part of default emacs?
> I've also configured C-x C-k to kill-buffer, but I'm fairly sure its default
> behaviour is a prefix for keyboard macro stuff. Not sure if it would be an
> intuitive buffer-killer for other people.
> 

'C-x k' is the kill-buffer key during the normal course of editing, but
its function is to start a minibuffer interaction allowing you to select a
buffer to kill, not to kill a buffer at point in an already on-going
interaction.

In an already on-going interaction, you're performing a special operation
on a "thing at point".  These kinds of things in Emacs generally use
combos with modifiers, I think.

'C-x C-k' is keyboard macro stuff in emacs, yes, but conkeror is not
likely to ever use that key for that purpose in the context under
discussion (minibuffer), so that leads me to view this binding as "up for
grabs".

This may all be a moot point though, because I think I've come up with a
way to just use 'C-k', and still avoid the conflict with kill-line.

-- 
John Foerch

Re: [conkeror] refactor-completers

From:
Kinley Dorji
Date:
2013-12-22 @ 02:59
> This may all be a moot point though, because I think I've come up with a
way to just use 'C-k', and still avoid the conflict with kill-line.

That would be the best way one could hope for. And don't forget the hack
for remembering one's place before kill-line. :)

Re: [conkeror] refactor-completers

From:
John J. Foerch
Date:
2013-12-21 @ 19:02
On Sat, Dec 21, 2013 at 01:45:20PM -0500, John J. Foerch wrote:
> On Sat, Dec 21, 2013 at 06:06:36PM +0100, Raimon Grau wrote:
> > I haven't tried the new conkeror branch and I don't use emacs bookmarks a lot
> > but here's my take:
> > 
> > What about using c-x r l (which is emacs' bookmark-list) and then show
> > something similar to c-x b, pressing RET would go to the bookmark location and
> > c-k would delete the bookmark, the same way as c-k kills a buffer when c-x b.
> 
> Bear in mind that we're talking about history as well, not just bookmarks.
> So this command that you describe would be almost exactly the same thing
> as find-url, minus the ability to edit the url.
> 
> The way I'm currently leaning is to bind read-url-kill-item to 'C-x C-k',
> so that it would be available, but not in conflict with the normal binding
> for kill-line.
> 
> This need not be viewed as the primary interface for managing history and
> bookmarks.  It's meant more as a convenience.

Also note that even in the switch-to-buffer prompt, the 'C-k' to kill a
buffer is overriding the kill-line binding.  It's just that people don't
generally use kill-line in a switch-to-buffer interaction, so nobody's
complained :)

This observation says to me that there should be some other binding which
would be considered the standard binding for this action, and that 'C-k'
should be viewed only as a shortcut for situations where it doesn't
conflict with editing keys.

Food for thought.

-- 
John Foerch

Re: [conkeror] refactor-completers

From:
Kinley Dorji
Date:
2013-12-20 @ 16:06
"One newly added feature made possible by this branch is the ability to
delete entries from history and bookmarks while in the url prompt,
analogous to how you can kill a buffer with C-k in the switch-to-buffer
prompt."

That is just awesome - it's the only thing I've missed in Conkeror.
Thank you very much John.

I will be very happy to help test the branch.

Kinley

On Fri, Dec 20, 2013 at 9:54 PM, John J. Foerch <jjfoerch@earthlink.net> wrote:
> Hi all,
>
> I have been working on a branch called refactor-completers — I had started
> it a year or so ago, then shelved it to focus on other things, and
> recently got back to finish it up.  It's getting close to the point where
> it can be merged into master, so I thought that an announcement and a call
> for testing and review would be in order.
>
> This branch is a refactoring of the minibuffer completions system, to make
> it easier to understand and more flexible.  One major bug is fixed, but
> for the most part, this branch is groundwork for future features.
>
> The bug that was fixed is that in filename completion, a directory
> separator is inserted after directories instead of a space.
> <http://bugs.conkeror.org/issue77>
>
> One newly added feature made possible by this branch is the ability to
> delete entries from history and bookmarks while in the url prompt,
> analogous to how you can kill a buffer with C-k in the switch-to-buffer
> prompt.
>
> If you use any completers in your rc, there are two breaking changes that
> you will need to update your rc for:
>
>  - The first is that completers are now instantiated with the 'new'
>    keyword, so "prefix_completer(...)" becomes "new
>    prefix_completer(...)", etc.
>
>  - Second, the symbol '$match_required' was changed to '$require_match'
>    wherever it appears.
>
> This second point is something that I wanted to do for consistency with
> Emacs naming conventions, and as the whole completions system is changing,
> it seemed like a good moment to make this change as well.
>
> If you have defined any completers of your own in your rc, those will need
> to be updated as well, though the changes are a little more involved so
> email me or see me in the irc channel for help with that.
>
> I would appreciate any testing that anybody can do before we merge this
> change — it's a big patch and I want to be as sure as possible that I
> haven't overlooked anything.
>
> Thanks all, and happy holidays,
>
> --
> John Foerch

Re: [conkeror] refactor-completers

From:
Kinley Dorji
Date:
2013-12-20 @ 17:15
Cool, unwanted bookmarks begone with C-k, without having to resort to
sqliteman. Will report back as I continue to try out the
refactor-completers branch.

On Fri, Dec 20, 2013 at 10:06 PM, Kinley Dorji <kinleyd@gmail.com> wrote:
> "One newly added feature made possible by this branch is the ability to
> delete entries from history and bookmarks while in the url prompt,
> analogous to how you can kill a buffer with C-k in the switch-to-buffer
> prompt."
>
> That is just awesome - it's the only thing I've missed in Conkeror.
> Thank you very much John.
>
> I will be very happy to help test the branch.
>
> Kinley
>
> On Fri, Dec 20, 2013 at 9:54 PM, John J. Foerch <jjfoerch@earthlink.net> wrote:
>> Hi all,
>>
>> I have been working on a branch called refactor-completers — I had started
>> it a year or so ago, then shelved it to focus on other things, and
>> recently got back to finish it up.  It's getting close to the point where
>> it can be merged into master, so I thought that an announcement and a call
>> for testing and review would be in order.
>>
>> This branch is a refactoring of the minibuffer completions system, to make
>> it easier to understand and more flexible.  One major bug is fixed, but
>> for the most part, this branch is groundwork for future features.
>>
>> The bug that was fixed is that in filename completion, a directory
>> separator is inserted after directories instead of a space.
>> <http://bugs.conkeror.org/issue77>
>>
>> One newly added feature made possible by this branch is the ability to
>> delete entries from history and bookmarks while in the url prompt,
>> analogous to how you can kill a buffer with C-k in the switch-to-buffer
>> prompt.
>>
>> If you use any completers in your rc, there are two breaking changes that
>> you will need to update your rc for:
>>
>>  - The first is that completers are now instantiated with the 'new'
>>    keyword, so "prefix_completer(...)" becomes "new
>>    prefix_completer(...)", etc.
>>
>>  - Second, the symbol '$match_required' was changed to '$require_match'
>>    wherever it appears.
>>
>> This second point is something that I wanted to do for consistency with
>> Emacs naming conventions, and as the whole completions system is changing,
>> it seemed like a good moment to make this change as well.
>>
>> If you have defined any completers of your own in your rc, those will need
>> to be updated as well, though the changes are a little more involved so
>> email me or see me in the irc channel for help with that.
>>
>> I would appreciate any testing that anybody can do before we merge this
>> change — it's a big patch and I want to be as sure as possible that I
>> haven't overlooked anything.
>>
>> Thanks all, and happy holidays,
>>
>> --
>> John Foerch