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:
parent
3c9bf0a0f2
commit
b74bb2d2d9
1 changed files with 8 additions and 3 deletions
9
magit.el
9
magit.el
|
@ -191,6 +191,9 @@
|
|||
(magit-rev-describe (cdr range)))
|
||||
(format "%s at %s" things (magit-rev-describe (car range))))))
|
||||
|
||||
(defun magit-default-rev ()
|
||||
(magit-commit-at-point t))
|
||||
|
||||
;;; Sections
|
||||
|
||||
(defun magit-insert-section (section title washer cmd &rest args)
|
||||
|
@ -824,13 +827,15 @@ pushed.
|
|||
|
||||
;;; Commits
|
||||
|
||||
(defun magit-commit-at-point ()
|
||||
(defun magit-commit-at-point (&optional nil-ok-p)
|
||||
(let* ((info (get-text-property (point) 'magit-info))
|
||||
(commit (and info
|
||||
(eq (car info) 'commit)
|
||||
(cadr info))))
|
||||
(if nil-ok-p
|
||||
commit
|
||||
(or commit
|
||||
(error "No commit at point."))))
|
||||
(error "No commit at point.")))))
|
||||
|
||||
(defun magit-revert-commit ()
|
||||
(interactive)
|
||||
|
|
Loading…
Reference in a new issue