April 20, 2004

Bulk view

sacha/fix-tla-log {{04.04.21,EmacsHacks}} 11:17

(defun sacha/fix-tla-log ()
  "Correct a wrong commit.
Run this inside the arch subdirectory for the patch in your
repository, not your project tree."
  ;; Copy the log file
       ((directory (car (file-expand-wildcards "*.patches")))
           (concat (file-name-as-directory directory)
                   "[email protected]/patch-log/patch-*"))))
         (car (file-expand-wildcards "*.tar.gz")))
        log-md5 tar-md5)
     (when directory
       (if (file-newer-than-file-p "log" log-file)
             (delete-file log-file)
             (copy-file "log" log-file))
         (delete-file "log")
         (copy-file log-file "log"))
       ;; Recreate the tar.gz
       (delete-file tar-file)
       (call-process "tar" nil nil nil "zcvf" tar-file directory)
       ;; Calculate checksums
         (call-process "md5sum" nil t nil "log" tar-file)
         (goto-char (point-min))
         (re-search-forward "^\\([^ ]+\\)\\s-+log" nil t)
         (setq log-md5 (match-string 1))
         (re-search-forward "^\\([^ ]+\\)" nil t)
         (setq tar-md5 (match-string 1)))
         (setq modes (file-modes "checksum"))
         (insert-file-contents "checksum")
         (goto-char (point-min))
         (re-search-forward "^Signature-for")
         (delete-region (point-min) (match-beginning 0))
         (re-search-forward "^md5\\s-+log\\s-+\\([^ ]+\\)$")
         (replace-match log-md5 t t nil 1)
         (re-search-forward "^md5\\s-+.+?\\.tar\\.gz\\s-+\\([^ ]+\\)$")
         (replace-match tar-md5 t t nil 1)
         (when (re-search-forward "BEGIN PGP SIGNATURE" nil t)
           (delete-region (line-beginning-position) (point-max)))
         (let ((pgg-output-buffer (current-buffer)))
           (pgg-sign t))
         (delete-file "checksum")
         ;; Sign the checksum
         (write-file "checksum")
         (set-file-modes "checksum" modes)))))

emacs-wiki-link-url: return relative links

(defadvice emacs-wiki-link-url (around sacha activate)
  "Return relative links if possible."
  (when ad-return-value
    (unless (emacs-wiki-wiki-url-p ad-return-value)
      (setq ad-return-value
             (if (string-match "public_html" ad-return-value)
      (when (and sacha/emacs-wiki-use-absolute-url-flag
        (setq ad-return-value