ranger-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ranger-users] ranger 1.6.0 on the horizon


From: Joshua Landau
Subject: Re: [Ranger-users] ranger 1.6.0 on the horizon
Date: Sun, 17 Feb 2013 15:03:33 +0000

On 17 February 2013 08:36, Miodrag Milic <address@hidden> wrote:

On Sat, Feb 16, 2013 at 11:35 PM, Joshua Landau <address@hidden> wrote:
Can't happen*, that's the problem. If you have full Regex, it's near-impossible to have letter-skipping. Unless I'm missing something.


3 travel modes fix all problems.

:/

At least one of us is missing the point, I think.
 
Configuration by specifying name of the class that implements matcher algorithm
By default 3 modes could be provided:

* set travel_matcher = 'TM_Normal'
Travel will act like find and query will be sent to RegEx engine as literal (between \Q and \E , that is, all RE chars escaped)

Regex would be a bit over-the-top, no? Why not just match strings, what's the point in Regex?
 
* set travel_matcher = "TM_Lazy"
Travel will act like it is acting at the moment. Query will be changed so that all special RE chars are escaped except ^$,and .* will be inserted in between (so that you can skip letters) before RegEx engine is invoked.

If you're escaping everything other than ^ and $, what's the point in Regex?

My Matcher class shows that it isn't hard to implement the same functionality in a more powerful way. Even if you hate the choices of syntax in Matcher, it's easy to change. Not so if you're using Regex.

I just think, for these two, using Regex is like using an elephant to water your plants. It's overkill, and misses the point of Regex (power).
 
* set travel_matcher = "TM_re"
Full blown RE, query is sent as it is to RegEx engine.

This seems more like a special-case than the two above. As I said before:

That's possible, but why? Surely[?] you wouldn't use Regex that much. :travel was intended for fast travel, not fidelity. There might be a use-case, but I'm not seeing it, so what's the point in Regex?

Do you seriously have such a wide directory structure that you need Regex? The biggest directory of mine that I can find (and that I use) is ~1700 long, but the files are just 0001.gif, 0002.gif... and it still takes ~4 keypresses to narrow down to one result.

There are places (https://bbs.archlinux.org/viewtopic.php?pid=1233010#p1233010, for example) that could do with it, but why here?

(But it is possible and not hard)

In this case Joshuas version could be simply set up as

class Matcher(str) ... 
...

set travel_mode = "Matcher"

Again, though, what would be your reason for full Regex? It seems unsuited, to me, so I imagine any reason could be sufficiently diverse to warrant a new command. Then you'd have three commands (:narrow, :travel, :somethingwithregex).

--

Some people, when confronted with a problem, think
“I know, I'll use regular expressions.”   Now they have two problems.

- Jamie Zawinski

reply via email to

[Prev in Thread] Current Thread [Next in Thread]