\\(.*\\)$"
,base)))
(re-search-forward regex nil t)
(setq ,year (match-string 1))
(setq ,month (match-string 2))
(setq ,day (match-string 3)))
(let ((tmp (match-string 4)))
(with-temp-buffer
(insert (or tmp ""))
(goto-char (point-min))
(if (re-search-forward "" nil t)
(setq ,hours (match-string 1)
,minutes (match-string 2))
(setq ,hours nil
,minutes nil))))))
(defun al-change-modification-date ()
(goto-char (point-min))
(search-forward "
Go backward in time to "
(format "%s %s" (al-month-name prev-month) prev-year) ".
")
(goto-char (point-min))))
(defun al-add-entry-to-file (base year month day archive-filename entry-contents)
(find-file archive-filename)
(goto-char (point-min))
(let ((matched nil)
(n-year (string-to-number year))
(n-month (string-to-number month))
(n-day (string-to-number day))
(entry-year)
(entry-month)
(entry-day)
(entry-hour)
(entry-min))
(while (and (not matched)
(al-re-search-next-entry base entry-year entry-month entry-day entry-hour entry-min))
;; Sanity check
(if (not (and (equal year entry-year)
(equal month entry-month)))
(error "An entry for %s contains %s-%s" (al-archive-basename base year month) entry-year entry-month))
;; If entries match, replace the old one with the new contents
(if (equal day entry-day)
(let ((entry-bounds (al-get-entry-bounds)))
(delete-region (car entry-bounds) (cdr entry-bounds))
(insert entry-contents)
(setq matched t))
;; See if we can insert this entry here; entries are sorted from newest to oldest
(if (> n-day (string-to-number entry-day))
(progn
(beginning-of-line)
(insert "\n")
(forward-line -1)
(insert entry-contents)
(setq matched t)))))
;; If we didn't get a match, just put the entry in.
(if (not matched)
(progn
(goto-char (point-min))
(search-forward "***MARK***")
(beginning-of-line)
(forward-line 1)
(insert "\n")
(insert entry-contents)))
(save-buffer 0)))
(defun al-add-entry-to-archive (path base year month day entry-contents)
(let ((archive-filename (al-archive-filename path base year month)))
(save-excursion
(if (file-exists-p archive-filename)
(al-add-entry-to-file base year month day archive-filename entry-contents)
(progn
(al-create-new-archive-file base year month archive-filename)
(al-add-entry-to-file base year month day archive-filename entry-contents))))))
(defun al-write-rss-header (buffer)
(with-current-buffer buffer
(insert
"
Federico Mena-Quintero - Activity Log
http://www.gnome.org/~federico/news.html
Boring news about Federico
" (al-generate-date 'year) " Federico Mena-Quintero
federico@gnome.org
federico@gnome.org
en
" (al-generate-date 'rfc822) "
")))
(defun al-write-rss-footer (buffer)
(with-current-buffer buffer
(insert
"
")))
(defun al-write-rss-file (path base buffer)
(with-current-buffer buffer
(let ((filename (al-rss-filename path base)))
(write-file filename))))
(defun al-make-links-absolute ()
(while (re-search-forward "\\(src\\|href\\)=\"\\([^\"]*\\)\"" nil t)
(let ((uri (match-string 2)))
(when (and (not (string-match "^[a-z]*://" uri))
(not (string-match "^mailto:" uri)))
(replace-match "\\1=\"http://www.gnome.org/~federico/\\2\"" t)))))
(defun al-add-entry-to-rss (buffer year month day hours minutes entry-contents)
(with-current-buffer buffer
(let ((beginning-of-entry (point)))
(insert entry-contents)
(goto-char beginning-of-entry)
(when (re-search-forward "href=\"\\(.*\\)\">\\(.*\\)" nil t)
(let* ((reference (match-string 1))
(guid-and-link (concat "http://www.gnome.org/~federico/" reference))
(title-date (match-string 2))
(n-year (string-to-number year))
(n-month (string-to-number month))
(n-day (string-to-number day))
(have-time (and hours minutes))
(n-hours (if have-time (string-to-number hours) 12))
(n-minutes (if have-time (string-to-number minutes) 0))
(pos nil))
;; Delete the