Received: (at 44597) by debbugs.gnu.org; 19 Dec 2020 00:17:00 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 18 19:17:00 2020 Received: from localhost ([127.0.0.1]:40537 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kqPvg-0007g9-DN for submit <at> debbugs.gnu.org; Fri, 18 Dec 2020 19:17:00 -0500 Received: from smtp-clients1.isti.cnr.it ([146.48.28.36]:36172) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <pot@HIDDEN>) id 1kqPve-0007g1-UQ for 44597 <at> debbugs.gnu.org; Fri, 18 Dec 2020 19:16:59 -0500 Received: from tucano.isti.cnr.it (tucano.isti.cnr.it [146.48.81.102]) (Authenticated sender: pot) by smtp-clients1.isti.cnr.it (Postfix) with ESMTPSA id CAF8DB0827; Sat, 19 Dec 2020 01:16:56 +0100 (CET) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.0 at smtp-out.isti.cnr.it Received: from pot by tucano.isti.cnr.it with local (Exim 4.94) (envelope-from <pot@HIDDEN>) id 1kqPvc-00A4YH-77; Sat, 19 Dec 2020 01:16:56 +0100 From: =?utf-8?Q?Francesco_Potort=C3=AC?= <pot@HIDDEN> Date: Sat, 19 Dec 2020 01:16:55 +0100 To: "Roland Winkler" <winkler@HIDDEN> In-Reply-To: <12739.87657.242919.24541@HIDDEN> (winkler@HIDDEN) Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting References: <E1kdHMM-00C53c-B6@HIDDEN> <87ima7yjp7.fsf@HIDDEN> <E1kdzOQ-00G9cu-G7@HIDDEN> <87sg99vviz.fsf@HIDDEN> <E1klwiI-004kvG-Le@HIDDEN> <87pn3lkay5.fsf@HIDDEN> <60225.35392.490825.24532@HIDDEN> <E1koUge-000QwB-NV@HIDDEN> <12739.87657.242919.24541@HIDDEN> Organization: X-fingerprint: 4B02 6187 5C03 D6B1 2E31 7666 09DF 2DC9 BE21 6115 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-Id: <E1kqPvc-00A4YH-77@HIDDEN> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 44597 Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 44597 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) >> The bibtex-get-date function in my patch does not assume that the "day" >> field is present. When it is missing, it uses the first day of the >> month, or day 30 if the LATEST argument is t. > >My point is that only rarely users will have "day" fields in their >database. Then it can happen easily that multiple entries have the >same "year" and "month" field, but no other criterion to sort these >entries. In my use case, I needed to sort about 100 bibtex entries in reversed date order, without any more criterion, and I had to resort to an external tool. The reason was that i had to participate to a career selection where people was asked to provide a list of their own papers listed in reverse chronological order. I had no need for a secondary sort key, so if I could just do that with bibtex.el it would have saved my day. In fact, I had thought about writing a more generic patch, but with limited time on my hands, I preferred improving the current situation rather than trying to do the best. >To resolve this ambiguity, if *I* was using such a scheme, I would >want to use other fields like "author" or "title". Certainly a more general scheme which allows arbitrary sort keys would be best. > That's when >individual preferences enter the stage. As we are talking about a >scheme that (I am pretty confident) will attract only a few users in >the first place, I believe it is better to let users define their >own functions for this. Sure. But in any case, having a set of predefined sorting methods would improve a lot over the current situation. I assume that most users are not able or willing to write their own function. >> As far as I can tell, "date" and "day" are sometimes used even if not >> standard. > >The "date" field is used by biblatex, which is a largely >backward-compatible successor of BibTeX. Its "date" field is >supposed to follow iso-8601, and that's also assumed by the code >example below. (In BibTeX mode, you can switch from old-fashioned >BibTeX to biblatex, see `bibtex-dialect'.) Yes, that's what I have found looking around. It is supported in my patch, though I have never used biblatex. I see now that biblatex has a successor called biber. Maybe one day I'll try it. >I have never seen a "day" field nor any code that supports it >(nor have I seen iso-8601 "date" fields that actually included a day). > >> I personally use "day" to keep track of the dates of congresses >> (for @inproceedings). > >Sure, that makes a date-based sorting more straightforward and >meaningful. Again, that depends on the use case. I am sure my patch can be useful even without a secondary sorting key and without a day being specified. >> >How about instead a new customizable sorting scheme, where the >> >value of bibtex-maintain-sorted-entries is a cons pair >> > >> > (INDEX-FUN . PREDICATE) >> > >> That would be certainly more flexible. However I think it is at >> least equally important to provide some precooked solutions. I >> myself would have spared some work some months ago if I had the >> 'reverse and 'reversedate methods available. > >The patch below implements such a scheme (not based on a cons pair >but a list that may include a third element INIT-FUN). > >To test the code, I also hacked a function `my-bibtex-index-date' >that provides an example for INDEX-FUN, see below. It may well be >that it does not exactly match your taste, but it should be >straightforward to adapt the code. The PREDICATE is then standard >`string-lessp' (or `string-greaterp' for reversed sorting). > >Can you please test this? Thanks. I will, but please be patient. I do this in my spare time, which is highly variable. Thanks, will come back to you as soon as I can
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at 44597) by debbugs.gnu.org; 18 Dec 2020 22:48:47 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 18 17:48:46 2020 Received: from localhost ([127.0.0.1]:40404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kqOYI-00013L-A2 for submit <at> debbugs.gnu.org; Fri, 18 Dec 2020 17:48:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <winkler@HIDDEN>) id 1kqOYF-000136-KM for 44597 <at> debbugs.gnu.org; Fri, 18 Dec 2020 17:48:45 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43995) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from <winkler@HIDDEN>) id 1kqOY9-0000vz-FA; Fri, 18 Dec 2020 17:48:37 -0500 Received: from [2602:30a:2e52:d720:65b7:1416:12e7:8bfb] (port=33134 helo=regnitz) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from <winkler@HIDDEN>) id 1kqOY8-0004Ha-RZ; Fri, 18 Dec 2020 17:48:37 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID: <12739.87657.242919.24541@HIDDEN> Date: Fri, 18 Dec 2020 16:48:35 -0600 From: "Roland Winkler" <winkler@HIDDEN> To: "Francesco \=\?utf-8\?Q\?Potort\=C3\=AC"?= <pot@HIDDEN> Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting In-Reply-To: <E1koUge-000QwB-NV@HIDDEN> References: <E1kdHMM-00C53c-B6@HIDDEN> <87ima7yjp7.fsf@HIDDEN> <E1kdzOQ-00G9cu-G7@HIDDEN> <87sg99vviz.fsf@HIDDEN> <E1klwiI-004kvG-Le@HIDDEN> <87pn3lkay5.fsf@HIDDEN> <60225.35392.490825.24532@HIDDEN> <E1koUge-000QwB-NV@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 44597 Cc: 44597 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) On Sun Dec 13 2020 Francesco Potort=C3=AC wrote: > The bibtex-get-date function in my patch does not assume that the "day" > field is present. When it is missing, it uses the first day of the > month, or day 30 if the LATEST argument is t. My point is that only rarely users will have "day" fields in their database. Then it can happen easily that multiple entries have the same "year" and "month" field, but no other criterion to sort these entries. To resolve this ambiguity, if *I* was using such a scheme, I would want to use other fields like "author" or "title". That's when individual preferences enter the stage. As we are talking about a scheme that (I am pretty confident) will attract only a few users in the first place, I believe it is better to let users define their own functions for this. > As far as I can tell, "date" and "day" are sometimes used even if not > standard. The "date" field is used by biblatex, which is a largely backward-compatible successor of BibTeX. Its "date" field is supposed to follow iso-8601, and that's also assumed by the code example below. (In BibTeX mode, you can switch from old-fashioned BibTeX to biblatex, see `bibtex-dialect'.) I have never seen a "day" field nor any code that supports it (nor have I seen iso-8601 "date" fields that actually included a day). > I personally use "day" to keep track of the dates of congresses > (for @inproceedings). Sure, that makes a date-based sorting more straightforward and meaningful. > >How about instead a new customizable sorting scheme, where the > >value of bibtex-maintain-sorted-entries is a cons pair > > > > (INDEX-FUN . PREDICATE) > > > That would be certainly more flexible. However I think it is at > least equally important to provide some precooked solutions. I > myself would have spared some work some months ago if I had the > 'reverse and 'reversedate methods available. The patch below implements such a scheme (not based on a cons pair but a list that may include a third element INIT-FUN). To test the code, I also hacked a function `my-bibtex-index-date' that provides an example for INDEX-FUN, see below. It may well be that it does not exactly match your taste, but it should be straightforward to adapt the code. The PREDICATE is then standard `string-lessp' (or `string-greaterp' for reversed sorting). Can you please test this? Thanks. --8<---------------cut here---------------start------------->8--- (defvar my-bibtex-month-alist "Alist associating month names with month numbers. Case is ignored." ;; Add more (abbreviated) month names in your favorite languages. (let ((i 0)) (mapcar (lambda (elt) (setq i (1+ i)) (cons (cdr elt) (format "%02d" i))) bibtex-predefined-month-strings))) (defun my-bibtex-index-date () "Return the date of current entry as a string in yyyymmdd format." ;; To follow crossrefs, use instead `bibtex-autokey-get-field' with ;; `bibtex-autokey-use-crossref' bound non-nil. But remember that ;; BibTeX expects that a cross-referenced entry occurs later in the ;; database files than entries cross-referencing it. That's why ;; `bibtex-maintain-sorted-entries' may take the value `crossref'. (let* ((str (bibtex-text-in-field '("date" "year"))) (iso8601 (and str (iso8601-valid-p str) (iso8601-parse str))) (year (or (and iso8601 (let ((year (decoded-time-year iso8601))) (and year (format "%04d" year)))) ;; BibTeX permits a year field "(about 1984)", where only ;; the last four nonpunctuation characters must be numer= als. (and str (string-match "\\([0-9][0-9][0-9][0-9]\\)[^[:alnum:= ]]*\\'" str) (match-string 1 str)) "0000")) ; Change according to taste. (month (or (and iso8601 (let ((month (decoded-time-month iso8601))) (and month (format "%02d" month)))) (let ((month (bibtex-text-in-field "month"))) (if month (cond ((cdr (assoc-string month my-bibtex-month-alist t= ))) ((string-match "\\`\\([01]?\\)[0-9]\\'" mon= th) (if (match-string 1 month) (match-string 0 month) (concat "0" (match-string 0 month))))))) "00")) ; Change according to taste. (day (or (and iso8601 (let ((day (decoded-time-day iso8601))) (and day (format "%02d" day)))) (let ((day (bibtex-text-in-field "day"))) (if (and day (string-match "\\`\\([03]?\\)[0-9]" day)) (if (match-string 1 day) day (concat "0" day)))) "00"))) ; Change according to taste. A `day' field is not ; standard BibTeX. We could also use other fields ; if `day' is not defined for an entry. (concat year month day))) (setq bibtex-maintain-sorted-entries '(my-bibtex-index-date string-lessp)) --8<---------------cut here---------------end--------------->8--- diff --git a/etc/NEWS b/etc/NEWS index 8746337..4a8e70e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1481,6 +1481,10 @@ completions with more information in completion pref= ix and suffix. This new option allows the user to customize how case is converted when unifying entries. =20 +--- +*** The user option `bibtex-maintain-sorted-entries' now permits +user-defined sorting schemes. + +++ *** 'format-seconds' can now be used for sub-second times. The new optional "," parameter has been added, and diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index a78219e..2c7633c 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -204,20 +204,33 @@ bibtex-clean-entry-hook (defcustom bibtex-maintain-sorted-entries nil "If non-nil, BibTeX mode maintains all entries in sorted order. Allowed non-nil values are: -plain or t All entries are sorted alphabetically. -crossref All entries are sorted alphabetically unless an entry has a +plain or t Sort entries alphabetically by keys. +crossref Sort entries alphabetically by keys unless an entry has a crossref field. These crossrefed entries are placed in alphabetical order immediately preceding the main entry. entry-class The entries are divided into classes according to their entry type, see `bibtex-sort-entry-class'. Within each class - the entries are sorted alphabetically. + sort entries alphabetically by keys. +(INDEX-FUN PREDICATE) +(INDEX-FUN PREDICATE INIT-FUN) Sort entries using INDEX-FUN and PREDICATE. + Function INDEX-FUN is called for each entry with point at the + end of the head of the entry. Its return values are used to + sort the entries using PREDICATE. Function PREDICATE takes t= wo + arguments INDEX1 and INDEX2 as returned by INDEX-FUN. + It should return non-nil if INDEX1 should sort before INDEX2. + If INIT-FUN is non-nil, it should be a function that is called + with no arguments to initialize the sorting. See also `bibtex-sort-ignore-string-entries'." :group 'bibtex :type '(choice (const nil) + (const t) (const plain) (const crossref) (const entry-class) - (const t)) + (group :tag "Custom scheme" + (function :tag "Index-Fun") + (function :tag "Predicate") + (option (function :tag "Init-Fun")))) :safe (lambda (a) (memq a '(nil t plain crossref entry-class)))) =20 (defcustom bibtex-sort-entry-class @@ -3998,28 +4011,15 @@ bibtex-narrow-to-entry (narrow-to-region (bibtex-beginning-of-entry) (bibtex-end-of-entry)))) =20 -(defun bibtex-entry-index () - "Return index of BibTeX entry head at or past position of point. -The index is a list (KEY CROSSREF-KEY ENTRY-TYPE) that is used for sorting -the entries of the BibTeX buffer. CROSSREF-KEY is nil unless the value -of `bibtex-maintain-sorted-entries' is `crossref'. Move point to the end -of the head of the entry found. Return nil if no entry found." - (let ((case-fold-search t)) - (if (re-search-forward bibtex-entry-maybe-empty-head nil t) - (let ((key (bibtex-key-in-head)) - ;; all entry types should be downcase (for ease of compariso= n) - (entry-type (downcase (bibtex-type-in-head)))) - ;; Don't search CROSSREF-KEY if we don't need it. - (if (eq bibtex-maintain-sorted-entries 'crossref) - (let ((bounds (bibtex-search-forward-field - "\\(OPT\\)?crossref" t))) - (list key - (if bounds (bibtex-text-in-field-bounds bounds t)) - entry-type)) - (list key nil entry-type)))))) - -(defun bibtex-init-sort-entry-class-alist () - "Initialize `bibtex-sort-entry-class-alist' (buffer-local)." +(define-obsolete-function-alias 'bibtex-init-sort-entry-class-alist + #'bibtex-init-sort "28.1") +(defun bibtex-init-sort (&optional parse) + "Initialize sorting of BibTeX entries. +If PARSE is non-nil, also parse BibTeX keys." + (if (or parse + (and (eq bibtex-maintain-sorted-entries 'crossref) + (functionp bibtex-reference-keys))) + (bibtex-parse-keys)) (unless (local-variable-p 'bibtex-sort-entry-class-alist) (setq-local bibtex-sort-entry-class-alist (let ((i -1) alist) @@ -4029,7 +4029,36 @@ bibtex-init-sort-entry-class-alist ;; All entry types should be downcase (for ease of c= omparison). (push (cons (if (stringp entry) (downcase entry) ent= ry) i) alist))) - alist)))) + alist))) + ;; Custom sorting scheme + (if (and (consp bibtex-maintain-sorted-entries) + (nth 2 bibtex-maintain-sorted-entries)) + (funcall (nth 2 bibtex-maintain-sorted-entries)))) + +(defun bibtex-entry-index () + "Return index of BibTeX entry head at or past position of point. +The index is a list (KEY CROSSREF-KEY ENTRY-TYPE) that is used for sorting +the entries of the BibTeX buffer. CROSSREF-KEY is nil unless the value of +`bibtex-maintain-sorted-entries' is `crossref'. +If `bibtex-maintain-sorted-entries' is (INDEX-FUN ...), the index is the r= eturn +value of INDEX-FUN. Return nil if no entry found. +Move point to the end of the head of the entry found." + (let ((case-fold-search t)) + (if (re-search-forward bibtex-entry-maybe-empty-head nil t) + (if (consp bibtex-maintain-sorted-entries) + ;; Custom sorting scheme + (funcall (car bibtex-maintain-sorted-entries)) + (let ((key (bibtex-key-in-head)) + ;; ENTRY-TYPE should be downcase (for ease of comparison) + (entry-type (downcase (bibtex-type-in-head))) + bounds) + (list key + ;; Don't search CROSSREF-KEY if we don't need it. + (and (eq bibtex-maintain-sorted-entries 'crossref) + (setq bounds (bibtex-search-forward-field + "\\(OPT\\)?crossref" t)) + (bibtex-text-in-field-bounds bounds t)) + entry-type)))))) =20 (defun bibtex-lessp (index1 index2) "Predicate for sorting BibTeX entries with indices INDEX1 and INDEX2. @@ -4038,6 +4067,8 @@ bibtex-lessp If its value is nil use plain sorting." (cond ((not index1) (not index2)) ; indices can be nil ((not index2) nil) + ((consp bibtex-maintain-sorted-entries) + (funcall (cadr bibtex-maintain-sorted-entries) index1 index2)) ((eq bibtex-maintain-sorted-entries 'crossref) ;; CROSSREF-KEY may be nil or it can point to an entry ;; in another BibTeX file. In both cases we ignore CROSSREF-KEY. @@ -4074,10 +4105,7 @@ bibtex-sort-buffer are ignored." (interactive) (bibtex-beginning-of-first-entry) ; Needed by `sort-subr' - (bibtex-init-sort-entry-class-alist) ; Needed by `bibtex-lessp'. - (if (and (eq bibtex-maintain-sorted-entries 'crossref) - (functionp bibtex-reference-keys)) - (bibtex-parse-keys)) ; Needed by `bibtex-lessp'. + (bibtex-init-sort) ; Needed by `bibtex-lessp'. (sort-subr nil 'bibtex-skip-to-valid-entry ; NEXTREC function 'bibtex-end-of-entry ; ENDREC function @@ -4228,10 +4256,7 @@ bibtex-prepare-new-entry search to look for place for KEY. This requires that buffer is sorted, see `bibtex-validate'. Return t if preparation was successful or nil if entry KEY already exists." - (bibtex-init-sort-entry-class-alist) ; Needed by `bibtex-lessp'. - (if (and (eq bibtex-maintain-sorted-entries 'crossref) - (functionp bibtex-reference-keys)) - (bibtex-parse-keys)) ; Needed by `bibtex-lessp'. + (bibtex-init-sort) ; Needed by `bibtex-lessp'. (let ((key (nth 0 index)) key-exist) (cond ((or (null key) @@ -4322,9 +4347,7 @@ bibtex-validate (setq syntax-error t) =20 ;; Check for duplicate keys and correct sort order - (bibtex-init-sort-entry-class-alist) ; Needed by `bibtex-lessp'. - (bibtex-parse-keys) ; Possibly needed by `bibtex-lessp'. - ; Always needed by subsequent global key che= ck. + (bibtex-init-sort t) ; Needed by `bibtex-lessp' and global key c= heck. (let (previous current key-list) (bibtex-progress-message "Checking for duplicate keys") (bibtex-map-entries
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at 44597) by debbugs.gnu.org; 13 Dec 2020 16:57:37 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 13 11:57:37 2020 Received: from localhost ([127.0.0.1]:49970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1koUgi-0000oC-TO for submit <at> debbugs.gnu.org; Sun, 13 Dec 2020 11:57:37 -0500 Received: from smtp-clients1.isti.cnr.it ([146.48.28.36]:35978) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <pot@HIDDEN>) id 1koUgg-0000o3-K0 for 44597 <at> debbugs.gnu.org; Sun, 13 Dec 2020 11:57:35 -0500 Received: from tucano.isti.cnr.it (tucano.isti.cnr.it [146.48.81.102]) (Authenticated sender: pot) by smtp-clients1.isti.cnr.it (Postfix) with ESMTPSA id 13FD2B0833; Sun, 13 Dec 2020 17:57:33 +0100 (CET) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at smtp-out.isti.cnr.it Received: from pot by tucano.isti.cnr.it with local (Exim 4.94) (envelope-from <pot@HIDDEN>) id 1koUge-000QwB-NV; Sun, 13 Dec 2020 17:57:32 +0100 From: =?utf-8?Q?Francesco_Potort=C3=AC?= <pot@HIDDEN> Date: Sun, 13 Dec 2020 17:57:32 +0100 To: "Roland Winkler" <winkler@HIDDEN> In-Reply-To: <60225.35392.490825.24532@HIDDEN> (winkler@HIDDEN) Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting References: <E1kdHMM-00C53c-B6@HIDDEN> <87ima7yjp7.fsf@HIDDEN> <E1kdzOQ-00G9cu-G7@HIDDEN> <87sg99vviz.fsf@HIDDEN> <E1klwiI-004kvG-Le@HIDDEN> <87pn3lkay5.fsf@HIDDEN> <60225.35392.490825.24532@HIDDEN> Organization: X-fingerprint: 4B02 6187 5C03 D6B1 2E31 7666 09DF 2DC9 BE21 6115 Message-Id: <E1koUge-000QwB-NV@HIDDEN> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 44597 Cc: 44597 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) >I am not sure the proposed patch is the best way to go. Suppose a >BibTeX file contains just several dozen entries per year of >publication. Then sorting by date becomes meaningful only if the >date for each entry includes not only year and month, but also the >day. The bibtex-get-date function in my patch does not assume that the "day" field is present. When it is missing, it uses the first day of the month, or day 30 if the LATEST argument is t. By the way, there is an error in my patch: it shuld be "day", not "days". >I assume that's why the proposed patch also uses a `day' >field. But such a field is not standard for BibTeX entries, and I >am not aware of any "default" mechanisms to support it. As far as I can tell, "date" and "day" are sometimes used even if not standard. Anyway, if any of "date" or "day" are present, the patch will use them, else it will use what's available. I personally use "day" to keep track of the dates of congresses (for @inproceedings). >How about instead a new customizable sorting scheme, where the value >of bibtex-maintain-sorted-entries is a cons pair > > (INDEX-FUN . PREDICATE) > >where INDEX-FUN is a user-defined function that replaces >bibtex-entry-index, and PREDICATE is a user-defined function that >replaces the default predicate bibtex-lessp. Then users can define >custom sorting schemes to their liking, where PREDICATE sorts the >entries based on the return values of INDEX-FUN. That would be certainly more flexible. However I think it is at least equally important to provide some precooked solutions. I myself would have spared some work some months ago if I had the 'reverse and 'reversedate methods available.
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at 44597) by debbugs.gnu.org; 12 Dec 2020 18:32:52 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 12 13:32:52 2020 Received: from localhost ([127.0.0.1]:46440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ko9hL-0000Tj-M4 for submit <at> debbugs.gnu.org; Sat, 12 Dec 2020 13:32:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <winkler@HIDDEN>) id 1ko9hH-0000T1-UA for 44597 <at> debbugs.gnu.org; Sat, 12 Dec 2020 13:32:48 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48124) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from <winkler@HIDDEN>) id 1ko9hB-0006wm-E7; Sat, 12 Dec 2020 13:32:41 -0500 Received: from [2602:30a:2e52:d720:65b7:1416:12e7:8bfb] (port=44130 helo=regnitz) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from <winkler@HIDDEN>) id 1ko7Sk-00078F-GA; Sat, 12 Dec 2020 11:09:38 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <60225.35392.490825.24532@HIDDEN> Date: Sat, 12 Dec 2020 10:09:37 -0600 From: "Roland Winkler" <winkler@HIDDEN> To: Lars Ingebrigtsen <larsi@HIDDEN> Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting In-Reply-To: <87pn3lkay5.fsf@HIDDEN> References: <E1kdHMM-00C53c-B6@HIDDEN> <87ima7yjp7.fsf@HIDDEN> <E1kdzOQ-00G9cu-G7@HIDDEN> <87sg99vviz.fsf@HIDDEN> <E1klwiI-004kvG-Le@HIDDEN> <87pn3lkay5.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 44597 Cc: Francesco =?utf-8?Q?Potort=C3=AC ?= <pot@HIDDEN>, 44597 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) On Mon Dec 7 2020 Lars Ingebrigtsen wrote: > I've added Roland to the Cc's; I'm guessing he'll have some > comments. I am not sure the proposed patch is the best way to go. Suppose a BibTeX file contains just several dozen entries per year of publication. Then sorting by date becomes meaningful only if the date for each entry includes not only year and month, but also the day. I assume that's why the proposed patch also uses a `day' field. But such a field is not standard for BibTeX entries, and I am not aware of any "default" mechanisms to support it. I guess you maintain such a field by hand in your BibTeX database. I am not sure it makes sense for BibTeX mode to go in such a direction with hard-coded hand-crafted solutions, where likely the next user wants to do things just a little different. How about instead a new customizable sorting scheme, where the value of bibtex-maintain-sorted-entries is a cons pair (INDEX-FUN . PREDICATE) where INDEX-FUN is a user-defined function that replaces bibtex-entry-index, and PREDICATE is a user-defined function that replaces the default predicate bibtex-lessp. Then users can define custom sorting schemes to their liking, where PREDICATE sorts the entries based on the return values of INDEX-FUN.
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at 44597) by debbugs.gnu.org; 9 Dec 2020 14:21:00 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 09 09:21:00 2020 Received: from localhost ([127.0.0.1]:33149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kn0Ky-0006Aq-9h for submit <at> debbugs.gnu.org; Wed, 09 Dec 2020 09:21:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47988) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <winkler@HIDDEN>) id 1kn0Kv-0006Ae-Ty for 44597 <at> debbugs.gnu.org; Wed, 09 Dec 2020 09:20:58 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47769) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from <winkler@HIDDEN>) id 1kn0Kq-0000qi-Ab; Wed, 09 Dec 2020 09:20:52 -0500 Received: from [2602:30a:2e52:d720:65b7:1416:12e7:8bfb] (port=39498 helo=regnitz) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from <winkler@HIDDEN>) id 1kn0Kp-0003GI-F1; Wed, 09 Dec 2020 09:20:51 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID: <56641.47347.638827.24528@HIDDEN> Date: Wed, 9 Dec 2020 08:20:49 -0600 From: "Roland Winkler" <winkler@HIDDEN> To: Francesco =?utf-8?Q?Potort=C3?==AC <pot@HIDDEN> Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting In-Reply-To: <E1kmKoO-008iDx-Ux@HIDDEN> References: <E1kdHMM-00C53c-B6@HIDDEN> <87ima7yjp7.fsf@HIDDEN> <E1kdzOQ-00G9cu-G7@HIDDEN> <87sg99vviz.fsf@HIDDEN> <E1klwiI-004kvG-Le@HIDDEN> <87pn3lkay5.fsf@HIDDEN> <E1kmKoO-008iDx-Ux@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 44597 Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 44597 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) On Mon Dec 7 2020 Francesco Potort=C3=AC wrote: > Ah, I forgot. >=20 > I did not include it in the patch, but I think that > bibtex-autokey-get-field should be renamed to bibtex-get-field I'll look into this patch. (I believe bibtex-autokey-get-field need not be renamed. But it will be better to call instead the low-level function bibtex-text-in-field.)
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at 44597) by debbugs.gnu.org; 9 Dec 2020 12:59:44 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 09 07:59:44 2020 Received: from localhost ([127.0.0.1]:33011 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kmz4J-00022L-Ns for submit <at> debbugs.gnu.org; Wed, 09 Dec 2020 07:59:44 -0500 Received: from quimby.gnus.org ([95.216.78.240]:37268) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <larsi@HIDDEN>) id 1kmz43-00021s-Nn for 44597 <at> debbugs.gnu.org; Wed, 09 Dec 2020 07:59:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=hGqmhawtgcp/N4YaXkAoWRv6o2Hx9Mkx3mMQxs3Rxhc=; b=IJcnVHEDyuepktqzp4PuFhFncu zhDQdjLcpWHRPsXvsjoqqx1XrF+o7aDv42kN0VLUZF72oihLcg1nTgIMOvSl+DuFO0I6cLYgGSAic z30RUAF0NC3uroH5/Cuw5YZlh7/yWj2ug7zxWoRNpsKV5jIs5qt2/MLw9nw5LHPOHBJc=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <larsi@HIDDEN>) id 1kmz3v-0001BO-Fh; Wed, 09 Dec 2020 13:59:22 +0100 From: Lars Ingebrigtsen <larsi@HIDDEN> To: Francesco =?utf-8?Q?Potort=C3=AC?= <pot@HIDDEN> Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting References: <E1kdHMM-00C53c-B6@HIDDEN> <87ima7yjp7.fsf@HIDDEN> <E1kdzOQ-00G9cu-G7@HIDDEN> <87sg99vviz.fsf@HIDDEN> <E1klwiI-004kvG-Le@HIDDEN> <87pn3lkay5.fsf@HIDDEN> <E1kmwGN-00ArN5-7M@HIDDEN> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAGFBMVEVkWFWlmJGahHuJ dW5JODUfGBjRtan////fYGFmAAAAAWJLR0QHFmGI6wAAAAd0SU1FB+QMCQwiLouH4zQAAAGySURB VDjLbZNBcqswDIaVmHRdw4zXTbmAQelb+02lPQv7ALQz3P8IlWyYYIgWTMZffv2SbMHF3jswQ9tw qgIuFi3i0MERXNHaztr3Jh2BLQHnVCX8gWTQWW/e4XYGt+k2fcVbipSIOBKvwNEU/ot7ZAqh4ThJ IZwV8AjGSyNEwkSRNqA2AA1x5eHmUi5AqoFdlmW2994PfKhqFmJt6++c4rN/eFsKsDCmND32oEQL b5KKz+Dnc3mkk7n6L0tHCauR6Gn+As31rLSTWUFsz2OXbL88+RfAuo807fr4HlcyDjL37U4iwbe5 63GLV5TOtz5igmAGBb2/9I1/NhghwJAF/t8vVsBkRffp3YK7R0eSSt17ROfwS3I/AaBKDLoZq4sy XkHrUVNVALM7quJRA8zlovuBShGyhaSyHVENVPAB2CPt34/0IYOVZyUpSST8BKMT0BaQ9kCvQrcA fQ2uehX6EI2vzS/b3pyBy6BRwC8UBEDhFWAplSIfQVeuYgVR3DJA9OuYmMs5UQa95F9Lkl3bAd2z LTutsSkapj0JUDw8bOsfGUI+15F0Yy/u5X/Q6PrKjz/uCgZm66j0+QAAACV0RVh0ZGF0ZTpjcmVh dGUAMjAyMC0xMi0wOVQxMjozNDo0NiswMDowMEr0/B0AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjAt MTItMDlUMTI6MzQ6NDYrMDA6MDA7qUShAAAAAElFTkSuQmCC X-Now-Playing: CocoRosie's _Put the Shine On_: "Hell's Gate" Date: Wed, 09 Dec 2020 13:59:18 +0100 In-Reply-To: <E1kmwGN-00ArN5-7M@HIDDEN> ("Francesco =?utf-8?Q?Potort=C3=AC=22's?= message of "Wed, 09 Dec 2020 10:59:58 +0100") Message-ID: <877dpr5e55.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Francesco Potortì <pot@HIDDEN> writes: >>> Allowed non-nil values are: >>> -plain or t All entries are sorted alphabetically. >>> +plain or t Entries are sorted alphabetically. >>> +reverse Entries are sorted in reverse alphabetic order. > [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 44597 Cc: 44597 <at> debbugs.gnu.org, Roland Winkler <winkler@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Francesco Potort=C3=AC <pot@HIDDEN> writes: >>> Allowed non-nil values are: >>> -plain or t All entries are sorted alphabetically. >>> +plain or t Entries are sorted alphabetically. >>> +reverse Entries are sorted in reverse alphabetic order. >>> +date Entries are sorted by date. >>> +reversedate Entries are reverse sorted by date, starting with newest. > > Thinking again, maybe the reverse flag should be orthogonal to the > rest, to be applied separately? I think a single setting should be sufficient here. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at 44597) by debbugs.gnu.org; 9 Dec 2020 10:00:05 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 09 05:00:05 2020 Received: from localhost ([127.0.0.1]:32843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kmwGT-0003pY-4i for submit <at> debbugs.gnu.org; Wed, 09 Dec 2020 05:00:05 -0500 Received: from smtp-clients2.isti.cnr.it ([146.48.28.37]:34988) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <pot@HIDDEN>) id 1kmwGP-0003oa-Hs for 44597 <at> debbugs.gnu.org; Wed, 09 Dec 2020 05:00:03 -0500 Received: from tucano.isti.cnr.it (tucano.isti.cnr.it [146.48.81.102]) (Authenticated sender: pot) by smtp-clients2.isti.cnr.it (Postfix) with ESMTPSA id AA798B0841; Wed, 9 Dec 2020 10:59:59 +0100 (CET) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at smtp-out.isti.cnr.it Received: from pot by tucano.isti.cnr.it with local (Exim 4.94) (envelope-from <pot@HIDDEN>) id 1kmwGN-00ArN5-7M; Wed, 09 Dec 2020 10:59:59 +0100 From: =?utf-8?Q?Francesco_Potort=C3=AC?= <pot@HIDDEN> Date: Wed, 09 Dec 2020 10:59:58 +0100 To: Lars Ingebrigtsen <larsi@HIDDEN> In-Reply-To: <87pn3lkay5.fsf@HIDDEN> (larsi@HIDDEN) Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting References: <E1kdHMM-00C53c-B6@HIDDEN> <87ima7yjp7.fsf@HIDDEN> <E1kdzOQ-00G9cu-G7@HIDDEN> <87sg99vviz.fsf@HIDDEN> <E1klwiI-004kvG-Le@HIDDEN> <87pn3lkay5.fsf@HIDDEN> Organization: X-fingerprint: 4B02 6187 5C03 D6B1 2E31 7666 09DF 2DC9 BE21 6115 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-Id: <E1kmwGN-00ArN5-7M@HIDDEN> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 44597 Cc: 44597 <at> debbugs.gnu.org, Roland Winkler <winkler@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) >> Allowed non-nil values are: >> -plain or t All entries are sorted alphabetically. >> +plain or t Entries are sorted alphabetically. >> +reverse Entries are sorted in reverse alphabetic order. >> +date Entries are sorted by date. >> +reversedate Entries are reverse sorted by date, starting with newest. Thinking again, maybe the reverse flag should be orthogonal to the rest, to be applied separately?
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at 44597) by debbugs.gnu.org; 7 Dec 2020 18:00:43 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 07 13:00:43 2020 Received: from localhost ([127.0.0.1]:55464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kmKoU-0002NX-Nd for submit <at> debbugs.gnu.org; Mon, 07 Dec 2020 13:00:42 -0500 Received: from smtp-clients1.isti.cnr.it ([146.48.28.36]:56800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <pot@HIDDEN>) id 1kmKoR-0002J9-B7 for 44597 <at> debbugs.gnu.org; Mon, 07 Dec 2020 13:00:41 -0500 Received: from tucano.isti.cnr.it (tucano.isti.cnr.it [146.48.81.102]) (Authenticated sender: pot) by smtp-clients1.isti.cnr.it (Postfix) with ESMTPSA id 4D3E3B07F2; Mon, 7 Dec 2020 19:00:37 +0100 (CET) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at smtp-out.isti.cnr.it Received: from pot by tucano.isti.cnr.it with local (Exim 4.94) (envelope-from <pot@HIDDEN>) id 1kmKoO-008iDx-Ux; Mon, 07 Dec 2020 19:00:36 +0100 From: =?utf-8?Q?Francesco_Potort=C3=AC?= <pot@HIDDEN> Date: Mon, 07 Dec 2020 19:00:36 +0100 To: Lars Ingebrigtsen <larsi@HIDDEN> In-Reply-To: <87pn3lkay5.fsf@HIDDEN> (larsi@HIDDEN) Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting References: <E1kdHMM-00C53c-B6@HIDDEN> <87ima7yjp7.fsf@HIDDEN> <E1kdzOQ-00G9cu-G7@HIDDEN> <87sg99vviz.fsf@HIDDEN> <E1klwiI-004kvG-Le@HIDDEN> <87pn3lkay5.fsf@HIDDEN> Organization: X-fingerprint: 4B02 6187 5C03 D6B1 2E31 7666 09DF 2DC9 BE21 6115 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-Id: <E1kmKoO-008iDx-Ux@HIDDEN> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 44597 Cc: 44597 <at> debbugs.gnu.org, Roland Winkler <winkler@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) Ah, I forgot. I did not include it in the patch, but I think that bibtex-autokey-get-field should be renamed to bibtex-get-field -- fp
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at 44597) by debbugs.gnu.org; 7 Dec 2020 13:22:38 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 07 08:22:38 2020 Received: from localhost ([127.0.0.1]:52875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kmGTN-0000Em-UM for submit <at> debbugs.gnu.org; Mon, 07 Dec 2020 08:22:38 -0500 Received: from quimby.gnus.org ([95.216.78.240]:36762) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <larsi@HIDDEN>) id 1kmGTM-0000EX-IC for 44597 <at> debbugs.gnu.org; Mon, 07 Dec 2020 08:22:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=gShFOcEdow/rnKrWMimFdaD3k1pm7VQZBxjAXpV6B6c=; b=elbxH6RLxpuJ8LSCdiTJNLtNKe KNg+NK2mnU1HlNW2aXyXXQEzRy+ZwcvJSTcwF3pKPS8qHcbKpSet2p++6Am5wBb5he8YqAFy4ye2k aE0vTL9TxGxYKgwIANHPNaDdq/cafexQ4K2tG+thPY8GQTVnLR3ae+x6FRyJbPstvhOw=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <larsi@HIDDEN>) id 1kmGTD-0005lI-PH; Mon, 07 Dec 2020 14:22:30 +0100 From: Lars Ingebrigtsen <larsi@HIDDEN> To: Francesco =?utf-8?Q?Potort=C3=AC?= <pot@HIDDEN> Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting References: <E1kdHMM-00C53c-B6@HIDDEN> <87ima7yjp7.fsf@HIDDEN> <E1kdzOQ-00G9cu-G7@HIDDEN> <87sg99vviz.fsf@HIDDEN> <E1klwiI-004kvG-Le@HIDDEN> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAGFBMVEWMbVafjHCpsZ9U QTq/wa3f1rnIxrD///8EdFpvAAAAAWJLR0QHFmGI6wAAAAd0SU1FB+QMBw0MKxH3A5MAAAG7SURB VDjLlZLLUuswDIblaug6bhjWSQhZuxUP0AnGexZk3WZcv/8jIMlOywl05qCZxLY+6Zd8AQBr7a5b WVvDpvvVWtj9EXT/AXzXj70ffwBf7ArK2PsVgZXb+368A0oO/FPg/XO6TGkeF6AJ8gtJzEtvAkbx HfeaE7JAAeJ5JvYGH8YsoEBDK/DJpxRT1OUIfa4wojNdClphATo5k0PaKIkFaEJoGmLbxDXw3UkA DamIXQFriR0EBFlfwazAPZYtFiBBCggURAESLgvMYJsyUhCky2enWnQDIR/d22utOQ8FDFkopXmb EEyTG1MQ02L1lFK7n1YZbA1/l27JKCUWsBiD2+IYvoNvUaeXe2C4B36RmmU8px9gto8KphAv8XO6 gbPdTQKqAzqwXbiCFiBc0umDtkgI9YuCmUFFZCzxKRoG5KpBNli7J3kJAOT4Iz39w8SAaJ+vlVkF +SJdC0NEzJfHAVgb0eNEgEEm7FTo0MjDY00mJVyGmouAETkGLkS5UiNtsSg6N1sERNjvGo5AgPYp tij6HFABgjtKi+DIGGvRSarshKVQ2pWCLM4Fq9Kh1HaOMHdVGpE9fgHaLgewPOinBQAAACV0RVh0 ZGF0ZTpjcmVhdGUAMjAyMC0xMi0wN1QxMzoxMjo0MyswMDowMLCqNRIAAAAldEVYdGRhdGU6bW9k aWZ5ADIwMjAtMTItMDdUMTM6MTI6NDMrMDA6MDDB942uAAAAAElFTkSuQmCC X-Now-Playing: Nihiloxica's _Kaloli_: "Tewali Sukali" Date: Mon, 07 Dec 2020 14:22:26 +0100 In-Reply-To: <E1klwiI-004kvG-Le@HIDDEN> ("Francesco =?utf-8?Q?Potort=C3=AC=22's?= message of "Sun, 06 Dec 2020 17:16:42 +0100") Message-ID: <87pn3lkay5.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Francesco Potortì <pot@HIDDEN> writes: >>Yes, I think introducing a variable to control the sorting would be a >>good idea. It'd default to `bibtex-lessp' (or rather, something that >>does the same), but (as you say) have an input that mak [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 44597 Cc: 44597 <at> debbugs.gnu.org, Roland Winkler <winkler@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Francesco Potort=C3=AC <pot@HIDDEN> writes: >>Yes, I think introducing a variable to control the sorting would be a >>good idea. It'd default to `bibtex-lessp' (or rather, something that >>does the same), but (as you say) have an input that makes implementing >>other sorting functions easier. >> >>Patches welcome. :-) > > This is a patch that improves things, in my opinion. This is not the > ideal situation I mentioned above, but "il meglio =C3=A8 il nemico del be= ne" > (best is enemy of good). So here you are, this one satisfies my needs > and is hoefully a step towards a more general solution. [...] > Allowed non-nil values are: > -plain or t All entries are sorted alphabetically. > +plain or t Entries are sorted alphabetically. > +reverse Entries are sorted in reverse alphabetic order. > +date Entries are sorted by date. > +reversedate Entries are reverse sorted by date, starting with newest. Thanks; this looks like a good feature to me. I've added Roland to the Cc's; I'm guessing he'll have some comments. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at 44597) by debbugs.gnu.org; 6 Dec 2020 16:16:47 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 06 11:16:47 2020 Received: from localhost ([127.0.0.1]:50995 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1klwiN-0003wB-0B for submit <at> debbugs.gnu.org; Sun, 06 Dec 2020 11:16:47 -0500 Received: from smtp-clients2.isti.cnr.it ([146.48.28.37]:45044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <pot@HIDDEN>) id 1klwiK-0003vx-Lx for 44597 <at> debbugs.gnu.org; Sun, 06 Dec 2020 11:16:45 -0500 Received: from tucano.isti.cnr.it (tucano.isti.cnr.it [146.48.81.102]) (Authenticated sender: pot) by smtp-clients2.isti.cnr.it (Postfix) with ESMTPSA id F10CBB0838; Sun, 6 Dec 2020 17:16:42 +0100 (CET) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at smtp-out.isti.cnr.it Received: from pot by tucano.isti.cnr.it with local (Exim 4.94) (envelope-from <pot@HIDDEN>) id 1klwiI-004kvG-Le; Sun, 06 Dec 2020 17:16:42 +0100 From: =?utf-8?Q?Francesco_Potort=C3=AC?= <pot@HIDDEN> Date: Sun, 06 Dec 2020 17:16:42 +0100 To: Lars Ingebrigtsen <larsi@HIDDEN> In-Reply-To: <87sg99vviz.fsf@HIDDEN> (larsi@HIDDEN) Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting References: <E1kdHMM-00C53c-B6@HIDDEN> <87ima7yjp7.fsf@HIDDEN> <E1kdzOQ-00G9cu-G7@HIDDEN> <87sg99vviz.fsf@HIDDEN> Organization: X-fingerprint: 4B02 6187 5C03 D6B1 2E31 7666 09DF 2DC9 BE21 6115 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-Id: <E1klwiI-004kvG-Le@HIDDEN> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 44597 Cc: 44597 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) >> Ideally, bibtex.el should provide a hook where one can install any >> function for sorting. The hook should get some arguments (the type of >> entry, the name of entry, the date, a bibtex custom field and maybe >> others). That would make bibtex.el more generally flexible. > >Yes, I think introducing a variable to control the sorting would be a >good idea. It'd default to `bibtex-lessp' (or rather, something that >does the same), but (as you say) have an input that makes implementing >other sorting functions easier. > >Patches welcome. :-) This is a patch that improves things, in my opinion. This is not the ideal situation I mentioned above, but "il meglio è il nemico del bene" (best is enemy of good). So here you are, this one satisfies my needs and is hoefully a step towards a more general solution. diff -pub /home/pot/elisp/bibtex-trunk.el /home/pot/elisp/bibtex.el --- /home/pot/elisp/bibtex-trunk.el 2020-12-03 18:52:11.000000000 +0100 +++ /home/pot/elisp/bibtex.el 2020-12-06 17:02:06.000000000 +0100 @@ -202,7 +202,10 @@ narrowed to just the entry." (defcustom bibtex-maintain-sorted-entries nil "If non-nil, BibTeX mode maintains all entries in sorted order. Allowed non-nil values are: -plain or t All entries are sorted alphabetically. +plain or t Entries are sorted alphabetically. +reverse Entries are sorted in reverse alphabetic order. +date Entries are sorted by date. +reversedate Entries are reverse sorted by date, starting with newest. crossref All entries are sorted alphabetically unless an entry has a crossref field. These crossrefed entries are placed in alphabetical order immediately preceding the main entry. @@ -213,10 +216,13 @@ See also `bibtex-sort-ignore-string-entr :group 'bibtex :type '(choice (const nil) (const plain) + (const reverse) + (const date) + (const reversedate) (const crossref) (const entry-class) (const t)) - :safe (lambda (a) (memq a '(nil t plain crossref entry-class)))) + :safe (lambda (a) (memq a '(nil t plain reverse date reversedate crossref entry-class)))) (defcustom bibtex-sort-entry-class '(("String") @@ -3993,23 +3999,25 @@ If mark is active count entries in regio (defun bibtex-entry-index () "Return index of BibTeX entry head at or past position of point. -The index is a list (KEY CROSSREF-KEY ENTRY-TYPE) that is used for sorting -the entries of the BibTeX buffer. CROSSREF-KEY is nil unless the value -of `bibtex-maintain-sorted-entries' is `crossref'. Move point to the end -of the head of the entry found. Return nil if no entry found." +The index is a list (KEY CROSSREF-KEY ENTRY-TYPE DATE) that is +used for sorting the entries of the BibTeX buffer. CROSSREF-KEY +is nil unless the value of `bibtex-maintain-sorted-entries' is +`crossref'. Move point to the end of the head of the entry +found. Return nil if no entry found." (let ((case-fold-search t)) (if (re-search-forward bibtex-entry-maybe-empty-head nil t) (let ((key (bibtex-key-in-head)) ;; all entry types should be downcase (for ease of comparison) - (entry-type (downcase (bibtex-type-in-head)))) + (crossref-key nil) + (entry-type (downcase (bibtex-type-in-head))) + (date (bibtex-get-date))) ;; Don't search CROSSREF-KEY if we don't need it. - (if (eq bibtex-maintain-sorted-entries 'crossref) + (when (eq bibtex-maintain-sorted-entries 'crossref) (let ((bounds (bibtex-search-forward-field "\\(OPT\\)?crossref" t))) - (list key - (if bounds (bibtex-text-in-field-bounds bounds t)) - entry-type)) - (list key nil entry-type)))))) + (when bounds + (setq crossref-key (bibtex-text-in-field-bounds bounds t))))) + (list key crossref-key entry-type date))))) (defun bibtex-init-sort-entry-class-alist () "Initialize `bibtex-sort-entry-class-alist' (buffer-local)." @@ -4024,6 +4032,28 @@ of the head of the entry found. Return alist))) alist)))) +(defun bibtex-get-date (&optional latest) + "Return date of current entry as a string in yyyy-mm-dd format. +If any part of date is missing, use the earliest possible missing +value, unless LATEST is not nil, in which case use the latest possible +missing value." + (let ((date (bibtex-autokey-get-field "date"))) + (if (string> date "") + date + (let ((year (bibtex-autokey-get-field "year")) + (month (bibtex-autokey-get-field + "month" '(("^jan.*". "01") ("^feb.*". "02") ("^mar.*". "03") + ("^apr.*". "04") ("^may.*". "05") ("^jun.*". "06") + ("^jul.*". "07") ("^aug.*". "08") ("^sep.*". "09") + ("^oct.*". "10") ("^nov.*". "11") ("^dec.*". "12")))) + (day (bibtex-autokey-get-field "days" '(("-.*" . ""))))) + (when (string= year "") (setq year (if latest "9999" "1900"))) + (when (string= month "") (setq month (if latest "12" "01"))) + (when (string= day "") (setq day (if latest "31" "01"))) + (concat year "-" month "-" (if (= (string-width day) 1) + (concat "0" day) + (substring day 0 2))))))) + (defun bibtex-lessp (index1 index2) "Predicate for sorting BibTeX entries with indices INDEX1 and INDEX2. Each index is a list (KEY CROSSREF-KEY ENTRY-TYPE). @@ -4056,6 +4086,12 @@ If its value is nil use plain sorting." (or (< n1 n2) (and (= n1 n2) (string-lessp (car index1) (car index2)))))) + ((eq bibtex-maintain-sorted-entries 'reversedate) + (string-lessp (nth 3 index2) (nth 3 index1))) + ((eq bibtex-maintain-sorted-entries 'date) + (string-lessp (nth 3 index1) (nth 3 index2))) + ((eq bibtex-maintain-sorted-entries 'reverse) + (string-lessp (car index2) (car index1))) (t ; (eq bibtex-maintain-sorted-entries 'plain) (string-lessp (car index1) (car index2)))))
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at 44597) by debbugs.gnu.org; 16 Nov 2020 21:31:29 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 16 16:31:29 2020 Received: from localhost ([127.0.0.1]:57538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kem5x-0004Se-Eq for submit <at> debbugs.gnu.org; Mon, 16 Nov 2020 16:31:29 -0500 Received: from quimby.gnus.org ([95.216.78.240]:39066) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <larsi@HIDDEN>) id 1kem5u-0004SO-Px for 44597 <at> debbugs.gnu.org; Mon, 16 Nov 2020 16:31:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=obcTu2/5gIdzYCj6J2WFdrDhV4+wkRQhu1QS8pwy65s=; b=PuMwH5T0RSGiAvn+9XZUfM4qZQ jWVqu6bNilmFUUBsRAEw+DCODeMlmF3JZhnp/K9rafHckyv03sP3e3bKiA+oAW9Ws2HzbAZEJMHFq e5o1SFkuVvLqKZK9KsRkFlaVIEfF48CcHIwr6wImfNoL0sS8LclkNjeRqe6JHx/HRbxU=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <larsi@HIDDEN>) id 1kem5m-0005ZB-25; Mon, 16 Nov 2020 22:31:20 +0100 From: Lars Ingebrigtsen <larsi@HIDDEN> To: Francesco =?utf-8?Q?Potort=C3=AC?= <pot@HIDDEN> Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting References: <E1kdHMM-00C53c-B6@HIDDEN> <87ima7yjp7.fsf@HIDDEN> <E1kdzOQ-00G9cu-G7@HIDDEN> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAFVBMVEUtKSgeHR1GQjhi WlGSg3LXyrn///+uCZ/EAAAAAWJLR0QGYWa4fQAAAAd0SU1FB+QLEBUTN6V3ELwAAAGnSURBVDjL pZRBk9sgDIUF3t5xm94JpHcb4Xti4N6J0f//Kysg8ZLJ+tCpDplxvkjvGb0A8M+lQBtppJbvxBht uN57NMj6+Sh0iFifuim6+4V6myAbfANYZh34PKjBme87DEgD/1P6CKxPM+P4YkvEI5d+nyVeJZbr gXaavj+AXzS/SO6KF7pi18POKhrBxtVn9TwK8RilvI6T9ATSti45jRV4umf4GWkSenAFfFwrGBLR XUFIN6mhTBNWFA3hiegvMJif2x/H2hErkFuad/HqStYOY7c/s5W6B5bBHUOcwPKT3gHYIu5j3JQt VnV9sQIkA/IxZYXFfJfiIkKU6FwBR1NDGWVaC9fUYmP31cj2fT6zOFx0t/+lEUKn0fbBGGgrnmlt +R+e2xC4bHKhFLCpDPu+lkQWU1ijs6aY2Uf94PE3H1yMAdHPX+A3UQhpM56ui/PTFzixV5a2EcAp 25b1yEip7RLLg1Pdv6CBlEsOjFJ7rkQ9k0yZ1RnUA26AXz1jLJVubPe8J/FUVsVOA/q76SOqiMqF gGjC9nKriI+VrxquE2bu4FGfuFNXAOaabmkAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjAtMTEtMTZU MjE6MTk6NTUrMDA6MDBxlbeqAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIwLTExLTE2VDIxOjE5OjU1 KzAwOjAwAMgPFgAAAABJRU5ErkJggg== X-Now-Playing: Various's _Amchitka (1)_: "Phil Ochs - No More Songs" Date: Mon, 16 Nov 2020 22:31:16 +0100 In-Reply-To: <E1kdzOQ-00G9cu-G7@HIDDEN> ("Francesco =?utf-8?Q?Potort=C3=AC=22's?= message of "Sat, 14 Nov 2020 18:31:18 +0100") Message-ID: <87sg99vviz.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Francesco Potortì <pot@HIDDEN> writes: > Ideally, bibtex.el should provide a hook where one can install any > function for sorting. The hook should get some arguments (the type of > entry, the name of entry, the date, a bibtex custom field [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 44597 Cc: 44597 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Francesco Potort=C3=AC <pot@HIDDEN> writes: > Ideally, bibtex.el should provide a hook where one can install any > function for sorting. The hook should get some arguments (the type of > entry, the name of entry, the date, a bibtex custom field and maybe > others). That would make bibtex.el more generally flexible. Yes, I think introducing a variable to control the sorting would be a good idea. It'd default to `bibtex-lessp' (or rather, something that does the same), but (as you say) have an input that makes implementing other sorting functions easier. Patches welcome. :-) --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at 44597) by debbugs.gnu.org; 14 Nov 2020 17:31:22 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 14 12:31:22 2020 Received: from localhost ([127.0.0.1]:51922 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kdzOU-0004rI-3r for submit <at> debbugs.gnu.org; Sat, 14 Nov 2020 12:31:22 -0500 Received: from smtp-clients1.isti.cnr.it ([146.48.28.36]:34046) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <pot@HIDDEN>) id 1kdzOS-0004rA-IR for 44597 <at> debbugs.gnu.org; Sat, 14 Nov 2020 12:31:21 -0500 Received: from tucano.isti.cnr.it (tucano.isti.cnr.it [146.48.81.102]) (Authenticated sender: pot) by smtp-clients1.isti.cnr.it (Postfix) with ESMTPSA id C9909B0833; Sat, 14 Nov 2020 18:31:18 +0100 (CET) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at smtp-out.isti.cnr.it Received: from pot by tucano.isti.cnr.it with local (Exim 4.94) (envelope-from <pot@HIDDEN>) id 1kdzOQ-00G9cu-G7; Sat, 14 Nov 2020 18:31:18 +0100 From: =?utf-8?Q?Francesco_Potort=C3=AC?= <pot@HIDDEN> Date: Sat, 14 Nov 2020 18:31:18 +0100 To: Lars Ingebrigtsen <larsi@HIDDEN> In-reply-to: <87ima7yjp7.fsf@HIDDEN> (larsi@HIDDEN) Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting References: <E1kdHMM-00C53c-B6@HIDDEN> <87ima7yjp7.fsf@HIDDEN> Organization: X-fingerprint: 4B02 6187 5C03 D6B1 2E31 7666 09DF 2DC9 BE21 6115 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-Id: <E1kdzOQ-00G9cu-G7@HIDDEN> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 44597 Cc: 44597 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) >> I wish bibtex mode would allow for reverse sorting of entries. >> >> Some years ago I used to obtain that behaviour by advising the sort-subr >> functions when called inside a bibtex-mode buffer. No more. >> >> The modern bibtex.el sorts an entry when bibtex-clean-entry is called >> when bibtex-maintain-sorted-entries is t without calling sort-subr, but >> relying only on bibtex-lessp, which is not easy to advice. > >I haven't looked at the code closely, but wouldn't advising bibtex-lessp >to just swap the parameters work? Yes. In fact, after writing my bug report I looked at the code again and I did just that :) However, I think that reversing the sorting order is just the most common of various criteria that one would like to use for sorting. Recently I had a reason for getting one hundred bibtex entries sorted by date in reverse order, a task that would take a long time by hand, especially in front of frequent modifications of the list of entries to be sorted. Fortunately I was able to use bibtex2html to do the job, but the most natural thing would have been to use bibtex.el with a proper sorting function. Ideally, bibtex.el should provide a hook where one can install any function for sorting. The hook should get some arguments (the type of entry, the name of entry, the date, a bibtex custom field and maybe others). That would make bibtex.el more generally flexible.
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at 44597) by debbugs.gnu.org; 14 Nov 2020 16:41:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 14 11:41:51 2020 Received: from localhost ([127.0.0.1]:51776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kdycY-0001Q0-Sz for submit <at> debbugs.gnu.org; Sat, 14 Nov 2020 11:41:51 -0500 Received: from quimby.gnus.org ([95.216.78.240]:44918) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <larsi@HIDDEN>) id 1kdycX-0001Pq-QJ for 44597 <at> debbugs.gnu.org; Sat, 14 Nov 2020 11:41:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=dyhWrYGNOdMjNFT25T2kcXOcGdTPIMihZymmCSTDQVs=; b=FtJULkVDehgEPomuEMtYZ4cubr iZgfc87PUF8+5ok2d7WM9FwDvapX1TrhnKvvvEB8oWapYNQI8apwAFgUeplaLKnUlyGkVMAa10P/M LFkuOpY5zuIqOphezZvdNwDUju2g8SKZhWzYeKSMynPH/WBrag66wQxbPJjIj40SPZzY=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <larsi@HIDDEN>) id 1kdycP-0000pk-AX; Sat, 14 Nov 2020 17:41:43 +0100 From: Lars Ingebrigtsen <larsi@HIDDEN> To: Francesco =?utf-8?Q?Potort=C3=AC?= <pot@HIDDEN> Subject: Re: bug#44597: 26.3; bibtex should allow reverse sorting References: <E1kdHMM-00C53c-B6@HIDDEN> X-Now-Playing: Moor Mother's _Circuit City_: "Act 1 - Working Machine" Date: Sat, 14 Nov 2020 17:41:40 +0100 In-Reply-To: <E1kdHMM-00C53c-B6@HIDDEN> ("Francesco =?utf-8?Q?Potort=C3=AC=22's?= message of "Thu, 12 Nov 2020 19:30:14 +0100") Message-ID: <87ima7yjp7.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Francesco Potortì <pot@HIDDEN> writes: > I wish bibtex mode would allow for reverse sorting of entries. > > Some years ago I used to obtain that behaviour by advising the sort-subr > functions when called inside a bibtex-mode buffer. No mo [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 44597 Cc: 44597 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Francesco Potort=C3=AC <pot@HIDDEN> writes: > I wish bibtex mode would allow for reverse sorting of entries. > > Some years ago I used to obtain that behaviour by advising the sort-subr > functions when called inside a bibtex-mode buffer. No more. > > The modern bibtex.el sorts an entry when bibtex-clean-entry is called > when bibtex-maintain-sorted-entries is t without calling sort-subr, but > relying only on bibtex-lessp, which is not easy to advice. I haven't looked at the code closely, but wouldn't advising bibtex-lessp to just swap the parameters work? --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no
bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 12 Nov 2020 18:30:21 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 12 13:30:21 2020 Received: from localhost ([127.0.0.1]:45556 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kdHMT-00029E-8Q for submit <at> debbugs.gnu.org; Thu, 12 Nov 2020 13:30:21 -0500 Received: from lists.gnu.org ([209.51.188.17]:39754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <pot@HIDDEN>) id 1kdHMQ-000296-Tg for submit <at> debbugs.gnu.org; Thu, 12 Nov 2020 13:30:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <pot@HIDDEN>) id 1kdHMQ-0002ZM-NA for bug-gnu-emacs@HIDDEN; Thu, 12 Nov 2020 13:30:18 -0500 Received: from smtp-clients2.isti.cnr.it ([146.48.28.37]:38200) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <pot@HIDDEN>) id 1kdHMP-0003V6-2B for bug-gnu-emacs@HIDDEN; Thu, 12 Nov 2020 13:30:18 -0500 Received: from tucano.isti.cnr.it (tucano.isti.cnr.it [146.48.81.102]) (Authenticated sender: pot) by smtp-clients2.isti.cnr.it (Postfix) with ESMTPSA id AF718AE6E4 for <bug-gnu-emacs@HIDDEN>; Thu, 12 Nov 2020 19:30:14 +0100 (CET) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at smtp-out.isti.cnr.it Received: from pot by tucano.isti.cnr.it with local (Exim 4.94) (envelope-from <pot@HIDDEN>) id 1kdHMM-00C53c-B6 for bug-gnu-emacs@HIDDEN; Thu, 12 Nov 2020 19:30:14 +0100 From: =?utf-8?Q?Francesco_Potort=C3=AC?= <pot@HIDDEN> Date: Thu, 12 Nov 2020 19:30:14 +0100 To: bug-gnu-emacs@HIDDEN Subject: 26.3; bibtex should allow reverse sorting Organization: X-fingerprint: 4B02 6187 5C03 D6B1 2E31 7666 09DF 2DC9 BE21 6115 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-Id: <E1kdHMM-00C53c-B6@HIDDEN> Received-SPF: softfail client-ip=146.48.28.37; envelope-from=pot@HIDDEN; helo=smtp-clients2.isti.cnr.it X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 13:30:15 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) I wish bibtex mode would allow for reverse sorting of entries. Some years ago I used to obtain that behaviour by advising the sort-subr functions when called inside a bibtex-mode buffer. No more. The modern bibtex.el sorts an entry when bibtex-clean-entry is called when bibtex-maintain-sorted-entries is t without calling sort-subr, but relying only on bibtex-lessp, which is not easy to advice. I have numbered labels, and I want them to stay in reverse order as they are, but now I can get that behaviour only by setting bibtex-maintain-sorted-entries to nil Please add some way to reverse the order of entries -- fp
Francesco Potortì <pot@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#44597
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.