aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2019-06-02 13:04:13 -0400
committerStefan Monnier2019-06-02 13:04:13 -0400
commit8047bd08caa11804174535599ee0090c4ead3178 (patch)
tree94162eaa14123beca843650841eb408bef856d18
parente3029eaadf967e9c753c79d91a65f38a744bf4e4 (diff)
downloademacs-8047bd08caa11804174535599ee0090c4ead3178.tar.gz
emacs-8047bd08caa11804174535599ee0090c4ead3178.zip
* gnus.el: Fix cycle in eager macroexpansion
* lisp/gnus/gnus-sum.el (gnus-data): Use cl-defstruct. (gnus-data-set-pos, gnus-data-set-header, gnus-data-set-mark) (gnus-data-set-number): Delete macros; use `setf` instead. (gnus-data-unread-p, gnus-data-read-p, gnus-data-pseudo-p, gnus-data-find) (gnus-summary-skip-intangible, gnus-summary-article-number): Redefine as inlinable functions rather than macros. * lisp/gnus/gnus.el: Adjust autoloads for the macros turned functions.
-rw-r--r--lisp/gnus/gnus-sum.el81
-rw-r--r--lisp/gnus/gnus.el4
2 files changed, 31 insertions, 54 deletions
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 5d5d2ec464b..a7dd734a342 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -3157,53 +3157,29 @@ The following commands are available:
3157 3157
3158;; Summary data functions. 3158;; Summary data functions.
3159 3159
3160(defmacro gnus-data-number (data) 3160(cl-defstruct (gnus-data
3161 `(car ,data)) 3161 (:constructor nil)
3162 (:constructor gnus-data-make (number mark pos header level))
3163 (:type list))
3164 number mark pos header level)
3162 3165
3163(defmacro gnus-data-set-number (data number) 3166(define-inline gnus-data-unread-p (data)
3164 `(setcar ,data ,number)) 3167 (inline-quote (= (gnus-data-mark ,data) gnus-unread-mark)))
3165 3168
3166(defmacro gnus-data-mark (data) 3169(define-inline gnus-data-read-p (data)
3167 `(nth 1 ,data)) 3170 (inline-quote (/= (gnus-data-mark ,data) gnus-unread-mark)))
3168 3171
3169(defmacro gnus-data-set-mark (data mark) 3172(define-inline gnus-data-pseudo-p (data)
3170 `(setcar (nthcdr 1 ,data) ,mark)) 3173 (inline-quote (consp (gnus-data-header ,data))))
3171 3174
3172(defmacro gnus-data-pos (data) 3175(define-inline gnus-data-find (number)
3173 `(nth 2 ,data)) 3176 (inline-quote (assq ,number gnus-newsgroup-data)))
3174
3175(defmacro gnus-data-set-pos (data pos)
3176 `(setcar (nthcdr 2 ,data) ,pos))
3177
3178(defmacro gnus-data-header (data)
3179 `(nth 3 ,data))
3180
3181(defmacro gnus-data-set-header (data header)
3182 `(setf (nth 3 ,data) ,header))
3183
3184(defmacro gnus-data-level (data)
3185 `(nth 4 ,data))
3186
3187(defmacro gnus-data-unread-p (data)
3188 `(= (nth 1 ,data) gnus-unread-mark))
3189
3190(defmacro gnus-data-read-p (data)
3191 `(/= (nth 1 ,data) gnus-unread-mark))
3192
3193(defmacro gnus-data-pseudo-p (data)
3194 `(consp (nth 3 ,data)))
3195
3196(defmacro gnus-data-find (number)
3197 `(assq ,number gnus-newsgroup-data))
3198 3177
3199(defmacro gnus-data-find-list (number &optional data) 3178(defmacro gnus-data-find-list (number &optional data)
3200 `(let ((bdata ,(or data 'gnus-newsgroup-data))) 3179 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3201 (memq (assq ,number bdata) 3180 (memq (assq ,number bdata)
3202 bdata))) 3181 bdata)))
3203 3182
3204(defmacro gnus-data-make (number mark pos header level)
3205 `(list ,number ,mark ,pos ,header ,level))
3206
3207(defun gnus-data-enter (after-article number mark pos header level offset) 3183(defun gnus-data-enter (after-article number mark pos header level offset)
3208 (let ((data (gnus-data-find-list after-article))) 3184 (let ((data (gnus-data-find-list after-article)))
3209 (unless data 3185 (unless data
@@ -3293,9 +3269,10 @@ The following commands are available:
3293 (setq data (cdr data))) 3269 (setq data (cdr data)))
3294 children)) 3270 children))
3295 3271
3296(defmacro gnus-summary-skip-intangible () 3272(defsubst gnus-summary-skip-intangible ()
3273 ;; FIXME: Does this really warrant a `defsubst'?
3297 "If the current article is intangible, then jump to a different article." 3274 "If the current article is intangible, then jump to a different article."
3298 '(let ((to (get-text-property (point) 'gnus-intangible))) 3275 (let ((to (get-text-property (point) 'gnus-intangible)))
3299 (and to (gnus-summary-goto-subject to)))) 3276 (and to (gnus-summary-goto-subject to))))
3300 3277
3301(defmacro gnus-summary-article-intangible-p () 3278(defmacro gnus-summary-article-intangible-p ()
@@ -3304,14 +3281,13 @@ The following commands are available:
3304 3281
3305;; Some summary mode macros. 3282;; Some summary mode macros.
3306 3283
3307(defmacro gnus-summary-article-number () 3284(defsubst gnus-summary-article-number ()
3308 "The article number of the article on the current line. 3285 "The article number of the article on the current line.
3309If there isn't an article number here, then we return the current 3286If there isn't an article number here, then we return the current
3310article number." 3287article number."
3311 '(progn 3288 (gnus-summary-skip-intangible)
3312 (gnus-summary-skip-intangible) 3289 (or (get-text-property (point) 'gnus-number)
3313 (or (get-text-property (point) 'gnus-number) 3290 (gnus-summary-last-subject)))
3314 (gnus-summary-last-subject))))
3315 3291
3316(define-inline gnus-summary-article-header (&optional number) 3292(define-inline gnus-summary-article-header (&optional number)
3317 "Return the header of article NUMBER." 3293 "Return the header of article NUMBER."
@@ -3434,7 +3410,7 @@ marks of articles."
3434 (while data 3410 (while data
3435 (while (get-text-property (point) 'gnus-intangible) 3411 (while (get-text-property (point) 'gnus-intangible)
3436 (forward-line 1)) 3412 (forward-line 1))
3437 (gnus-data-set-pos (car data) (+ (point) 3)) 3413 (setf (gnus-data-pos (car data)) (+ (point) 3))
3438 (setq data (cdr data)) 3414 (setq data (cdr data))
3439 (forward-line 1)))))) 3415 (forward-line 1))))))
3440 3416
@@ -4709,7 +4685,7 @@ the id of the parent article (if any)."
4709 (delq thread parent))) 4685 (delq thread parent)))
4710 (if (gnus-summary-insert-subject id header) 4686 (if (gnus-summary-insert-subject id header)
4711 ;; Set the (possibly) new article number in the data structure. 4687 ;; Set the (possibly) new article number in the data structure.
4712 (gnus-data-set-number data (gnus-id-to-article id)) 4688 (setf (gnus-data-number data) (gnus-id-to-article id))
4713 (setcar thread old) 4689 (setcar thread old)
4714 nil)))) 4690 nil))))
4715 4691
@@ -9811,9 +9787,9 @@ C-u g', show the raw article."
9811 (insert ".\n") 9787 (insert ".\n")
9812 (let ((nntp-server-buffer (current-buffer))) 9788 (let ((nntp-server-buffer (current-buffer)))
9813 (setq header (car (gnus-get-newsgroup-headers deps t)))))) 9789 (setq header (car (gnus-get-newsgroup-headers deps t))))))
9814 (gnus-data-set-header 9790 (setf (gnus-data-header
9815 (gnus-data-find (cdr gnus-article-current)) 9791 (gnus-data-find (cdr gnus-article-current)))
9816 header) 9792 header)
9817 (gnus-summary-update-article-line 9793 (gnus-summary-update-article-line
9818 (cdr gnus-article-current) header) 9794 (cdr gnus-article-current) header)
9819 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t) 9795 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
@@ -10762,7 +10738,7 @@ groups."
10762 (let ((nntp-server-buffer (current-buffer))) 10738 (let ((nntp-server-buffer (current-buffer)))
10763 (setq header (car (gnus-get-newsgroup-headers nil t)))) 10739 (setq header (car (gnus-get-newsgroup-headers nil t))))
10764 (with-current-buffer gnus-summary-buffer 10740 (with-current-buffer gnus-summary-buffer
10765 (gnus-data-set-header (gnus-data-find article) header) 10741 (setf (gnus-data-header (gnus-data-find article)) header)
10766 (gnus-summary-update-article-line article header) 10742 (gnus-summary-update-article-line article header)
10767 (if (gnus-summary-goto-subject article nil t) 10743 (if (gnus-summary-goto-subject article nil t)
10768 (gnus-summary-update-secondary-mark article))))))) 10744 (gnus-summary-update-secondary-mark article)))))))
@@ -11271,8 +11247,9 @@ If NO-EXPIRE, auto-expiry will be inhibited."
11271 (insert to-insert)) 11247 (insert to-insert))
11272 ;; Optionally update the marks by some user rule. 11248 ;; Optionally update the marks by some user rule.
11273 (when (eq type 'unread) 11249 (when (eq type 'unread)
11274 (gnus-data-set-mark 11250 (setf (gnus-data-mark
11275 (gnus-data-find (gnus-summary-article-number)) mark) 11251 (gnus-data-find (gnus-summary-article-number)))
11252 mark)
11276 (gnus-summary-update-line (eq mark gnus-unread-mark))))))) 11253 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
11277 11254
11278(defun gnus-mark-article-as-read (article &optional mark) 11255(defun gnus-mark-article-as-read (article &optional mark)
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 66e6c57e66b..9ee7db9e203 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -2617,8 +2617,8 @@ are always t.")
2617 gnus-list-of-unread-articles gnus-list-of-read-articles 2617 gnus-list-of-unread-articles gnus-list-of-read-articles
2618 gnus-offer-save-summaries gnus-make-thread-indent-array 2618 gnus-offer-save-summaries gnus-make-thread-indent-array
2619 gnus-summary-exit gnus-update-read-articles gnus-summary-last-subject 2619 gnus-summary-exit gnus-update-read-articles gnus-summary-last-subject
2620 (gnus-summary-skip-intangible macro) (gnus-summary-article-number macro) 2620 gnus-summary-skip-intangible gnus-summary-article-number
2621 (gnus-data-header macro) (gnus-data-find macro)) 2621 gnus-data-header gnus-data-find)
2622 ("gnus-group" gnus-group-insert-group-line gnus-group-quit 2622 ("gnus-group" gnus-group-insert-group-line gnus-group-quit
2623 gnus-group-list-groups gnus-group-first-unread-group 2623 gnus-group-list-groups gnus-group-first-unread-group
2624 gnus-group-set-mode-line gnus-group-set-info gnus-group-save-newsrc 2624 gnus-group-set-mode-line gnus-group-set-info gnus-group-save-newsrc