unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#2270: 23.0.90; find-library: (1) doc string, (2) other-window version
@ 2009-02-10 18:23 Drew Adams
  0 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2009-02-10 18:23 UTC (permalink / raw)
  To: emacs-pretest-bug

emacs -Q
 
1. The doc string of find-library says only this:
"Find the elisp source of LIBRARY."
 
Hardly very helpful. What is LIBRARY? A file name as a string?
Absolute or relative? A symbol naming a feature? A symbol naming a
relative file name? All of the above?
 
Also, "elisp" should be "Emacs-Lisp".
 

2. Please add this command (or equivalent), after adjusting its doc
string also to explain what LIBRARY is:
 
(defun find-library-other-window (library)
  "Find the Emacs-Lisp source of LIBRARY in another window."
  (interactive
   (let* ((path (cons (or find-function-source-path load-path)
        (find-library-suffixes)))
   (def (if (eq (function-called-at-point) 'require)
     (save-excursion (backward-up-list)
                                   (forward-char)
                                   (backward-sexp -2)
                                   (thing-at-point 'symbol))
   (thing-at-point 'symbol))))
     (when def (setq def (and (locate-file-completion def path 'test) def)))
     (list (completing-read "Library name: " 'locate-file-completion
                            path nil nil nil def))))
  (let ((buf (find-file-noselect (find-library-name library))))
    (pop-to-buffer buf 'other-window)))
 

In GNU Emacs 23.0.90.1 (i386-mingw-nt5.1.2600)
 of 2009-02-01 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'
 







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

* bug#2270: 23.0.90; find-library: (1) doc string, (2) other-window version
@ 2009-02-11  2:27 Chong Yidong
  2012-10-24 17:41 ` bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... " Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Chong Yidong @ 2009-02-11  2:27 UTC (permalink / raw)
  To: Drew Adams; +Cc: 2270

> 1. The doc string of find-library says only this:
> "Find the elisp source of LIBRARY."
>
> Hardly very helpful.

I've clarified it.

> 2. Please add this command (or equivalent), after adjusting its doc
> string also to explain what LIBRARY is:

After the release, maybe.






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

* bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... (2) other-window version
  2009-02-11  2:27 bug#2270: 23.0.90; find-library: (1) doc string, (2) other-window version Chong Yidong
@ 2012-10-24 17:41 ` Drew Adams
       [not found]   ` <jwv3913g142.fsf-monnier+emacs@gnu.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2012-10-24 17:41 UTC (permalink / raw)
  To: 'Chong Yidong'; +Cc: 2270, 2270

> Sent: Tuesday, February 10, 2009 6:27 PM
>
> > 2. Please add this command (or equivalent), after adjusting its doc
> >    string also to explain what LIBRARY is:
> 
> After the release, maybe.

Clearly, that upcoming release was many moon ago.

I repeat my suggestion to add command `find-library-other-window'.
I also suggest that it be bound by default to `C-x 4 l'.

I've used this command & key forever, and wouldn't be without it.
(And I rarely have a need anymore for same-window `find-library'.)

---

(defun find-library-other-window (library)
  "Find the Emacs-Lisp source of LIBRARY in another window."
  (interactive
   (progn
     (require 'find-func)
     (let* ((path  (cons (or find-function-source-path load-path)
                         (find-library-suffixes)))
            (def   (if (eq (function-called-at-point) 'require)
                       (save-excursion (backward-up-list)
                                       (forward-char)
                                       (backward-sexp -2)
                                       (thing-at-point 'symbol))
                     (thing-at-point 'symbol))))
       (when def (setq def  (and (locate-file-completion def path 'test)
                                 def)))
       (list (completing-read "Library name: " 'locate-file-completion
                              path nil nil nil def)))))
  (let ((buf  (find-file-noselect (find-library-name library))))
    (pop-to-buffer buf 'other-window)))






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

* bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... (2) other-window version
       [not found]   ` <jwv3913g142.fsf-monnier+emacs@gnu.org>
@ 2012-10-24 19:38     ` Drew Adams
  2012-10-24 20:42       ` Stefan Monnier
  0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2012-10-24 19:38 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: 2270, 2270

> > I repeat my suggestion to add command `find-library-other-window'.
> 
> As mentioned in other threads, I'd rather we add a "use other 
> window for next command" prefix command (which we could bind
> to C-x 4), I could live with adding yet another such foo-other-window
> command since we don't yet have such a prefix command.

Yes, please add it while waiting for your ideal to bless the planet. ;-)

> > I also suggest that it be bound by default to `C-x 4 l'.
> 
> Since find-library is not bound to any key, I don't think
> find-library-other-window should be bound either.

"Since"?  The one doesn't follow from the other.  There is no logical reason why
we cannot have one command bound and not the other.  It depends on what we
expect the most common uses to be.  I proposed a key for the other-window
version because I don't think the same-window version is very useful.  But
that's me.

In any case, FWIW, I disagree that this should not be bound by default.

But if you are coming from the point of view that things must follow your
proposed new _implementation_, then such a hard-and-fast rule pretty much
follows, I'm guessing.  In spite of the fact that it might not be useful/needed
in all cases.  Hammer therefore nail?

> > I've used this command & key forever, and wouldn't be without it.
> > (And I rarely have a need anymore for same-window `find-library'.)
> 
> In my experience, people rarely need both the "same-window" and the
> "other-window" forms of a command, indeed.

Disagree, as one of the "people".  In this case, yes (this person rarely uses
the same-window version of this particular command).  But not in general.  I use
BOTH versions of most same- and other-window commands.

You keep repeating that supposition, BTW, but so far haven't provided any data
backing it up.  I, for one, would find it hard to believe that many people use
only `C-x C-f' or `C-x 4 f', but not both.

Perhaps this too is hammer therefore nail?  Does your proposed implementation
perhaps require a user to opt for one or the other for all uses?

Whatever.  I have the command/key for my own use.






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

* bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... (2) other-window version
  2012-10-24 19:38     ` Drew Adams
@ 2012-10-24 20:42       ` Stefan Monnier
  2012-10-24 21:20         ` Stefan Monnier
  2012-10-24 21:25         ` Drew Adams
  0 siblings, 2 replies; 14+ messages in thread
From: Stefan Monnier @ 2012-10-24 20:42 UTC (permalink / raw)
  To: Drew Adams; +Cc: 2270, 2270

> Yes, please add it while waiting for your ideal to bless the planet. ;-)

Please provide a proper patch (i.e. not one that doesn't simply
duplicate find-library's code.)

> only `C-x C-f' or `C-x 4 f', but not both.

Actually, adding a C-x 4 prefix that works for "all" commands would make
sure that both options are always available.


        Stefan





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

* bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... (2) other-window version
  2012-10-24 20:42       ` Stefan Monnier
@ 2012-10-24 21:20         ` Stefan Monnier
  2012-10-24 21:25         ` Drew Adams
  1 sibling, 0 replies; 14+ messages in thread
From: Stefan Monnier @ 2012-10-24 21:20 UTC (permalink / raw)
  To: Drew Adams; +Cc: 2270, 2270

> Please provide a proper patch (i.e. not one that doesn't simply
                                      ^^^
> duplicate find-library's code.)

Sorry for the extra `not'.


        Stefan





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

* bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... (2) other-window version
  2012-10-24 20:42       ` Stefan Monnier
  2012-10-24 21:20         ` Stefan Monnier
@ 2012-10-24 21:25         ` Drew Adams
  2016-04-27 17:26           ` Lars Ingebrigtsen
  1 sibling, 1 reply; 14+ messages in thread
From: Drew Adams @ 2012-10-24 21:25 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: 2270, 2270

> Please provide a proper patch (i.e. not one that doesn't simply
> duplicate find-library's code.)

Dunno what you mean.  Do you just mean a proper patch (e.g. `diff' output) or
are you saying that you want code that is different from what I sent?
 
> > only `C-x C-f' or `C-x 4 f', but not both.
> 
> Actually, adding a C-x 4 prefix that works for "all" commands 
> would make sure that both options are always available.

That's fine.  I already spoke up in favor of your idea (in the abstract).

I assume that it will be just as easy as now for a user to bind a different
function to one or the other key sequence, without affecting the other?

IOW, today a user can easily bind `C-x 4 f' to `butterfly' and leave `C-x C-f'
bound to `find-file'.  I assume that will be just as easy after your
implementation.  Likewise, for unbinding one of the two but not the other.






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

* bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... (2) other-window version
  2012-10-24 21:25         ` Drew Adams
@ 2016-04-27 17:26           ` Lars Ingebrigtsen
  2016-04-27 17:34             ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-27 17:26 UTC (permalink / raw)
  To: Drew Adams; +Cc: 2270, 'Chong Yidong', 'Stefan Monnier', 2270

I've now added a prefix argument to pop to a different window.  I've
also cleaned up the switch-to-buffer error handling code, which I think
isn't necessary any more after Martin's window fixes...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no






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

* bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... (2) other-window version
  2016-04-27 17:26           ` Lars Ingebrigtsen
@ 2016-04-27 17:34             ` Drew Adams
  2016-04-27 17:38               ` Lars Ingebrigtsen
  2016-04-27 18:46               ` Stefan Monnier
  0 siblings, 2 replies; 14+ messages in thread
From: Drew Adams @ 2016-04-27 17:34 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 2270, Chong Yidong, Stefan Monnier, 2270

> I've now added a prefix argument to pop to a different window.  I've
> also cleaned up the switch-to-buffer error handling code, which I think
> isn't necessary any more after Martin's window fixes...

1. I would still prefer to have the other-window version bound to
   `C-x 4 l'.

2. I think that the other-window version is far more useful than
   the same-window version.  So if other-window behavior is available
   only via a prefix arg I'd prefer that it be the other way around:
   a prefix arg uses the same window; no prefix arg uses another
   window.  (Yes, that would be a change in the default behavior.)

(Anyway, thanks for adding the other-window behavior.)





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

* bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... (2) other-window version
  2016-04-27 17:34             ` Drew Adams
@ 2016-04-27 17:38               ` Lars Ingebrigtsen
  2016-04-27 17:43                 ` Dmitry Gutov
  2016-04-27 18:46               ` Stefan Monnier
  1 sibling, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-27 17:38 UTC (permalink / raw)
  To: Drew Adams; +Cc: 2270, Chong Yidong, Stefan Monnier, 2270

Drew Adams <drew.adams@oracle.com> writes:

>> I've now added a prefix argument to pop to a different window.  I've
>> also cleaned up the switch-to-buffer error handling code, which I think
>> isn't necessary any more after Martin's window fixes...
>
> 1. I would still prefer to have the other-window version bound to
>    `C-x 4 l'.

`find-library' isn't bound to any key, but I think it probably should
be.  `C-x 4 l' seems like as good a keystroke as any.  Any thought from
other people?  I use the command quite a lot...

> 2. I think that the other-window version is far more useful than
>    the same-window version.  So if other-window behavior is available
>    only via a prefix arg I'd prefer that it be the other way around:
>    a prefix arg uses the same window; no prefix arg uses another
>    window.  (Yes, that would be a change in the default behavior.)

The command now uses pop-to-buffer-same-window, which is quite
customisable, as I understand things.  (I haven't looked into the
new-fangled window popping controlling functions.)  So I think this
should be customisable ... somehow ... by the users now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... (2) other-window version
  2016-04-27 17:38               ` Lars Ingebrigtsen
@ 2016-04-27 17:43                 ` Dmitry Gutov
  2016-04-27 17:56                   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Gutov @ 2016-04-27 17:43 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Drew Adams; +Cc: 2270, Chong Yidong, Stefan Monnier, 2270

On 04/27/2016 08:38 PM, Lars Ingebrigtsen wrote:

> `find-library' isn't bound to any key, but I think it probably should
> be.  `C-x 4 l' seems like as good a keystroke as any.  Any thought from
> other people?  I use the command quite a lot...

I think the "other window" version should simply be a separate command, 
like find-function-other-window, xref-find-definitions-other-window, etc.

Having a default binding for it would be a bit odd, considering 
find-library doesn't have one.

>> 2. I think that the other-window version is far more useful than
>>    the same-window version.  So if other-window behavior is available
>>    only via a prefix arg I'd prefer that it be the other way around:
>>    a prefix arg uses the same window; no prefix arg uses another
>>    window.  (Yes, that would be a change in the default behavior.)

-1 from me.

> The command now uses pop-to-buffer-same-window, which is quite
> customisable, as I understand things.  (I haven't looked into the
> new-fangled window popping controlling functions.)  So I think this
> should be customisable ... somehow ... by the users now.

It's... not as easy as one might hope. And if you customize 
`find-library' to use the other window this way, there will be no way to 
have it use the current window just this one time. And vice versa.





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

* bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... (2) other-window version
  2016-04-27 17:43                 ` Dmitry Gutov
@ 2016-04-27 17:56                   ` Lars Ingebrigtsen
  2016-04-27 18:57                     ` Dmitry Gutov
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-27 17:56 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 2270, Chong Yidong, Stefan Monnier, 2270

Dmitry Gutov <dgutov@yandex.ru> writes:

> I think the "other window" version should simply be a separate
> command, like find-function-other-window,
> xref-find-definitions-other-window, etc.

Oh, I had gotten the impression that we're moving away from that?  I
though that was part of the reason for those...  popping customisation
thingies that I haven't paid all that much attention to.  :-)

I can add an -other-window version -- it would just call the current
version with the new optional parameter...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... (2) other-window version
  2016-04-27 17:34             ` Drew Adams
  2016-04-27 17:38               ` Lars Ingebrigtsen
@ 2016-04-27 18:46               ` Stefan Monnier
  1 sibling, 0 replies; 14+ messages in thread
From: Stefan Monnier @ 2016-04-27 18:46 UTC (permalink / raw)
  To: Drew Adams; +Cc: Lars Ingebrigtsen, 2270

> 1. I would still prefer to have the other-window version bound to
>    `C-x 4 l'.

Actually, using the `other-frame-window' package from GNU ELPA, you
could have exactly that without any extra code.

> 2. I think that the other-window version is far more useful than
>    the same-window version.  So if other-window behavior is available
>    only via a prefix arg I'd prefer that it be the other way around:
>    a prefix arg uses the same window; no prefix arg uses another
>    window.  (Yes, that would be a change in the default behavior.)

Indeed, the `other-frame-window' also needs to be expanded to provide
a new prefix which means "use same frame" or "use same window".


        Stefan





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

* bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... (2) other-window version
  2016-04-27 17:56                   ` Lars Ingebrigtsen
@ 2016-04-27 18:57                     ` Dmitry Gutov
  0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Gutov @ 2016-04-27 18:57 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 2270, Chong Yidong, Stefan Monnier, 2270

On 04/27/2016 08:56 PM, Lars Ingebrigtsen wrote:

> Oh, I had gotten the impression that we're moving away from that?  I
> though that was part of the reason for those...  popping customisation
> thingies that I haven't paid all that much attention to.  :-)

IIUC we were moving toward prefix commands, but not the way you've used 
current-prefix-arg here.





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

end of thread, other threads:[~2016-04-27 18:57 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-11  2:27 bug#2270: 23.0.90; find-library: (1) doc string, (2) other-window version Chong Yidong
2012-10-24 17:41 ` bug#2270: [PATCH] bug#2270, RE: 23.0.90; find-library:... " Drew Adams
     [not found]   ` <jwv3913g142.fsf-monnier+emacs@gnu.org>
2012-10-24 19:38     ` Drew Adams
2012-10-24 20:42       ` Stefan Monnier
2012-10-24 21:20         ` Stefan Monnier
2012-10-24 21:25         ` Drew Adams
2016-04-27 17:26           ` Lars Ingebrigtsen
2016-04-27 17:34             ` Drew Adams
2016-04-27 17:38               ` Lars Ingebrigtsen
2016-04-27 17:43                 ` Dmitry Gutov
2016-04-27 17:56                   ` Lars Ingebrigtsen
2016-04-27 18:57                     ` Dmitry Gutov
2016-04-27 18:46               ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2009-02-10 18:23 bug#2270: 23.0.90; find-library: (1) doc string, " 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).