]> git.eshelyaron.com Git - emacs.git/commitdiff
Reimplement gnus-thread-header in Lisp
authorMattias Engdegård <mattiase@acm.org>
Sat, 11 Dec 2021 20:59:13 +0000 (21:59 +0100)
committerMattias Engdegård <mattiase@acm.org>
Sat, 11 Dec 2021 20:59:13 +0000 (21:59 +0100)
* lisp/gnus/gnus-sum.el (gnus-thread-header):
Replace lovingly hand-crafted assembler code with plain Lisp.
With lexical binding the difference is unlikely to be detectable.

lisp/gnus/gnus-sum.el

index ba616586002bb8497e6e1fff4c9289e1e4ebf59e..1bd0e8847e253e2576760110c7ec288a7bca47ae 100644 (file)
@@ -5001,23 +5001,13 @@ If LINE, insert the rebuilt thread starting on line LINE."
                              gnus-article-sort-functions)))
       (gnus-message 7 "Sorting articles...done"))))
 
-;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
-(defmacro gnus-thread-header (thread)
-  "Return header of first article in THREAD.
-Note that THREAD must never, ever be anything else than a variable -
-using some other form will lead to serious barfage."
-  (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
-  ;; (8% speedup to gnus-summary-prepare, just for fun :-)
-  (cond
-   ((and (boundp 'lexical-binding) lexical-binding)
-    ;; FIXME: This version could be a "defsubst" rather than a macro.
-    `(#[257 "\211:\203\16\0\211@;\203\15\0A@@\207"
-            [] 2]
-      ,thread))
-   (t
-    ;; Not sure how XEmacs handles these things, so let's keep the old code.
-    (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
-          (vector thread) 2))))
+(defsubst gnus-thread-header (thread)
+  "Return header of first article in THREAD."
+  (if (consp thread)
+      (car (if (stringp (car thread))
+               (cadr thread)
+             thread))
+    thread))
 
 (defsubst gnus-article-sort-by-number (h1 h2)
   "Sort articles by article number."