+(defun stgit-select ()
+ "Expand or collapse the current entry"
+ (interactive)
+ (let ((curpatch (stgit-patch-at-point)))
+ (if (not curpatch)
+ (let ((patched-file (stgit-patched-file-at-point)))
+ (unless patched-file
+ (error "No patch or file on the current line"))
+ (let ((filename (expand-file-name (cdr patched-file))))
+ (unless (file-exists-p filename)
+ (error "File does not exist"))
+ (find-file filename)))
+ (setq curpatch (intern curpatch))
+ (setq stgit-expanded-patches
+ (if (memq curpatch stgit-expanded-patches)
+ (delq curpatch stgit-expanded-patches)
+ (cons curpatch stgit-expanded-patches)))
+ (stgit-reload))))
+
+(defun stgit-find-file-other-window ()
+ "Open file at point in other window"
+ (interactive)
+ (let ((patched-file (stgit-patched-file-at-point)))
+ (unless patched-file
+ (error "No file on the current line"))
+ (let ((filename (expand-file-name (cdr patched-file))))
+ (unless (file-exists-p filename)
+ (error "File does not exist"))
+ (find-file-other-window filename))))
+