all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 41890@debbugs.gnu.org, 42210@debbugs.gnu.org, juri@linkov.net,
	contovob@tcd.ie, philip@warpmail.net, dgutov@yandex.ru
Subject: bug#41890: bug#42210: bug#41890: 28.0.50; [PATCH]: Add bindings for project.el
Date: Fri, 24 Jul 2020 08:12:13 -0700	[thread overview]
Message-ID: <871rl1t0aa.fsf@iris.silentflame.com> (raw)
In-Reply-To: <83sgdhe9jc.fsf@gnu.org>

Hello Eli,

On Fri 24 Jul 2020 at 09:01AM +03, Eli Zaretskii wrote:

>> Date: Thu, 23 Jul 2020 19:04:13 -0700
>> Cc: "Basil L. Contovounesios" <contovob@tcd.ie>,
>>  "Philip K." <philip@warpmail.net>, 41890@debbugs.gnu.org,
>>  42210@debbugs.gnu.org
>>
>> -(defun project-switch-to-buffer ()
>> +(defun project-switch-to-buffer (&optional switching-function)
>>    "Switch to another buffer belonging to the current project.
>>  This function prompts for another buffer, offering as candidates
>>  buffers that belong to the same project as the current buffer.
>>  Two buffers belong to the same project if their project instances,
>> -as reported by `project-current' in each buffer, are identical."
>> +as reported by `project-current' in each buffer, are identical.
>> +
>> +Optional argument SWITCHING-FUNCTION is the function used to
>> +switch the buffer.  It defaults to `switch-to-buffer'."
>>    (interactive)
>
> This interface strikes me as unusual and even unexpected for a command
> that switches to another buffer.  I would expect it to have an API
> similar to that of switch-to-buffer: that it should accept the buffer
> to switch to as an argument, and set up that argument in the
> 'interactive' spec according to the preferences of this command
> (offering buffers in the same project etc.).  The API you propose
> makes it awkward, to say the least, to invoke this command from Lisp.

I added the argument just so I could reuse the code in
project-switch-to-buffer, so a simple alternative for the purposes of my
patch would be to factor that code out into a new
project--select-project-buffer defun.  Then no existing APIs would be
changed.

Would that be sufficient?

> Granted, the original API doesn't allow such invocation, either, but
> as long as we are changing this API, let's try fixing that, okay?

This is a bit tricky actually -- what should the function do if some
Lisp code passes it a buffer which is not part of the current project?
Throw an error?  But then surely the Lisp code would prefer to just
check if the buffer is part of the project itself, and use
switch-to-buffer.

I'd be grateful if you could say more about the sort of Lisp code you
have in mind.  I'm struggling to imagine wanting to call this function
from Lisp except via call-interactively.

-- 
Sean Whitton





  reply	other threads:[~2020-07-24 15:12 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16  9:49 bug#41890: 28.0.50; [PATCH]: Add bindings for project.el Theodor Thornhill
     [not found] ` <83pn9z13xq.fsf@gnu.org>
2020-06-16 16:44   ` Theodor Thornhill
2020-06-16 17:16     ` Eli Zaretskii
2020-06-16 17:30       ` Theodor Thornhill
2020-06-16 18:14         ` Basil L. Contovounesios
2020-06-16 19:07           ` Theodor Thornhill
2020-06-16 19:12             ` Theodor Thornhill
2020-06-16 21:57               ` Juri Linkov
2020-06-16 22:47                 ` Dmitry Gutov
2020-06-16 23:24                   ` Juri Linkov
2020-06-16 23:42                     ` Dmitry Gutov
2020-06-17 21:23                       ` Juri Linkov
2020-06-17 22:16                         ` Dmitry Gutov
2020-06-17 22:27                           ` Juri Linkov
2020-06-17 22:38                             ` Dmitry Gutov
2020-06-17 23:23                               ` Juri Linkov
2020-06-17 23:36                                 ` Dmitry Gutov
2020-06-18 22:59                                   ` Juri Linkov
2020-06-18 23:08                                     ` Dmitry Gutov
2020-06-20 23:41                                   ` Juri Linkov
2020-06-21  0:25                                     ` Dmitry Gutov
2020-06-17 10:51                 ` Philip K.
2020-06-16 20:31             ` Basil L. Contovounesios
2020-06-17 19:10               ` Theodor Thornhill
2020-06-17 19:40                 ` Basil L. Contovounesios
2020-06-17 23:07                 ` Dmitry Gutov
2020-06-16 21:23       ` Dmitry Gutov
2020-06-16 21:35         ` Dmitry Gutov
2020-06-17 14:28           ` Eli Zaretskii
2020-06-17 14:27         ` Eli Zaretskii
2020-06-17 15:49           ` Dmitry Gutov
2020-06-17 16:33             ` Eli Zaretskii
2020-06-17 22:23               ` Dmitry Gutov
2020-06-18 13:38                 ` Eli Zaretskii
2020-06-18 15:47                   ` Dmitry Gutov
2020-06-18 17:24                     ` Eli Zaretskii
2020-06-18 18:18                       ` Michael Albinus
2020-06-18 16:25       ` Stefan Monnier
2020-06-18 17:30         ` Eli Zaretskii
2020-06-18 18:22           ` Dmitry Gutov
2020-06-18 18:42             ` Eli Zaretskii
2020-06-18 18:54               ` Dmitry Gutov
2020-06-18 19:04                 ` Eli Zaretskii
2020-06-18 21:12                   ` Dmitry Gutov
2020-06-19  6:11                     ` Eli Zaretskii
     [not found] ` <3ad1ecbb-36d6-79c0-7a7b-6ff3a561e512@yandex.ru>
2020-06-18 14:09   ` Philip K.
2020-06-18 17:22     ` Basil L. Contovounesios
2020-06-18 18:50       ` Philip K.
2020-06-18 22:10         ` Juri Linkov
2020-06-18 23:01           ` Dmitry Gutov
2020-06-18 23:24             ` Juri Linkov
2020-06-18 23:31               ` Dmitry Gutov
2020-06-19 10:15                 ` Simen Heggestøyl
2020-07-11 17:07         ` Sean Whitton
2020-07-12 15:18           ` Dmitry Gutov
2020-07-12 16:24             ` Sean Whitton
2020-07-12 20:12               ` Dmitry Gutov
2020-07-18 16:06                 ` bug#42210: " Sean Whitton
2020-07-19 23:46                   ` Dmitry Gutov
2020-07-20  0:30                     ` Juri Linkov
2020-07-20  1:04                       ` bug#41890: " Dmitry Gutov
2020-07-20 20:47                         ` Juri Linkov
2020-07-20 21:00                           ` Dmitry Gutov
2020-07-20 16:49                     ` Sean Whitton
2020-07-20 20:41                       ` bug#41890: " Juri Linkov
2020-07-20 21:02                         ` Dmitry Gutov
2020-07-20 21:24                         ` bug#41890: " Sean Whitton
2020-07-20 22:00                       ` Dmitry Gutov
2020-07-21  0:33                         ` Sean Whitton
2020-07-21 23:38                           ` Juri Linkov
2020-07-22  0:38                             ` Dmitry Gutov
2020-07-22  1:33                               ` Sean Whitton
2020-07-22 19:28                                 ` bug#41890: " Sean Whitton
2020-07-23 23:46                                   ` Dmitry Gutov
2020-07-24  2:04                                     ` Sean Whitton
2020-07-24  6:01                                       ` bug#41890: " Eli Zaretskii
2020-07-24 15:12                                         ` Sean Whitton [this message]
2020-07-24 16:12                                           ` Eli Zaretskii
2020-07-24 21:20                                             ` Sean Whitton
2020-07-24 22:54                                               ` Dmitry Gutov
2020-07-24 23:13                                                 ` Sean Whitton
2020-07-24 23:45                                                   ` Dmitry Gutov
2020-07-25  6:14                                               ` Eli Zaretskii
2020-07-26  5:15                                                 ` bug#41890: " Sean Whitton
2020-07-27  0:01                                                   ` Dmitry Gutov
2020-07-22  1:31                             ` Sean Whitton
2020-07-23  0:32                               ` bug#41890: " Juri Linkov
2020-07-23 15:06                                 ` Sean Whitton
2020-07-20 10:21                   ` Basil L. Contovounesios
2020-07-20 14:45                     ` Eli Zaretskii
2020-07-12 23:48               ` Juri Linkov
2020-07-13  0:13                 ` Dmitry Gutov
2020-07-13  0:23                   ` Juri Linkov
2020-07-13  6:56                     ` Philip K.
2020-07-13 10:47                       ` Dmitry Gutov
2020-07-13 10:50                         ` Dmitry Gutov
2020-07-13 11:02                           ` Philip K.
2020-07-18 15:19                             ` Sean Whitton
2020-07-13 23:49                       ` Juri Linkov
2020-07-14  7:03                         ` Philip K.
2020-07-14 22:34                           ` Juri Linkov
2020-07-14 23:32                             ` Dmitry Gutov
2020-07-15 23:59                               ` Juri Linkov
2020-07-16 13:38                                 ` Dmitry Gutov
2020-07-15 19:21                             ` Philip K.
2020-07-15 23:35                               ` Dmitry Gutov
     [not found]     ` <902001d0-ab1c-b697-bfd0-b8ec195dc65f@yandex.ru>
2020-06-19 10:13       ` Simen Heggestøyl
2020-06-19 10:26         ` Philip K.
2020-06-19 10:50           ` Simen Heggestøyl
2020-06-19 12:25             ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871rl1t0aa.fsf@iris.silentflame.com \
    --to=spwhitton@spwhitton.name \
    --cc=41890@debbugs.gnu.org \
    --cc=42210@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    --cc=philip@warpmail.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.