Re: emacs / distel problem with dynamic tags

[email protected] Wed, 04 Jul 2007 22:42:46 +0100
Newsgroups gmane.comp.lang.erlang.distel.devel
Message-ID <[email protected]>
"Bill Clementson" <[email protected]> writes:

> On 7/4/07, Matthias Radestock <[email protected]> wrote:
>>
>> I cannot think of any reason why one would regularly use the prefix arg
>> for erl-find-source-under-point. All it does is prompt for the function
>> to look up. erl-find-mod does the same thing, and without requiring a
>> prefix arg, and hence wouldn't suffer from the reported problem.
>
> Both erl-find-mod and erl-find-source-under-point call erl-find-source

Correct.

> (which had the call to erl-target-node in it that was causing the
> problem).

Not quite. The problem only occurs when one supplies a prefix arg.
erl-find-mod doesn't ordinarily take a prefix arg, so there is no reason
to call it with one.

In other words, the old behaviour of "C-u M-x
erl-find-source-under-point" is identical to the (old and new) behaviour
of "M-x erl-find-mod".

Actually, that's not quite true. C-u M-x erl-find-source-under-point
defaults the selection to the module/function under the point, whereas
erl-find-mod does not. Also, erl-find-mod is not bound to a convenient
key sequence.

So back to the drawing board ...

The trouble here is that we need to cater for all of the following uses:

1) "find a specified module/function, using the current node"

2) "find a specified module/function, using a specified node"

3) "find the module/function under point, using the current node"

4) "find the module/function under point, using a specified node"

5) "find a specified module/function, but use the module/function under
point as first guess that can be refined, using the current node"

6) "find a specified module/function, but use the module/function under
point as first guess that can be refined, using a specified node".

Before my change (and after yours) the shortest sequences to accomplish
the above were/are as follows:

1) M-x erl-find-mod (enter m/f)
2) C-c C-d C-n (enter node name) M-x erl-find-mod
3) M-.
4) C-c C-d C-n (enter node name) M-.
5) C-u M-. (confirm or enter m/f)
6) C-c C-d C-n (enter node name) C-u M-. (confirm or enter m/f)

After my change the sequences were:

1) M-x erl-find-mod (enter m/f)
2) C-u M-x erl-find-mod (enter node name)
3) M-.
4) C-u M-. (enter node name) (confirm m/f)
5) C-u M-. (enter node name) (confirm or enter m/f)
6) C-u M-. (enter node name) (confirm or enter m/f)

I reckon the additional keystroke in 4) is ok. What isn't so great is
the requirement to enter the node name on 5). We could

a) revert to the old behaviour, as you did.

b) go with the new behaviour, unmodified. I am struggling to think of a
reason why one would want to perform 5) on a regular basis. So the
inconvenience should be minimal, certainly compared to the gain of
having a convenient and *consistent* mechanism of getting prompted for a
node name. To be sure we could try to find out from the OP what exactly
they are trying to accomplish.

c) add node name defaulting + history to the node name selection. This
would reduce the sequence to
  C-u M-. (confirm node name) (confirm or enter m/f)
i.e. a single keystroke more than before. It's also a nice feature in
general.

d) make erl-find-mod default the m/f selection to the m/f under point
and bind the command to a key sequence. This makes it almost identical
to erl-find-source-under-point, the only difference being that it
*always* prompts for the m/f selection. There is then no point having a
prefix-triggered m/f prompt on erl-find-source-under-point, so we should
ditch that feature.

Any other ideas? My personal preference is the combination of
c)+d). Unfortunately that also takes the longest time to
implement. Having said that, it probably took me longer to write this
email ;)


Matthias

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/