;;; tla.el --- Elementary support for the Arch revision control system ;; Copyright (C) 2003, 2004 Milan Zamazal ;; Author: Milan Zamazal ;; Keywords: ;; COPYRIGHT NOTICE ;; ;; This program is free software; you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by the Free ;; Software Foundation; either version 2, or (at your option) any later ;; version. ;; ;; This program is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ;; for more details. ;; ;; You can find the GNU General Public License at ;; http://www.gnu.org/copyleft/gpl.html ;; or you can write to the Free Software Foundation, Inc., 59 Temple Place, ;; Suite 330, Boston, MA 02111-1307, USA. ;;; Commentary: ;; ;;; Code: (defvar tla-command-name "tla" "*") (defun tla--command (&rest args) (mapconcat #'identity (list* tla-command-name args) " ")) (defun tla-changes (&optional prefix) (interactive "P") (save-some-buffers) (shell-command (tla--command "what-changed" (when prefix "--diffs")))) (defun tla-commit () (interactive) (save-buffer) (save-some-buffers) (shell-command (tla--command "commit"))) (define-derived-mode tla-log-mode text-mode "ArchLog") (define-key tla-log-mode-map "\C-c\C-c" 'tla-commit) (add-to-list 'auto-mode-alist '("\\+\\+log\\." . tla-log-mode)) ;;;###autoload (defun tla-log (&optional insert-changelog) (interactive "P") (find-file (let ((file (shell-command-to-string (concat (tla--command "make-log") " 2>/dev/null")))) (string-match "^.*$" file) (match-string 0 file))) (when insert-changelog (goto-char (point-max)) (insert-file (find-change-log)) (when (re-search-forward "^2" nil t) (delete-region (line-beginning-position) (line-beginning-position 3))) (when (re-search-forward "^2" nil t) (delete-region (line-beginning-position) (point-max)))) (goto-char (point-min)) (end-of-line)) ;;;###autoload (defun tla-log-merge () (interactive) (tla-log) (goto-char (point-max)) (shell-command (tla--command "log-for-merge") t) (goto-char (point-min)) (end-of-line)) (defvar tla-history-buffer "*tla history*") (setq tla-history-font-lock-keywords '(("^[^ \t].*$" . font-lock-variable-name-face))) (define-derived-mode tla-history-mode fundamental-mode "ArchHistory" (set (make-local-variable 'font-lock-defaults) '(tla-history-font-lock-keywords t t)) (view-mode 1)) (define-key tla-history-mode-map "\r" 'tla-view-log) ;;;###autoload (defun tla-history () (interactive) (ignore-errors (kill-buffer tla-history-buffer)) (shell-command (tla--command "logs --full --summary --reverse") tla-history-buffer) (pop-to-buffer tla-history-buffer) (tla-history-mode)) (defvar tla-log-buffer "*tla log*") (defun tla-view-log () (interactive) (when (save-excursion (beginning-of-line) (looking-at "[^ \t]")) (shell-command (format (tla--command "cat-log %s") (buffer-substring-no-properties (save-excursion (beginning-of-line) (point)) (save-excursion (end-of-line) (point)))) tla-log-buffer))) ;;; Announce (provide 'tla) ;;; tla.el ends here