From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Citation syntax: a revised proposal Date: Mon, 16 Feb 2015 14:16:02 -0500 Message-ID: References: <87k2zjnc0e.fsf@berkeley.edu> <87a90e83ki.fsf@ucl.ac.uk> <87bnktj0c4.fsf@nicolasgoaziou.fr> <87r3tp8zez.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNR9P-00054R-CH for emacs-orgmode@gnu.org; Mon, 16 Feb 2015 14:16:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNR9M-0007Cs-B0 for emacs-orgmode@gnu.org; Mon, 16 Feb 2015 14:16:11 -0500 Received: from smtp.andrew.cmu.edu ([128.2.105.204]:38638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNR9M-0007Cl-6I for emacs-orgmode@gnu.org; Mon, 16 Feb 2015 14:16:08 -0500 In-reply-to: <87r3tp8zez.fsf@gmx.us> 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: Rasmus Cc: emacs-orgmode@gnu.org That is probably something like it. I meant sorted by year (others may prefer author), which also means looking up in the database, decorating, and then sorting, but that doesn't fundamentally change your idea. Then, from the sorted list, you have to regenerate the org-syntax and replace the original text with the new string. hard may be an overstatment. I just have the experience from org-ref that there were often corner cases that I did not anticipate, with an even simpler syntax. I would hope the new syntax and data structure make this easier, but I will reserve judgment until it exists and we can try it. I am confident some ambitious soul will set out to make a citation using every possible variation, and then want to do something like sort it, and expect it to be done correctly, and will file bug reports if it is not. If not hard, it will definitely be more difficult! Still, as long as it is possible, it is only hard one time, and then it is done. Possible is the key. That said, there is a famous statment that it is twice as hard to debug code as to write it, so if you your cleverest at writing the code you are by definition not clever enough to debug it! Like I said, this community is very clever at solving these kinds of issues, so probably it is not a reason to not try something. Rasmus writes: > John Kitchin writes: > >> They are probably minor, but for example I am not sure how easy it would >> be to sort a multicite with all of the syntax options. I guess it can be >> done, I just do not see it clearly. It may not be necessary to do this >> either. > > Out of curiosity: > > Why would this be hard? Would it amount to more than replacing identity > in the below snippet with something that gets the true author? You can > split out global pre and post note beforehand and reinsert it. I'm > probably missing something. > > (sort '((:key "foo" :pre "pre") > (:key "bar" :post "pp. 22") > (:key "baz")) > (lambda (a b) (string-collate-lessp > (funcall 'identity (plist-get a :key)) > (funcall 'identity (plist-get b :key))))) > > =E2=80=94Rasmus -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu