From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Snader Subject: Re: Patch to implement sorting Org tables by IP address Date: Sun, 14 Dec 2014 10:19:34 -0500 Message-ID: <63EA1170-B4E2-4CB8-95CD-77AF7AA117C3@mac.com> References: <87r3w4a326.fsf@nicolasgoaziou.fr> <87tx0z8vxw.fsf@nicolasgoaziou.fr> <42DDD6AD-8F6F-4F85-840B-4C3946AD3C55@mac.com> <87oar78ro1.fsf@nicolasgoaziou.fr> <8C2CF3B2-399D-4944-8CE9-D486EA1A0985@mac.com> <87bnn78apu.fsf@nicolasgoaziou.fr> <2217AFF8-7135-4EAC-A189-8152FDDE52F9@mac.com> <87tx0y79st.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Content-Type: multipart/signed; boundary="Apple-Mail=_841637AE-2766-4560-81C6-3965F9860F5E"; protocol="application/pgp-signature"; micalg=pgp-sha1 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0Axk-0005iz-5Y for emacs-orgmode@gnu.org; Sun, 14 Dec 2014 10:20:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0Axe-0004Az-0V for emacs-orgmode@gnu.org; Sun, 14 Dec 2014 10:20:00 -0500 Received: from st11p01mm-asmtpout002.mac.com ([17.172.204.237]:49072 helo=st11p01mm-asmtp002.mac.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0Axd-00047C-Qy for emacs-orgmode@gnu.org; Sun, 14 Dec 2014 10:19:53 -0500 Received: from [172.30.0.157] (unknown [75.115.6.171]) by st11p01mm-asmtp002.mac.com (Oracle Communications Messaging Server 7.0.5.33.0 64bit (built Aug 27 2014)) with ESMTPSA id <0NGK002AHVX18I50@st11p01mm-asmtp002.mac.com> for emacs-orgmode@gnu.org; Sun, 14 Dec 2014 15:19:50 +0000 (GMT) In-reply-to: <87tx0y79st.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --Apple-Mail=_841637AE-2766-4560-81C6-3965F9860F5E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Dec 14, 2014, at 6:25 AM, Nicolas Goaziou = wrote: >=20 > Jon Snader writes: >> Really, this doesn=E2=80=99t matter because I was >> merely commenting on why (prompt . comparison) isn=E2=80=99t enough. = Of >> course, you could roll any special extraction functionality into the >> comparison but I don=E2=80=99t really like that. >=20 > Then >=20 > (prompt comparison extraction) >=20 > while still allowing >=20 > (prompt comparison) >=20 > which would be a special case for >=20 > (prompt comparison #'org-sort-remove-invisible) That would make sense. Also, I think the prompt should be something like = =E2=80=9C(t)ime=E2=80=9D so that the prompt message can be built = on-the-fly. The `t=E2=80=99 (or whatever) can be extracted from the = prompt to build a list of legal answers. >=20 >> Anyway, what I was suggesting in my last post was that we duplicate >> the functionality of org-sort-list. >=20 > This what I initially suggested. However, I'm trying to see if a table > approach would ultimately be better. You=E2=80=99ve convinced me that your original suggestion is the right = one. It allows users to add additional sorting options if they need one. = Even a user without Elisp skills could use it (by calling it = interactively) if the extraction function was already available either = in Emacs/Org itself or locally. The important thing to me is that the user have the capability to add = another sort when (admittedly rarely) needed. The ?f ?F mechanism = provides the necessary escape hatch and is what current users are used = to. >=20 >> There, if you=E2=80=99re calling it programmatically you specify = getkey-func >> and compare-func. If you call it interactively, it asks you for the >> extraction function (which must return a string or number) and it >> tests it to see which comparison function to use. I like this = approach >> because it makes org-sort-list and org-table-sort-lines work the same >> way. What=E2=80=99s not to like? >=20 > The networking researcher will have to provide its sorting function = each > time, which was one of your arguments. Sorry. That was because I didn=E2=80=99t completely understand your = suggestion. The point is that the ?f ?F mechanism enables both = interactive AND programmatic use. The researcher could write a bit of = Elisp that calls org-table-sort-lines with his own extraction and = comparison functions and then call that Elisp interactively. As I see it, we=E2=80=99ve reached the conclusion that we should either = have some sort of minimal table-driven mechanism or duplicate the = functionality in org-sort-list. I like duplicating the org-sort-list = functionality best. As you pointed out before, org-do-sort is an = internal function and we probably shouldn=E2=80=99t let users mess with = it. We could, I suppose, move all the work out to org-table-sort-lines = but then org-do-sort is little more than a call to sort. As I said above, you=E2=80=99ve convinced me that ?f ?F is the right = solution. --Apple-Mail=_841637AE-2766-4560-81C6-3965F9860F5E Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIcBAEBAgAGBQJUjaqPAAoJEO+a/ARTO0yyCJ4P/0x+laUsiUnhcXw7IkIZ62ob 8VWFqBTd17vQxBMjo3CKn2mffb7W0ZLezmIDc84OzUd62EtjFUZq5A3gfGFm3IPA jrsNu4X8IEaiRscjZKJtGSJ9+YQy8X2kj//R8GOUwNkxVvNW8bEkDsftPh+3x2JZ suezAuvsUbXHAPBUp8WwIJwYfz7884dk1pacvWJpqeekRD8irrK6M1dRJj7TF16S rGxElNx0zSSnNMtwG9DyYBog9/eyeXKgAPkB75Zs6oU5u9RWCyZ+gCgrKrqskaWq 4uc26d1Oa1eOwc48iDGxYAJmkVjF00GrGS4qJtn/GNPydKgzAhPSHm6pARhNRsUU iaLUsi4C2uI3k3mIYY3crOhxaTAigkpYGCTi5YucXmgAi9Q9X1TSKYXW/ETLX7y3 d1zgwkdYo7jMchq2yr2Km9kQbqey1uCR6QGSDa6FSHzPRWcGbK51l2BsybQ1DBVL x2lHwVWTgRpHUpWbQD38DxrmU5Vg3G9CntPqh5s8Go1HX2sbmh/LGaodWEKNQpu+ TG15ckQIfq3D5N3VINL1tTl/MuYkfAYafiFCL7ilFkHp/AmLd7DlUqOe3LSmXMlL JI+m3ioHdb4YFJjcf7CZOVuZ5D6RwKl+vydDRkDkjf9YfaQVjdOviaig3y7Bqbma T4otsuwbqvs2GjLGFh9S =PFnd -----END PGP SIGNATURE----- --Apple-Mail=_841637AE-2766-4560-81C6-3965F9860F5E--