* how about a find-library-other-window command?
@ 2007-06-19 18:23 Drew Adams
2007-06-19 19:08 ` David House
` (2 more replies)
0 siblings, 3 replies; 38+ messages in thread
From: Drew Adams @ 2007-06-19 18:23 UTC (permalink / raw)
To: Emacs-Devel
I almost never want to `find-library' in the same window. Usually, I'm
examining code in some library that makes reference to another library (e.g.
(require 'foo)). I want to open that library in another window. So far, I've
been cloning the window (frame, actually: C-x 5 2) and then useing
`find-library'.
How about a `find-library-other-window' command?
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 18:23 how about a find-library-other-window command? Drew Adams
@ 2007-06-19 19:08 ` David House
2007-06-19 19:39 ` Sean O'Rourke
` (3 more replies)
2007-06-19 19:15 ` Stefan Monnier
2007-06-20 13:28 ` Richard Stallman
2 siblings, 4 replies; 38+ messages in thread
From: David House @ 2007-06-19 19:08 UTC (permalink / raw)
To: Drew Adams; +Cc: Emacs-Devel
Drew Adams writes:
> How about a `find-library-other-window' command?
I've wondered in the past whether it would be feasible to have C-x 4 be bound to
a command which reads a key sequence then executes it in another window, so that
we needn't define new commands for every command we want to execute in the other
window.
We could still define key aliases so that C-x 4 f would be
find-file-other-window instead of the more cumbersome C-x 4 C-x C-f. This means
we can't use 'f' in the other window, but how useful would self-insert-command
be anyway?
--
-David House, dmhouse@gmail.com
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 18:23 how about a find-library-other-window command? Drew Adams
2007-06-19 19:08 ` David House
@ 2007-06-19 19:15 ` Stefan Monnier
2007-06-19 19:36 ` Drew Adams
` (3 more replies)
2007-06-20 13:28 ` Richard Stallman
2 siblings, 4 replies; 38+ messages in thread
From: Stefan Monnier @ 2007-06-19 19:15 UTC (permalink / raw)
To: Drew Adams; +Cc: Emacs-Devel
> I almost never want to `find-library' in the same window. Usually, I'm
> examining code in some library that makes reference to another library
> (e.g. (require 'foo)). I want to open that library in another window.
> So far, I've been cloning the window (frame, actually: C-x 5 2) and then
> useing `find-library'.
Agreed. (actually, what I do instead is to use find-library from
a dedicated window (or a minibuffer-only window), which forces find-library
to create a new frame for the library)
> How about a `find-library-other-window' command?
Sure. Although I'm wondering: are there many users you use both find-file
and find-file-other-window, as well as other <foo> vs
<foo>-other-window commands?
I'd be happy to change all that: remove/deprecate the <foo>-other-window
commands and make the <foo> commands use either the same window or another
depending on some user configuration.
Stefan
^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: how about a find-library-other-window command?
2007-06-19 19:15 ` Stefan Monnier
@ 2007-06-19 19:36 ` Drew Adams
2007-06-19 19:53 ` Andreas Schwab
` (2 subsequent siblings)
3 siblings, 0 replies; 38+ messages in thread
From: Drew Adams @ 2007-06-19 19:36 UTC (permalink / raw)
To: Emacs-Devel
> > How about a `find-library-other-window' command?
>
> Sure. Although I'm wondering: are there many users you use both find-file
> and find-file-other-window, as well as other <foo> vs
> <foo>-other-window commands?
>
> I'd be happy to change all that: remove/deprecate the <foo>-other-window
> commands and make the <foo> commands use either the same window or another
> depending on some user configuration.
I use both. I think you (Stefan) tend to have all windows be dedicated
automatically, IIRC, but I do not, although I do use non-nil
`pop-up-frames', so a buffer is displayed for the first time, a priori, in
its own frame.
I do use Emacs windows sometimes, and I do also visit a different file in
the same window sometimes. That is, I do sometimes use `C-x C-f', even
though I more often use `C-x 4 f'.
So, unless there is a way that configuration would also allow the
flexibility for users that we have now, I don't think it's a good idea to
just get rid of the separate commands and depend on a configuration option.
It would be an especially bad idea, I think, if a _single_ option were used
to configure all possible other-window behavior. That is, I don't think
people necessarily always use `foo-other-window' even if they do always use
`bar-other-window'.
Summary: I think we need the flexibility we have now.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 19:08 ` David House
@ 2007-06-19 19:39 ` Sean O'Rourke
2007-06-19 19:52 ` Drew Adams
2007-06-19 19:51 ` Drew Adams
` (2 subsequent siblings)
3 siblings, 1 reply; 38+ messages in thread
From: Sean O'Rourke @ 2007-06-19 19:39 UTC (permalink / raw)
To: David House; +Cc: Drew Adams, Emacs-Devel
David House <dmhouse@gmail.com> writes:
> Drew Adams writes:
> > How about a `find-library-other-window' command?
>
> I've wondered in the past whether it would be feasible to have
> C-x 4 be bound to a command which reads a key sequence then
> executes it in another window, so that we needn't define new
> commands for every command we want to execute in the other
> window.
This, or something similar, seems useful. I currently use a
slightly different hack that makes "C-z FOO" do whatever "C-x
FOO" does, but in another window. I do it by copying `ctl-x-map'
and wrapping the entries with this:
(defun other-windowize (fn)
`(lambda ()
(interactive)
(switch-to-buffer-other-window
(save-window-excursion (call-interactively ',fn) (current-buffer)))))
No doubt there's a better way, but this seems to work well enough
to replace many existing FOO-other-window commands, and to
other-windowize some new things.
/s
^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: how about a find-library-other-window command?
2007-06-19 19:08 ` David House
2007-06-19 19:39 ` Sean O'Rourke
@ 2007-06-19 19:51 ` Drew Adams
2007-06-19 21:40 ` David Kastrup
2007-06-20 13:28 ` Richard Stallman
3 siblings, 0 replies; 38+ messages in thread
From: Drew Adams @ 2007-06-19 19:51 UTC (permalink / raw)
To: Emacs-Devel
> I've wondered in the past whether it would be feasible to have
> C-x 4 be bound to
> a command which reads a key sequence then executes it in another
> window, so that
> we needn't define new commands for every command we want to
> execute in the other
> window.
>
> We could still define key aliases so that C-x 4 f would be
> find-file-other-window instead of the more cumbersome C-x 4 C-x
> C-f. This means
> we can't use 'f' in the other window, but how useful would
> self-insert-command
> be anyway?
I won't argue against exploring that, but I don't really see what is gained,
beyond not needing to define the separate `-other-*' commands. What is
gained for a user? I guess s?he might have fewer keys to remember, but s?he
would have more keys to type, no?
Also, I can imagine (though I don't recall if this is ever the case in the
current code) that some `-other-*' commands might need to do some additional
or different treatment. That is, I'm not sure that a blanket conversion from
`foo' to `foo-other-window' is good for all cases. But that would be a minor
consideration anyway - those commands could be treated specially.
^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: how about a find-library-other-window command?
2007-06-19 19:39 ` Sean O'Rourke
@ 2007-06-19 19:52 ` Drew Adams
0 siblings, 0 replies; 38+ messages in thread
From: Drew Adams @ 2007-06-19 19:52 UTC (permalink / raw)
To: Emacs-Devel
> > I've wondered in the past whether it would be feasible to have
> > C-x 4 be bound to a command which reads a key sequence then
> > executes it in another window, so that we needn't define new
> > commands for every command we want to execute in the other
> > window.
>
> This, or something similar, seems useful. I currently use a
> slightly different hack that makes "C-z FOO" do whatever "C-x
> FOO" does, but in another window. I do it by copying `ctl-x-map'
> and wrapping the entries with this:
>
> (defun other-windowize (fn)
> `(lambda ()
> (interactive)
> (switch-to-buffer-other-window
> (save-window-excursion (call-interactively ',fn)
> (current-buffer)))))
>
> No doubt there's a better way, but this seems to work well enough
> to replace many existing FOO-other-window commands, and to
> other-windowize some new things.
I like this idea a little better than David's suggestion, but I'm not sure
about the implementation. What happens if `fn' doesn't change the current
buffer? Anyway, something like this might be worth exploring. The particular
prefix key (`C-z') should be open to user configuration.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 19:15 ` Stefan Monnier
2007-06-19 19:36 ` Drew Adams
@ 2007-06-19 19:53 ` Andreas Schwab
2007-06-19 20:41 ` Stefan Monnier
2007-06-19 23:24 ` Davis Herring
2007-06-20 13:28 ` Richard Stallman
3 siblings, 1 reply; 38+ messages in thread
From: Andreas Schwab @ 2007-06-19 19:53 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Drew Adams, Emacs-Devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> I'd be happy to change all that: remove/deprecate the <foo>-other-window
> commands and make the <foo> commands use either the same window or another
> depending on some user configuration.
That would make it very cumbersome to use if I had to change a
configuration option just to use an other-window command.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 19:53 ` Andreas Schwab
@ 2007-06-19 20:41 ` Stefan Monnier
2007-06-19 20:55 ` Drew Adams
2007-06-19 21:54 ` Juri Linkov
0 siblings, 2 replies; 38+ messages in thread
From: Stefan Monnier @ 2007-06-19 20:41 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Drew Adams, Emacs-Devel
>> I'd be happy to change all that: remove/deprecate the <foo>-other-window
>> commands and make the <foo> commands use either the same window or another
>> depending on some user configuration.
> That would make it very cumbersome to use if I had to change a
> configuration option just to use an other-window command.
I like David's idea also.
Maybe we could try something as follows:
- make <foo> use a new command like `switch-or-pop-to-buffer' which behavior
depends on a "config var".
- add prefix keys such as C-x 4 which can force one of the two behaviors for
the next command (or maybe just one prefix key C-x 4 which toggles the
behavior of the next command).
- make the "config var" sufficiently complex that it doesn't just choose
"always pop" or "always switch" but can choose different defaults for
different commands. How to do that is up-in-the-air:
- Maybe switch-or-pop-to-buffer would look at this-command (yuck) and do as
assq search in a config alist based on that.
- Or switch-or-pop-to-buffer would take an additional argument to specify
the key to use an the alist search.
- It would probably be good to be able to specify not just different
behaviors depending on the command but also depending on the buffer in
which it is executed (e.g. "always use switch when done inside a *Help*
buffer").
...
Stefan
^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: how about a find-library-other-window command?
2007-06-19 20:41 ` Stefan Monnier
@ 2007-06-19 20:55 ` Drew Adams
2007-06-19 21:54 ` Juri Linkov
1 sibling, 0 replies; 38+ messages in thread
From: Drew Adams @ 2007-06-19 20:55 UTC (permalink / raw)
To: Emacs-Devel
> Maybe we could try something as follows:
>
> - make <foo> use a new command like `switch-or-pop-to-buffer'
> which behavior
> depends on a "config var".
> - add prefix keys such as C-x 4 which can force one of the two
> behaviors for
> the next command (or maybe just one prefix key C-x 4 which toggles the
> behavior of the next command).
> - make the "config var" sufficiently complex that it doesn't just choose
> "always pop" or "always switch" but can choose different defaults for
> different commands. How to do that is up-in-the-air:
> - Maybe switch-or-pop-to-buffer would look at this-command
> (yuck) and do as
> assq search in a config alist based on that.
> - Or switch-or-pop-to-buffer would take an additional argument
> to specify
> the key to use an the alist search.
> - It would probably be good to be able to specify not just different
> behaviors depending on the command but also depending on the buffer in
> which it is executed (e.g. "always use switch when done
> inside a *Help*
> buffer").
> ...
This is all beginning to sound a bit complex. Perhaps worth exploring, but,
in the meantime, could we at least add `find-library-other-window'? ;-)
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 19:08 ` David House
2007-06-19 19:39 ` Sean O'Rourke
2007-06-19 19:51 ` Drew Adams
@ 2007-06-19 21:40 ` David Kastrup
2007-06-20 1:03 ` Stefan Monnier
2007-06-20 13:28 ` Richard Stallman
3 siblings, 1 reply; 38+ messages in thread
From: David Kastrup @ 2007-06-19 21:40 UTC (permalink / raw)
To: David House; +Cc: Drew Adams, Emacs-Devel
David House <dmhouse@gmail.com> writes:
> Drew Adams writes:
> > How about a `find-library-other-window' command?
>
> I've wondered in the past whether it would be feasible to have C-x 4
> be bound to a command which reads a key sequence then executes it in
> another window, so that we needn't define new commands for every
> command we want to execute in the other window.
C-x 4 2 is not substantially longer than C-x 4. I think this would
only make some sense if it uses the C-x map right away.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 20:41 ` Stefan Monnier
2007-06-19 20:55 ` Drew Adams
@ 2007-06-19 21:54 ` Juri Linkov
2007-06-20 13:28 ` Richard Stallman
1 sibling, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2007-06-19 21:54 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
> - make <foo> use a new command like `switch-or-pop-to-buffer' which behavior
> depends on a "config var".
Maybe some more clear and short name like `show-buffer'.
> - add prefix keys such as C-x 4 which can force one of the two behaviors for
> the next command (or maybe just one prefix key C-x 4 which toggles the
> behavior of the next command).
C-x 4 or some such prefix could automatically add the command's context
(buffer name + this-command) to the config variable, so the next call
without C-x 4 will reuse this preference once explicitly defined by calling
the command with the C-x 4 prefix.
> - make the "config var" sufficiently complex that it doesn't just choose
> "always pop" or "always switch" but can choose different defaults for
> different commands. How to do that is up-in-the-air:
> - Maybe switch-or-pop-to-buffer would look at this-command (yuck) and do as
> assq search in a config alist based on that.
> - Or switch-or-pop-to-buffer would take an additional argument to specify
> the key to use an the alist search.
> - It would probably be good to be able to specify not just different
> behaviors depending on the command but also depending on the buffer in
> which it is executed (e.g. "always use switch when done inside a *Help*
> buffer").
If there are too many parameter types used in the config variable (the
target buffer name, the source buffer name, this-command), another option
would be to allow a predicate function in such a config variable.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 19:15 ` Stefan Monnier
2007-06-19 19:36 ` Drew Adams
2007-06-19 19:53 ` Andreas Schwab
@ 2007-06-19 23:24 ` Davis Herring
2007-06-19 23:30 ` Drew Adams
2007-06-20 13:28 ` Richard Stallman
3 siblings, 1 reply; 38+ messages in thread
From: Davis Herring @ 2007-06-19 23:24 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Drew Adams, Emacs-Devel
>> How about a `find-library-other-window' command?
Inline reply to Drew:
Is M-x find-lib TAB - RET really that much faster than C-x 5 2 M-x
find-lib RET? (The difference being "TAB -" in place of "C-x 5 2", of
course.)
> Sure. Although I'm wondering: are there many users you use both find-file
> and find-file-other-window, as well as other <foo> vs
> <foo>-other-window commands?
I find that I use C-x 4 b all the time (and C-x b too, of course); C-x 4 f
a little less often. But I always work with windows and not frames, and
tend to set them up and leave them alone (saving window configurations or
just killing them off when done with them).
Davis
--
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.
^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: how about a find-library-other-window command?
2007-06-19 23:24 ` Davis Herring
@ 2007-06-19 23:30 ` Drew Adams
0 siblings, 0 replies; 38+ messages in thread
From: Drew Adams @ 2007-06-19 23:30 UTC (permalink / raw)
To: Emacs-Devel
> >> How about a `find-library-other-window' command?
>
> Inline reply to Drew:
> Is M-x find-lib TAB - RET really that much faster than C-x 5 2 M-x
> find-lib RET? (The difference being "TAB -" in place of "C-x 5 2", of
> course.)
No, not much. I'm getting in the habit now. For a while it was a gotcha for
me, as I kept forgetting that it was going to replace the file I was looking
at.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 21:40 ` David Kastrup
@ 2007-06-20 1:03 ` Stefan Monnier
0 siblings, 0 replies; 38+ messages in thread
From: Stefan Monnier @ 2007-06-20 1:03 UTC (permalink / raw)
To: David Kastrup; +Cc: David House, Drew Adams, Emacs-Devel
> C-x 4 2 is not substantially longer than C-x 4.
But C-x 4 a followed by switch-to-buffer doesn't do the same as
pop-to-buffer, because pop-to-buffer obeys special-display-buffer-names.
Stefan
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 18:23 how about a find-library-other-window command? Drew Adams
2007-06-19 19:08 ` David House
2007-06-19 19:15 ` Stefan Monnier
@ 2007-06-20 13:28 ` Richard Stallman
2007-06-20 14:17 ` Juri Linkov
2007-06-20 16:49 ` Drew Adams
2 siblings, 2 replies; 38+ messages in thread
From: Richard Stallman @ 2007-06-20 13:28 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
How about a `find-library-other-window' command?
Sure. Would you like to send a patch and change log entry?
Please include a patch for etc/NEWS.
The ideas for changing C-x 4 may be worth investigating,
but please do this now.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 19:08 ` David House
` (2 preceding siblings ...)
2007-06-19 21:40 ` David Kastrup
@ 2007-06-20 13:28 ` Richard Stallman
3 siblings, 0 replies; 38+ messages in thread
From: Richard Stallman @ 2007-06-20 13:28 UTC (permalink / raw)
To: David House; +Cc: drew.adams, emacs-devel
I've wondered in the past whether it would be feasible to have C-x 4 be bound to
a command which reads a key sequence then executes it in another window, so that
we needn't define new commands for every command we want to execute in the other
window.
It is an interesting idea, but we would need a special feature to enable
c-x 4 f to keep working, so you don't have to type C-x 4 C-f.
Some attention may be needed for various help features that use keymaps,
in order to get good results.
So this won't be trivial, but it is worth trying.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 19:15 ` Stefan Monnier
` (2 preceding siblings ...)
2007-06-19 23:24 ` Davis Herring
@ 2007-06-20 13:28 ` Richard Stallman
3 siblings, 0 replies; 38+ messages in thread
From: Richard Stallman @ 2007-06-20 13:28 UTC (permalink / raw)
To: Stefan Monnier; +Cc: drew.adams, emacs-devel
I'd be happy to change all that: remove/deprecate the <foo>-other-window
commands and make the <foo> commands use either the same window or another
depending on some user configuration.
I do not like this in general.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-19 21:54 ` Juri Linkov
@ 2007-06-20 13:28 ` Richard Stallman
2007-06-20 14:09 ` Juri Linkov
0 siblings, 1 reply; 38+ messages in thread
From: Richard Stallman @ 2007-06-20 13:28 UTC (permalink / raw)
To: Juri Linkov; +Cc: monnier, emacs-devel
C-x 4 or some such prefix could automatically add the command's context
(buffer name + this-command) to the config variable, so the next call
without C-x 4 will reuse this preference once explicitly defined by calling
the command with the C-x 4 prefix.
That is not a good implementation, because it requires each command to
have special code to test the flag. The original idea was both better
and simpler.
Another drawback of this method is you'd have to type C-x 4 C-x C-f.
That is a big drawback.
So this is ruled out.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-20 13:28 ` Richard Stallman
@ 2007-06-20 14:09 ` Juri Linkov
2007-06-20 14:57 ` Andreas Schwab
` (2 more replies)
0 siblings, 3 replies; 38+ messages in thread
From: Juri Linkov @ 2007-06-20 14:09 UTC (permalink / raw)
To: rms; +Cc: monnier, emacs-devel
> C-x 4 or some such prefix could automatically add the command's context
> (buffer name + this-command) to the config variable, so the next call
> without C-x 4 will reuse this preference once explicitly defined by calling
> the command with the C-x 4 prefix.
>
> That is not a good implementation, because it requires each command to
> have special code to test the flag. The original idea was both better
> and simpler.
Let me express more clear what I meant: not each command should test the flag,
but only a new function `show-buffer' used by these commands.
So for instance having
(defun foo ()
(interactive)
...
(show-buffer new-buffer))
bound to some key (e.g. `C-c C-f').
Then after typing `C-x 4 C-c C-f', the prefix `C-x 4' will set some
special variable, and `show-buffer' called by this command will detect it
and put `this-command' to the user config alist with a flag to reuse this
user preference next time this command is called without the prefix `C-x 4'.
> Another drawback of this method is you'd have to type C-x 4 C-x C-f.
You have to type `C-x 4 C-x C-f' only once. After `show-buffer' records the
fact of calling with the prefix `C-x 4' first time, it will reuse this
preference on subsequent invocations without the prefix `C-x 4'.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-20 13:28 ` Richard Stallman
@ 2007-06-20 14:17 ` Juri Linkov
2007-06-20 16:49 ` Drew Adams
1 sibling, 0 replies; 38+ messages in thread
From: Juri Linkov @ 2007-06-20 14:17 UTC (permalink / raw)
To: rms; +Cc: Drew Adams, emacs-devel
> How about a `find-library-other-window' command?
>
> Sure. Would you like to send a patch and change log entry?
> Please include a patch for etc/NEWS.
I think polluting the namespace is not a good thing. There are too many
commands that display a new buffer, and don't have the duplicate name with
the `-other-window' suffix, and adding more redundant commands will increase
the mess.
I don't suggest removing `-other-window' from the existing basic commands,
but suggest not to add it to minor commands like `find-library' .
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-20 14:09 ` Juri Linkov
@ 2007-06-20 14:57 ` Andreas Schwab
2007-06-20 15:44 ` Juri Linkov
2007-06-20 17:21 ` Ehud Karni
2007-06-21 1:07 ` Richard Stallman
2 siblings, 1 reply; 38+ messages in thread
From: Andreas Schwab @ 2007-06-20 14:57 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel, rms, monnier
Juri Linkov <juri@jurta.org> writes:
> You have to type `C-x 4 C-x C-f' only once. After `show-buffer' records the
> fact of calling with the prefix `C-x 4' first time, it will reuse this
> preference on subsequent invocations without the prefix `C-x 4'.
That's definitely not something I'd like. Just because I use the
other-window function once does not mean I want to use it always.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-20 14:57 ` Andreas Schwab
@ 2007-06-20 15:44 ` Juri Linkov
2007-06-21 1:07 ` Richard Stallman
0 siblings, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2007-06-20 15:44 UTC (permalink / raw)
To: Andreas Schwab; +Cc: emacs-devel, rms, monnier
>> You have to type `C-x 4 C-x C-f' only once. After `show-buffer' records the
>> fact of calling with the prefix `C-x 4' first time, it will reuse this
>> preference on subsequent invocations without the prefix `C-x 4'.
>
> That's definitely not something I'd like. Just because I use the
> other-window function once does not mean I want to use it always.
We can use longer prefixes for that (e.g. `C-x 4 1') once the basic idea
is accepted.
`C-x C-f' - always use the same window
`C-x 4 C-x C-f' - always use another window
`C-x 4 1 C-x C-f' - use another window and save this preference to the config,
so next `C-x C-f' will use it
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: how about a find-library-other-window command?
2007-06-20 13:28 ` Richard Stallman
2007-06-20 14:17 ` Juri Linkov
@ 2007-06-20 16:49 ` Drew Adams
2007-06-21 1:07 ` Richard Stallman
2007-06-22 19:29 ` Juri Linkov
1 sibling, 2 replies; 38+ messages in thread
From: Drew Adams @ 2007-06-20 16:49 UTC (permalink / raw)
To: rms; +Cc: emacs-devel
> How about a `find-library-other-window' command?
>
> Sure. Would you like to send a patch and change log entry?
> Please include a patch for etc/NEWS.
>
> The ideas for changing C-x 4 may be worth investigating,
> but please do this now.
Not sure if this is what you need. Can someone tell me the easiest way to
generate this on Windows (I have Cygwin `diff')? I downloaded the latest
version of NEWS.22 and find-func.el at
http://cvs.savannah.gnu.org/viewvc/emacs/emacs/, made some changes, used
`diff', and then copy+pasted the `diff' output here. Are there already
instructions for that somewhere? Where do I find the proper format and
content for a change-log entry?
----------------------8<--------------------------
2007-06-20 Drew Adams <drew.adams@oracle.com>
*find-func.el (find-library-other-frame)
(find-library-other-window): New commands.
----------------------8<--------------------------
diff -c c\:/drews-lisp-20/cvs-lisp/NEWS.22
c\:/drews-lisp-20/cvs-lisp/NEWS-patched.22
*** c:/drews-lisp-20/cvs-lisp/NEWS.22 Wed Jun 20 08:43:46 2007
--- c:/drews-lisp-20/cvs-lisp/NEWS-patched.22 Wed Jun 20 08:49:00 2007
***************
*** 1495,1500 ****
--- 1495,1506 ----
*** New option `ebnf-arrow-scale' which specify the arrow scale.
Values lower than 1.0, shrink the arrow.
Values greater than 1.0, expand the arrow.
+
+ ** find-func changes:
+
+ *** New commands `find-library-other-window' and
`find-library-other-frame'
+ Same as `find-library', except the library is visited in a different
+ window or frame, respectively.
\f
* New Modes and Packages in Emacs 22.1
----------------------8<--------------------------
diff -c c\:/drews-lisp-20/cvs-lisp/find-func-CVS-2007-06-20.el
c\:/drews-lisp-20/cvs-lisp/find-func-patched-2007-06-20.el
*** c:/drews-lisp-20/cvs-lisp/find-func-CVS-2007-06-20.el Wed Jun 20
08:16:04 2007
--- c:/drews-lisp-20/cvs-lisp/find-func-patched-2007-06-20.el Wed Jun 20
08:41:22 2007
***************
*** 203,208 ****
--- 203,234 ----
(condition-case nil (switch-to-buffer buf) (error (pop-to-buffer
buf)))))
;;;###autoload
+ (defun find-library-other-window (library)
+ "Find the elisp source of LIBRARY in another window."
+ (interactive
+ (list
+ (completing-read "Library name: "
+ 'locate-file-completion
+ (cons (or find-function-source-path load-path)
+ (find-library-suffixes)))))
+ (let ((buf (find-file-noselect (find-library-name library))))
+ (condition-case nil (switch-to-buffer-other-window buf)
+ (error (pop-to-buffer buf)))))
+
+ ;;;###autoload
+ (defun find-library-other-frame (library)
+ "Find the elisp source of LIBRARY in another frame."
+ (interactive
+ (list
+ (completing-read "Library name: "
+ 'locate-file-completion
+ (cons (or find-function-source-path load-path)
+ (find-library-suffixes)))))
+ (let ((buf (find-file-noselect (find-library-name library))))
+ (condition-case nil (switch-to-buffer-other-frame buf)
+ (error (pop-to-buffer buf)))))
+
+ ;;;###autoload
(defun find-function-search-for-symbol (symbol type library)
"Search for SYMBOL's definition of type TYPE in LIBRARY.
Visit the library in a buffer, and return a cons cell (BUFFER . POSITION),
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-20 14:09 ` Juri Linkov
2007-06-20 14:57 ` Andreas Schwab
@ 2007-06-20 17:21 ` Ehud Karni
2007-06-20 17:54 ` Juri Linkov
2007-06-21 1:07 ` Richard Stallman
2 siblings, 1 reply; 38+ messages in thread
From: Ehud Karni @ 2007-06-20 17:21 UTC (permalink / raw)
To: juri; +Cc: emacs-devel, rms, monnier
On Wed, 20 Jun 2007 17:09:14 +0300, Juri Linkov wrote:
>
> Let me express more clear what I meant: not each command should test the flag,
> but only a new function `show-buffer' used by these commands.
>
> So for instance having
>
> (defun foo ()
> (interactive)
> ...
> (show-buffer new-buffer))
>
> bound to some key (e.g. `C-c C-f').
>
> Then after typing `C-x 4 C-c C-f', the prefix `C-x 4' will set some
> special variable, and `show-buffer' called by this command will detect it
> and put `this-command' to the user config alist with a flag to reuse this
> user preference next time this command is called without the prefix `C-x 4'.
>
> > Another drawback of this method is you'd have to type C-x 4 C-x C-f.
>
> You have to type `C-x 4 C-x C-f' only once. After `show-buffer' records the
> fact of calling with the prefix `C-x 4' first time, it will reuse this
> preference on subsequent invocations without the prefix `C-x 4'.
And you have to define a new prefix (C-x what?) to restore the one
window/frame behavior again for this function (each separately) ?
Ehud.
--
Ehud Karni Tel: +972-3-7966-561 /"\
Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
Insurance agencies (USA) voice mail and X Against HTML Mail
http://www.mvs.co.il FAX: 1-815-5509341 / \
GnuPG: 98EA398D <http://www.keyserver.net/> Better Safe Than Sorry
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-20 17:21 ` Ehud Karni
@ 2007-06-20 17:54 ` Juri Linkov
0 siblings, 0 replies; 38+ messages in thread
From: Juri Linkov @ 2007-06-20 17:54 UTC (permalink / raw)
To: ehud; +Cc: rms, monnier, emacs-devel
>> You have to type `C-x 4 C-x C-f' only once. After `show-buffer' records the
>> fact of calling with the prefix `C-x 4' first time, it will reuse this
>> preference on subsequent invocations without the prefix `C-x 4'.
>
> And you have to define a new prefix (C-x what?) to restore the one
> window/frame behavior again for this function (each separately) ?
Yes, some complementary prefix (e.g. `C-x 4 4') is needed to restore the
original behavior.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-20 14:09 ` Juri Linkov
2007-06-20 14:57 ` Andreas Schwab
2007-06-20 17:21 ` Ehud Karni
@ 2007-06-21 1:07 ` Richard Stallman
2 siblings, 0 replies; 38+ messages in thread
From: Richard Stallman @ 2007-06-21 1:07 UTC (permalink / raw)
To: Juri Linkov; +Cc: monnier, emacs-devel
Then after typing `C-x 4 C-c C-f', the prefix `C-x 4' will set some
special variable, and `show-buffer' called by this command will detect it
and put `this-command' to the user config alist with a flag to reuse this
user preference next time this command is called without the prefix `C-x 4'.
That mechanism might work, but that user interface is just no good.
Adding one extra character here is a big change for the worse.
You have to type `C-x 4 C-x C-f' only once. After `show-buffer' records the
fact of calling with the prefix `C-x 4' first time, it will reuse this
preference on subsequent invocations without the prefix `C-x 4'.
I certainly don't want that. At least, not as the replacement for the
current C-x 4 prefix. I don't mind if that behavior is available for
you if you like it, but I won't accept it as the default.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-20 16:49 ` Drew Adams
@ 2007-06-21 1:07 ` Richard Stallman
2007-06-22 19:29 ` Juri Linkov
1 sibling, 0 replies; 38+ messages in thread
From: Richard Stallman @ 2007-06-21 1:07 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
It looks right. Would someone please install it in the trunk?
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-20 15:44 ` Juri Linkov
@ 2007-06-21 1:07 ` Richard Stallman
2007-06-21 7:43 ` Juri Linkov
2007-06-21 9:57 ` David House
0 siblings, 2 replies; 38+ messages in thread
From: Richard Stallman @ 2007-06-21 1:07 UTC (permalink / raw)
To: Juri Linkov; +Cc: schwab, monnier, emacs-devel
`C-x C-f' - always use the same window
`C-x 4 C-x C-f' - always use another window
I do not want anything that would replace C-x 4 f and similar
commands with four-character sequences. Please stop proposing
such ideas.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-21 1:07 ` Richard Stallman
@ 2007-06-21 7:43 ` Juri Linkov
2007-06-21 9:55 ` David House
2007-06-21 9:57 ` David House
1 sibling, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2007-06-21 7:43 UTC (permalink / raw)
To: rms; +Cc: emacs-devel
> Please stop proposing such ideas.
Why should I stop proposing ideas? Is it because you are not interested
in discussing new features?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-21 7:43 ` Juri Linkov
@ 2007-06-21 9:55 ` David House
0 siblings, 0 replies; 38+ messages in thread
From: David House @ 2007-06-21 9:55 UTC (permalink / raw)
To: Juri Linkov; +Cc: rms, emacs-devel
Juri Linkov writes:
> > Please stop proposing such ideas.
>
> Why should I stop proposing ideas? Is it because you are not interested
> in discussing new features?
_Such_ ideas, not ideas generally. Richard was remarking that he isn't going to
accept any proposal that involves C-x 4 f etc being replaced with four-character
key sequences (like C-x 4 C-x C-f), so there's no point making those proposals
in the first place. By all means propose ideas, but make sure they don't
have the effect of making find-file-other-window into a four-character key
sequence.
--
-David House, dmhouse@gmail.com
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-21 1:07 ` Richard Stallman
2007-06-21 7:43 ` Juri Linkov
@ 2007-06-21 9:57 ` David House
2007-06-21 10:49 ` Kim F. Storm
2007-06-21 10:49 ` Andreas Schwab
1 sibling, 2 replies; 38+ messages in thread
From: David House @ 2007-06-21 9:57 UTC (permalink / raw)
To: rms; +Cc: Juri Linkov, schwab, monnier, emacs-devel
Richard Stallman writes:
> I do not want anything that would replace C-x 4 f and similar
> commands with four-character sequences.
I would be happy with a system whereby C-x 4 <key> was equivalent to C-x <key>
in the other window, so that find-file-other-window becomes C-x 4 C-f (as it is
also currently) and C-x 4 f is set-fill-column-other-window. The latter perhaps
isn't that useful, but for consistency's sake, it should be that.
In other words we make a copy of ctrl-x-map and put it on C-x 4, but with every
command having its effects in the other window.
--
-David House, dmhouse@gmail.com
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-21 9:57 ` David House
@ 2007-06-21 10:49 ` Kim F. Storm
2007-06-21 11:38 ` Andreas Schwab
2007-06-22 1:51 ` Richard Stallman
2007-06-21 10:49 ` Andreas Schwab
1 sibling, 2 replies; 38+ messages in thread
From: Kim F. Storm @ 2007-06-21 10:49 UTC (permalink / raw)
To: David House; +Cc: Juri Linkov, schwab, emacs-devel, rms, monnier
David House <dmhouse@gmail.com> writes:
> Richard Stallman writes:
> > I do not want anything that would replace C-x 4 f and similar
> > commands with four-character sequences.
>
> I would be happy with a system whereby C-x 4 <key> was equivalent to C-x <key>
> in the other window, so that find-file-other-window becomes C-x 4 C-f (as it is
> also currently) and C-x 4 f is set-fill-column-other-window. The latter perhaps
> isn't that useful, but for consistency's sake, it should be that.
>
> In other words we make a copy of ctrl-x-map and put it on C-x 4, but with every
> command having its effects in the other window.
>
> --
> -David House, dmhouse@gmail.com
Not that I care a lot about this, but...
Most of the relevant find-file-.... functions will eventually call switch-to-buffer,
switch-to-buffer-other-window, or switch-to-buffer-other-frame.
Now, if switch-to-buffer looked at the keys used to invoke the current
command, it could DTRT if command invoked with a C-x 4 or C-x 5 prefix
vs. a plain C-x prefix.
If we don't want to do it at the C level (in switch-to-buffer), we
could create a new switch-to-buffer-dwim that could be used in
find-file, and friends.
Then would could simply put find-file on C-x 4 f and C-x 5 f and have it
dtrt.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-21 9:57 ` David House
2007-06-21 10:49 ` Kim F. Storm
@ 2007-06-21 10:49 ` Andreas Schwab
1 sibling, 0 replies; 38+ messages in thread
From: Andreas Schwab @ 2007-06-21 10:49 UTC (permalink / raw)
To: David House; +Cc: Juri Linkov, emacs-devel, rms, monnier
David House <dmhouse@gmail.com> writes:
> In other words we make a copy of ctrl-x-map and put it on C-x 4, but with every
> command having its effects in the other window.
It should still be possible to easily put the functionality of
foo-other-window on a different key.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-21 10:49 ` Kim F. Storm
@ 2007-06-21 11:38 ` Andreas Schwab
2007-06-22 1:51 ` Richard Stallman
1 sibling, 0 replies; 38+ messages in thread
From: Andreas Schwab @ 2007-06-21 11:38 UTC (permalink / raw)
To: Kim F. Storm; +Cc: Juri Linkov, David House, emacs-devel, rms, monnier
storm@cua.dk (Kim F. Storm) writes:
> Then would could simply put find-file on C-x 4 f and C-x 5 f and have it
> dtrt.
What if I want to put it on a different key? Changing the behaviour
depending on the binding is a bad idea, IMHO.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-21 10:49 ` Kim F. Storm
2007-06-21 11:38 ` Andreas Schwab
@ 2007-06-22 1:51 ` Richard Stallman
1 sibling, 0 replies; 38+ messages in thread
From: Richard Stallman @ 2007-06-22 1:51 UTC (permalink / raw)
To: Kim F. Storm; +Cc: juri, dmhouse, emacs-devel, monnier, schwab
Now, if switch-to-buffer looked at the keys used to invoke the current
command, it could DTRT if command invoked with a C-x 4 or C-x 5 prefix
vs. a plain C-x prefix.
That would work, but it doesn't seem very clean.
If we want to have the same command do both jobs (same window and
other window), I'd rather have `interactive' set up an argument to
tell it which one to do.
However, I think it is cleaner to continue to have different commands
for the same-window and other-window cases.
In other words, I think the cleanest approach for this is the one
we are now using, and that it is best not to change this at all.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: how about a find-library-other-window command?
2007-06-20 16:49 ` Drew Adams
2007-06-21 1:07 ` Richard Stallman
@ 2007-06-22 19:29 ` Juri Linkov
2007-06-22 20:40 ` Drew Adams
1 sibling, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2007-06-22 19:29 UTC (permalink / raw)
To: Drew Adams; +Cc: rms, emacs-devel
> + (defun find-library-other-window (library)
> + "Find the elisp source of LIBRARY in another window."
> + (interactive
> + (list
> + (completing-read "Library name: "
> + 'locate-file-completion
> + (cons (or find-function-source-path load-path)
> + (find-library-suffixes)))))
> + (let ((buf (find-file-noselect (find-library-name library))))
> + (condition-case nil (switch-to-buffer-other-window buf)
> + (error (pop-to-buffer buf)))))
> +
> + ;;;###autoload
> + (defun find-library-other-frame (library)
> + "Find the elisp source of LIBRARY in another frame."
> + (interactive
> + (list
> + (completing-read "Library name: "
> + 'locate-file-completion
> + (cons (or find-function-source-path load-path)
> + (find-library-suffixes)))))
> + (let ((buf (find-file-noselect (find-library-name library))))
> + (condition-case nil (switch-to-buffer-other-frame buf)
> + (error (pop-to-buffer buf)))))
This duplicates the same code in three places. If we are going to keep
the practice of using three commands with different suffixes, then we can
at least simplify the definition of window/frame commands? These commands
could just let-bind a variable indicating the scope of the commands, and
call-interactively the basic command allowing `switch-to-buffer' to decide
where to display the buffer.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: how about a find-library-other-window command?
2007-06-22 19:29 ` Juri Linkov
@ 2007-06-22 20:40 ` Drew Adams
0 siblings, 0 replies; 38+ messages in thread
From: Drew Adams @ 2007-06-22 20:40 UTC (permalink / raw)
To: Juri Linkov; +Cc: rms, emacs-devel
> This duplicates the same code in three places. If we are going to keep
> the practice of using three commands with different suffixes, then we can
> at least simplify the definition of window/frame commands? These commands
> could just let-bind a variable indicating the scope of the commands, and
> call-interactively the basic command allowing `switch-to-buffer' to decide
> where to display the buffer.
Right; I agree. A variable or a helper function with a parameter or some
such, to factor the common code. I wasn't sure what the policy/preference
was. Feel free to factor things per the standard practice, whatever it might
be.
^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2007-06-22 20:40 UTC | newest]
Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-19 18:23 how about a find-library-other-window command? Drew Adams
2007-06-19 19:08 ` David House
2007-06-19 19:39 ` Sean O'Rourke
2007-06-19 19:52 ` Drew Adams
2007-06-19 19:51 ` Drew Adams
2007-06-19 21:40 ` David Kastrup
2007-06-20 1:03 ` Stefan Monnier
2007-06-20 13:28 ` Richard Stallman
2007-06-19 19:15 ` Stefan Monnier
2007-06-19 19:36 ` Drew Adams
2007-06-19 19:53 ` Andreas Schwab
2007-06-19 20:41 ` Stefan Monnier
2007-06-19 20:55 ` Drew Adams
2007-06-19 21:54 ` Juri Linkov
2007-06-20 13:28 ` Richard Stallman
2007-06-20 14:09 ` Juri Linkov
2007-06-20 14:57 ` Andreas Schwab
2007-06-20 15:44 ` Juri Linkov
2007-06-21 1:07 ` Richard Stallman
2007-06-21 7:43 ` Juri Linkov
2007-06-21 9:55 ` David House
2007-06-21 9:57 ` David House
2007-06-21 10:49 ` Kim F. Storm
2007-06-21 11:38 ` Andreas Schwab
2007-06-22 1:51 ` Richard Stallman
2007-06-21 10:49 ` Andreas Schwab
2007-06-20 17:21 ` Ehud Karni
2007-06-20 17:54 ` Juri Linkov
2007-06-21 1:07 ` Richard Stallman
2007-06-19 23:24 ` Davis Herring
2007-06-19 23:30 ` Drew Adams
2007-06-20 13:28 ` Richard Stallman
2007-06-20 13:28 ` Richard Stallman
2007-06-20 14:17 ` Juri Linkov
2007-06-20 16:49 ` Drew Adams
2007-06-21 1:07 ` Richard Stallman
2007-06-22 19:29 ` Juri Linkov
2007-06-22 20:40 ` Drew Adams
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.