General defaulting for revisions.

* magit.el (magit-commit-at-point): Added option nil-ok-p argument.
(magit-default-rev): New.
This commit is contained in:
Marius Vollmer 2008-08-17 01:37:48 +03:00
parent 3c9bf0a0f2
commit b74bb2d2d9

View file

@ -191,6 +191,9 @@
(magit-rev-describe (cdr range))) (magit-rev-describe (cdr range)))
(format "%s at %s" things (magit-rev-describe (car range)))))) (format "%s at %s" things (magit-rev-describe (car range))))))
(defun magit-default-rev ()
(magit-commit-at-point t))
;;; Sections ;;; Sections
(defun magit-insert-section (section title washer cmd &rest args) (defun magit-insert-section (section title washer cmd &rest args)
@ -824,13 +827,15 @@ pushed.
;;; Commits ;;; Commits
(defun magit-commit-at-point () (defun magit-commit-at-point (&optional nil-ok-p)
(let* ((info (get-text-property (point) 'magit-info)) (let* ((info (get-text-property (point) 'magit-info))
(commit (and info (commit (and info
(eq (car info) 'commit) (eq (car info) 'commit)
(cadr info)))) (cadr info))))
(or commit (if nil-ok-p
(error "No commit at point.")))) commit
(or commit
(error "No commit at point.")))))
(defun magit-revert-commit () (defun magit-revert-commit ()
(interactive) (interactive)