Skip to content
Browse files

support buffer which has no relationship with file

  • Loading branch information...
1 parent 6a4d3b4 commit 0b2f32cd785d959a4b07b54caacd309fe9b4ac51 @syohex committed Nov 11, 2012
Showing with 10 additions and 5 deletions.
  1. +10 −5 quickrun.el
View
15 quickrun.el
@@ -927,15 +927,18 @@ by quickrun.el. But you can register your own command for some languages")
(setq quickrun/remove-files (append abs-paths quickrun/remove-files))))
(defun quickrun/temp-name (src)
- (let* ((extension (file-name-extension src))
+ (let* ((extension (if src
+ (file-name-extension src)
+ ""))
(suffix (or (and extension (concat "." extension)) ""))
(dir (quickrun/default-directory)))
(expand-file-name (concat dir (make-temp-name "qr_") suffix))))
(defun quickrun/command-key (src)
- (let ((file-type (quickrun/decide-file-type src)))
- (or (and (and (consp current-prefix-arg) (= (car current-prefix-arg) 4))
- (quickrun/prompt))
+ (let ((file-type (and src (quickrun/decide-file-type src)))
+ (use-prefix-p (and (consp current-prefix-arg)
+ (= (car current-prefix-arg) 4))))
+ (or (and (or (not src) use-prefix-p) (quickrun/prompt))
(and quickrun-option-cmd-alist "_user_defined") ;; setting dummy value
quickrun-option-cmdkey
(gethash file-type quickrun/command-key-table)
@@ -954,7 +957,9 @@ by quickrun.el. But you can register your own command for some languages")
(kill-buffer quickrun/buffer-name)))
(defun quickrun/common (start end)
- (let* ((orig-src (file-name-nondirectory (buffer-file-name)))
+ (let* ((file (buffer-file-name))
+ (orig-src (if file
+ (file-name-nondirectory file)))
(cmd-key (quickrun/command-key orig-src)))
(quickrun/set-default-directory cmd-key)
(quickrun/kill-quickrun-buffer)

0 comments on commit 0b2f32c

Please sign in to comment.
Something went wrong with that request. Please try again.