summaryrefslogtreecommitdiff
path: root/tests/ci-build-stage-two.el
blob: 1b58af4e92623d73c83e89b351f63d499eb97133 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
(princ "STEP 2: init.el.\n" (quote external-debugging-output))

(setq org-id-track-globally t)

(princ "STEP 3: after org roam\n" (quote external-debugging-output))

(setq term-file-prefix nil)

(princ "STEP 4: after org roam\n" (quote external-debugging-output))

(force-mode-line-update)

(setq org-html-link-use-abs-url nil)
(setq default-directory (expand-file-name "~/monorepo"))
(setq org-html-link-use-abs-url nil)
(setq org-html-link-org-files-as-html t)

(require (quote htmlize))
(require 'hl-line)
(require (quote nix-mode))

(setq org-html-htmlize-output-type (quote css))

(princ "STEP 5: before catppuccin\n" (quote external-debugging-output))

(defun my-ci-force-fontification ()
  "Ensure the buffer is fully colorized before htmlize touches it."
  ;; Do NOT try to syntax-highlight the Frankenstein RSS file
  (unless (string-match-p "rss\\.org$" (buffer-file-name))
    (font-lock-ensure)))

(princ "after ci force fontification\n" (quote external-debugging-output))
(princ "C\n" 'external-debugging-output)

(add-hook 'org-publish-before-export-hook #'my-ci-force-fontification)
(princ "C\n" 'external-debugging-output)

(princ "please work\n" (quote external-debugging-output))

(face-spec-recalc 'default (selected-frame))
(princ "please work part 2\n" (quote external-debugging-output))
;; (when (fboundp 'redisplay) (redisplay t))
(princ "please work part 3\n" (quote external-debugging-output))

(princ (format "THEME CHECK - Default background: %s\n" 
               (face-attribute 'default :background)) 
       'external-debugging-output)

(princ "STEP 6: before publish-all\n" (quote external-debugging-output))

(setq treesit-auto-install nil)

;; --- DUMP LOG BUFFERS ---
(let ((warnings-buf (get-buffer "*Warnings*"))
      (messages-buf (get-buffer "*Messages*")))
  
  (princ "\n========================================\n" 'external-debugging-output)
  
  ;; 1. Dump Warnings
  (if warnings-buf
      (with-current-buffer warnings-buf
        (princ "       DUMPING *Warnings* BUFFER        \n" 'external-debugging-output)
        (princ "----------------------------------------\n" 'external-debugging-output)
        (princ (buffer-string) 'external-debugging-output))
    (princ "       No *Warnings* buffer found.      \n" 'external-debugging-output))
    
  (princ "\n========================================\n" 'external-debugging-output)

  ;; 2. Dump Messages
  (if messages-buf
      (with-current-buffer messages-buf
        (princ "       DUMPING *Messages* BUFFER        \n" 'external-debugging-output)
        (princ "----------------------------------------\n" 'external-debugging-output)
        (princ (buffer-string) 'external-debugging-output))
    (princ "       No *Messages* buffer found.      \n" 'external-debugging-output))

  (princ "========================================\n\n" 'external-debugging-output))
;; ----------------------------

(require 'pp) ; Pull in the pretty-printer

(princ "\n========================================\n" 'external-debugging-output)
(princ "   DUMPING org-publish-project-alist    \n" 'external-debugging-output)
(princ "----------------------------------------\n" 'external-debugging-output)

;; pp-to-string formats the nested list with proper indentation and line breaks
(princ (pp-to-string org-publish-project-alist) 'external-debugging-output)

(princ "\n========================================\n\n" 'external-debugging-output)
(setq org-export-use-babel nil)

(advice-add 'org-publish-file :before
            (lambda (file &rest _)
              (princ (format "-> Exporting file: %s\n" file) 'external-debugging-output)))

(advice-add 'org-publish-find-title :before
            (lambda (file &rest _)
              (princ (format "-> Extracting title for sitemap: %s\n" file) 'external-debugging-output)))

(advice-add 'org-publish-file :after
            (lambda (file &rest _)
              (princ (format "<- Finished file: %s\n" file) 'external-debugging-output)))

(defvar my-sitemap-counter 0)
(advice-add 'org-sitemap-format-entry-xml :before
            (lambda (entry &rest _)
              (setq my-sitemap-counter (1+ my-sitemap-counter))
              (when (= 0 (mod my-sitemap-counter 20))
                (princ (format "  [Sitemap XML] Processed %d files... Current: %s\n" 
                               my-sitemap-counter entry) 
                       'external-debugging-output))))

(advice-add 'org-rss-publish-to-rss :around
            (lambda (fn plist filename pub-dir)
              (princ (format "[rss] enter %s\n" filename) 'external-debugging-output)
              (prog1 (funcall fn plist filename pub-dir)
                (princ (format "[rss] leave %s\n" filename) 'external-debugging-output))))

(advice-add 'org-icalendar-create-uid :before
            (lambda (&rest _) (princ "[rss] before uid\n" 'external-debugging-output)))

(advice-add 'org-rss-add-pubdate-property :before
            (lambda (&rest _) (princ "[rss] before pubdate\n" 'external-debugging-output)))

(advice-add 'write-file :before
            (lambda (&rest _) (princ "[rss] before write-file\n" 'external-debugging-output)))

(advice-add 'org-export-to-file :before
            (lambda (&rest _) (princ "[rss] before org-export-to-file\n" 'external-debugging-output)))

(org-publish-all t)